From 44649cc6721f8a685f71db42115c439b21b4ed06 Mon Sep 17 00:00:00 2001 From: Brentley Jones Date: Tue, 23 Jan 2024 13:57:40 -0600 Subject: [PATCH] Remove unused source files Signed-off-by: Brentley Jones --- ...toGenerateProtocolDelegate.generated.swift | 12 ---- ...erateProtocolRelayDelegate.generated.swift | 30 -------- ...oGenerateTableViewDelegate.generated.swift | 41 ----------- .../Community/CommunityViewViewModel.swift | 64 ----------------- .../DiscoveryCommunityViewViewModel.swift | 64 ----------------- .../MastodonRegisterViewModel+Diffable.swift | 53 --------------- .../Content/MediaView+Configuration.swift | 68 ------------------- 7 files changed, 332 deletions(-) delete mode 100644 Mastodon/Generated/AutoGenerateProtocolDelegate.generated.swift delete mode 100644 Mastodon/Generated/AutoGenerateProtocolRelayDelegate.generated.swift delete mode 100644 Mastodon/Generated/AutoGenerateTableViewDelegate.generated.swift delete mode 100644 Mastodon/Scene/Discovery/Community/CommunityViewViewModel.swift delete mode 100644 Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewViewModel.swift delete mode 100644 Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel+Diffable.swift delete mode 100644 Mastodon/Scene/Share/View/Content/MediaView+Configuration.swift diff --git a/Mastodon/Generated/AutoGenerateProtocolDelegate.generated.swift b/Mastodon/Generated/AutoGenerateProtocolDelegate.generated.swift deleted file mode 100644 index a771d34622..0000000000 --- a/Mastodon/Generated/AutoGenerateProtocolDelegate.generated.swift +++ /dev/null @@ -1,12 +0,0 @@ -// Generated using Sourcery 1.6.1 — https://github.com/krzysztofzablocki/Sourcery -// DO NOT EDIT -// sourcery:inline:NotificationTableViewCellDelegate.AutoGenerateProtocolDelegate -notificationView(_ notificationView: NotificationView, menuButton button: UIButton, didSelectAction action: NotificationView.AuthorMenuAction, menuContext: NotificationView.AuthorMenuContext) -notificationView(_ notificationView: NotificationView, statusView: StatusView, authorAvatarButtonDidPressed button: AvatarButton) -notificationView(_ notificationView: NotificationView, statusView: StatusView, metaText: MetaText, didSelectMeta meta: Meta) -notificationView(_ notificationView: NotificationView, statusView: StatusView, actionToolbarContainer: ActionToolbarContainer, buttonDidPressed button: UIButton, action: ActionToolbarContainer.Action) -notificationView(_ notificationView: NotificationView, quoteStatusView: StatusView, authorAvatarButtonDidPressed button: AvatarButton) -notificationView(_ notificationView: NotificationView, quoteStatusView: StatusView, metaText: MetaText, didSelectMeta meta: Meta) -// sourcery:end - - diff --git a/Mastodon/Generated/AutoGenerateProtocolRelayDelegate.generated.swift b/Mastodon/Generated/AutoGenerateProtocolRelayDelegate.generated.swift deleted file mode 100644 index ae7cb25a6e..0000000000 --- a/Mastodon/Generated/AutoGenerateProtocolRelayDelegate.generated.swift +++ /dev/null @@ -1,30 +0,0 @@ -// Generated using Sourcery 1.6.1 — https://github.com/krzysztofzablocki/Sourcery -// DO NOT EDIT -// sourcery:inline:NotificationViewContainerTableViewCell.AutoGenerateProtocolRelayDelegate -func notificationView(_ notificationView: NotificationView, menuButton button: UIButton, didSelectAction action: NotificationView.AuthorMenuAction, menuContext: NotificationView.AuthorMenuContext) { - notificationView(notificationView, menuButton: button, didSelectAction: action, menuContext: menuContext) -} - -func notificationView(_ notificationView: NotificationView, statusView: StatusView, authorAvatarButtonDidPressed button: AvatarButton) { - notificationView(notificationView, statusView: statusView, authorAvatarButtonDidPressed: button) -} - -func notificationView(_ notificationView: NotificationView, statusView: StatusView, metaText: MetaText, didSelectMeta meta: Meta) { - notificationView(notificationView, statusView: statusView, metaText: metaText, didSelectMeta: meta) -} - -func notificationView(_ notificationView: NotificationView, statusView: StatusView, actionToolbarContainer: ActionToolbarContainer, buttonDidPressed button: UIButton, action: ActionToolbarContainer.Action) { - notificationView(notificationView, statusView: statusView, actionToolbarContainer: actionToolbarContainer, buttonDidPressed: button, action: action) -} - -func notificationView(_ notificationView: NotificationView, quoteStatusView: StatusView, authorAvatarButtonDidPressed button: AvatarButton) { - notificationView(notificationView, quoteStatusView: quoteStatusView, authorAvatarButtonDidPressed: button) -} - -func notificationView(_ notificationView: NotificationView, quoteStatusView: StatusView, metaText: MetaText, didSelectMeta meta: Meta) { - notificationView(notificationView, quoteStatusView: quoteStatusView, metaText: metaText, didSelectMeta: meta) -} - -// sourcery:end - - diff --git a/Mastodon/Generated/AutoGenerateTableViewDelegate.generated.swift b/Mastodon/Generated/AutoGenerateTableViewDelegate.generated.swift deleted file mode 100644 index 3b72c900a2..0000000000 --- a/Mastodon/Generated/AutoGenerateTableViewDelegate.generated.swift +++ /dev/null @@ -1,41 +0,0 @@ -// Generated using Sourcery 1.9.2 — https://github.com/krzysztofzablocki/Sourcery -// DO NOT EDIT - -// sourcery:inline:DiscoveryCommunityViewController.AutoGenerateTableViewDelegate - -// Generated using Sourcery -// DO NOT EDIT -func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - aspectTableView(tableView, didSelectRowAt: indexPath) -} - -func tableView(_ tableView: UITableView, contextMenuConfigurationForRowAt indexPath: IndexPath, point: CGPoint) -> UIContextMenuConfiguration? { - return aspectTableView(tableView, contextMenuConfigurationForRowAt: indexPath, point: point) -} - -func tableView(_ tableView: UITableView, previewForHighlightingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? { - return aspectTableView(tableView, previewForHighlightingContextMenuWithConfiguration: configuration) -} - -func tableView(_ tableView: UITableView, previewForDismissingContextMenuWithConfiguration configuration: UIContextMenuConfiguration) -> UITargetedPreview? { - return aspectTableView(tableView, previewForDismissingContextMenuWithConfiguration: configuration) -} - -func tableView(_ tableView: UITableView, willPerformPreviewActionForMenuWith configuration: UIContextMenuConfiguration, animator: UIContextMenuInteractionCommitAnimating) { - aspectTableView(tableView, willPerformPreviewActionForMenuWith: configuration, animator: animator) -} -// sourcery:end - - - - - - - - - - - - - - diff --git a/Mastodon/Scene/Discovery/Community/CommunityViewViewModel.swift b/Mastodon/Scene/Discovery/Community/CommunityViewViewModel.swift deleted file mode 100644 index 51eba9b36f..0000000000 --- a/Mastodon/Scene/Discovery/Community/CommunityViewViewModel.swift +++ /dev/null @@ -1,64 +0,0 @@ -// -// DiscoveryCommunityViewViewModel.swift -// Mastodon -// -// Created by MainasuK on 2022-4-29. -// - -import os.log -import UIKit -import Combine -import GameplayKit -import CoreData -import CoreDataStack -import MastodonSDK - -final class DiscoveryCommunityViewViewModel { - - let logger = Logger(subsystem: "DiscoveryCommunityViewViewModel", category: "ViewModel") - - var disposeBag = Set() - - // input - let context: AppContext - let viewDidAppeared = PassthroughSubject() - let statusFetchedResultsController: StatusFetchedResultsController - - // output - var diffableDataSource: UITableViewDiffableDataSource? - private(set) lazy var stateMachine: GKStateMachine = { - let stateMachine = GKStateMachine(states: [ - State.Initial(viewModel: self), - State.Reloading(viewModel: self), - State.Fail(viewModel: self), - State.Idle(viewModel: self), - State.Loading(viewModel: self), - State.NoMore(viewModel: self), - ]) - stateMachine.enter(State.Initial.self) - return stateMachine - }() - - let didLoadLatest = PassthroughSubject() - - init(context: AppContext) { - self.context = context - self.statusFetchedResultsController = StatusFetchedResultsController( - managedObjectContext: context.managedObjectContext, - domain: nil, - additionalTweetPredicate: nil - ) - // end init - - context.authenticationService.activeMastodonAuthentication - .map { $0?.domain } - .assign(to: \.value, on: statusFetchedResultsController.domain) - .store(in: &disposeBag) - - } - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - -} diff --git a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewViewModel.swift b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewViewModel.swift deleted file mode 100644 index bbf508b697..0000000000 --- a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewViewModel.swift +++ /dev/null @@ -1,64 +0,0 @@ -// -// DiscoveryCommunityViewModel.swift -// Mastodon -// -// Created by MainasuK on 2022-4-29. -// - -import os.log -import UIKit -import Combine -import GameplayKit -import CoreData -import CoreDataStack -import MastodonSDK - -final class DiscoveryCommunityViewModel { - - let logger = Logger(subsystem: "DiscoveryCommunityViewModel", category: "ViewModel") - - var disposeBag = Set() - - // input - let context: AppContext - let viewDidAppeared = PassthroughSubject() - let statusFetchedResultsController: StatusFetchedResultsController - - // output - var diffableDataSource: UITableViewDiffableDataSource? - private(set) lazy var stateMachine: GKStateMachine = { - let stateMachine = GKStateMachine(states: [ - State.Initial(viewModel: self), - State.Reloading(viewModel: self), - State.Fail(viewModel: self), - State.Idle(viewModel: self), - State.Loading(viewModel: self), - State.NoMore(viewModel: self), - ]) - stateMachine.enter(State.Initial.self) - return stateMachine - }() - - let didLoadLatest = PassthroughSubject() - - init(context: AppContext) { - self.context = context - self.statusFetchedResultsController = StatusFetchedResultsController( - managedObjectContext: context.managedObjectContext, - domain: nil, - additionalTweetPredicate: nil - ) - // end init - - context.authenticationService.activeMastodonAuthentication - .map { $0?.domain } - .assign(to: \.value, on: statusFetchedResultsController.domain) - .store(in: &disposeBag) - - } - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - -} diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel+Diffable.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel+Diffable.swift deleted file mode 100644 index b3e2a2cdb6..0000000000 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel+Diffable.swift +++ /dev/null @@ -1,53 +0,0 @@ -// -// MastodonRegisterViewModel+Diffable.swift -// Mastodon -// -// Created by MainasuK on 2022-1-5. -// - -import UIKit -import Combine -import MastodonAsset -import MastodonLocalization - -extension MastodonRegisterViewModel { - private func configureAvatar(cell: MastodonRegisterAvatarTableViewCell) { - self.$avatarImage - .receive(on: DispatchQueue.main) - .sink { [weak self, weak cell] image in - guard let self = self else { return } - guard let cell = cell else { return } - let image = image ?? Asset.Scene.Onboarding.avatarPlaceholder.image - cell.avatarButton.setImage(image, for: .normal) - cell.avatarButton.menu = self.createAvatarMediaContextMenu() - cell.avatarButton.showsMenuAsPrimaryAction = true - } - .store(in: &cell.disposeBag) - } - - private func configureTextFieldCell( - cell: MastodonRegisterTextFieldTableViewCell, - validateState: Published.Publisher - ) { - Publishers.CombineLatest( - validateState, - cell.textField.publisher(for: \.isFirstResponder) - ) - .receive(on: DispatchQueue.main) - .sink { [weak cell] validateState, isFirstResponder in - guard let cell = cell else { return } - switch validateState { - case .empty: - cell.textFieldShadowContainer.shadowColor = isFirstResponder ? Asset.Colors.brandBlue.color : .black - cell.textFieldShadowContainer.shadowAlpha = isFirstResponder ? 1 : 0.25 - case .valid: - cell.textFieldShadowContainer.shadowColor = Asset.Colors.TextField.valid.color - cell.textFieldShadowContainer.shadowAlpha = 1 - case .invalid: - cell.textFieldShadowContainer.shadowColor = Asset.Colors.TextField.invalid.color - cell.textFieldShadowContainer.shadowAlpha = 1 - } - } - .store(in: &cell.disposeBag) - } -} diff --git a/Mastodon/Scene/Share/View/Content/MediaView+Configuration.swift b/Mastodon/Scene/Share/View/Content/MediaView+Configuration.swift deleted file mode 100644 index b782f8e8a3..0000000000 --- a/Mastodon/Scene/Share/View/Content/MediaView+Configuration.swift +++ /dev/null @@ -1,68 +0,0 @@ -// -// MediaView+Configuration.swift -// Mastodon -// -// Created by MainasuK on 2022-1-12. -// - -import UIKit -import Combine -import CoreDataStack -import MastodonUI -import AlamofireImage - -extension MediaView { - public static func configuration(status: Status) -> [MediaView.Configuration] { - func videoInfo(from attachment: MastodonAttachment) -> MediaView.Configuration.VideoInfo { - MediaView.Configuration.VideoInfo( - aspectRadio: attachment.size, - assetURL: attachment.assetURL, - previewURL: attachment.previewURL, - durationMS: attachment.durationMS - ) - } - - let status = status.reblog ?? status - let attachments = status.attachments - let configurations = attachments.map { attachment -> MediaView.Configuration in - let configuration: MediaView.Configuration = { - switch attachment.kind { - case .image: - let info = MediaView.Configuration.ImageInfo( - aspectRadio: attachment.size, - assetURL: attachment.assetURL - ) - return .init( - info: .image(info: info), - blurhash: attachment.blurhash - ) - case .video: - let info = videoInfo(from: attachment) - return .init( - info: .video(info: info), - blurhash: attachment.blurhash - ) - case .gifv: - let info = videoInfo(from: attachment) - return .init( - info: .gif(info: info), - blurhash: attachment.blurhash - ) - case .audio: - let info = videoInfo(from: attachment) - return .init( - info: .video(info: info), - blurhash: attachment.blurhash - ) - } // end switch - }() - - configuration.load() - configuration.isReveal = status.isMediaSensitive ? status.isSensitiveToggled : true - - return configuration - } - - return configurations - } -}