mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 00:01:00 +00:00
Finalize classes
This commit is contained in:
parent
095abbeea9
commit
a4b94bf33c
30 changed files with 31 additions and 31 deletions
|
@ -3,7 +3,7 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import HTTP
|
import HTTP
|
||||||
|
|
||||||
public class StubbingURLProtocol: URLProtocol {
|
public final class StubbingURLProtocol: URLProtocol {
|
||||||
private static var targetsForURLs = [URL: Target]()
|
private static var targetsForURLs = [URL: Target]()
|
||||||
private static var stubsForURLs = [URL: HTTPStub]()
|
private static var stubsForURLs = [URL: HTTPStub]()
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ private extension HTML {
|
||||||
|
|
||||||
// https://docs.joinmastodon.org/spec/activitypub/#sanitization
|
// https://docs.joinmastodon.org/spec/activitypub/#sanitization
|
||||||
|
|
||||||
private class HTMLParser: NSObject {
|
private final class HTMLParser: NSObject {
|
||||||
private struct Link: Hashable {
|
private struct Link: Hashable {
|
||||||
let href: URL
|
let href: URL
|
||||||
let location: Int
|
let location: Int
|
||||||
|
|
|
@ -6,7 +6,7 @@ import Mastodon
|
||||||
import Secrets
|
import Secrets
|
||||||
import UserNotifications
|
import UserNotifications
|
||||||
|
|
||||||
class NotificationService: UNNotificationServiceExtension {
|
final class NotificationService: UNNotificationServiceExtension {
|
||||||
|
|
||||||
var contentHandler: ((UNNotificationContent) -> Void)?
|
var contentHandler: ((UNNotificationContent) -> Void)?
|
||||||
var bestAttemptContent: UNMutableNotificationContent?
|
var bestAttemptContent: UNMutableNotificationContent?
|
||||||
|
|
|
@ -27,7 +27,7 @@ public struct UserNotificationClient {
|
||||||
extension UserNotificationClient {
|
extension UserNotificationClient {
|
||||||
public static func live(_ userNotificationCenter: UNUserNotificationCenter) -> Self {
|
public static func live(_ userNotificationCenter: UNUserNotificationCenter) -> Self {
|
||||||
// swiftlint:disable nesting
|
// swiftlint:disable nesting
|
||||||
class Delegate: NSObject, UNUserNotificationCenterDelegate {
|
final class Delegate: NSObject, UNUserNotificationCenterDelegate {
|
||||||
let subject: PassthroughSubject<DelegateEvent, Never>
|
let subject: PassthroughSubject<DelegateEvent, Never>
|
||||||
|
|
||||||
init(subject: PassthroughSubject<DelegateEvent, Never>) {
|
init(subject: PassthroughSubject<DelegateEvent, Never>) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ extension WebAuthSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WebAuthSessionContextProvider: NSObject, ASWebAuthenticationPresentationContextProviding {
|
final class WebAuthSessionContextProvider: NSObject, ASWebAuthenticationPresentationContextProviding {
|
||||||
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
|
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
|
||||||
ASPresentationAnchor()
|
ASPresentationAnchor()
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class MockUserDefaults: UserDefaults {
|
public final class MockUserDefaults: UserDefaults {
|
||||||
public convenience init() {
|
public convenience init() {
|
||||||
self.init(suiteName: Self.suiteName)!
|
self.init(suiteName: Self.suiteName)!
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class MockWebAuthSession: WebAuthSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SuccessfulMockWebAuthSession: MockWebAuthSession {
|
public final class SuccessfulMockWebAuthSession: MockWebAuthSession {
|
||||||
private let redirectURL: URL
|
private let redirectURL: URL
|
||||||
|
|
||||||
required init(
|
required init(
|
||||||
|
@ -60,7 +60,7 @@ public class SuccessfulMockWebAuthSession: MockWebAuthSession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CanceledLoginMockWebAuthSession: MockWebAuthSession {
|
public final class CanceledLoginMockWebAuthSession: MockWebAuthSession {
|
||||||
override var completionHandlerError: Error? {
|
override var completionHandlerError: Error? {
|
||||||
WebAuthSessionError(.canceledLogin)
|
WebAuthSessionError(.canceledLogin)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import CombineExpectations
|
||||||
@testable import ServiceLayerMocks
|
@testable import ServiceLayerMocks
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class AuthenticationServiceTests: XCTestCase {
|
final class AuthenticationServiceTests: XCTestCase {
|
||||||
func testAuthentication() throws {
|
func testAuthentication() throws {
|
||||||
let sut = AuthenticationService(url: URL(string: "https://mastodon.social")!, environment: .mock())
|
let sut = AuthenticationService(url: URL(string: "https://mastodon.social")!, environment: .mock())
|
||||||
let authenticationRecorder = sut.authenticate().record()
|
let authenticationRecorder = sut.authenticate().record()
|
||||||
|
|
|
@ -8,7 +8,7 @@ import CombineExpectations
|
||||||
import Stubbing
|
import Stubbing
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class InstanceURLServiceTests: XCTestCase {
|
final class InstanceURLServiceTests: XCTestCase {
|
||||||
func testFiltering() throws {
|
func testFiltering() throws {
|
||||||
let sut = InstanceURLService(environment: .mock())
|
let sut = InstanceURLService(environment: .mock())
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ protocol ZoomAnimatorDelegate: class {
|
||||||
func referenceViewFrameInTransitioningView(for zoomAnimator: ZoomAnimator) -> CGRect?
|
func referenceViewFrameInTransitioningView(for zoomAnimator: ZoomAnimator) -> CGRect?
|
||||||
}
|
}
|
||||||
|
|
||||||
class ZoomAnimator: NSObject {
|
final class ZoomAnimator: NSObject {
|
||||||
weak var fromDelegate: ZoomAnimatorDelegate?
|
weak var fromDelegate: ZoomAnimatorDelegate?
|
||||||
weak var toDelegate: ZoomAnimatorDelegate?
|
weak var toDelegate: ZoomAnimatorDelegate?
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class ZoomDismissalInteractionController: NSObject {
|
final class ZoomDismissalInteractionController: NSObject {
|
||||||
var transitionContext: UIViewControllerContextTransitioning?
|
var transitionContext: UIViewControllerContextTransitioning?
|
||||||
var animator: UIViewControllerAnimatedTransitioning?
|
var animator: UIViewControllerAnimatedTransitioning?
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class ZoomTransitionController: NSObject {
|
final class ZoomTransitionController: NSObject {
|
||||||
var isInteractive = false
|
var isInteractive = false
|
||||||
|
|
||||||
weak var fromDelegate: ZoomAnimatorDelegate?
|
weak var fromDelegate: ZoomAnimatorDelegate?
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import AVFoundation
|
import AVFoundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class ImageNavigationController: UINavigationController {
|
final class ImageNavigationController: UINavigationController {
|
||||||
let transitionController = ZoomTransitionController()
|
let transitionController = ZoomTransitionController()
|
||||||
|
|
||||||
private let imagePageViewController: ImagePageViewController
|
private let imagePageViewController: ImagePageViewController
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
class ImagePageViewController: UIPageViewController {
|
final class ImagePageViewController: UIPageViewController {
|
||||||
let imageViewControllers: [ImageViewController]
|
let imageViewControllers: [ImageViewController]
|
||||||
|
|
||||||
init(initiallyVisible: AttachmentViewModel, statusViewModel: StatusViewModel) {
|
init(initiallyVisible: AttachmentViewModel, statusViewModel: StatusViewModel) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Kingfisher
|
||||||
import UIKit
|
import UIKit
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
class ImageViewController: UIViewController {
|
final class ImageViewController: UIViewController {
|
||||||
let scrollView = UIScrollView()
|
let scrollView = UIScrollView()
|
||||||
let imageView = AnimatedImageView()
|
let imageView = AnimatedImageView()
|
||||||
let playerView = PlayerView()
|
let playerView = PlayerView()
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Foundation
|
||||||
import Mastodon
|
import Mastodon
|
||||||
import ServiceLayer
|
import ServiceLayer
|
||||||
|
|
||||||
final public class CollectionItemsViewModel: ObservableObject {
|
public final class CollectionItemsViewModel: ObservableObject {
|
||||||
@Published public var alertItem: AlertItem?
|
@Published public var alertItem: AlertItem?
|
||||||
public private(set) var nextPageMaxId: String?
|
public private(set) var nextPageMaxId: String?
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import Combine
|
import Combine
|
||||||
import ServiceLayer
|
import ServiceLayer
|
||||||
|
|
||||||
final public class LoadMoreViewModel: ObservableObject, CollectionItemViewModel {
|
public final class LoadMoreViewModel: ObservableObject, CollectionItemViewModel {
|
||||||
public var direction = LoadMore.Direction.up
|
public var direction = LoadMore.Direction.up
|
||||||
@Published public private(set) var loading = false
|
@Published public private(set) var loading = false
|
||||||
public let events: AnyPublisher<AnyPublisher<CollectionItemEvent, Error>, Never>
|
public let events: AnyPublisher<AnyPublisher<CollectionItemEvent, Error>, Never>
|
||||||
|
|
|
@ -10,7 +10,7 @@ import ServiceLayerMocks
|
||||||
@testable import ViewModels
|
@testable import ViewModels
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class AddIdentityViewModelTests: XCTestCase {
|
final class AddIdentityViewModelTests: XCTestCase {
|
||||||
func testAddIdentity() throws {
|
func testAddIdentity() throws {
|
||||||
let uuid = UUID(uuidString: "E621E1F8-C36C-495A-93FC-0C247A3E6E5F")!
|
let uuid = UUID(uuidString: "E621E1F8-C36C-495A-93FC-0C247A3E6E5F")!
|
||||||
let environment = AppEnvironment.mock(uuid: { uuid })
|
let environment = AppEnvironment.mock(uuid: { uuid })
|
||||||
|
|
|
@ -7,7 +7,7 @@ import ServiceLayerMocks
|
||||||
@testable import ViewModels
|
@testable import ViewModels
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class RootViewModelTests: XCTestCase {
|
final class RootViewModelTests: XCTestCase {
|
||||||
var cancellables = Set<AnyCancellable>()
|
var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
func testAddIdentity() throws {
|
func testAddIdentity() throws {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Kingfisher
|
||||||
import UIKit
|
import UIKit
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
class AccountHeaderView: UIView {
|
final class AccountHeaderView: UIView {
|
||||||
let headerImageView = AnimatedImageView()
|
let headerImageView = AnimatedImageView()
|
||||||
let headerButton = UIButton()
|
let headerButton = UIButton()
|
||||||
let noteTextView = TouchFallthroughTextView()
|
let noteTextView = TouchFallthroughTextView()
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
class AccountListCell: UITableViewCell {
|
final class AccountListCell: UITableViewCell {
|
||||||
var viewModel: AccountViewModel?
|
var viewModel: AccountViewModel?
|
||||||
|
|
||||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import Kingfisher
|
import Kingfisher
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class AccountView: UIView {
|
final class AccountView: UIView {
|
||||||
let avatarImageView = AnimatedImageView()
|
let avatarImageView = AnimatedImageView()
|
||||||
let displayNameLabel = UILabel()
|
let displayNameLabel = UILabel()
|
||||||
let accountLabel = UILabel()
|
let accountLabel = UILabel()
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
class ConversationListCell: UITableViewCell {
|
final class ConversationListCell: UITableViewCell {
|
||||||
var viewModel: ConversationViewModel?
|
var viewModel: ConversationViewModel?
|
||||||
|
|
||||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
class LoadMoreCell: UITableViewCell {
|
final class LoadMoreCell: UITableViewCell {
|
||||||
var viewModel: LoadMoreViewModel?
|
var viewModel: LoadMoreViewModel?
|
||||||
|
|
||||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
class NotificationListCell: UITableViewCell {
|
final class NotificationListCell: UITableViewCell {
|
||||||
var viewModel: NotificationViewModel?
|
var viewModel: NotificationViewModel?
|
||||||
|
|
||||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import AVKit
|
import AVKit
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class PlayerView: UIView {
|
final class PlayerView: UIView {
|
||||||
override class var layerClass: AnyClass {
|
override class var layerClass: AnyClass {
|
||||||
AVPlayerLayer.self
|
AVPlayerLayer.self
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import Mastodon
|
import Mastodon
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class PollOptionButton: UIButton {
|
final class PollOptionButton: UIButton {
|
||||||
init(title: String, emoji: [Emoji], multipleSelection: Bool) {
|
init(title: String, emoji: [Emoji], multipleSelection: Bool) {
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import Mastodon
|
import Mastodon
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class PollResultView: UIView {
|
final class PollResultView: UIView {
|
||||||
private let verticalStackView = UIStackView()
|
private let verticalStackView = UIStackView()
|
||||||
private let horizontalStackView = UIStackView()
|
private let horizontalStackView = UIStackView()
|
||||||
private let titleLabel = UILabel()
|
private let titleLabel = UILabel()
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import UIKit
|
import UIKit
|
||||||
import ViewModels
|
import ViewModels
|
||||||
|
|
||||||
class StatusListCell: UITableViewCell {
|
final class StatusListCell: UITableViewCell {
|
||||||
var viewModel: StatusViewModel?
|
var viewModel: StatusViewModel?
|
||||||
|
|
||||||
override func updateConfiguration(using state: UICellConfigurationState) {
|
override func updateConfiguration(using state: UICellConfigurationState) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
class WebfingerIndicatorView: UIVisualEffectView {
|
final class WebfingerIndicatorView: UIVisualEffectView {
|
||||||
private let activityIndicatorView = UIActivityIndicatorView()
|
private let activityIndicatorView = UIActivityIndicatorView()
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|
Loading…
Reference in a new issue