From 79ba6ed13f2809f70532d7049ce244a64fce6bf6 Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Wed, 28 Jun 2023 09:43:12 +0200 Subject: [PATCH] Remove obsolete code --- ...eTimelineNavigationBarTitleViewModel.swift | 16 ----------- .../Root/MainTab/MainTabBarController.swift | 27 +----------------- .../Sources/MastodonCore/AppContext.swift | 2 +- .../Service/StatusPublishService.swift | 28 ------------------- 4 files changed, 2 insertions(+), 71 deletions(-) delete mode 100644 MastodonSDK/Sources/MastodonCore/Service/StatusPublishService.swift diff --git a/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleViewModel.swift b/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleViewModel.swift index 9862d7e0d..9f736619b 100644 --- a/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleViewModel.swift +++ b/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleViewModel.swift @@ -72,22 +72,6 @@ final class HomeTimelineNavigationBarTitleViewModel { } .store(in: &disposeBag) -// context.statusPublishService.latestPublishingComposeViewModel -// .receive(on: DispatchQueue.main) -// .sink { [weak self] composeViewModel in -// guard let self = self else { return } -// guard let composeViewModel = composeViewModel, -// let state = composeViewModel.publishStateMachine.currentState else { -// self.isPublishingPost.value = false -// self.isPublished.value = false -// return -// } -// -// self.isPublishingPost.value = state is ComposeViewModel.PublishState.Publishing || state is ComposeViewModel.PublishState.Fail -// self.isPublished.value = state is ComposeViewModel.PublishState.Finish -// } -// .store(in: &disposeBag) - Publishers.CombineLatest4( hasNewPosts.eraseToAnyPublisher(), isOffline.eraseToAnyPublisher(), diff --git a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift index 6d4b51c1b..2f892a51a 100644 --- a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift +++ b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift @@ -214,32 +214,7 @@ extension MainTabBarController { .store(in: &disposeBag) // handle post failure - // FIXME: refacotr -// context.statusPublishService -// .latestPublishingComposeViewModel -// .receive(on: DispatchQueue.main) -// .sink { [weak self] composeViewModel in -// guard let self = self else { return } -// guard let composeViewModel = composeViewModel else { return } -// guard let currentState = composeViewModel.publishStateMachine.currentState else { return } -// guard currentState is ComposeViewModel.PublishState.Fail else { return } -// -// let alertController = UIAlertController(title: L10n.Common.Alerts.PublishPostFailure.title, message: L10n.Common.Alerts.PublishPostFailure.message, preferredStyle: .alert) -// let discardAction = UIAlertAction(title: L10n.Common.Controls.Actions.discard, style: .destructive) { [weak self, weak composeViewModel] _ in -// guard let self = self else { return } -// guard let composeViewModel = composeViewModel else { return } -// self.context.statusPublishService.remove(composeViewModel: composeViewModel) -// } -// alertController.addAction(discardAction) -// let retryAction = UIAlertAction(title: L10n.Common.Controls.Actions.tryAgain, style: .default) { [weak composeViewModel] _ in -// guard let composeViewModel = composeViewModel else { return } -// composeViewModel.publishStateMachine.enter(ComposeViewModel.PublishState.Publishing.self) -// } -// alertController.addAction(retryAction) -// self.present(alertController, animated: true, completion: nil) -// } -// .store(in: &disposeBag) - + // handle push notification. // toggle entry when finish fetch latest notification Publishers.CombineLatest( diff --git a/MastodonSDK/Sources/MastodonCore/AppContext.swift b/MastodonSDK/Sources/MastodonCore/AppContext.swift index 560061e98..0ee653061 100644 --- a/MastodonSDK/Sources/MastodonCore/AppContext.swift +++ b/MastodonSDK/Sources/MastodonCore/AppContext.swift @@ -23,7 +23,7 @@ public class AppContext: ObservableObject { public let apiService: APIService public let authenticationService: AuthenticationService public let emojiService: EmojiService - // public let statusPublishService = StatusPublishService() + public let publisherService: PublisherService public let notificationService: NotificationService public let settingService: SettingService diff --git a/MastodonSDK/Sources/MastodonCore/Service/StatusPublishService.swift b/MastodonSDK/Sources/MastodonCore/Service/StatusPublishService.swift deleted file mode 100644 index b92eb291f..000000000 --- a/MastodonSDK/Sources/MastodonCore/Service/StatusPublishService.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// StatusPublishService.swift -// Mastodon -// -// Created by MainasuK Cirno on 2021-3-26. -// - -import Foundation -import Intents -import Combine -import CoreData -import CoreDataStack -import MastodonSDK -import UIKit - -public final class StatusPublishService { - - var disposeBag = Set() - - let workingQueue = DispatchQueue(label: "org.joinmastodon.app.StatusPublishService.working-queue") - - // input - // var viewModels = CurrentValueSubject<[ComposeViewModel], Never>([]) // use strong reference to retain the view models - - // output - let composeViewModelDidUpdatePublisher = PassthroughSubject() - // let latestPublishingComposeViewModel = CurrentValueSubject(nil) -}