chore: move core logic into package
This commit is contained in:
parent
64f3d2fe3a
commit
fa27a28a60
|
@ -6,6 +6,7 @@
|
|||
//
|
||||
|
||||
import UIKit
|
||||
import MastodonCore
|
||||
|
||||
protocol NeedsDependency: AnyObject {
|
||||
var context: AppContext! { get set }
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
// Created by sxiaojian on 2021/4/22.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import CoreData
|
||||
import CoreDataStack
|
||||
import Foundation
|
||||
import MastodonCore
|
||||
import MastodonSDK
|
||||
import UIKit
|
||||
|
||||
enum SelectedAccountSection: Equatable, Hashable {
|
||||
case main
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//
|
||||
|
||||
import Foundation
|
||||
import MastodonCore
|
||||
|
||||
enum ComposeStatusAttachmentItem {
|
||||
case attachment(attachmentService: MastodonAttachmentService)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import Foundation
|
||||
import Combine
|
||||
import CoreData
|
||||
import MastodonCore
|
||||
import MastodonMeta
|
||||
import CoreDataStack
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ enum ComposeStatusSection: Equatable, Hashable {
|
|||
}
|
||||
|
||||
extension ComposeStatusSection {
|
||||
enum ComposeKind {
|
||||
public enum ComposeKind {
|
||||
case post
|
||||
case hashtag(hashtag: String)
|
||||
case mention(user: ManagedObjectRecord<MastodonUser>)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import os.log
|
||||
import UIKit
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonSDK
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import UIKit
|
|||
import MetaTextKit
|
||||
import MastodonMeta
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
enum NotificationSection: Equatable, Hashable {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonMeta
|
||||
import MastodonLocalization
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import UIKit
|
|||
import MetaTextKit
|
||||
import MastodonMeta
|
||||
import Combine
|
||||
import MastodonCore
|
||||
|
||||
enum RecommendAccountSection: Equatable, Hashable {
|
||||
case main
|
||||
|
|
|
@ -13,6 +13,7 @@ import MastodonSDK
|
|||
import UIKit
|
||||
import os.log
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
enum ReportSection: Equatable, Hashable {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import UIKit
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
|
||||
enum SearchHistorySection: Hashable {
|
||||
case main
|
||||
|
|
|
@ -12,6 +12,7 @@ import UIKit
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
import MastodonUI
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import UIKit
|
||||
import MastodonSDK
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
enum SearchSection: Hashable {
|
||||
|
|
|
@ -9,6 +9,7 @@ import UIKit
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
enum SettingsSection: Hashable {
|
||||
|
@ -124,7 +125,7 @@ extension SettingsSection {
|
|||
|
||||
extension SettingsSection {
|
||||
|
||||
static func configureSettingToggle(
|
||||
public static func configureSettingToggle(
|
||||
cell: SettingsToggleTableViewCell,
|
||||
item: SettingsItem,
|
||||
setting: Setting
|
||||
|
@ -155,7 +156,7 @@ extension SettingsSection {
|
|||
}
|
||||
}
|
||||
|
||||
static func configureSettingToggle(
|
||||
public static func configureSettingToggle(
|
||||
cell: SettingsToggleTableViewCell,
|
||||
switchMode: SettingsItem.NotificationSwitchMode,
|
||||
subscription: NotificationSubscription
|
||||
|
|
|
@ -15,6 +15,7 @@ import AlamofireImage
|
|||
import MastodonMeta
|
||||
import MastodonSDK
|
||||
import NaturalLanguage
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
enum StatusSection: Equatable, Hashable {
|
||||
|
|
|
@ -9,6 +9,7 @@ import os.log
|
|||
import UIKit
|
||||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
import MetaTextKit
|
||||
import MastodonMeta
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import UIKit
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
|
||||
extension DataSourceFacade {
|
||||
static func responseToUserBlockAction(
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
import UIKit
|
||||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
|
||||
extension DataSourceFacade {
|
||||
static func responseToStatusBookmarkAction(
|
||||
public static func responseToStatusBookmarkAction(
|
||||
provider: DataSourceProvider,
|
||||
status: ManagedObjectRecord<Status>,
|
||||
authenticationBox: MastodonAuthenticationBox
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
import UIKit
|
||||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
|
||||
extension DataSourceFacade {
|
||||
static func responseToStatusFavoriteAction(
|
||||
public static func responseToStatusFavoriteAction(
|
||||
provider: DataSourceProvider,
|
||||
status: ManagedObjectRecord<Status>,
|
||||
authenticationBox: MastodonAuthenticationBox
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import UIKit
|
||||
import CoreDataStack
|
||||
import class CoreDataStack.Notification
|
||||
import MastodonCore
|
||||
import MastodonSDK
|
||||
import MastodonLocalization
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import UIKit
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
|
||||
extension DataSourceFacade {
|
||||
static func responseToUserMuteAction(
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import UIKit
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
extension DataSourceFacade {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import Foundation
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
|
||||
extension DataSourceFacade {
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import UIKit
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
extension UITableViewDelegate where Self: DataSourceProvider {
|
||||
|
|
|
@ -9,6 +9,7 @@ import UIKit
|
|||
import Combine
|
||||
import FLAnimatedImage
|
||||
import MetaTextKit
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
final class AccountListTableViewCell: UITableViewCell {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
|
||||
protocol AutoCompleteViewControllerDelegate: AnyObject {
|
||||
func autoCompleteViewController(_ viewController: AutoCompleteViewController, didSelectItem item: AutoCompleteItem)
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
final class AutoCompleteTopChevronView: UIView {
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
protocol ComposeStatusPollExpiresOptionCollectionViewCellDelegate: AnyObject {
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
protocol ComposeStatusPollOptionAppendEntryCollectionViewCellDelegate: AnyObject {
|
||||
|
|
|
@ -9,6 +9,7 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
import MastodonUI
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import PhotosUI
|
||||
import Meta
|
||||
import MetaTextKit
|
||||
import MastodonMeta
|
||||
import Meta
|
||||
import MastodonUI
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
import MastodonSDK
|
||||
|
||||
|
@ -752,7 +753,10 @@ extension ComposeViewController {
|
|||
// TODO: handle error
|
||||
return
|
||||
}
|
||||
context.statusPublishService.publish(composeViewModel: viewModel)
|
||||
|
||||
// context.statusPublishService.publish(composeViewModel: viewModel)
|
||||
assertionFailure()
|
||||
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import CoreDataStack
|
||||
import MastodonSDK
|
||||
import MastodonMeta
|
||||
import MetaTextKit
|
||||
import MastodonMeta
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
import MastodonSDK
|
||||
|
||||
extension ComposeViewModel {
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import CoreDataStack
|
|||
import GameplayKit
|
||||
import MastodonSDK
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
import MastodonMeta
|
||||
import MastodonUI
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonUI
|
||||
|
||||
final class ComposeRepliedToStatusContentTableViewCell: UITableViewCell {
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
//
|
||||
|
||||
import UIKit
|
||||
import MastodonUI
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
extension AttachmentContainerView {
|
||||
|
|
|
@ -10,6 +10,8 @@ import UIKit
|
|||
import Combine
|
||||
import MastodonSDK
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
protocol ComposeToolbarViewDelegate: AnyObject {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import UIKit
|
||||
import MastodonUI
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class StatusContentWarningEditorView: UIView {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
// Local Timeline
|
||||
|
|
|
@ -164,7 +164,7 @@ extension DiscoveryCommunityViewModel.State {
|
|||
self.maxID = newMaxID
|
||||
|
||||
var hasNewStatusesAppend = false
|
||||
var statusIDs = isReloading ? [] : viewModel.statusFetchedResultsController.statusIDs.value
|
||||
var statusIDs = isReloading ? [] : viewModel.statusFetchedResultsController.statusIDs
|
||||
for status in response.value {
|
||||
guard !statusIDs.contains(status.id) else { continue }
|
||||
statusIDs.append(status.id)
|
||||
|
@ -177,7 +177,7 @@ extension DiscoveryCommunityViewModel.State {
|
|||
} else {
|
||||
await enter(state: NoMore.self)
|
||||
}
|
||||
viewModel.statusFetchedResultsController.statusIDs.value = statusIDs
|
||||
viewModel.statusFetchedResultsController.statusIDs = statusIDs
|
||||
viewModel.didLoadLatest.send()
|
||||
|
||||
} catch {
|
||||
|
|
|
@ -54,7 +54,7 @@ final class DiscoveryCommunityViewModel {
|
|||
|
||||
context.authenticationService.activeMastodonAuthentication
|
||||
.map { $0?.domain }
|
||||
.assign(to: \.value, on: statusFetchedResultsController.domain)
|
||||
.assign(to: \.domain, on: statusFetchedResultsController)
|
||||
.store(in: &disposeBag)
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import Combine
|
|||
import Tabman
|
||||
import Pageboy
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
public class DiscoveryViewController: TabmanViewController, NeedsDependency {
|
||||
|
|
|
@ -9,6 +9,7 @@ import UIKit
|
|||
import Combine
|
||||
import Tabman
|
||||
import Pageboy
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class DiscoveryViewModel {
|
||||
|
|
|
@ -9,6 +9,7 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import MastodonUI
|
||||
import MastodonCore
|
||||
|
||||
final class DiscoveryForYouViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import GameplayKit
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonSDK
|
||||
import MastodonCore
|
||||
|
||||
final class DiscoveryForYouViewModel {
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
|
|
@ -11,6 +11,7 @@ import Combine
|
|||
import GameplayKit
|
||||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
import MastodonSDK
|
||||
|
||||
final class DiscoveryHashtagsViewModel {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
final class DiscoveryNewsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
|
|
@ -12,6 +12,7 @@ import GameplayKit
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonSDK
|
||||
import MastodonCore
|
||||
|
||||
final class DiscoveryNewsViewModel {
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
final class DiscoveryPostsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
|
|
@ -9,6 +9,7 @@ import os.log
|
|||
import Foundation
|
||||
import GameplayKit
|
||||
import MastodonSDK
|
||||
import MastodonCore
|
||||
|
||||
extension DiscoveryPostsViewModel {
|
||||
class State: GKState, NamingState {
|
||||
|
@ -166,7 +167,7 @@ extension DiscoveryPostsViewModel.State {
|
|||
self.offset = newOffset
|
||||
|
||||
var hasNewStatusesAppend = false
|
||||
var statusIDs = isReloading ? [] : viewModel.statusFetchedResultsController.statusIDs.value
|
||||
var statusIDs = isReloading ? [] : viewModel.statusFetchedResultsController.statusIDs
|
||||
for status in response.value {
|
||||
guard !statusIDs.contains(status.id) else { continue }
|
||||
statusIDs.append(status.id)
|
||||
|
@ -178,7 +179,7 @@ extension DiscoveryPostsViewModel.State {
|
|||
} else {
|
||||
await enter(state: NoMore.self)
|
||||
}
|
||||
viewModel.statusFetchedResultsController.statusIDs.value = statusIDs
|
||||
viewModel.statusFetchedResultsController.statusIDs = statusIDs
|
||||
viewModel.didLoadLatest.send()
|
||||
|
||||
} catch {
|
||||
|
|
|
@ -12,6 +12,7 @@ import GameplayKit
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import MastodonSDK
|
||||
import MastodonCore
|
||||
|
||||
final class DiscoveryPostsViewModel {
|
||||
|
||||
|
@ -51,7 +52,7 @@ final class DiscoveryPostsViewModel {
|
|||
|
||||
context.authenticationService.activeMastodonAuthentication
|
||||
.map { $0?.domain }
|
||||
.assign(to: \.value, on: statusFetchedResultsController.domain)
|
||||
.assign(to: \.domain, on: statusFetchedResultsController)
|
||||
.store(in: &disposeBag)
|
||||
|
||||
Task {
|
||||
|
|
|
@ -9,6 +9,8 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
public protocol DiscoveryIntroBannerViewDelegate: AnyObject {
|
||||
|
|
|
@ -12,6 +12,7 @@ import Combine
|
|||
import GameplayKit
|
||||
import CoreData
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class HashtagTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
|
|
@ -167,7 +167,7 @@ extension HashtagTimelineViewModel.State {
|
|||
self.maxID = newMaxID
|
||||
|
||||
var hasNewStatusesAppend = false
|
||||
var statusIDs = isReloading ? [] : viewModel.fetchedResultsController.statusIDs.value
|
||||
var statusIDs = isReloading ? [] : viewModel.fetchedResultsController.statusIDs
|
||||
for status in response.value {
|
||||
guard !statusIDs.contains(status.id) else { continue }
|
||||
statusIDs.append(status.id)
|
||||
|
|
|
@ -12,7 +12,8 @@ import CoreData
|
|||
import CoreDataStack
|
||||
import GameplayKit
|
||||
import MastodonSDK
|
||||
|
||||
import MastodonCore
|
||||
|
||||
final class HashtagTimelineViewModel {
|
||||
|
||||
let logger = Logger(subsystem: "HashtagTimelineViewModel", category: "ViewModel")
|
||||
|
@ -63,7 +64,7 @@ final class HashtagTimelineViewModel {
|
|||
|
||||
context.authenticationService.activeMastodonAuthenticationBox
|
||||
.map { $0?.domain }
|
||||
.assign(to: \.value, on: fetchedResultsController.domain)
|
||||
.assign(to: \.domain, on: fetchedResultsController)
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import CoreData
|
|||
import CoreDataStack
|
||||
import FLEX
|
||||
import SwiftUI
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonSDK
|
||||
import StoreKit
|
||||
|
|
|
@ -16,8 +16,9 @@ import MastodonSDK
|
|||
import AlamofireImage
|
||||
import StoreKit
|
||||
import MastodonAsset
|
||||
import MastodonLocalization
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
final class HomeTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import Foundation
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import GameplayKit
|
||||
import MastodonCore
|
||||
|
||||
extension HomeTimelineViewModel {
|
||||
class LoadLatestState: GKState {
|
||||
|
|
|
@ -15,6 +15,7 @@ import CoreDataStack
|
|||
import GameplayKit
|
||||
import AlamofireImage
|
||||
import DateToolsSwift
|
||||
import MastodonCore
|
||||
|
||||
final class HomeTimelineViewModel: NSObject {
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import Combine
|
||||
import Foundation
|
||||
import UIKit
|
||||
import MastodonCore
|
||||
|
||||
final class HomeTimelineNavigationBarTitleViewModel {
|
||||
|
||||
|
@ -48,21 +49,21 @@ final class HomeTimelineNavigationBarTitleViewModel {
|
|||
.assign(to: \.value, on: isOffline)
|
||||
.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)
|
||||
// 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(),
|
||||
|
|
|
@ -11,6 +11,7 @@ import Combine
|
|||
import Alamofire
|
||||
import AlamofireImage
|
||||
import FLAnimatedImage
|
||||
import MastodonCore
|
||||
|
||||
class MediaPreviewImageViewModel {
|
||||
|
||||
|
@ -29,18 +30,18 @@ class MediaPreviewImageViewModel {
|
|||
|
||||
extension MediaPreviewImageViewModel {
|
||||
|
||||
enum ImagePreviewItem {
|
||||
public enum ImagePreviewItem {
|
||||
case remote(RemoteImageContext)
|
||||
case local(LocalImageContext)
|
||||
}
|
||||
|
||||
struct RemoteImageContext {
|
||||
public struct RemoteImageContext {
|
||||
let assetURL: URL?
|
||||
let thumbnail: UIImage?
|
||||
let altText: String?
|
||||
}
|
||||
|
||||
struct LocalImageContext {
|
||||
public struct LocalImageContext {
|
||||
let image: UIImage
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ import UIKit
|
|||
import Combine
|
||||
import Pageboy
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
final class MediaPreviewViewController: UIViewController, NeedsDependency {
|
||||
|
|
|
@ -10,6 +10,7 @@ import Combine
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import Pageboy
|
||||
import MastodonCore
|
||||
|
||||
final class MediaPreviewViewModel: NSObject {
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import UIKit
|
|||
import AVKit
|
||||
import Combine
|
||||
import AlamofireImage
|
||||
import MastodonCore
|
||||
|
||||
final class MediaPreviewVideoViewModel {
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
final class NotificationTableViewCell: UITableViewCell {
|
||||
|
|
|
@ -9,6 +9,7 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class NotificationTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
|
|
@ -11,6 +11,7 @@ import Combine
|
|||
import CoreDataStack
|
||||
import GameplayKit
|
||||
import MastodonSDK
|
||||
import MastodonCore
|
||||
|
||||
final class NotificationTimelineViewModel {
|
||||
|
||||
|
@ -78,7 +79,7 @@ final class NotificationTimelineViewModel {
|
|||
|
||||
extension NotificationTimelineViewModel {
|
||||
|
||||
typealias Scope = APIService.NotificationScope
|
||||
typealias Scope = APIService.MastodonNotificationScope
|
||||
|
||||
static func feedPredicate(
|
||||
authenticationBox: MastodonAuthenticationBox,
|
||||
|
|
|
@ -12,6 +12,7 @@ import MastodonAsset
|
|||
import MastodonLocalization
|
||||
import Tabman
|
||||
import Pageboy
|
||||
import MastodonCore
|
||||
|
||||
final class NotificationViewController: TabmanViewController, NeedsDependency {
|
||||
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonAsset
|
||||
import MastodonLocalization
|
||||
import Pageboy
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class NotificationViewModel {
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ import os.log
|
|||
import ThirdPartyMailer
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
final class MastodonConfirmEmailViewController: UIViewController, NeedsDependency {
|
||||
|
@ -205,10 +207,10 @@ extension MastodonConfirmEmailViewController {
|
|||
}
|
||||
|
||||
func showEmailAppAlert() {
|
||||
let clients = ThirdPartyMailClient.clients()
|
||||
let clients = ThirdPartyMailClient.clients
|
||||
let application = UIApplication.shared
|
||||
let availableClients = clients.filter { client -> Bool in
|
||||
ThirdPartyMailer.application(application, isMailClientAvailable: client)
|
||||
ThirdPartyMailer.isMailClientAvailable(client)
|
||||
}
|
||||
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.OpenEmailApp.openEmailClient, message: nil, preferredStyle: .alert)
|
||||
|
||||
|
@ -218,7 +220,7 @@ extension MastodonConfirmEmailViewController {
|
|||
alertController.addAction(alertAction)
|
||||
_ = availableClients.compactMap { client -> UIAlertAction in
|
||||
let alertAction = UIAlertAction(title: client.name, style: .default) { _ in
|
||||
_ = ThirdPartyMailer.application(application, openMailClient: client)
|
||||
_ = ThirdPartyMailer.open(client, completionHandler: nil)
|
||||
}
|
||||
alertController.addAction(alertAction)
|
||||
return alertAction
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import Combine
|
||||
import Foundation
|
||||
import MastodonCore
|
||||
import MastodonSDK
|
||||
|
||||
final class MastodonConfirmEmailViewModel {
|
||||
|
|
|
@ -11,6 +11,7 @@ import Combine
|
|||
import GameController
|
||||
import AuthenticationServices
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
import MastodonUI
|
||||
|
||||
|
@ -281,7 +282,7 @@ extension MastodonPickServerViewController {
|
|||
guard let info = AuthenticationViewModel.AuthenticateInfo(
|
||||
domain: server.domain,
|
||||
application: application,
|
||||
redirectURI: response.value.redirectURI ?? MastodonAuthenticationController.callbackURL
|
||||
redirectURI: response.value.redirectURI ?? APIService.oauthCallbackURL
|
||||
) else {
|
||||
throw APIService.APIError.explicit(.badResponse)
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ import MastodonSDK
|
|||
import CoreDataStack
|
||||
import OrderedCollections
|
||||
import Tabman
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
class MastodonPickServerViewModel: NSObject {
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
import UIKit
|
||||
import Combine
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
final class PickServerLoaderTableViewCell: TimelineLoaderTableViewCell {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import UIKit
|
||||
import MastodonSDK
|
||||
import MastodonAsset
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
class PickServerCategoryView: UIView {
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
final class PickServerEmptyStateView: UIView {
|
||||
|
|
|
@ -14,6 +14,7 @@ import UIKit
|
|||
import SwiftUI
|
||||
import MastodonUI
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class MastodonRegisterViewController: UIViewController, NeedsDependency, OnboardingViewControllerAppearance {
|
||||
|
|
|
@ -10,6 +10,7 @@ import Foundation
|
|||
import MastodonSDK
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class MastodonRegisterViewModel: ObservableObject {
|
||||
|
|
|
@ -9,6 +9,7 @@ import Combine
|
|||
import os.log
|
||||
import UIKit
|
||||
import WebKit
|
||||
import MastodonCore
|
||||
|
||||
final class MastodonResendEmailViewController: UIViewController, NeedsDependency {
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
//
|
||||
|
||||
import UIKit
|
||||
import MastodonCore
|
||||
|
||||
#if DEBUG
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import MastodonSDK
|
|||
import SafariServices
|
||||
import MetaTextKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class MastodonServerRulesViewController: UIViewController, NeedsDependency {
|
||||
|
|
|
@ -11,6 +11,7 @@ import CoreData
|
|||
import CoreDataStack
|
||||
import Combine
|
||||
import MastodonSDK
|
||||
import MastodonCore
|
||||
|
||||
final class AuthenticationViewModel {
|
||||
|
||||
|
@ -121,7 +122,7 @@ extension AuthenticationViewModel {
|
|||
init?(
|
||||
domain: String,
|
||||
application: Mastodon.Entity.Application,
|
||||
redirectURI: String = MastodonAuthenticationController.callbackURL
|
||||
redirectURI: String = APIService.oauthCallbackURL
|
||||
) {
|
||||
self.domain = domain
|
||||
guard let clientID = application.clientID,
|
||||
|
|
|
@ -9,13 +9,14 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import AuthenticationServices
|
||||
import MastodonCore
|
||||
|
||||
final class MastodonAuthenticationController {
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
// input
|
||||
var context: AppContext!
|
||||
var context: AppContext
|
||||
let authenticateURL: URL
|
||||
var authenticationSession: ASWebAuthenticationSession?
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
final class WelcomeIllustrationView: UIView {
|
||||
|
|
|
@ -9,6 +9,7 @@ import os.log
|
|||
import UIKit
|
||||
import Combine
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class WelcomeViewController: UIViewController, NeedsDependency {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import Foundation
|
||||
import Combine
|
||||
import MastodonCore
|
||||
|
||||
final class WelcomeViewModel {
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import Combine
|
|||
import MastodonAsset
|
||||
import MastodonLocalization
|
||||
import MetaTextKit
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
final class ProfileFieldAddEntryCollectionViewCell: UICollectionViewCell {
|
||||
|
|
|
@ -10,6 +10,8 @@ import UIKit
|
|||
import Combine
|
||||
import MetaTextKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonLocalization
|
||||
|
||||
protocol ProfileFieldEditCollectionViewCellDelegate: AnyObject {
|
||||
|
|
|
@ -12,6 +12,7 @@ import MetaTextKit
|
|||
import MastodonLocalization
|
||||
import TabBarPager
|
||||
import XLPagerTabStrip
|
||||
import MastodonCore
|
||||
|
||||
protocol ProfileAboutViewControllerDelegate: AnyObject {
|
||||
func profileAboutViewController(_ viewController: ProfileAboutViewController, profileFieldCollectionViewCell: ProfileFieldCollectionViewCell, metaLabel: MetaLabel, didSelectMeta meta: Meta)
|
||||
|
|
|
@ -11,6 +11,7 @@ import Combine
|
|||
import CoreDataStack
|
||||
import MastodonSDK
|
||||
import MastodonMeta
|
||||
import MastodonCore
|
||||
import Kanna
|
||||
|
||||
final class ProfileAboutViewModel {
|
||||
|
|
|
@ -11,6 +11,7 @@ import AVKit
|
|||
import Combine
|
||||
import GameplayKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class BookmarkViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
|
|
@ -9,6 +9,7 @@ import os.log
|
|||
import Foundation
|
||||
import GameplayKit
|
||||
import MastodonSDK
|
||||
import MastodonCore
|
||||
|
||||
extension BookmarkViewModel {
|
||||
class State: GKState, NamingState {
|
||||
|
@ -72,7 +73,7 @@ extension BookmarkViewModel.State {
|
|||
guard let viewModel = viewModel, let stateMachine = stateMachine else { return }
|
||||
|
||||
// reset
|
||||
viewModel.statusFetchedResultsController.statusIDs.value = []
|
||||
viewModel.statusFetchedResultsController.statusIDs = []
|
||||
|
||||
stateMachine.enter(Loading.self)
|
||||
}
|
||||
|
@ -150,7 +151,7 @@ extension BookmarkViewModel.State {
|
|||
)
|
||||
|
||||
var hasNewStatusesAppend = false
|
||||
var statusIDs = viewModel.statusFetchedResultsController.statusIDs.value
|
||||
var statusIDs = viewModel.statusFetchedResultsController.statusIDs
|
||||
for status in response.value {
|
||||
guard !statusIDs.contains(status.id) else { continue }
|
||||
statusIDs.append(status.id)
|
||||
|
@ -169,7 +170,7 @@ extension BookmarkViewModel.State {
|
|||
} else {
|
||||
await enter(state: NoMore.self)
|
||||
}
|
||||
viewModel.statusFetchedResultsController.statusIDs.value = statusIDs
|
||||
viewModel.statusFetchedResultsController.statusIDs = statusIDs
|
||||
} catch {
|
||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch user bookmarks fail: \(error.localizedDescription)")
|
||||
await enter(state: Fail.self)
|
||||
|
|
|
@ -10,6 +10,7 @@ import Combine
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import GameplayKit
|
||||
import MastodonCore
|
||||
|
||||
final class BookmarkViewModel {
|
||||
|
||||
|
@ -51,7 +52,7 @@ final class BookmarkViewModel {
|
|||
|
||||
activeMastodonAuthenticationBox
|
||||
.map { $0?.domain }
|
||||
.assign(to: \.value, on: statusFetchedResultsController.domain)
|
||||
.assign(to: \.domain, on: statusFetchedResultsController)
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import Foundation
|
||||
import CoreDataStack
|
||||
import MastodonCore
|
||||
|
||||
final class CachedProfileViewModel: ProfileViewModel {
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class FamiliarFollowersViewController: UIViewController, NeedsDependency {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonCore
|
||||
import MastodonSDK
|
||||
import CoreDataStack
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import AVKit
|
|||
import Combine
|
||||
import GameplayKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonLocalization
|
||||
|
||||
final class FavoriteViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
import os.log
|
||||
import Foundation
|
||||
import GameplayKit
|
||||
import MastodonCore
|
||||
import MastodonSDK
|
||||
|
||||
extension FavoriteViewModel {
|
||||
|
@ -72,7 +73,7 @@ extension FavoriteViewModel.State {
|
|||
guard let viewModel = viewModel, let stateMachine = stateMachine else { return }
|
||||
|
||||
// reset
|
||||
viewModel.statusFetchedResultsController.statusIDs.value = []
|
||||
viewModel.statusFetchedResultsController.statusIDs = []
|
||||
|
||||
stateMachine.enter(Loading.self)
|
||||
}
|
||||
|
@ -150,7 +151,7 @@ extension FavoriteViewModel.State {
|
|||
)
|
||||
|
||||
var hasNewStatusesAppend = false
|
||||
var statusIDs = viewModel.statusFetchedResultsController.statusIDs.value
|
||||
var statusIDs = viewModel.statusFetchedResultsController.statusIDs
|
||||
for status in response.value {
|
||||
guard !statusIDs.contains(status.id) else { continue }
|
||||
statusIDs.append(status.id)
|
||||
|
@ -169,7 +170,7 @@ extension FavoriteViewModel.State {
|
|||
} else {
|
||||
await enter(state: NoMore.self)
|
||||
}
|
||||
viewModel.statusFetchedResultsController.statusIDs.value = statusIDs
|
||||
viewModel.statusFetchedResultsController.statusIDs = statusIDs
|
||||
} catch {
|
||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch user favorites fail: \(error.localizedDescription)")
|
||||
await enter(state: Fail.self)
|
||||
|
|
|
@ -10,6 +10,7 @@ import Combine
|
|||
import CoreData
|
||||
import CoreDataStack
|
||||
import GameplayKit
|
||||
import MastodonCore
|
||||
|
||||
final class FavoriteViewModel {
|
||||
|
||||
|
@ -51,7 +52,7 @@ final class FavoriteViewModel {
|
|||
|
||||
activeMastodonAuthenticationBox
|
||||
.map { $0?.domain }
|
||||
.assign(to: \.value, on: statusFetchedResultsController.domain)
|
||||
.assign(to: \.domain, on: statusFetchedResultsController)
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue