From a4b94bf33c44d51ff22a5662172cf1feb8d46f6b Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Sun, 8 Nov 2020 22:22:20 -0800 Subject: [PATCH] Finalize classes --- HTTP/Sources/Stubbing/StubbingURLProtocol.swift | 2 +- Mastodon/Sources/Mastodon/Entities/HTML.swift | 2 +- Notification Service Extension/NotificationService.swift | 2 +- .../ServiceLayer/Utilities/UserNotificationClient.swift | 2 +- .../Sources/ServiceLayer/Utilities/WebAuthSession.swift | 2 +- ServiceLayer/Sources/ServiceLayerMocks/MockUserDefaults.swift | 2 +- .../Sources/ServiceLayerMocks/MockWebAuthSession.swift | 4 ++-- .../Tests/ServiceLayerTests/AuthenticationServiceTests.swift | 2 +- .../Tests/ServiceLayerTests/InstanceURLServiceTests.swift | 2 +- Transitions/ZoomAnimator.swift | 2 +- Transitions/ZoomDismissalInteractionController.swift | 2 +- Transitions/ZoomTransitionController.swift | 2 +- View Controllers/ImageNavigationController.swift | 2 +- View Controllers/ImagePageViewController.swift | 2 +- View Controllers/ImageViewController.swift | 2 +- ViewModels/Sources/ViewModels/CollectionItemsViewModel.swift | 2 +- ViewModels/Sources/ViewModels/LoadMoreViewModel.swift | 2 +- .../Tests/ViewModelsTests/AddIdentityViewModelTests.swift | 2 +- ViewModels/Tests/ViewModelsTests/RootViewModelTests.swift | 2 +- Views/AccountHeaderView.swift | 2 +- Views/AccountListCell.swift | 2 +- Views/AccountView.swift | 2 +- Views/ConversationListCell.swift | 2 +- Views/LoadMoreCell.swift | 2 +- Views/NotificationListCell.swift | 2 +- Views/PlayerView.swift | 2 +- Views/PollOptionButton.swift | 2 +- Views/PollResultView.swift | 2 +- Views/Status/StatusListCell.swift | 2 +- Views/WebfingerIndicatorView.swift | 2 +- 30 files changed, 31 insertions(+), 31 deletions(-) diff --git a/HTTP/Sources/Stubbing/StubbingURLProtocol.swift b/HTTP/Sources/Stubbing/StubbingURLProtocol.swift index 8e62d7a..7d1cc6f 100644 --- a/HTTP/Sources/Stubbing/StubbingURLProtocol.swift +++ b/HTTP/Sources/Stubbing/StubbingURLProtocol.swift @@ -3,7 +3,7 @@ import Foundation import HTTP -public class StubbingURLProtocol: URLProtocol { +public final class StubbingURLProtocol: URLProtocol { private static var targetsForURLs = [URL: Target]() private static var stubsForURLs = [URL: HTTPStub]() diff --git a/Mastodon/Sources/Mastodon/Entities/HTML.swift b/Mastodon/Sources/Mastodon/Entities/HTML.swift index e62f4bb..c76caa4 100644 --- a/Mastodon/Sources/Mastodon/Entities/HTML.swift +++ b/Mastodon/Sources/Mastodon/Entities/HTML.swift @@ -39,7 +39,7 @@ private extension HTML { // https://docs.joinmastodon.org/spec/activitypub/#sanitization -private class HTMLParser: NSObject { +private final class HTMLParser: NSObject { private struct Link: Hashable { let href: URL let location: Int diff --git a/Notification Service Extension/NotificationService.swift b/Notification Service Extension/NotificationService.swift index 47c9342..393fb61 100644 --- a/Notification Service Extension/NotificationService.swift +++ b/Notification Service Extension/NotificationService.swift @@ -6,7 +6,7 @@ import Mastodon import Secrets import UserNotifications -class NotificationService: UNNotificationServiceExtension { +final class NotificationService: UNNotificationServiceExtension { var contentHandler: ((UNNotificationContent) -> Void)? var bestAttemptContent: UNMutableNotificationContent? diff --git a/ServiceLayer/Sources/ServiceLayer/Utilities/UserNotificationClient.swift b/ServiceLayer/Sources/ServiceLayer/Utilities/UserNotificationClient.swift index 618a543..3e61bf2 100644 --- a/ServiceLayer/Sources/ServiceLayer/Utilities/UserNotificationClient.swift +++ b/ServiceLayer/Sources/ServiceLayer/Utilities/UserNotificationClient.swift @@ -27,7 +27,7 @@ public struct UserNotificationClient { extension UserNotificationClient { public static func live(_ userNotificationCenter: UNUserNotificationCenter) -> Self { // swiftlint:disable nesting - class Delegate: NSObject, UNUserNotificationCenterDelegate { + final class Delegate: NSObject, UNUserNotificationCenterDelegate { let subject: PassthroughSubject init(subject: PassthroughSubject) { diff --git a/ServiceLayer/Sources/ServiceLayer/Utilities/WebAuthSession.swift b/ServiceLayer/Sources/ServiceLayer/Utilities/WebAuthSession.swift index 89e4ff0..ee3a689 100644 --- a/ServiceLayer/Sources/ServiceLayer/Utilities/WebAuthSession.swift +++ b/ServiceLayer/Sources/ServiceLayer/Utilities/WebAuthSession.swift @@ -42,7 +42,7 @@ extension WebAuthSession { } } -class WebAuthSessionContextProvider: NSObject, ASWebAuthenticationPresentationContextProviding { +final class WebAuthSessionContextProvider: NSObject, ASWebAuthenticationPresentationContextProviding { func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { ASPresentationAnchor() } diff --git a/ServiceLayer/Sources/ServiceLayerMocks/MockUserDefaults.swift b/ServiceLayer/Sources/ServiceLayerMocks/MockUserDefaults.swift index cae3c06..cbbba72 100644 --- a/ServiceLayer/Sources/ServiceLayerMocks/MockUserDefaults.swift +++ b/ServiceLayer/Sources/ServiceLayerMocks/MockUserDefaults.swift @@ -2,7 +2,7 @@ import Foundation -public class MockUserDefaults: UserDefaults { +public final class MockUserDefaults: UserDefaults { public convenience init() { self.init(suiteName: Self.suiteName)! } diff --git a/ServiceLayer/Sources/ServiceLayerMocks/MockWebAuthSession.swift b/ServiceLayer/Sources/ServiceLayerMocks/MockWebAuthSession.swift index c3ce386..3039b02 100644 --- a/ServiceLayer/Sources/ServiceLayerMocks/MockWebAuthSession.swift +++ b/ServiceLayer/Sources/ServiceLayerMocks/MockWebAuthSession.swift @@ -33,7 +33,7 @@ public class MockWebAuthSession: WebAuthSession { } } -public class SuccessfulMockWebAuthSession: MockWebAuthSession { +public final class SuccessfulMockWebAuthSession: MockWebAuthSession { private let redirectURL: URL required init( @@ -60,7 +60,7 @@ public class SuccessfulMockWebAuthSession: MockWebAuthSession { } } -public class CanceledLoginMockWebAuthSession: MockWebAuthSession { +public final class CanceledLoginMockWebAuthSession: MockWebAuthSession { override var completionHandlerError: Error? { WebAuthSessionError(.canceledLogin) } diff --git a/ServiceLayer/Tests/ServiceLayerTests/AuthenticationServiceTests.swift b/ServiceLayer/Tests/ServiceLayerTests/AuthenticationServiceTests.swift index 1fe8a54..bc8abfc 100644 --- a/ServiceLayer/Tests/ServiceLayerTests/AuthenticationServiceTests.swift +++ b/ServiceLayer/Tests/ServiceLayerTests/AuthenticationServiceTests.swift @@ -6,7 +6,7 @@ import CombineExpectations @testable import ServiceLayerMocks import XCTest -class AuthenticationServiceTests: XCTestCase { +final class AuthenticationServiceTests: XCTestCase { func testAuthentication() throws { let sut = AuthenticationService(url: URL(string: "https://mastodon.social")!, environment: .mock()) let authenticationRecorder = sut.authenticate().record() diff --git a/ServiceLayer/Tests/ServiceLayerTests/InstanceURLServiceTests.swift b/ServiceLayer/Tests/ServiceLayerTests/InstanceURLServiceTests.swift index 776805d..d227b07 100644 --- a/ServiceLayer/Tests/ServiceLayerTests/InstanceURLServiceTests.swift +++ b/ServiceLayer/Tests/ServiceLayerTests/InstanceURLServiceTests.swift @@ -8,7 +8,7 @@ import CombineExpectations import Stubbing import XCTest -class InstanceURLServiceTests: XCTestCase { +final class InstanceURLServiceTests: XCTestCase { func testFiltering() throws { let sut = InstanceURLService(environment: .mock()) diff --git a/Transitions/ZoomAnimator.swift b/Transitions/ZoomAnimator.swift index bf60a04..5e0b041 100644 --- a/Transitions/ZoomAnimator.swift +++ b/Transitions/ZoomAnimator.swift @@ -9,7 +9,7 @@ protocol ZoomAnimatorDelegate: class { func referenceViewFrameInTransitioningView(for zoomAnimator: ZoomAnimator) -> CGRect? } -class ZoomAnimator: NSObject { +final class ZoomAnimator: NSObject { weak var fromDelegate: ZoomAnimatorDelegate? weak var toDelegate: ZoomAnimatorDelegate? diff --git a/Transitions/ZoomDismissalInteractionController.swift b/Transitions/ZoomDismissalInteractionController.swift index f10b34d..71968fb 100644 --- a/Transitions/ZoomDismissalInteractionController.swift +++ b/Transitions/ZoomDismissalInteractionController.swift @@ -2,7 +2,7 @@ import UIKit -class ZoomDismissalInteractionController: NSObject { +final class ZoomDismissalInteractionController: NSObject { var transitionContext: UIViewControllerContextTransitioning? var animator: UIViewControllerAnimatedTransitioning? diff --git a/Transitions/ZoomTransitionController.swift b/Transitions/ZoomTransitionController.swift index 9b81c66..7b5fd64 100644 --- a/Transitions/ZoomTransitionController.swift +++ b/Transitions/ZoomTransitionController.swift @@ -2,7 +2,7 @@ import UIKit -class ZoomTransitionController: NSObject { +final class ZoomTransitionController: NSObject { var isInteractive = false weak var fromDelegate: ZoomAnimatorDelegate? diff --git a/View Controllers/ImageNavigationController.swift b/View Controllers/ImageNavigationController.swift index abc50e8..363bc79 100644 --- a/View Controllers/ImageNavigationController.swift +++ b/View Controllers/ImageNavigationController.swift @@ -3,7 +3,7 @@ import AVFoundation import UIKit -class ImageNavigationController: UINavigationController { +final class ImageNavigationController: UINavigationController { let transitionController = ZoomTransitionController() private let imagePageViewController: ImagePageViewController diff --git a/View Controllers/ImagePageViewController.swift b/View Controllers/ImagePageViewController.swift index 597a604..b654445 100644 --- a/View Controllers/ImagePageViewController.swift +++ b/View Controllers/ImagePageViewController.swift @@ -3,7 +3,7 @@ import UIKit import ViewModels -class ImagePageViewController: UIPageViewController { +final class ImagePageViewController: UIPageViewController { let imageViewControllers: [ImageViewController] init(initiallyVisible: AttachmentViewModel, statusViewModel: StatusViewModel) { diff --git a/View Controllers/ImageViewController.swift b/View Controllers/ImageViewController.swift index b710b5b..2a04861 100644 --- a/View Controllers/ImageViewController.swift +++ b/View Controllers/ImageViewController.swift @@ -4,7 +4,7 @@ import Kingfisher import UIKit import ViewModels -class ImageViewController: UIViewController { +final class ImageViewController: UIViewController { let scrollView = UIScrollView() let imageView = AnimatedImageView() let playerView = PlayerView() diff --git a/ViewModels/Sources/ViewModels/CollectionItemsViewModel.swift b/ViewModels/Sources/ViewModels/CollectionItemsViewModel.swift index dc2e28d..614541e 100644 --- a/ViewModels/Sources/ViewModels/CollectionItemsViewModel.swift +++ b/ViewModels/Sources/ViewModels/CollectionItemsViewModel.swift @@ -5,7 +5,7 @@ import Foundation import Mastodon import ServiceLayer -final public class CollectionItemsViewModel: ObservableObject { +public final class CollectionItemsViewModel: ObservableObject { @Published public var alertItem: AlertItem? public private(set) var nextPageMaxId: String? diff --git a/ViewModels/Sources/ViewModels/LoadMoreViewModel.swift b/ViewModels/Sources/ViewModels/LoadMoreViewModel.swift index 2beb843..d4e3dee 100644 --- a/ViewModels/Sources/ViewModels/LoadMoreViewModel.swift +++ b/ViewModels/Sources/ViewModels/LoadMoreViewModel.swift @@ -3,7 +3,7 @@ import Combine import ServiceLayer -final public class LoadMoreViewModel: ObservableObject, CollectionItemViewModel { +public final class LoadMoreViewModel: ObservableObject, CollectionItemViewModel { public var direction = LoadMore.Direction.up @Published public private(set) var loading = false public let events: AnyPublisher, Never> diff --git a/ViewModels/Tests/ViewModelsTests/AddIdentityViewModelTests.swift b/ViewModels/Tests/ViewModelsTests/AddIdentityViewModelTests.swift index 5c054f0..d096465 100644 --- a/ViewModels/Tests/ViewModelsTests/AddIdentityViewModelTests.swift +++ b/ViewModels/Tests/ViewModelsTests/AddIdentityViewModelTests.swift @@ -10,7 +10,7 @@ import ServiceLayerMocks @testable import ViewModels import XCTest -class AddIdentityViewModelTests: XCTestCase { +final class AddIdentityViewModelTests: XCTestCase { func testAddIdentity() throws { let uuid = UUID(uuidString: "E621E1F8-C36C-495A-93FC-0C247A3E6E5F")! let environment = AppEnvironment.mock(uuid: { uuid }) diff --git a/ViewModels/Tests/ViewModelsTests/RootViewModelTests.swift b/ViewModels/Tests/ViewModelsTests/RootViewModelTests.swift index e2604e6..0dc2286 100644 --- a/ViewModels/Tests/ViewModelsTests/RootViewModelTests.swift +++ b/ViewModels/Tests/ViewModelsTests/RootViewModelTests.swift @@ -7,7 +7,7 @@ import ServiceLayerMocks @testable import ViewModels import XCTest -class RootViewModelTests: XCTestCase { +final class RootViewModelTests: XCTestCase { var cancellables = Set() func testAddIdentity() throws { diff --git a/Views/AccountHeaderView.swift b/Views/AccountHeaderView.swift index 0f264c3..3e53e20 100644 --- a/Views/AccountHeaderView.swift +++ b/Views/AccountHeaderView.swift @@ -4,7 +4,7 @@ import Kingfisher import UIKit import ViewModels -class AccountHeaderView: UIView { +final class AccountHeaderView: UIView { let headerImageView = AnimatedImageView() let headerButton = UIButton() let noteTextView = TouchFallthroughTextView() diff --git a/Views/AccountListCell.swift b/Views/AccountListCell.swift index 84a5db5..cbf1b72 100644 --- a/Views/AccountListCell.swift +++ b/Views/AccountListCell.swift @@ -3,7 +3,7 @@ import UIKit import ViewModels -class AccountListCell: UITableViewCell { +final class AccountListCell: UITableViewCell { var viewModel: AccountViewModel? override func updateConfiguration(using state: UICellConfigurationState) { diff --git a/Views/AccountView.swift b/Views/AccountView.swift index f8ba210..1ef40a7 100644 --- a/Views/AccountView.swift +++ b/Views/AccountView.swift @@ -3,7 +3,7 @@ import Kingfisher import UIKit -class AccountView: UIView { +final class AccountView: UIView { let avatarImageView = AnimatedImageView() let displayNameLabel = UILabel() let accountLabel = UILabel() diff --git a/Views/ConversationListCell.swift b/Views/ConversationListCell.swift index 73c1cbd..496cd95 100644 --- a/Views/ConversationListCell.swift +++ b/Views/ConversationListCell.swift @@ -3,7 +3,7 @@ import UIKit import ViewModels -class ConversationListCell: UITableViewCell { +final class ConversationListCell: UITableViewCell { var viewModel: ConversationViewModel? override func updateConfiguration(using state: UICellConfigurationState) { diff --git a/Views/LoadMoreCell.swift b/Views/LoadMoreCell.swift index ba97beb..3adceb6 100644 --- a/Views/LoadMoreCell.swift +++ b/Views/LoadMoreCell.swift @@ -3,7 +3,7 @@ import UIKit import ViewModels -class LoadMoreCell: UITableViewCell { +final class LoadMoreCell: UITableViewCell { var viewModel: LoadMoreViewModel? override func updateConfiguration(using state: UICellConfigurationState) { diff --git a/Views/NotificationListCell.swift b/Views/NotificationListCell.swift index 89c7149..dfb1caa 100644 --- a/Views/NotificationListCell.swift +++ b/Views/NotificationListCell.swift @@ -3,7 +3,7 @@ import UIKit import ViewModels -class NotificationListCell: UITableViewCell { +final class NotificationListCell: UITableViewCell { var viewModel: NotificationViewModel? override func updateConfiguration(using state: UICellConfigurationState) { diff --git a/Views/PlayerView.swift b/Views/PlayerView.swift index 3f144e7..f74cc48 100644 --- a/Views/PlayerView.swift +++ b/Views/PlayerView.swift @@ -3,7 +3,7 @@ import AVKit import UIKit -class PlayerView: UIView { +final class PlayerView: UIView { override class var layerClass: AnyClass { AVPlayerLayer.self } diff --git a/Views/PollOptionButton.swift b/Views/PollOptionButton.swift index d1ef912..ebf317e 100644 --- a/Views/PollOptionButton.swift +++ b/Views/PollOptionButton.swift @@ -3,7 +3,7 @@ import Mastodon import UIKit -class PollOptionButton: UIButton { +final class PollOptionButton: UIButton { init(title: String, emoji: [Emoji], multipleSelection: Bool) { super.init(frame: .zero) diff --git a/Views/PollResultView.swift b/Views/PollResultView.swift index d30d7c6..dab90bd 100644 --- a/Views/PollResultView.swift +++ b/Views/PollResultView.swift @@ -3,7 +3,7 @@ import Mastodon import UIKit -class PollResultView: UIView { +final class PollResultView: UIView { private let verticalStackView = UIStackView() private let horizontalStackView = UIStackView() private let titleLabel = UILabel() diff --git a/Views/Status/StatusListCell.swift b/Views/Status/StatusListCell.swift index 01382a8..fd04c16 100644 --- a/Views/Status/StatusListCell.swift +++ b/Views/Status/StatusListCell.swift @@ -3,7 +3,7 @@ import UIKit import ViewModels -class StatusListCell: UITableViewCell { +final class StatusListCell: UITableViewCell { var viewModel: StatusViewModel? override func updateConfiguration(using state: UICellConfigurationState) { diff --git a/Views/WebfingerIndicatorView.swift b/Views/WebfingerIndicatorView.swift index 5787f26..9bb9d9b 100644 --- a/Views/WebfingerIndicatorView.swift +++ b/Views/WebfingerIndicatorView.swift @@ -2,7 +2,7 @@ import UIKit -class WebfingerIndicatorView: UIVisualEffectView { +final class WebfingerIndicatorView: UIVisualEffectView { private let activityIndicatorView = UIActivityIndicatorView() init() {