From fa27a28a6092c77d2dbce48eb1f09b3be3e44873 Mon Sep 17 00:00:00 2001 From: CMK Date: Sat, 8 Oct 2022 13:43:06 +0800 Subject: [PATCH] chore: move core logic into package --- Mastodon/Coordinator/NeedsDependency.swift | 1 + .../Account/SelectedAccountSection.swift | 4 +- .../Compose/ComposeStatusAttachmentItem.swift | 1 + .../Diffiable/Compose/ComposeStatusItem.swift | 1 + .../Compose/ComposeStatusSection.swift | 2 +- .../Discovery/DiscoverySection.swift | 1 + .../Notification/NotificationSection.swift | 1 + .../Profile/ProfileFieldSection.swift | 1 + .../RecommendAccountSection.swift | 1 + Mastodon/Diffiable/Report/ReportSection.swift | 1 + .../Search/SearchHistorySection.swift | 1 + .../Search/SearchResultSection.swift | 1 + Mastodon/Diffiable/Search/SearchSection.swift | 1 + .../Diffiable/Settings/SettingsSection.swift | 5 +- Mastodon/Diffiable/Status/StatusSection.swift | 1 + Mastodon/Diffiable/User/UserSection.swift | 1 + .../Provider/DataSourceFacade+Block.swift | 1 + .../Provider/DataSourceFacade+Bookmark.swift | 3 +- .../Provider/DataSourceFacade+Favorite.swift | 3 +- .../Provider/DataSourceFacade+Follow.swift | 1 + .../Provider/DataSourceFacade+Mute.swift | 1 + .../Provider/DataSourceFacade+Reblog.swift | 1 + .../DataSourceFacade+SearchHistory.swift | 1 + .../Provider/DataSourceFacade+Status.swift | 1 + ...taSourceProvider+UITableViewDelegate.swift | 2 + .../Cell/AccountListTableViewCell.swift | 1 + .../AutoCompleteViewController.swift | 1 + .../View/AutoCompleteTopChevronView.swift | 2 + ...sPollExpiresOptionCollectionViewCell.swift | 2 + ...lOptionAppendEntryCollectionViewCell.swift | 2 + ...seStatusPollOptionCollectionViewCell.swift | 1 + .../Scene/Compose/ComposeViewController.swift | 10 ++-- .../Compose/ComposeViewModel+DataSource.swift | 5 +- Mastodon/Scene/Compose/ComposeViewModel.swift | 1 + ...eRepliedToStatusContentTableViewCell.swift | 1 + ...tachmentContainerView+EmptyStateView.swift | 3 +- .../Compose/View/ComposeToolbarView.swift | 2 + .../View/StatusContentWarningEditorView.swift | 1 + .../DiscoveryCommunityViewController.swift | 1 + .../DiscoveryCommunityViewModel+State.swift | 4 +- .../DiscoveryCommunityViewModel.swift | 2 +- .../Discovery/DiscoveryViewController.swift | 1 + .../Scene/Discovery/DiscoveryViewModel.swift | 1 + .../DiscoveryForYouViewController.swift | 1 + .../ForYou/DiscoveryForYouViewModel.swift | 1 + .../DiscoveryHashtagsViewController.swift | 1 + .../Hashtags/DiscoveryHashtagsViewModel.swift | 1 + .../News/DiscoveryNewsViewController.swift | 1 + .../News/DiscoveryNewsViewModel.swift | 1 + .../Posts/DiscoveryPostsViewController.swift | 1 + .../Posts/DiscoveryPostsViewModel+State.swift | 5 +- .../Posts/DiscoveryPostsViewModel.swift | 3 +- .../View/DiscoveryIntroBannerView.swift | 2 + .../HashtagTimelineViewController.swift | 1 + .../HashtagTimelineViewModel+State.swift | 2 +- .../HashtagTimelineViewModel.swift | 5 +- ...meTimelineViewController+DebugAction.swift | 1 + .../HomeTimelineViewController.swift | 3 +- ...omeTimelineViewModel+LoadLatestState.swift | 1 + .../HomeTimeline/HomeTimelineViewModel.swift | 1 + ...eTimelineNavigationBarTitleViewModel.swift | 31 +++++------ .../Image/MediaPreviewImageViewModel.swift | 7 +-- .../MediaPreviewViewController.swift | 2 + .../MediaPreview/MediaPreviewViewModel.swift | 1 + .../Video/MediaPreviewVideoViewModel.swift | 1 + .../Cell/NotificationTableViewCell.swift | 1 + .../NotificationTimelineViewController.swift | 1 + .../NotificationTimelineViewModel.swift | 3 +- .../NotificationViewController.swift | 1 + .../Notification/NotificationViewModel.swift | 5 +- .../MastodonConfirmEmailViewController.swift | 8 +-- .../MastodonConfirmEmailViewModel.swift | 1 + .../MastodonPickServerViewController.swift | 3 +- .../MastodonPickServerViewModel.swift | 2 + .../PickServerLoaderTableViewCell.swift | 2 + .../View/PickServerCategoryView.swift | 1 + .../View/PickServerEmptyStateView.swift | 2 + .../MastodonRegisterViewController.swift | 1 + .../Register/MastodonRegisterViewModel.swift | 1 + .../MastodonResendEmailViewController.swift | 1 + ...todonServerRulesViewController+Debug.swift | 1 + .../MastodonServerRulesViewController.swift | 1 + .../Share/AuthenticationViewModel.swift | 3 +- .../MastodonAuthenticationController.swift | 3 +- .../View/WelcomeIllustrationView.swift | 2 + .../Welcome/WelcomeViewController.swift | 1 + .../Onboarding/Welcome/WelcomeViewModel.swift | 1 + ...ofileFieldAddEntryCollectionViewCell.swift | 1 + .../ProfileFieldEditCollectionViewCell.swift | 2 + .../About/ProfileAboutViewController.swift | 1 + .../Profile/About/ProfileAboutViewModel.swift | 1 + .../Bookmark/BookmarkViewController.swift | 1 + .../Bookmark/BookmarkViewModel+State.swift | 7 +-- .../Profile/Bookmark/BookmarkViewModel.swift | 3 +- .../Profile/CachedProfileViewModel.swift | 1 + .../FamiliarFollowersViewController.swift | 1 + .../FamiliarFollowersViewModel.swift | 1 + .../Favorite/FavoriteViewController.swift | 1 + .../Favorite/FavoriteViewModel+State.swift | 7 +-- .../Profile/Favorite/FavoriteViewModel.swift | 3 +- .../Follower/FollowerListViewController.swift | 1 + .../FollowerListViewModel+State.swift | 1 + .../Follower/FollowerListViewModel.swift | 1 + .../FollowingListViewController.swift | 1 + .../Following/FollowingListViewModel.swift | 2 +- .../Header/ProfileHeaderViewController.swift | 2 + .../Header/ProfileHeaderViewModel.swift | 1 + .../View/ProfileHeaderView+ViewModel.swift | 1 + .../Header/View/ProfileHeaderView.swift | 1 + .../Scene/Profile/MeProfileViewModel.swift | 1 + .../Paging/ProfilePagingViewController.swift | 1 + .../Scene/Profile/ProfileViewController.swift | 3 +- Mastodon/Scene/Profile/ProfileViewModel.swift | 1 + .../Profile/RemoteProfileViewModel.swift | 1 + .../Timeline/UserTimelineViewController.swift | 1 + .../UserTimelineViewModel+State.swift | 9 ++-- .../Timeline/UserTimelineViewModel.swift | 3 +- .../FavoritedByViewController.swift | 1 + .../RebloggedByViewController.swift | 1 + .../UserLIst/UserListViewModel+State.swift | 2 +- .../Profile/UserLIst/UserListViewModel.swift | 3 +- .../Report/Report/ReportViewController.swift | 1 + .../Scene/Report/Report/ReportViewModel.swift | 1 + .../ReportReason/ReportReasonView.swift | 1 + .../ReportReasonViewController.swift | 1 + .../ReportReason/ReportReasonViewModel.swift | 1 + .../ReportResult/ReportResultView.swift | 2 + .../ReportResultViewController.swift | 1 + .../ReportResult/ReportResultViewModel.swift | 1 + .../ReportServerRulesViewController.swift | 3 +- .../ReportServerRulesViewModel.swift | 1 + .../ReportStatusViewController.swift | 1 + .../ReportStatusViewModel+State.swift | 6 +-- .../ReportStatus/ReportStatusViewModel.swift | 3 +- .../ReportSupplementaryViewController.swift | 1 + .../ReportSupplementaryViewModel.swift | 1 + .../Root/ContentSplitViewController.swift | 1 + .../Root/MainTab/MainTabBarController.swift | 52 ++++++++++--------- .../SecondaryPlaceholderViewController.swift | 1 + .../Root/Sidebar/SidebarViewController.swift | 1 + .../Scene/Root/Sidebar/SidebarViewModel.swift | 1 + .../Sidebar/View/SidebarListContentView.swift | 2 + .../Search/Cell/TrendCollectionViewCell.swift | 1 + .../Search/Search/SearchViewController.swift | 1 + .../Scene/Search/Search/SearchViewModel.swift | 1 + .../SearchRecommendCollectionHeader.swift | 2 + .../SearchDetailViewController.swift | 3 +- .../SearchHistoryUserCollectionViewCell.swift | 1 + .../SearchHistoryViewController.swift | 1 + .../SearchHistoryViewModel.swift | 1 + .../View/SearchHistoryTableHeaderView.swift | 1 + .../SearchResultViewController.swift | 2 + .../SearchResultViewModel+State.swift | 3 +- .../SearchResult/SearchResultViewModel.swift | 3 +- .../Settings/SettingsViewController.swift | 8 +-- .../Scene/Settings/SettingsViewModel.swift | 1 + .../Content/ContentWarningOverlayView.swift | 1 + ...ubleTitleLabelNavigationBarTitleView.swift | 2 + .../NotificationView+Configuration.swift | 1 + .../PollOptionView+Configuration.swift | 1 + .../Content/StatusView+Configuration.swift | 2 + .../Share/View/Content/ThreadMetaView.swift | 1 + .../View/Content/UserView+Configuration.swift | 1 + .../Share/View/Decoration/SawToothView.swift | 1 + .../ThreadReplyLoaderTableViewCell.swift | 2 + .../TimelineBottomLoaderTableViewCell.swift | 2 + .../TimelineLoaderTableViewCell.swift | 2 + .../TimelineMiddleLoaderTableViewCell.swift | 1 + .../TimelineTopLoaderTableViewCell.swift | 3 ++ .../Share/Webview/WebViewController.swift | 1 + .../SuggestionAccountViewController.swift | 1 + .../SuggestionAccountViewModel.swift | 1 + ...estionAccountTableViewCell+ViewModel.swift | 2 + .../Scene/Thread/CachedThreadViewModel.swift | 1 + .../MastodonStatusThreadViewModel.swift | 1 + .../Scene/Thread/RemoteThreadViewModel.swift | 1 + .../Scene/Thread/ThreadViewController.swift | 1 + .../Thread/ThreadViewModel+Diffable.swift | 1 + Mastodon/Scene/Thread/ThreadViewModel.swift | 1 + Mastodon/Supporting Files/SceneDelegate.swift | 1 + .../Sources/MastodonCore/AppContext.swift | 8 +-- .../Extension/CoreDataStack/Instance.swift | 2 +- .../Extension/CoreDataStack/Setting.swift | 2 +- .../Extension/CoreDataStack/Status.swift | 12 ++--- .../CoreDataStack/Subscription.swift | 4 +- ...SearchHistoryFetchedResultController.swift | 14 ++--- .../StatusFetchedResultsController.swift | 24 ++++----- .../UserFetchedResultsController.swift | 14 ++--- .../Model/PlaintextMetaContent.swift | 0 .../Service/API/APIService+Account.swift | 10 ++-- .../Service/API/APIService+App.swift | 2 +- .../API/APIService+Authentication.swift | 4 +- .../Service/API/APIService+Block.swift | 2 +- .../Service/API/APIService+Bookmark.swift | 4 +- .../Service/API/APIService+Favorite.swift | 7 +-- .../Service/API/APIService+Follow.swift | 2 +- .../API/APIService+FollowRequest.swift | 4 +- .../Service/API/APIService+Follower.swift | 2 +- .../Service/API/APIService+Following.swift | 2 +- .../API/APIService+HashtagTimeline.swift | 2 +- .../Service/API/APIService+HomeTimeline.swift | 2 +- .../Service/API/APIService+Instance.swift | 2 +- .../Service/API/APIService+Mute.swift | 2 +- .../Service/API/APIService+Notification.swift | 14 ++--- .../Service/API/APIService+Onboarding.swift | 6 +-- .../Service/API/APIService+Poll.swift | 4 +- .../API/APIService+PublicTimeline.swift | 2 +- .../Service/API/APIService+Reblog.swift | 4 +- .../Service/API/APIService+Recommend.swift | 6 +-- .../Service/API/APIService+Relationship.swift | 2 +- .../Service/API/APIService+Status.swift | 4 +- .../Service/API/APIService+Thread.swift | 2 +- .../Service/API/APIService+Trend.swift | 6 +-- .../Service/API/APIService+UserTimeline.swift | 2 +- .../Service/API/APIService+WebFinger.swift | 2 +- .../MastodonCore/Service/API/APIService.swift | 2 +- ...vice+CoreData+MastodonAuthentication.swift | 2 +- .../APIService+CoreData+Subscriptions.swift | 2 +- .../Service/AuthenticationService.swift | 2 +- .../EmojiService+CustomEmojiViewModel.swift | 4 +- .../Service/Emoji/EmojiService.swift | 2 +- .../MastodonCore/Service/Emoji/Trie.swift | 14 ++--- ...astodonAttachmentService+UploadState.swift | 28 +++++----- .../MastodonAttachmentService.swift | 40 +++++++------- .../Notification/NotificationService.swift | 2 +- .../MastodonCore/Service/SettingService.swift | 4 +- .../Service/StatusFilterService.swift | 4 +- ...liarFollowersDashboardView+ViewModel.swift | 1 + .../View/Content/NotificationView.swift | 1 + .../ProfileCardView+Configuration.swift | 1 + .../MastodonUI/View/Content/StatusView.swift | 1 + .../View/Content/UserView+ViewModel.swift | 1 + 232 files changed, 455 insertions(+), 246 deletions(-) rename MastodonSDK/Sources/{MastodonUI => MastodonCore}/Model/PlaintextMetaContent.swift (100%) diff --git a/Mastodon/Coordinator/NeedsDependency.swift b/Mastodon/Coordinator/NeedsDependency.swift index d6a24cce3..c035437ac 100644 --- a/Mastodon/Coordinator/NeedsDependency.swift +++ b/Mastodon/Coordinator/NeedsDependency.swift @@ -6,6 +6,7 @@ // import UIKit +import MastodonCore protocol NeedsDependency: AnyObject { var context: AppContext! { get set } diff --git a/Mastodon/Diffiable/Account/SelectedAccountSection.swift b/Mastodon/Diffiable/Account/SelectedAccountSection.swift index 6c02d7059..d71cbf326 100644 --- a/Mastodon/Diffiable/Account/SelectedAccountSection.swift +++ b/Mastodon/Diffiable/Account/SelectedAccountSection.swift @@ -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 diff --git a/Mastodon/Diffiable/Compose/ComposeStatusAttachmentItem.swift b/Mastodon/Diffiable/Compose/ComposeStatusAttachmentItem.swift index 834e1da49..07ae4e5df 100644 --- a/Mastodon/Diffiable/Compose/ComposeStatusAttachmentItem.swift +++ b/Mastodon/Diffiable/Compose/ComposeStatusAttachmentItem.swift @@ -6,6 +6,7 @@ // import Foundation +import MastodonCore enum ComposeStatusAttachmentItem { case attachment(attachmentService: MastodonAttachmentService) diff --git a/Mastodon/Diffiable/Compose/ComposeStatusItem.swift b/Mastodon/Diffiable/Compose/ComposeStatusItem.swift index 65650dcdc..aad93c2d2 100644 --- a/Mastodon/Diffiable/Compose/ComposeStatusItem.swift +++ b/Mastodon/Diffiable/Compose/ComposeStatusItem.swift @@ -8,6 +8,7 @@ import Foundation import Combine import CoreData +import MastodonCore import MastodonMeta import CoreDataStack diff --git a/Mastodon/Diffiable/Compose/ComposeStatusSection.swift b/Mastodon/Diffiable/Compose/ComposeStatusSection.swift index 45ed86783..7b4596267 100644 --- a/Mastodon/Diffiable/Compose/ComposeStatusSection.swift +++ b/Mastodon/Diffiable/Compose/ComposeStatusSection.swift @@ -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) diff --git a/Mastodon/Diffiable/Discovery/DiscoverySection.swift b/Mastodon/Diffiable/Discovery/DiscoverySection.swift index 94e07c71b..2910171d1 100644 --- a/Mastodon/Diffiable/Discovery/DiscoverySection.swift +++ b/Mastodon/Diffiable/Discovery/DiscoverySection.swift @@ -7,6 +7,7 @@ import os.log import UIKit +import MastodonCore import MastodonUI import MastodonSDK diff --git a/Mastodon/Diffiable/Notification/NotificationSection.swift b/Mastodon/Diffiable/Notification/NotificationSection.swift index 97cf8ada0..6f08a0252 100644 --- a/Mastodon/Diffiable/Notification/NotificationSection.swift +++ b/Mastodon/Diffiable/Notification/NotificationSection.swift @@ -14,6 +14,7 @@ import UIKit import MetaTextKit import MastodonMeta import MastodonAsset +import MastodonCore import MastodonLocalization enum NotificationSection: Equatable, Hashable { diff --git a/Mastodon/Diffiable/Profile/ProfileFieldSection.swift b/Mastodon/Diffiable/Profile/ProfileFieldSection.swift index e1b0d649f..19771b5db 100644 --- a/Mastodon/Diffiable/Profile/ProfileFieldSection.swift +++ b/Mastodon/Diffiable/Profile/ProfileFieldSection.swift @@ -8,6 +8,7 @@ import os import UIKit import Combine +import MastodonCore import MastodonMeta import MastodonLocalization diff --git a/Mastodon/Diffiable/RecommandAccount/RecommendAccountSection.swift b/Mastodon/Diffiable/RecommandAccount/RecommendAccountSection.swift index f59164f35..fc2d68044 100644 --- a/Mastodon/Diffiable/RecommandAccount/RecommendAccountSection.swift +++ b/Mastodon/Diffiable/RecommandAccount/RecommendAccountSection.swift @@ -13,6 +13,7 @@ import UIKit import MetaTextKit import MastodonMeta import Combine +import MastodonCore enum RecommendAccountSection: Equatable, Hashable { case main diff --git a/Mastodon/Diffiable/Report/ReportSection.swift b/Mastodon/Diffiable/Report/ReportSection.swift index 69b9da234..6513c1249 100644 --- a/Mastodon/Diffiable/Report/ReportSection.swift +++ b/Mastodon/Diffiable/Report/ReportSection.swift @@ -13,6 +13,7 @@ import MastodonSDK import UIKit import os.log import MastodonAsset +import MastodonCore import MastodonLocalization enum ReportSection: Equatable, Hashable { diff --git a/Mastodon/Diffiable/Search/SearchHistorySection.swift b/Mastodon/Diffiable/Search/SearchHistorySection.swift index 557b49f2b..03de14c1c 100644 --- a/Mastodon/Diffiable/Search/SearchHistorySection.swift +++ b/Mastodon/Diffiable/Search/SearchHistorySection.swift @@ -7,6 +7,7 @@ import UIKit import CoreDataStack +import MastodonCore enum SearchHistorySection: Hashable { case main diff --git a/Mastodon/Diffiable/Search/SearchResultSection.swift b/Mastodon/Diffiable/Search/SearchResultSection.swift index 1b1ac3ec9..b7fb09df7 100644 --- a/Mastodon/Diffiable/Search/SearchResultSection.swift +++ b/Mastodon/Diffiable/Search/SearchResultSection.swift @@ -12,6 +12,7 @@ import UIKit import CoreData import CoreDataStack import MastodonAsset +import MastodonCore import MastodonLocalization import MastodonUI diff --git a/Mastodon/Diffiable/Search/SearchSection.swift b/Mastodon/Diffiable/Search/SearchSection.swift index 4f550abf7..c7f3922fb 100644 --- a/Mastodon/Diffiable/Search/SearchSection.swift +++ b/Mastodon/Diffiable/Search/SearchSection.swift @@ -7,6 +7,7 @@ import UIKit import MastodonSDK +import MastodonCore import MastodonLocalization enum SearchSection: Hashable { diff --git a/Mastodon/Diffiable/Settings/SettingsSection.swift b/Mastodon/Diffiable/Settings/SettingsSection.swift index 6925303d8..6086a0151 100644 --- a/Mastodon/Diffiable/Settings/SettingsSection.swift +++ b/Mastodon/Diffiable/Settings/SettingsSection.swift @@ -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 diff --git a/Mastodon/Diffiable/Status/StatusSection.swift b/Mastodon/Diffiable/Status/StatusSection.swift index 40b7e5351..08b55bc69 100644 --- a/Mastodon/Diffiable/Status/StatusSection.swift +++ b/Mastodon/Diffiable/Status/StatusSection.swift @@ -15,6 +15,7 @@ import AlamofireImage import MastodonMeta import MastodonSDK import NaturalLanguage +import MastodonCore import MastodonUI enum StatusSection: Equatable, Hashable { diff --git a/Mastodon/Diffiable/User/UserSection.swift b/Mastodon/Diffiable/User/UserSection.swift index cb806c4e9..6bb402b3a 100644 --- a/Mastodon/Diffiable/User/UserSection.swift +++ b/Mastodon/Diffiable/User/UserSection.swift @@ -9,6 +9,7 @@ import os.log import UIKit import CoreData import CoreDataStack +import MastodonCore import MetaTextKit import MastodonMeta diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Block.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Block.swift index e9a0b02c0..7166cb39b 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Block.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Block.swift @@ -7,6 +7,7 @@ import UIKit import CoreDataStack +import MastodonCore extension DataSourceFacade { static func responseToUserBlockAction( diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Bookmark.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Bookmark.swift index 0c467778d..93da15271 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Bookmark.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Bookmark.swift @@ -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, authenticationBox: MastodonAuthenticationBox diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Favorite.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Favorite.swift index fba4f697b..71c02828f 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Favorite.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Favorite.swift @@ -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, authenticationBox: MastodonAuthenticationBox diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift index f0bc379ae..cd29d2eca 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Follow.swift @@ -8,6 +8,7 @@ import UIKit import CoreDataStack import class CoreDataStack.Notification +import MastodonCore import MastodonSDK import MastodonLocalization diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Mute.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Mute.swift index b5b2dec97..b48fbf462 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Mute.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Mute.swift @@ -7,6 +7,7 @@ import UIKit import CoreDataStack +import MastodonCore extension DataSourceFacade { static func responseToUserMuteAction( diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Reblog.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Reblog.swift index 7eda84599..283a21dc8 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Reblog.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Reblog.swift @@ -7,6 +7,7 @@ import UIKit import CoreDataStack +import MastodonCore import MastodonUI extension DataSourceFacade { diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+SearchHistory.swift b/Mastodon/Protocol/Provider/DataSourceFacade+SearchHistory.swift index 8beaabbae..25ffd4b8e 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+SearchHistory.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+SearchHistory.swift @@ -7,6 +7,7 @@ import Foundation import CoreDataStack +import MastodonCore extension DataSourceFacade { diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift index 4c948c716..25ab53103 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Status.swift @@ -7,6 +7,7 @@ import UIKit import CoreDataStack +import MastodonCore import MastodonUI import MastodonLocalization diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift b/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift index c00c36971..b62064a6f 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift @@ -8,6 +8,8 @@ import os.log import UIKit import CoreDataStack +import MastodonCore +import MastodonUI import MastodonLocalization extension UITableViewDelegate where Self: DataSourceProvider { diff --git a/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift b/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift index 96111d9f8..66f49efe8 100644 --- a/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift +++ b/Mastodon/Scene/Account/Cell/AccountListTableViewCell.swift @@ -9,6 +9,7 @@ import UIKit import Combine import FLAnimatedImage import MetaTextKit +import MastodonCore import MastodonUI final class AccountListTableViewCell: UITableViewCell { diff --git a/Mastodon/Scene/Compose/AutoComplete/AutoCompleteViewController.swift b/Mastodon/Scene/Compose/AutoComplete/AutoCompleteViewController.swift index 6b71c5dd2..16f65f702 100644 --- a/Mastodon/Scene/Compose/AutoComplete/AutoCompleteViewController.swift +++ b/Mastodon/Scene/Compose/AutoComplete/AutoCompleteViewController.swift @@ -8,6 +8,7 @@ import os.log import UIKit import Combine +import MastodonCore protocol AutoCompleteViewControllerDelegate: AnyObject { func autoCompleteViewController(_ viewController: AutoCompleteViewController, didSelectItem item: AutoCompleteItem) diff --git a/Mastodon/Scene/Compose/AutoComplete/View/AutoCompleteTopChevronView.swift b/Mastodon/Scene/Compose/AutoComplete/View/AutoCompleteTopChevronView.swift index 9c3c81c3a..ccc36b1df 100644 --- a/Mastodon/Scene/Compose/AutoComplete/View/AutoCompleteTopChevronView.swift +++ b/Mastodon/Scene/Compose/AutoComplete/View/AutoCompleteTopChevronView.swift @@ -7,6 +7,8 @@ import UIKit import Combine +import MastodonCore +import MastodonUI final class AutoCompleteTopChevronView: UIView { diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollExpiresOptionCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollExpiresOptionCollectionViewCell.swift index 8a00fccde..ac32129cc 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollExpiresOptionCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollExpiresOptionCollectionViewCell.swift @@ -9,6 +9,8 @@ import os.log import UIKit import Combine import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization protocol ComposeStatusPollExpiresOptionCollectionViewCellDelegate: AnyObject { diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift index 336d109c9..29a9c0c56 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift @@ -8,6 +8,8 @@ import os.log import UIKit import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization protocol ComposeStatusPollOptionAppendEntryCollectionViewCellDelegate: AnyObject { diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionCollectionViewCell.swift index c1869669c..96ba4ce59 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionCollectionViewCell.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import MastodonAsset +import MastodonCore import MastodonLocalization import MastodonUI diff --git a/Mastodon/Scene/Compose/ComposeViewController.swift b/Mastodon/Scene/Compose/ComposeViewController.swift index 8783c8c0e..619f6efb1 100644 --- a/Mastodon/Scene/Compose/ComposeViewController.swift +++ b/Mastodon/Scene/Compose/ComposeViewController.swift @@ -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) } diff --git a/Mastodon/Scene/Compose/ComposeViewModel+DataSource.swift b/Mastodon/Scene/Compose/ComposeViewModel+DataSource.swift index c638eb769..f8694376a 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel+DataSource.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel+DataSource.swift @@ -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 { diff --git a/Mastodon/Scene/Compose/ComposeViewModel.swift b/Mastodon/Scene/Compose/ComposeViewModel.swift index 162043064..35cc965ed 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel.swift @@ -13,6 +13,7 @@ import CoreDataStack import GameplayKit import MastodonSDK import MastodonAsset +import MastodonCore import MastodonLocalization import MastodonMeta import MastodonUI diff --git a/Mastodon/Scene/Compose/TableViewCell/ComposeRepliedToStatusContentTableViewCell.swift b/Mastodon/Scene/Compose/TableViewCell/ComposeRepliedToStatusContentTableViewCell.swift index f15675b24..b0fbb0194 100644 --- a/Mastodon/Scene/Compose/TableViewCell/ComposeRepliedToStatusContentTableViewCell.swift +++ b/Mastodon/Scene/Compose/TableViewCell/ComposeRepliedToStatusContentTableViewCell.swift @@ -7,6 +7,7 @@ import UIKit import Combine +import MastodonUI final class ComposeRepliedToStatusContentTableViewCell: UITableViewCell { diff --git a/Mastodon/Scene/Compose/View/AttachmentContainerView+EmptyStateView.swift b/Mastodon/Scene/Compose/View/AttachmentContainerView+EmptyStateView.swift index 1d32931af..0dabe7790 100644 --- a/Mastodon/Scene/Compose/View/AttachmentContainerView+EmptyStateView.swift +++ b/Mastodon/Scene/Compose/View/AttachmentContainerView+EmptyStateView.swift @@ -6,8 +6,9 @@ // import UIKit -import MastodonUI import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization extension AttachmentContainerView { diff --git a/Mastodon/Scene/Compose/View/ComposeToolbarView.swift b/Mastodon/Scene/Compose/View/ComposeToolbarView.swift index 4ed84be7c..a993da228 100644 --- a/Mastodon/Scene/Compose/View/ComposeToolbarView.swift +++ b/Mastodon/Scene/Compose/View/ComposeToolbarView.swift @@ -10,6 +10,8 @@ import UIKit import Combine import MastodonSDK import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization protocol ComposeToolbarViewDelegate: AnyObject { diff --git a/Mastodon/Scene/Compose/View/StatusContentWarningEditorView.swift b/Mastodon/Scene/Compose/View/StatusContentWarningEditorView.swift index 83900c762..80dd04d37 100644 --- a/Mastodon/Scene/Compose/View/StatusContentWarningEditorView.swift +++ b/Mastodon/Scene/Compose/View/StatusContentWarningEditorView.swift @@ -8,6 +8,7 @@ import UIKit import MastodonUI import MastodonAsset +import MastodonCore import MastodonLocalization final class StatusContentWarningEditorView: UIView { diff --git a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewController.swift b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewController.swift index 524805ad7..b8c86974b 100644 --- a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewController.swift +++ b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewController.swift @@ -8,6 +8,7 @@ import os.log import UIKit import Combine +import MastodonCore import MastodonUI // Local Timeline diff --git a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+State.swift b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+State.swift index a3947e6ab..b7b078c7a 100644 --- a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+State.swift +++ b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+State.swift @@ -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 { diff --git a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel.swift b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel.swift index 86d94a3aa..4c01cb0bc 100644 --- a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel.swift +++ b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel.swift @@ -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) } diff --git a/Mastodon/Scene/Discovery/DiscoveryViewController.swift b/Mastodon/Scene/Discovery/DiscoveryViewController.swift index d94e6e592..3fc2e8944 100644 --- a/Mastodon/Scene/Discovery/DiscoveryViewController.swift +++ b/Mastodon/Scene/Discovery/DiscoveryViewController.swift @@ -11,6 +11,7 @@ import Combine import Tabman import Pageboy import MastodonAsset +import MastodonCore import MastodonUI public class DiscoveryViewController: TabmanViewController, NeedsDependency { diff --git a/Mastodon/Scene/Discovery/DiscoveryViewModel.swift b/Mastodon/Scene/Discovery/DiscoveryViewModel.swift index dfeb16e2b..d91d9eee1 100644 --- a/Mastodon/Scene/Discovery/DiscoveryViewModel.swift +++ b/Mastodon/Scene/Discovery/DiscoveryViewModel.swift @@ -9,6 +9,7 @@ import UIKit import Combine import Tabman import Pageboy +import MastodonCore import MastodonLocalization final class DiscoveryViewModel { diff --git a/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewController.swift b/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewController.swift index 9f6368e63..aa4d45f6d 100644 --- a/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewController.swift +++ b/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import MastodonUI +import MastodonCore final class DiscoveryForYouViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewModel.swift b/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewModel.swift index a31022a7c..5073ae200 100644 --- a/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewModel.swift +++ b/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewModel.swift @@ -12,6 +12,7 @@ import GameplayKit import CoreData import CoreDataStack import MastodonSDK +import MastodonCore final class DiscoveryForYouViewModel { diff --git a/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewController.swift b/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewController.swift index 20ad408a2..8985af2de 100644 --- a/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewController.swift +++ b/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewController.swift @@ -8,6 +8,7 @@ import os.log import UIKit import Combine +import MastodonCore import MastodonUI final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewModel.swift b/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewModel.swift index 1b119f3d7..5e931063a 100644 --- a/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewModel.swift +++ b/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewModel.swift @@ -11,6 +11,7 @@ import Combine import GameplayKit import CoreData import CoreDataStack +import MastodonCore import MastodonSDK final class DiscoveryHashtagsViewModel { diff --git a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewController.swift b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewController.swift index d2415145c..7f9efb0d9 100644 --- a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewController.swift +++ b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewController.swift @@ -8,6 +8,7 @@ import os.log import UIKit import Combine +import MastodonCore import MastodonUI final class DiscoveryNewsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel.swift b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel.swift index 2c4d89dc8..35af8f962 100644 --- a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel.swift +++ b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel.swift @@ -12,6 +12,7 @@ import GameplayKit import CoreData import CoreDataStack import MastodonSDK +import MastodonCore final class DiscoveryNewsViewModel { diff --git a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewController.swift b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewController.swift index 537ca1c58..96f20dbcc 100644 --- a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewController.swift +++ b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewController.swift @@ -8,6 +8,7 @@ import os.log import UIKit import Combine +import MastodonCore import MastodonUI final class DiscoveryPostsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+State.swift b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+State.swift index 0ff6cbb14..2e5ae9847 100644 --- a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+State.swift +++ b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+State.swift @@ -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 { diff --git a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel.swift b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel.swift index c001bb7b3..ad6639b16 100644 --- a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel.swift +++ b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel.swift @@ -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 { diff --git a/Mastodon/Scene/Discovery/View/DiscoveryIntroBannerView.swift b/Mastodon/Scene/Discovery/View/DiscoveryIntroBannerView.swift index afc2cb7db..492541062 100644 --- a/Mastodon/Scene/Discovery/View/DiscoveryIntroBannerView.swift +++ b/Mastodon/Scene/Discovery/View/DiscoveryIntroBannerView.swift @@ -9,6 +9,8 @@ import os.log import UIKit import Combine import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization public protocol DiscoveryIntroBannerViewDelegate: AnyObject { diff --git a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewController.swift b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewController.swift index 02738747c..b422481f2 100644 --- a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewController.swift +++ b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewController.swift @@ -12,6 +12,7 @@ import Combine import GameplayKit import CoreData import MastodonAsset +import MastodonCore import MastodonLocalization final class HashtagTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift index 6b75d3875..8e3b6f5d1 100644 --- a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift +++ b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift @@ -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) diff --git a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel.swift b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel.swift index f22987273..88eb8fcdd 100644 --- a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel.swift +++ b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel.swift @@ -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) } diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift index 4fae66d33..2a26c6cf8 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift @@ -13,6 +13,7 @@ import CoreData import CoreDataStack import FLEX import SwiftUI +import MastodonCore import MastodonUI import MastodonSDK import StoreKit diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift index 24b96f265..00433be44 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift @@ -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 { diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadLatestState.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadLatestState.swift index 3e46c2af4..234504e38 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadLatestState.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadLatestState.swift @@ -11,6 +11,7 @@ import Foundation import CoreData import CoreDataStack import GameplayKit +import MastodonCore extension HomeTimelineViewModel { class LoadLatestState: GKState { diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift index be7de3a5a..72131f366 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift @@ -15,6 +15,7 @@ import CoreDataStack import GameplayKit import AlamofireImage import DateToolsSwift +import MastodonCore final class HomeTimelineViewModel: NSObject { diff --git a/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleViewModel.swift b/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleViewModel.swift index 71b4dda8b..09e750ed1 100644 --- a/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleViewModel.swift +++ b/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleViewModel.swift @@ -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(), diff --git a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewModel.swift b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewModel.swift index 1a141c723..e82118f78 100644 --- a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewModel.swift +++ b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewModel.swift @@ -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 } diff --git a/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift b/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift index e1e367e37..c6552bcba 100644 --- a/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift +++ b/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift @@ -10,6 +10,8 @@ import UIKit import Combine import Pageboy import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization final class MediaPreviewViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/MediaPreview/MediaPreviewViewModel.swift b/Mastodon/Scene/MediaPreview/MediaPreviewViewModel.swift index 2fbc5f0ac..c43d24945 100644 --- a/Mastodon/Scene/MediaPreview/MediaPreviewViewModel.swift +++ b/Mastodon/Scene/MediaPreview/MediaPreviewViewModel.swift @@ -10,6 +10,7 @@ import Combine import CoreData import CoreDataStack import Pageboy +import MastodonCore final class MediaPreviewViewModel: NSObject { diff --git a/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewModel.swift b/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewModel.swift index 7485bdb44..97e5f955b 100644 --- a/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewModel.swift +++ b/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewModel.swift @@ -10,6 +10,7 @@ import UIKit import AVKit import Combine import AlamofireImage +import MastodonCore final class MediaPreviewVideoViewModel { diff --git a/Mastodon/Scene/Notification/Cell/NotificationTableViewCell.swift b/Mastodon/Scene/Notification/Cell/NotificationTableViewCell.swift index bbdb2afaa..d8949e391 100644 --- a/Mastodon/Scene/Notification/Cell/NotificationTableViewCell.swift +++ b/Mastodon/Scene/Notification/Cell/NotificationTableViewCell.swift @@ -8,6 +8,7 @@ import os.log import UIKit import Combine +import MastodonCore import MastodonUI final class NotificationTableViewCell: UITableViewCell { diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewController.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewController.swift index 300b9165d..c549d8f99 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewController.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import CoreDataStack +import MastodonCore import MastodonLocalization final class NotificationTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift index 5c86b9f38..5e4f7d7ca 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift @@ -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, diff --git a/Mastodon/Scene/Notification/NotificationViewController.swift b/Mastodon/Scene/Notification/NotificationViewController.swift index 0935c9967..474a778d8 100644 --- a/Mastodon/Scene/Notification/NotificationViewController.swift +++ b/Mastodon/Scene/Notification/NotificationViewController.swift @@ -12,6 +12,7 @@ import MastodonAsset import MastodonLocalization import Tabman import Pageboy +import MastodonCore final class NotificationViewController: TabmanViewController, NeedsDependency { diff --git a/Mastodon/Scene/Notification/NotificationViewModel.swift b/Mastodon/Scene/Notification/NotificationViewModel.swift index 60967c436..313b206c8 100644 --- a/Mastodon/Scene/Notification/NotificationViewModel.swift +++ b/Mastodon/Scene/Notification/NotificationViewModel.swift @@ -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 { diff --git a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift index 550dae7cc..a90da1e81 100644 --- a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift @@ -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 diff --git a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewModel.swift b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewModel.swift index 35480ba98..bbfbf706b 100644 --- a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewModel.swift +++ b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewModel.swift @@ -7,6 +7,7 @@ import Combine import Foundation +import MastodonCore import MastodonSDK final class MastodonConfirmEmailViewModel { diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift index d05b446ae..7845722e5 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift @@ -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) } diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift index b077cbbe1..50c1d7aac 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift @@ -13,6 +13,8 @@ import MastodonSDK import CoreDataStack import OrderedCollections import Tabman +import MastodonCore +import MastodonUI class MastodonPickServerViewModel: NSObject { diff --git a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerLoaderTableViewCell.swift b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerLoaderTableViewCell.swift index 5649fe579..3b0ebca8c 100644 --- a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerLoaderTableViewCell.swift +++ b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerLoaderTableViewCell.swift @@ -8,6 +8,8 @@ import UIKit import Combine import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization final class PickServerLoaderTableViewCell: TimelineLoaderTableViewCell { diff --git a/Mastodon/Scene/Onboarding/PickServer/View/PickServerCategoryView.swift b/Mastodon/Scene/Onboarding/PickServer/View/PickServerCategoryView.swift index 784559480..9d6cfc85f 100644 --- a/Mastodon/Scene/Onboarding/PickServer/View/PickServerCategoryView.swift +++ b/Mastodon/Scene/Onboarding/PickServer/View/PickServerCategoryView.swift @@ -8,6 +8,7 @@ import UIKit import MastodonSDK import MastodonAsset +import MastodonUI import MastodonLocalization class PickServerCategoryView: UIView { diff --git a/Mastodon/Scene/Onboarding/PickServer/View/PickServerEmptyStateView.swift b/Mastodon/Scene/Onboarding/PickServer/View/PickServerEmptyStateView.swift index a75570087..5f9b45c10 100644 --- a/Mastodon/Scene/Onboarding/PickServer/View/PickServerEmptyStateView.swift +++ b/Mastodon/Scene/Onboarding/PickServer/View/PickServerEmptyStateView.swift @@ -7,6 +7,8 @@ import UIKit import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization final class PickServerEmptyStateView: UIView { diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift index 89c98759f..9b10bd48e 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift @@ -14,6 +14,7 @@ import UIKit import SwiftUI import MastodonUI import MastodonAsset +import MastodonCore import MastodonLocalization final class MastodonRegisterViewController: UIViewController, NeedsDependency, OnboardingViewControllerAppearance { diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel.swift index e7fbd307d..a23d4b975 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewModel.swift @@ -10,6 +10,7 @@ import Foundation import MastodonSDK import UIKit import MastodonAsset +import MastodonCore import MastodonLocalization final class MastodonRegisterViewModel: ObservableObject { diff --git a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift index 1d3a29cb5..178d489be 100644 --- a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift @@ -9,6 +9,7 @@ import Combine import os.log import UIKit import WebKit +import MastodonCore final class MastodonResendEmailViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController+Debug.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController+Debug.swift index f6aaf5fba..7477d3bc5 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController+Debug.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController+Debug.swift @@ -6,6 +6,7 @@ // import UIKit +import MastodonCore #if DEBUG diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift index 2f13ad193..0d4e27d98 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift @@ -12,6 +12,7 @@ import MastodonSDK import SafariServices import MetaTextKit import MastodonAsset +import MastodonCore import MastodonLocalization final class MastodonServerRulesViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Onboarding/Share/AuthenticationViewModel.swift b/Mastodon/Scene/Onboarding/Share/AuthenticationViewModel.swift index eb3cf5721..920164bce 100644 --- a/Mastodon/Scene/Onboarding/Share/AuthenticationViewModel.swift +++ b/Mastodon/Scene/Onboarding/Share/AuthenticationViewModel.swift @@ -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, diff --git a/Mastodon/Scene/Onboarding/Share/MastodonAuthenticationController.swift b/Mastodon/Scene/Onboarding/Share/MastodonAuthenticationController.swift index 470cc79a5..e56c7f126 100644 --- a/Mastodon/Scene/Onboarding/Share/MastodonAuthenticationController.swift +++ b/Mastodon/Scene/Onboarding/Share/MastodonAuthenticationController.swift @@ -9,13 +9,14 @@ import os.log import UIKit import Combine import AuthenticationServices +import MastodonCore final class MastodonAuthenticationController { var disposeBag = Set() // input - var context: AppContext! + var context: AppContext let authenticateURL: URL var authenticationSession: ASWebAuthenticationSession? diff --git a/Mastodon/Scene/Onboarding/Welcome/View/WelcomeIllustrationView.swift b/Mastodon/Scene/Onboarding/Welcome/View/WelcomeIllustrationView.swift index 9a5d6c13e..0530539a2 100644 --- a/Mastodon/Scene/Onboarding/Welcome/View/WelcomeIllustrationView.swift +++ b/Mastodon/Scene/Onboarding/Welcome/View/WelcomeIllustrationView.swift @@ -7,6 +7,8 @@ import UIKit import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization final class WelcomeIllustrationView: UIView { diff --git a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift index c64dd469f..41e77987c 100644 --- a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift +++ b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import MastodonAsset +import MastodonCore import MastodonLocalization final class WelcomeViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewModel.swift b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewModel.swift index 74b13b1a8..d57a6ee5f 100644 --- a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewModel.swift +++ b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewModel.swift @@ -7,6 +7,7 @@ import Foundation import Combine +import MastodonCore final class WelcomeViewModel { diff --git a/Mastodon/Scene/Profile/About/Cell/ProfileFieldAddEntryCollectionViewCell.swift b/Mastodon/Scene/Profile/About/Cell/ProfileFieldAddEntryCollectionViewCell.swift index 9f22886e6..f630ec696 100644 --- a/Mastodon/Scene/Profile/About/Cell/ProfileFieldAddEntryCollectionViewCell.swift +++ b/Mastodon/Scene/Profile/About/Cell/ProfileFieldAddEntryCollectionViewCell.swift @@ -11,6 +11,7 @@ import Combine import MastodonAsset import MastodonLocalization import MetaTextKit +import MastodonCore import MastodonUI final class ProfileFieldAddEntryCollectionViewCell: UICollectionViewCell { diff --git a/Mastodon/Scene/Profile/About/Cell/ProfileFieldEditCollectionViewCell.swift b/Mastodon/Scene/Profile/About/Cell/ProfileFieldEditCollectionViewCell.swift index 43c47f1e1..4286bca03 100644 --- a/Mastodon/Scene/Profile/About/Cell/ProfileFieldEditCollectionViewCell.swift +++ b/Mastodon/Scene/Profile/About/Cell/ProfileFieldEditCollectionViewCell.swift @@ -10,6 +10,8 @@ import UIKit import Combine import MetaTextKit import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization protocol ProfileFieldEditCollectionViewCellDelegate: AnyObject { diff --git a/Mastodon/Scene/Profile/About/ProfileAboutViewController.swift b/Mastodon/Scene/Profile/About/ProfileAboutViewController.swift index 47385813d..eb1e6b39c 100644 --- a/Mastodon/Scene/Profile/About/ProfileAboutViewController.swift +++ b/Mastodon/Scene/Profile/About/ProfileAboutViewController.swift @@ -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) diff --git a/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift b/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift index ff1e261a2..68a3d0fea 100644 --- a/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift +++ b/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift @@ -11,6 +11,7 @@ import Combine import CoreDataStack import MastodonSDK import MastodonMeta +import MastodonCore import Kanna final class ProfileAboutViewModel { diff --git a/Mastodon/Scene/Profile/Bookmark/BookmarkViewController.swift b/Mastodon/Scene/Profile/Bookmark/BookmarkViewController.swift index 18e3c34fd..6d3d80737 100644 --- a/Mastodon/Scene/Profile/Bookmark/BookmarkViewController.swift +++ b/Mastodon/Scene/Profile/Bookmark/BookmarkViewController.swift @@ -11,6 +11,7 @@ import AVKit import Combine import GameplayKit import MastodonAsset +import MastodonCore import MastodonLocalization final class BookmarkViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+State.swift b/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+State.swift index eda823b50..085967ec7 100644 --- a/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+State.swift +++ b/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+State.swift @@ -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) diff --git a/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel.swift b/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel.swift index 8dc8d734a..df48b68e7 100644 --- a/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel.swift +++ b/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel.swift @@ -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) } diff --git a/Mastodon/Scene/Profile/CachedProfileViewModel.swift b/Mastodon/Scene/Profile/CachedProfileViewModel.swift index c33a905a7..f30fac4ea 100644 --- a/Mastodon/Scene/Profile/CachedProfileViewModel.swift +++ b/Mastodon/Scene/Profile/CachedProfileViewModel.swift @@ -7,6 +7,7 @@ import Foundation import CoreDataStack +import MastodonCore final class CachedProfileViewModel: ProfileViewModel { diff --git a/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewController.swift b/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewController.swift index 1e60f7a90..c82b8b3ad 100644 --- a/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewController.swift +++ b/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewController.swift @@ -8,6 +8,7 @@ import os.log import UIKit import Combine +import MastodonCore import MastodonLocalization final class FamiliarFollowersViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewModel.swift b/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewModel.swift index 544f8a062..065ede47c 100644 --- a/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewModel.swift +++ b/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewModel.swift @@ -7,6 +7,7 @@ import UIKit import Combine +import MastodonCore import MastodonSDK import CoreDataStack diff --git a/Mastodon/Scene/Profile/Favorite/FavoriteViewController.swift b/Mastodon/Scene/Profile/Favorite/FavoriteViewController.swift index 2ac1e2065..d3cdb2b8e 100644 --- a/Mastodon/Scene/Profile/Favorite/FavoriteViewController.swift +++ b/Mastodon/Scene/Profile/Favorite/FavoriteViewController.swift @@ -14,6 +14,7 @@ import AVKit import Combine import GameplayKit import MastodonAsset +import MastodonCore import MastodonLocalization final class FavoriteViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+State.swift b/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+State.swift index 6c539450c..84f2da1db 100644 --- a/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+State.swift +++ b/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+State.swift @@ -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) diff --git a/Mastodon/Scene/Profile/Favorite/FavoriteViewModel.swift b/Mastodon/Scene/Profile/Favorite/FavoriteViewModel.swift index 150c8f815..0570df2e9 100644 --- a/Mastodon/Scene/Profile/Favorite/FavoriteViewModel.swift +++ b/Mastodon/Scene/Profile/Favorite/FavoriteViewModel.swift @@ -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) } diff --git a/Mastodon/Scene/Profile/Follower/FollowerListViewController.swift b/Mastodon/Scene/Profile/Follower/FollowerListViewController.swift index decc1ee97..ff2977d45 100644 --- a/Mastodon/Scene/Profile/Follower/FollowerListViewController.swift +++ b/Mastodon/Scene/Profile/Follower/FollowerListViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import GameplayKit import Combine +import MastodonCore import MastodonLocalization final class FollowerListViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Profile/Follower/FollowerListViewModel+State.swift b/Mastodon/Scene/Profile/Follower/FollowerListViewModel+State.swift index a2958de3c..ffedeae46 100644 --- a/Mastodon/Scene/Profile/Follower/FollowerListViewModel+State.swift +++ b/Mastodon/Scene/Profile/Follower/FollowerListViewModel+State.swift @@ -9,6 +9,7 @@ import os.log import Foundation import GameplayKit import MastodonSDK +import MastodonCore extension FollowerListViewModel { class State: GKState, NamingState { diff --git a/Mastodon/Scene/Profile/Follower/FollowerListViewModel.swift b/Mastodon/Scene/Profile/Follower/FollowerListViewModel.swift index 80f26e608..af0f6b139 100644 --- a/Mastodon/Scene/Profile/Follower/FollowerListViewModel.swift +++ b/Mastodon/Scene/Profile/Follower/FollowerListViewModel.swift @@ -12,6 +12,7 @@ import CoreData import CoreDataStack import GameplayKit import MastodonSDK +import MastodonCore final class FollowerListViewModel { diff --git a/Mastodon/Scene/Profile/Following/FollowingListViewController.swift b/Mastodon/Scene/Profile/Following/FollowingListViewController.swift index c125b0214..18994d26b 100644 --- a/Mastodon/Scene/Profile/Following/FollowingListViewController.swift +++ b/Mastodon/Scene/Profile/Following/FollowingListViewController.swift @@ -10,6 +10,7 @@ import UIKit import GameplayKit import Combine import MastodonLocalization +import MastodonCore final class FollowingListViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Profile/Following/FollowingListViewModel.swift b/Mastodon/Scene/Profile/Following/FollowingListViewModel.swift index f1e07f9d8..a809e14d0 100644 --- a/Mastodon/Scene/Profile/Following/FollowingListViewModel.swift +++ b/Mastodon/Scene/Profile/Following/FollowingListViewModel.swift @@ -7,10 +7,10 @@ import Foundation import Combine -import Combine import CoreData import CoreDataStack import GameplayKit +import MastodonCore import MastodonSDK final class FollowingListViewModel { diff --git a/Mastodon/Scene/Profile/Header/ProfileHeaderViewController.swift b/Mastodon/Scene/Profile/Header/ProfileHeaderViewController.swift index f35ac6aa4..5c7ce808a 100644 --- a/Mastodon/Scene/Profile/Header/ProfileHeaderViewController.swift +++ b/Mastodon/Scene/Profile/Header/ProfileHeaderViewController.swift @@ -15,6 +15,8 @@ import CropViewController import MastodonMeta import MetaTextKit import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization import TabBarPager diff --git a/Mastodon/Scene/Profile/Header/ProfileHeaderViewModel.swift b/Mastodon/Scene/Profile/Header/ProfileHeaderViewModel.swift index e28b250cf..15a13de84 100644 --- a/Mastodon/Scene/Profile/Header/ProfileHeaderViewModel.swift +++ b/Mastodon/Scene/Profile/Header/ProfileHeaderViewModel.swift @@ -12,6 +12,7 @@ import CoreDataStack import Kanna import MastodonSDK import MastodonMeta +import MastodonCore import MastodonUI final class ProfileHeaderViewModel { diff --git a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+ViewModel.swift b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+ViewModel.swift index b57bf95a5..c51ccfab3 100644 --- a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+ViewModel.swift +++ b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+ViewModel.swift @@ -11,6 +11,7 @@ import Combine import CoreDataStack import MetaTextKit import MastodonMeta +import MastodonCore import MastodonUI import MastodonAsset import MastodonLocalization diff --git a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift index e68fd9c7b..9e6e163aa 100644 --- a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift +++ b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift @@ -11,6 +11,7 @@ import Combine import FLAnimatedImage import MetaTextKit import MastodonAsset +import MastodonCore import MastodonLocalization import MastodonUI diff --git a/Mastodon/Scene/Profile/MeProfileViewModel.swift b/Mastodon/Scene/Profile/MeProfileViewModel.swift index cee6d5e47..d6a30fd04 100644 --- a/Mastodon/Scene/Profile/MeProfileViewModel.swift +++ b/Mastodon/Scene/Profile/MeProfileViewModel.swift @@ -10,6 +10,7 @@ import UIKit import Combine import CoreData import CoreDataStack +import MastodonCore import MastodonSDK final class MeProfileViewModel: ProfileViewModel { diff --git a/Mastodon/Scene/Profile/Paging/ProfilePagingViewController.swift b/Mastodon/Scene/Profile/Paging/ProfilePagingViewController.swift index cc798b6cf..db92617b7 100644 --- a/Mastodon/Scene/Profile/Paging/ProfilePagingViewController.swift +++ b/Mastodon/Scene/Profile/Paging/ProfilePagingViewController.swift @@ -11,6 +11,7 @@ import Combine import XLPagerTabStrip import TabBarPager import MastodonAsset +import MastodonCore import MastodonUI protocol ProfilePagingViewControllerDelegate: AnyObject { diff --git a/Mastodon/Scene/Profile/ProfileViewController.swift b/Mastodon/Scene/Profile/ProfileViewController.swift index 3e437bb7c..3393a2edf 100644 --- a/Mastodon/Scene/Profile/ProfileViewController.swift +++ b/Mastodon/Scene/Profile/ProfileViewController.swift @@ -11,8 +11,9 @@ import Combine import MastodonMeta import MetaTextKit import MastodonAsset -import MastodonLocalization +import MastodonCore import MastodonUI +import MastodonLocalization import CoreDataStack import TabBarPager import XLPagerTabStrip diff --git a/Mastodon/Scene/Profile/ProfileViewModel.swift b/Mastodon/Scene/Profile/ProfileViewModel.swift index 9d64df6ee..3893c80a1 100644 --- a/Mastodon/Scene/Profile/ProfileViewModel.swift +++ b/Mastodon/Scene/Profile/ProfileViewModel.swift @@ -12,6 +12,7 @@ import CoreDataStack import MastodonSDK import MastodonMeta import MastodonAsset +import MastodonCore import MastodonLocalization import MastodonUI diff --git a/Mastodon/Scene/Profile/RemoteProfileViewModel.swift b/Mastodon/Scene/Profile/RemoteProfileViewModel.swift index bb565c3e0..cb1f0e4c3 100644 --- a/Mastodon/Scene/Profile/RemoteProfileViewModel.swift +++ b/Mastodon/Scene/Profile/RemoteProfileViewModel.swift @@ -10,6 +10,7 @@ import Foundation import Combine import CoreDataStack import MastodonSDK +import MastodonCore final class RemoteProfileViewModel: ProfileViewModel { diff --git a/Mastodon/Scene/Profile/Timeline/UserTimelineViewController.swift b/Mastodon/Scene/Profile/Timeline/UserTimelineViewController.swift index fb42b81b8..beed25086 100644 --- a/Mastodon/Scene/Profile/Timeline/UserTimelineViewController.swift +++ b/Mastodon/Scene/Profile/Timeline/UserTimelineViewController.swift @@ -13,6 +13,7 @@ import CoreDataStack import GameplayKit import TabBarPager import XLPagerTabStrip +import MastodonCore final class UserTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+State.swift b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+State.swift index ca798fa0b..17409a2bc 100644 --- a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+State.swift +++ b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+State.swift @@ -8,6 +8,7 @@ import os.log import Foundation import GameplayKit +import MastodonCore import MastodonSDK extension UserTimelineViewModel { @@ -72,7 +73,7 @@ extension UserTimelineViewModel.State { guard let viewModel = viewModel, let stateMachine = stateMachine else { return } // reset - viewModel.statusFetchedResultsController.statusIDs.value = [] + viewModel.statusFetchedResultsController.statusIDs = [] stateMachine.enter(Loading.self) } @@ -130,7 +131,7 @@ extension UserTimelineViewModel.State { super.didEnter(from: previousState) guard let viewModel = viewModel, let stateMachine = stateMachine else { return } - let maxID = viewModel.statusFetchedResultsController.statusIDs.value.last + let maxID = viewModel.statusFetchedResultsController.statusIDs.last guard let userID = viewModel.userIdentifier?.userID, !userID.isEmpty else { stateMachine.enter(Fail.self) @@ -157,7 +158,7 @@ extension UserTimelineViewModel.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 UserTimelineViewModel.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 timeline fail: \(error.localizedDescription)") diff --git a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift index 2d350fb0b..bd28d2c79 100644 --- a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift +++ b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift @@ -12,6 +12,7 @@ import Combine import CoreData import CoreDataStack import MastodonSDK +import MastodonCore final class UserTimelineViewModel { @@ -64,7 +65,7 @@ final class UserTimelineViewModel { context.authenticationService.activeMastodonAuthenticationBox .map { $0?.domain } - .assign(to: \.value, on: statusFetchedResultsController.domain) + .assign(to: \.domain, on: statusFetchedResultsController) .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Profile/UserLIst/FavoritedBy/FavoritedByViewController.swift b/Mastodon/Scene/Profile/UserLIst/FavoritedBy/FavoritedByViewController.swift index 0e2bc64ed..5d9a20610 100644 --- a/Mastodon/Scene/Profile/UserLIst/FavoritedBy/FavoritedByViewController.swift +++ b/Mastodon/Scene/Profile/UserLIst/FavoritedBy/FavoritedByViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import GameplayKit import Combine +import MastodonCore import MastodonLocalization final class FavoritedByViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Profile/UserLIst/RebloggedBy/RebloggedByViewController.swift b/Mastodon/Scene/Profile/UserLIst/RebloggedBy/RebloggedByViewController.swift index 78988bb41..3f3e239a1 100644 --- a/Mastodon/Scene/Profile/UserLIst/RebloggedBy/RebloggedByViewController.swift +++ b/Mastodon/Scene/Profile/UserLIst/RebloggedBy/RebloggedByViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import GameplayKit import Combine +import MastodonCore import MastodonLocalization final class RebloggedByViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Profile/UserLIst/UserListViewModel+State.swift b/Mastodon/Scene/Profile/UserLIst/UserListViewModel+State.swift index 90b928235..9098c7f81 100644 --- a/Mastodon/Scene/Profile/UserLIst/UserListViewModel+State.swift +++ b/Mastodon/Scene/Profile/UserLIst/UserListViewModel+State.swift @@ -205,7 +205,7 @@ extension UserListViewModel.State { guard let viewModel = viewModel else { return } // trigger reload - viewModel.userFetchedResultsController.records = viewModel.userFetchedResultsController.records + viewModel.userFetchedResultsController.userIDs = viewModel.userFetchedResultsController.userIDs } } } diff --git a/Mastodon/Scene/Profile/UserLIst/UserListViewModel.swift b/Mastodon/Scene/Profile/UserLIst/UserListViewModel.swift index 472c497f6..f8d9a3bd6 100644 --- a/Mastodon/Scene/Profile/UserLIst/UserListViewModel.swift +++ b/Mastodon/Scene/Profile/UserLIst/UserListViewModel.swift @@ -10,6 +10,7 @@ import UIKit import Combine import CoreDataStack import GameplayKit +import MastodonCore final class UserListViewModel { @@ -36,7 +37,7 @@ final class UserListViewModel { return stateMachine }() - init( + public init( context: AppContext, kind: Kind ) { diff --git a/Mastodon/Scene/Report/Report/ReportViewController.swift b/Mastodon/Scene/Report/Report/ReportViewController.swift index 854ea96b6..57107be47 100644 --- a/Mastodon/Scene/Report/Report/ReportViewController.swift +++ b/Mastodon/Scene/Report/Report/ReportViewController.swift @@ -10,6 +10,7 @@ import UIKit import Combine import CoreDataStack import MastodonAsset +import MastodonCore import MastodonLocalization class ReportViewController: UIViewController, NeedsDependency, ReportViewControllerAppearance { diff --git a/Mastodon/Scene/Report/Report/ReportViewModel.swift b/Mastodon/Scene/Report/Report/ReportViewModel.swift index 81ba20125..4e59cb440 100644 --- a/Mastodon/Scene/Report/Report/ReportViewModel.swift +++ b/Mastodon/Scene/Report/Report/ReportViewModel.swift @@ -14,6 +14,7 @@ import MastodonSDK import OrderedCollections import os.log import UIKit +import MastodonCore import MastodonLocalization class ReportViewModel { diff --git a/Mastodon/Scene/Report/ReportReason/ReportReasonView.swift b/Mastodon/Scene/Report/ReportReason/ReportReasonView.swift index 8ee04311e..763024fa8 100644 --- a/Mastodon/Scene/Report/ReportReason/ReportReasonView.swift +++ b/Mastodon/Scene/Report/ReportReason/ReportReasonView.swift @@ -10,6 +10,7 @@ import SwiftUI import MastodonLocalization import MastodonSDK import MastodonAsset +import MastodonCore struct ReportReasonView: View { diff --git a/Mastodon/Scene/Report/ReportReason/ReportReasonViewController.swift b/Mastodon/Scene/Report/ReportReason/ReportReasonViewController.swift index ac5d9e797..2e8e53d18 100644 --- a/Mastodon/Scene/Report/ReportReason/ReportReasonViewController.swift +++ b/Mastodon/Scene/Report/ReportReason/ReportReasonViewController.swift @@ -11,6 +11,7 @@ import SwiftUI import Combine import MastodonUI import MastodonAsset +import MastodonCore import MastodonLocalization protocol ReportReasonViewControllerDelegate: AnyObject { diff --git a/Mastodon/Scene/Report/ReportReason/ReportReasonViewModel.swift b/Mastodon/Scene/Report/ReportReason/ReportReasonViewModel.swift index 91715cba8..0407307b7 100644 --- a/Mastodon/Scene/Report/ReportReason/ReportReasonViewModel.swift +++ b/Mastodon/Scene/Report/ReportReason/ReportReasonViewModel.swift @@ -8,6 +8,7 @@ import UIKit import SwiftUI import MastodonAsset +import MastodonCore import MastodonSDK import MastodonLocalization diff --git a/Mastodon/Scene/Report/ReportResult/ReportResultView.swift b/Mastodon/Scene/Report/ReportResult/ReportResultView.swift index b3bbe7938..b1ad76415 100644 --- a/Mastodon/Scene/Report/ReportResult/ReportResultView.swift +++ b/Mastodon/Scene/Report/ReportResult/ReportResultView.swift @@ -10,6 +10,8 @@ import SwiftUI import MastodonSDK import MastodonUI import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization import CoreDataStack diff --git a/Mastodon/Scene/Report/ReportResult/ReportResultViewController.swift b/Mastodon/Scene/Report/ReportResult/ReportResultViewController.swift index 957760f38..1a5aabb67 100644 --- a/Mastodon/Scene/Report/ReportResult/ReportResultViewController.swift +++ b/Mastodon/Scene/Report/ReportResult/ReportResultViewController.swift @@ -10,6 +10,7 @@ import UIKit import SwiftUI import Combine import MastodonAsset +import MastodonCore import MastodonLocalization final class ReportResultViewController: UIViewController, NeedsDependency, ReportViewControllerAppearance { diff --git a/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift b/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift index 67d7475dd..8508d1596 100644 --- a/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift +++ b/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift @@ -13,6 +13,7 @@ import MastodonSDK import os.log import UIKit import MastodonAsset +import MastodonCore import MastodonUI import MastodonLocalization diff --git a/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewController.swift b/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewController.swift index 73a47496c..3f1cdf331 100644 --- a/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewController.swift +++ b/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewController.swift @@ -9,8 +9,9 @@ import os.log import UIKit import SwiftUI import Combine -import MastodonUI import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization protocol ReportServerRulesViewControllerDelegate: AnyObject { diff --git a/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewModel.swift b/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewModel.swift index 50d2bf2d3..4ea190a74 100644 --- a/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewModel.swift +++ b/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewModel.swift @@ -8,6 +8,7 @@ import UIKit import SwiftUI import MastodonAsset +import MastodonCore import MastodonSDK import MastodonLocalization diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift index d3844a3be..7ed704434 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift @@ -10,6 +10,7 @@ import UIKit import Combine import CoreDataStack import MastodonAsset +import MastodonCore import MastodonLocalization protocol ReportStatusViewControllerDelegate: AnyObject { diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift index c653fc4ad..6e9d48af0 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift @@ -81,7 +81,7 @@ extension ReportStatusViewModel.State { return } - let maxID = viewModel.statusFetchedResultsController.statusIDs.value.last + let maxID = viewModel.statusFetchedResultsController.statusIDs.last Task { let managedObjectContext = viewModel.context.managedObjectContext @@ -106,7 +106,7 @@ extension ReportStatusViewModel.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) @@ -118,7 +118,7 @@ extension ReportStatusViewModel.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 timeline fail: \(error.localizedDescription)") diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel.swift index 239960637..b539909da 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel.swift @@ -14,6 +14,7 @@ import MastodonSDK import OrderedCollections import os.log import UIKit +import MastodonCore class ReportStatusViewModel { @@ -68,7 +69,7 @@ class ReportStatusViewModel { context.authenticationService.activeMastodonAuthenticationBox .map { $0?.domain } - .assign(to: \.value, on: statusFetchedResultsController.domain) + .assign(to: \.domain, on: statusFetchedResultsController) .store(in: &disposeBag) $selectStatuses diff --git a/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift b/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift index fd7783170..8e44479d3 100644 --- a/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift +++ b/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import MastodonAsset +import MastodonCore import MastodonLocalization protocol ReportSupplementaryViewControllerDelegate: AnyObject { diff --git a/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewModel.swift b/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewModel.swift index c07ee1f54..8ddc2d91a 100644 --- a/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewModel.swift +++ b/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewModel.swift @@ -8,6 +8,7 @@ import UIKit import Combine import CoreDataStack +import MastodonCore import MastodonSDK class ReportSupplementaryViewModel { diff --git a/Mastodon/Scene/Root/ContentSplitViewController.swift b/Mastodon/Scene/Root/ContentSplitViewController.swift index 0058f5f6e..1222e4c58 100644 --- a/Mastodon/Scene/Root/ContentSplitViewController.swift +++ b/Mastodon/Scene/Root/ContentSplitViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import CoreDataStack +import MastodonCore protocol ContentSplitViewControllerDelegate: AnyObject { func contentSplitViewController(_ contentSplitViewController: ContentSplitViewController, sidebarViewController: SidebarViewController, didSelectTab tab: MainTabBarController.Tab) diff --git a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift index 8970e2f29..39cc23b4b 100644 --- a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift +++ b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift @@ -10,6 +10,7 @@ import UIKit import Combine import SafariServices import MastodonAsset +import MastodonCore import MastodonLocalization import MastodonUI @@ -17,7 +18,7 @@ class MainTabBarController: UITabBarController { let logger = Logger(subsystem: "MainTabBarController", category: "UI") - var disposeBag = Set() + public var disposeBag = Set() weak var context: AppContext! weak var coordinator: SceneCoordinator! @@ -220,30 +221,31 @@ extension MainTabBarController { .store(in: &disposeBag) // handle post failure - 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) + // 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 diff --git a/Mastodon/Scene/Root/Sidebar/SecondaryPlaceholderViewController.swift b/Mastodon/Scene/Root/Sidebar/SecondaryPlaceholderViewController.swift index a381844df..6937f1a3f 100644 --- a/Mastodon/Scene/Root/Sidebar/SecondaryPlaceholderViewController.swift +++ b/Mastodon/Scene/Root/Sidebar/SecondaryPlaceholderViewController.swift @@ -7,6 +7,7 @@ import UIKit import Combine +import MastodonCore final class SecondaryPlaceholderViewController: UIViewController { var disposeBag = Set() diff --git a/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift b/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift index c7cf3d49d..86d549373 100644 --- a/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift +++ b/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import CoreDataStack +import MastodonCore import MastodonUI protocol SidebarViewControllerDelegate: AnyObject { diff --git a/Mastodon/Scene/Root/Sidebar/SidebarViewModel.swift b/Mastodon/Scene/Root/Sidebar/SidebarViewModel.swift index a6698d6c2..967d10b09 100644 --- a/Mastodon/Scene/Root/Sidebar/SidebarViewModel.swift +++ b/Mastodon/Scene/Root/Sidebar/SidebarViewModel.swift @@ -12,6 +12,7 @@ import CoreDataStack import Meta import MastodonMeta import MastodonAsset +import MastodonCore import MastodonLocalization final class SidebarViewModel { diff --git a/Mastodon/Scene/Root/Sidebar/View/SidebarListContentView.swift b/Mastodon/Scene/Root/Sidebar/View/SidebarListContentView.swift index 794563eaf..515988405 100644 --- a/Mastodon/Scene/Root/Sidebar/View/SidebarListContentView.swift +++ b/Mastodon/Scene/Root/Sidebar/View/SidebarListContentView.swift @@ -9,6 +9,8 @@ import os.log import UIKit import MetaTextKit import FLAnimatedImage +import MastodonCore +import MastodonUI final class SidebarListContentView: UIView, UIContentView { diff --git a/Mastodon/Scene/Search/Search/Cell/TrendCollectionViewCell.swift b/Mastodon/Scene/Search/Search/Cell/TrendCollectionViewCell.swift index 379cba70d..30f618625 100644 --- a/Mastodon/Scene/Search/Search/Cell/TrendCollectionViewCell.swift +++ b/Mastodon/Scene/Search/Search/Cell/TrendCollectionViewCell.swift @@ -9,6 +9,7 @@ import UIKit import Combine import MetaTextKit import MastodonAsset +import MastodonCore import MastodonUI final class TrendCollectionViewCell: UICollectionViewCell { diff --git a/Mastodon/Scene/Search/Search/SearchViewController.swift b/Mastodon/Scene/Search/Search/SearchViewController.swift index 982844f51..947c1593d 100644 --- a/Mastodon/Scene/Search/Search/SearchViewController.swift +++ b/Mastodon/Scene/Search/Search/SearchViewController.swift @@ -11,6 +11,7 @@ import GameplayKit import MastodonSDK import UIKit import MastodonAsset +import MastodonCore import MastodonLocalization final class HeightFixedSearchBar: UISearchBar { diff --git a/Mastodon/Scene/Search/Search/SearchViewModel.swift b/Mastodon/Scene/Search/Search/SearchViewModel.swift index b47bc2e88..b0eccd49b 100644 --- a/Mastodon/Scene/Search/Search/SearchViewModel.swift +++ b/Mastodon/Scene/Search/Search/SearchViewModel.swift @@ -10,6 +10,7 @@ import CoreData import CoreDataStack import Foundation import GameplayKit +import MastodonCore import MastodonSDK import OSLog import UIKit diff --git a/Mastodon/Scene/Search/Search/View/SearchRecommendCollectionHeader.swift b/Mastodon/Scene/Search/Search/View/SearchRecommendCollectionHeader.swift index 19d2e9d4b..1d4788ac8 100644 --- a/Mastodon/Scene/Search/Search/View/SearchRecommendCollectionHeader.swift +++ b/Mastodon/Scene/Search/Search/View/SearchRecommendCollectionHeader.swift @@ -8,6 +8,8 @@ import Foundation import UIKit import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization class SearchRecommendCollectionHeader: UIView { diff --git a/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift b/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift index 701dc4fa6..0b0a0d003 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift @@ -10,6 +10,7 @@ import UIKit import Combine import Pageboy import MastodonAsset +import MastodonCore import MastodonLocalization final class CustomSearchController: UISearchController { @@ -165,7 +166,7 @@ extension SearchDetailViewController { case .hashtags: viewController.viewModel.hashtags = allSearchScopeViewController.viewModel.hashtags case .posts: - viewController.viewModel.statusFetchedResultsController.statusIDs.value = allSearchScopeViewController.viewModel.statusFetchedResultsController.statusIDs.value + viewController.viewModel.statusFetchedResultsController.statusIDs = allSearchScopeViewController.viewModel.statusFetchedResultsController.statusIDs } } } diff --git a/Mastodon/Scene/Search/SearchDetail/SearchHistory/Cell/SearchHistoryUserCollectionViewCell.swift b/Mastodon/Scene/Search/SearchDetail/SearchHistory/Cell/SearchHistoryUserCollectionViewCell.swift index 71663dd66..49bbfa3af 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchHistory/Cell/SearchHistoryUserCollectionViewCell.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchHistory/Cell/SearchHistoryUserCollectionViewCell.swift @@ -7,6 +7,7 @@ import UIKit import Combine +import MastodonCore import MastodonUI final class SearchHistoryUserCollectionViewCell: UICollectionViewCell { diff --git a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewController.swift b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewController.swift index 0dbb89cf4..7d5f6c60e 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewController.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewController.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import CoreDataStack +import MastodonCore final class SearchHistoryViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel.swift b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel.swift index c7a135964..b7987413f 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel.swift @@ -9,6 +9,7 @@ import UIKit import Combine import CoreDataStack import CommonOSLog +import MastodonCore final class SearchHistoryViewModel { diff --git a/Mastodon/Scene/Search/SearchDetail/SearchHistory/View/SearchHistoryTableHeaderView.swift b/Mastodon/Scene/Search/SearchDetail/SearchHistory/View/SearchHistoryTableHeaderView.swift index 5de09f802..13bf9993f 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchHistory/View/SearchHistoryTableHeaderView.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchHistory/View/SearchHistoryTableHeaderView.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import MastodonAsset +import MastodonCore import MastodonLocalization import MastodonUI diff --git a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewController.swift b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewController.swift index f3d989b41..87c981071 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewController.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewController.swift @@ -8,6 +8,8 @@ import os.log import UIKit import Combine +import MastodonCore +import MastodonUI final class SearchResultViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel+State.swift b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel+State.swift index b763547bf..cd1579747 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel+State.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel+State.swift @@ -9,6 +9,7 @@ import os.log import Foundation import GameplayKit import MastodonSDK +import MastodonCore extension SearchResultViewModel { class State: GKState, NamingState { @@ -156,7 +157,7 @@ extension SearchResultViewModel.State { // reset data source when the search is refresh if offset == nil { viewModel.userFetchedResultsController.userIDs = [] - viewModel.statusFetchedResultsController.statusIDs.value = [] + viewModel.statusFetchedResultsController.statusIDs = [] viewModel.hashtags = [] } diff --git a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel.swift b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel.swift index ad012518d..a7b97de6b 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewModel.swift @@ -12,6 +12,7 @@ import CoreDataStack import GameplayKit import CommonOSLog import MastodonSDK +import MastodonCore final class SearchResultViewModel { @@ -68,7 +69,7 @@ final class SearchResultViewModel { context.authenticationService.activeMastodonAuthenticationBox .map { $0?.domain } - .assign(to: \.value, on: statusFetchedResultsController.domain) + .assign(to: \.domain, on: statusFetchedResultsController) .store(in: &disposeBag) // Publishers.CombineLatest( diff --git a/Mastodon/Scene/Settings/SettingsViewController.swift b/Mastodon/Scene/Settings/SettingsViewController.swift index 8455ac7d9..e17db3e11 100644 --- a/Mastodon/Scene/Settings/SettingsViewController.swift +++ b/Mastodon/Scene/Settings/SettingsViewController.swift @@ -10,11 +10,13 @@ import UIKit import Combine import CoreData import CoreDataStack -import MastodonSDK -import MetaTextKit -import MastodonMeta import AuthenticationServices +import MetaTextKit +import MastodonSDK +import MastodonMeta import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization class SettingsViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/Settings/SettingsViewModel.swift b/Mastodon/Scene/Settings/SettingsViewModel.swift index 1eb9a4094..ea2275429 100644 --- a/Mastodon/Scene/Settings/SettingsViewModel.swift +++ b/Mastodon/Scene/Settings/SettingsViewModel.swift @@ -13,6 +13,7 @@ import MastodonSDK import UIKit import os.log import AuthenticationServices +import MastodonCore class SettingsViewModel { diff --git a/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift b/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift index 8300f865a..ca46193b6 100644 --- a/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift +++ b/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift @@ -10,6 +10,7 @@ import Foundation import Combine import UIKit import MastodonAsset +import MastodonCore import MastodonLocalization import MastodonUI diff --git a/Mastodon/Scene/Share/View/Content/DoubleTitleLabelNavigationBarTitleView.swift b/Mastodon/Scene/Share/View/Content/DoubleTitleLabelNavigationBarTitleView.swift index b6a36f0e0..6734b7b77 100644 --- a/Mastodon/Scene/Share/View/Content/DoubleTitleLabelNavigationBarTitleView.swift +++ b/Mastodon/Scene/Share/View/Content/DoubleTitleLabelNavigationBarTitleView.swift @@ -9,6 +9,8 @@ import UIKit import Meta import MetaTextKit import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization final class DoubleTitleLabelNavigationBarTitleView: UIView { diff --git a/Mastodon/Scene/Share/View/Content/NotificationView+Configuration.swift b/Mastodon/Scene/Share/View/Content/NotificationView+Configuration.swift index 45652321f..ed5e68dc7 100644 --- a/Mastodon/Scene/Share/View/Content/NotificationView+Configuration.swift +++ b/Mastodon/Scene/Share/View/Content/NotificationView+Configuration.swift @@ -13,6 +13,7 @@ import MetaTextKit import MastodonMeta import Meta import MastodonAsset +import MastodonCore import MastodonLocalization import class CoreDataStack.Notification diff --git a/Mastodon/Scene/Share/View/Content/PollOptionView+Configuration.swift b/Mastodon/Scene/Share/View/Content/PollOptionView+Configuration.swift index 99b0f3b6b..7d1baa188 100644 --- a/Mastodon/Scene/Share/View/Content/PollOptionView+Configuration.swift +++ b/Mastodon/Scene/Share/View/Content/PollOptionView+Configuration.swift @@ -9,6 +9,7 @@ import UIKit import Combine import CoreDataStack import MetaTextKit +import MastodonCore import MastodonUI extension PollOptionView { diff --git a/Mastodon/Scene/Share/View/Content/StatusView+Configuration.swift b/Mastodon/Scene/Share/View/Content/StatusView+Configuration.swift index 1bdff4d80..78ca7b88d 100644 --- a/Mastodon/Scene/Share/View/Content/StatusView+Configuration.swift +++ b/Mastodon/Scene/Share/View/Content/StatusView+Configuration.swift @@ -10,6 +10,8 @@ import Combine import MastodonUI import CoreDataStack import MastodonSDK +import MastodonCore +import MastodonUI import MastodonLocalization import MastodonMeta import Meta diff --git a/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift b/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift index 0953feecd..8d72d953e 100644 --- a/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift +++ b/Mastodon/Scene/Share/View/Content/ThreadMetaView.swift @@ -7,6 +7,7 @@ import UIKit import MastodonUI +import MastodonCore final class ThreadMetaView: UIView { diff --git a/Mastodon/Scene/Share/View/Content/UserView+Configuration.swift b/Mastodon/Scene/Share/View/Content/UserView+Configuration.swift index 3d22eedae..2a2130406 100644 --- a/Mastodon/Scene/Share/View/Content/UserView+Configuration.swift +++ b/Mastodon/Scene/Share/View/Content/UserView+Configuration.swift @@ -11,6 +11,7 @@ import MastodonUI import CoreDataStack import MastodonLocalization import MastodonMeta +import MastodonCore import Meta extension UserView { diff --git a/Mastodon/Scene/Share/View/Decoration/SawToothView.swift b/Mastodon/Scene/Share/View/Decoration/SawToothView.swift index e344b62ef..f154a48e6 100644 --- a/Mastodon/Scene/Share/View/Decoration/SawToothView.swift +++ b/Mastodon/Scene/Share/View/Decoration/SawToothView.swift @@ -8,6 +8,7 @@ import Foundation import UIKit import Combine +import MastodonCore final class SawToothView: UIView { static let widthUint = 8 diff --git a/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift index 065a41281..d3abb9e79 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift @@ -9,6 +9,8 @@ import os.log import UIKit import Combine import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization protocol ThreadReplyLoaderTableViewCellDelegate: AnyObject { diff --git a/Mastodon/Scene/Share/View/TableviewCell/TimelineBottomLoaderTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/TimelineBottomLoaderTableViewCell.swift index 70f366bce..f6c4596ab 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/TimelineBottomLoaderTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/TimelineBottomLoaderTableViewCell.swift @@ -7,6 +7,8 @@ import UIKit import Combine +import MastodonCore +import MastodonUI final class TimelineBottomLoaderTableViewCell: TimelineLoaderTableViewCell { diff --git a/Mastodon/Scene/Share/View/TableviewCell/TimelineLoaderTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/TimelineLoaderTableViewCell.swift index 29344eb28..f9d58da6a 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/TimelineLoaderTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/TimelineLoaderTableViewCell.swift @@ -8,6 +8,8 @@ import UIKit import Combine import MastodonAsset +import MastodonCore +import MastodonUI import MastodonLocalization class TimelineLoaderTableViewCell: UITableViewCell { diff --git a/Mastodon/Scene/Share/View/TableviewCell/TimelineMiddleLoaderTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/TimelineMiddleLoaderTableViewCell.swift index a12920c59..462a22d48 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/TimelineMiddleLoaderTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/TimelineMiddleLoaderTableViewCell.swift @@ -9,6 +9,7 @@ import Combine import CoreData import os.log import UIKit +import MastodonUI protocol TimelineMiddleLoaderTableViewCellDelegate: AnyObject { func timelineMiddleLoaderTableViewCell(_ cell: TimelineMiddleLoaderTableViewCell, loadMoreButtonDidPressed button: UIButton) diff --git a/Mastodon/Scene/Share/View/TableviewCell/TimelineTopLoaderTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/TimelineTopLoaderTableViewCell.swift index 4accee1de..20c117eab 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/TimelineTopLoaderTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/TimelineTopLoaderTableViewCell.swift @@ -7,6 +7,9 @@ import UIKit import Combine +import MastodonCore +import MastodonUI + final class TimelineTopLoaderTableViewCell: TimelineLoaderTableViewCell { override func _init() { diff --git a/Mastodon/Scene/Share/Webview/WebViewController.swift b/Mastodon/Scene/Share/Webview/WebViewController.swift index bde6e8936..cb690de93 100644 --- a/Mastodon/Scene/Share/Webview/WebViewController.swift +++ b/Mastodon/Scene/Share/Webview/WebViewController.swift @@ -10,6 +10,7 @@ import Combine import os.log import UIKit import WebKit +import MastodonCore final class WebViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewController.swift b/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewController.swift index 07c27a721..3dfffa540 100644 --- a/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewController.swift +++ b/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewController.swift @@ -12,6 +12,7 @@ import Foundation import OSLog import UIKit import MastodonAsset +import MastodonCore import MastodonLocalization class SuggestionAccountViewController: UIViewController, NeedsDependency { diff --git a/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewModel.swift b/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewModel.swift index 0263b61ec..70676bf0f 100644 --- a/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewModel.swift +++ b/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewModel.swift @@ -10,6 +10,7 @@ import CoreData import CoreDataStack import GameplayKit import MastodonSDK +import MastodonCore import os.log import UIKit diff --git a/Mastodon/Scene/SuggestionAccount/TableViewCell/SuggestionAccountTableViewCell+ViewModel.swift b/Mastodon/Scene/SuggestionAccount/TableViewCell/SuggestionAccountTableViewCell+ViewModel.swift index 722f76180..6d93be1a9 100644 --- a/Mastodon/Scene/SuggestionAccount/TableViewCell/SuggestionAccountTableViewCell+ViewModel.swift +++ b/Mastodon/Scene/SuggestionAccount/TableViewCell/SuggestionAccountTableViewCell+ViewModel.swift @@ -9,6 +9,8 @@ import UIKit import Combine import CoreDataStack import MastodonAsset +import MastodonCore +import MastodonUI import MastodonMeta import Meta diff --git a/Mastodon/Scene/Thread/CachedThreadViewModel.swift b/Mastodon/Scene/Thread/CachedThreadViewModel.swift index c4ff3b985..0a39db590 100644 --- a/Mastodon/Scene/Thread/CachedThreadViewModel.swift +++ b/Mastodon/Scene/Thread/CachedThreadViewModel.swift @@ -7,6 +7,7 @@ import Foundation import CoreDataStack +import MastodonCore final class CachedThreadViewModel: ThreadViewModel { init(context: AppContext, status: Status) { diff --git a/Mastodon/Scene/Thread/MastodonStatusThreadViewModel.swift b/Mastodon/Scene/Thread/MastodonStatusThreadViewModel.swift index c158270cb..97998fd73 100644 --- a/Mastodon/Scene/Thread/MastodonStatusThreadViewModel.swift +++ b/Mastodon/Scene/Thread/MastodonStatusThreadViewModel.swift @@ -12,6 +12,7 @@ import Combine import CoreData import CoreDataStack import MastodonSDK +import MastodonCore import MastodonMeta final class MastodonStatusThreadViewModel { diff --git a/Mastodon/Scene/Thread/RemoteThreadViewModel.swift b/Mastodon/Scene/Thread/RemoteThreadViewModel.swift index 6d2e3d975..da5a9bba0 100644 --- a/Mastodon/Scene/Thread/RemoteThreadViewModel.swift +++ b/Mastodon/Scene/Thread/RemoteThreadViewModel.swift @@ -8,6 +8,7 @@ import os.log import UIKit import CoreDataStack +import MastodonCore import MastodonSDK final class RemoteThreadViewModel: ThreadViewModel { diff --git a/Mastodon/Scene/Thread/ThreadViewController.swift b/Mastodon/Scene/Thread/ThreadViewController.swift index bd90fb370..7915df6e5 100644 --- a/Mastodon/Scene/Thread/ThreadViewController.swift +++ b/Mastodon/Scene/Thread/ThreadViewController.swift @@ -12,6 +12,7 @@ import CoreData import AVKit import MastodonMeta import MastodonAsset +import MastodonCore import MastodonLocalization final class ThreadViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { diff --git a/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift b/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift index ededcb044..a865dd8f0 100644 --- a/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift +++ b/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift @@ -9,6 +9,7 @@ import UIKit import Combine import CoreData import CoreDataStack +import MastodonCore import MastodonSDK extension ThreadViewModel { diff --git a/Mastodon/Scene/Thread/ThreadViewModel.swift b/Mastodon/Scene/Thread/ThreadViewModel.swift index 5a3127e66..54c9d1599 100644 --- a/Mastodon/Scene/Thread/ThreadViewModel.swift +++ b/Mastodon/Scene/Thread/ThreadViewModel.swift @@ -14,6 +14,7 @@ import GameplayKit import MastodonSDK import MastodonMeta import MastodonAsset +import MastodonCore import MastodonLocalization class ThreadViewModel { diff --git a/Mastodon/Supporting Files/SceneDelegate.swift b/Mastodon/Supporting Files/SceneDelegate.swift index 54b1fd57e..04f7ea784 100644 --- a/Mastodon/Supporting Files/SceneDelegate.swift +++ b/Mastodon/Supporting Files/SceneDelegate.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import CoreDataStack +import MastodonCore #if PROFILE import FPSIndicator diff --git a/MastodonSDK/Sources/MastodonCore/AppContext.swift b/MastodonSDK/Sources/MastodonCore/AppContext.swift index 7c61cd75b..1965a91e2 100644 --- a/MastodonSDK/Sources/MastodonCore/AppContext.swift +++ b/MastodonSDK/Sources/MastodonCore/AppContext.swift @@ -15,7 +15,7 @@ import AlamofireImage public class AppContext: ObservableObject { - var disposeBag = Set() + public var disposeBag = Set() public let coreDataStack: CoreDataStack public let managedObjectContext: NSManagedObjectContext @@ -116,16 +116,16 @@ public class AppContext: ObservableObject { extension AppContext { - typealias ByteCount = Int + public typealias ByteCount = Int - static let byteCountFormatter: ByteCountFormatter = { + public static let byteCountFormatter: ByteCountFormatter = { let formatter = ByteCountFormatter() return formatter }() private static let purgeCacheWorkingQueue = DispatchQueue(label: "org.joinmastodon.app.AppContext.purgeCacheWorkingQueue") - func purgeCache() -> AnyPublisher { + public func purgeCache() -> AnyPublisher { Publishers.MergeMany([ AppContext.purgeAlamofireImageCache(), AppContext.purgeTemporaryDirectory(), diff --git a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Instance.swift b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Instance.swift index 6cacd9db9..4192b68a2 100644 --- a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Instance.swift +++ b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Instance.swift @@ -10,7 +10,7 @@ import CoreDataStack import MastodonSDK extension Instance { - var configuration: Mastodon.Entity.Instance.Configuration? { + public var configuration: Mastodon.Entity.Instance.Configuration? { guard let configurationRaw = configurationRaw else { return nil } guard let configuration = try? JSONDecoder().decode(Mastodon.Entity.Instance.Configuration.self, from: configurationRaw) else { return nil diff --git a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Setting.swift b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Setting.swift index 4d1fc0ca5..bb76b69fb 100644 --- a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Setting.swift +++ b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Setting.swift @@ -15,7 +15,7 @@ extension Setting { // return SettingsItem.AppearanceMode(rawValue: appearanceRaw) ?? .automatic // } - var activeSubscription: Subscription? { + public var activeSubscription: Subscription? { return (subscriptions ?? Set()) .sorted(by: { $0.activedAt > $1.activedAt }) .first diff --git a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Status.swift b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Status.swift index 2e0cf516a..797abac7f 100644 --- a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Status.swift +++ b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Status.swift @@ -10,13 +10,13 @@ import Foundation import MastodonSDK extension Status { - enum SensitiveType { + public enum SensitiveType { case none case all case media(isSensitive: Bool) } - var sensitiveType: SensitiveType { + public var sensitiveType: SensitiveType { let spoilerText = self.spoilerText ?? "" // cast .all sensitive when has spoiter text @@ -44,9 +44,9 @@ extension Status { // return author // } //} -// + extension Status { - var statusURL: URL { + public var statusURL: URL { if let urlString = self.url, let url = URL(string: urlString) { @@ -56,7 +56,7 @@ extension Status { } } - var activityItems: [Any] { + public var activityItems: [Any] { var items: [Any] = [] items.append(self.statusURL) return items @@ -71,7 +71,7 @@ extension Status { //} extension Status { - var asRecord: ManagedObjectRecord { + public var asRecord: ManagedObjectRecord { return .init(objectID: self.objectID) } } diff --git a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Subscription.swift b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Subscription.swift index 8253264a0..67f3709d1 100644 --- a/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Subscription.swift +++ b/MastodonSDK/Sources/MastodonCore/Extension/CoreDataStack/Subscription.swift @@ -9,11 +9,11 @@ import Foundation import CoreDataStack import MastodonSDK -typealias NotificationSubscription = Subscription +public typealias NotificationSubscription = Subscription extension Subscription { - var policy: Mastodon.API.Subscriptions.Policy { + public var policy: Mastodon.API.Subscriptions.Policy { return Mastodon.API.Subscriptions.Policy(rawValue: policyRaw) ?? .all } diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SearchHistoryFetchedResultController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SearchHistoryFetchedResultController.swift index c3521c6fe..196c9b8f5 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SearchHistoryFetchedResultController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SearchHistoryFetchedResultController.swift @@ -12,19 +12,19 @@ import CoreData import CoreDataStack import MastodonSDK -final class SearchHistoryFetchedResultController: NSObject { +public final class SearchHistoryFetchedResultController: NSObject { var disposeBag = Set() - let fetchedResultsController: NSFetchedResultsController - let domain = CurrentValueSubject(nil) - let userID = CurrentValueSubject(nil) + public let fetchedResultsController: NSFetchedResultsController + public let domain = CurrentValueSubject(nil) + public let userID = CurrentValueSubject(nil) // output let _objectIDs = CurrentValueSubject<[NSManagedObjectID], Never>([]) - @Published var records: [ManagedObjectRecord] = [] + @Published public private(set) var records: [ManagedObjectRecord] = [] - init(managedObjectContext: NSManagedObjectContext) { + public init(managedObjectContext: NSManagedObjectContext) { self.fetchedResultsController = { let fetchRequest = SearchHistory.sortedFetchRequest fetchRequest.returnsObjectsAsFaults = false @@ -70,7 +70,7 @@ final class SearchHistoryFetchedResultController: NSObject { // MARK: - NSFetchedResultsControllerDelegate extension SearchHistoryFetchedResultController: NSFetchedResultsControllerDelegate { - func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { + public func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) let objects = fetchedResultsController.fetchedObjects ?? [] diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/StatusFetchedResultsController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/StatusFetchedResultsController.swift index 10da3f3fa..c08673acb 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/StatusFetchedResultsController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/StatusFetchedResultsController.swift @@ -12,22 +12,22 @@ import CoreData import CoreDataStack import MastodonSDK -final class StatusFetchedResultsController: NSObject { +public final class StatusFetchedResultsController: NSObject { var disposeBag = Set() let fetchedResultsController: NSFetchedResultsController // input - let domain = CurrentValueSubject(nil) - let statusIDs = CurrentValueSubject<[Mastodon.Entity.Status.ID], Never>([]) + @Published public var domain: String? = nil + @Published public var statusIDs: [Mastodon.Entity.Status.ID] = [] // output let _objectIDs = CurrentValueSubject<[NSManagedObjectID], Never>([]) - @Published var records: [ManagedObjectRecord] = [] + @Published public private(set) var records: [ManagedObjectRecord] = [] - init(managedObjectContext: NSManagedObjectContext, domain: String?, additionalTweetPredicate: NSPredicate?) { - self.domain.value = domain ?? "" + public init(managedObjectContext: NSManagedObjectContext, domain: String?, additionalTweetPredicate: NSPredicate?) { + self.domain = domain ?? "" self.fetchedResultsController = { let fetchRequest = Status.sortedFetchRequest fetchRequest.predicate = Status.predicate(domain: domain ?? "", ids: []) @@ -53,8 +53,8 @@ final class StatusFetchedResultsController: NSObject { fetchedResultsController.delegate = self Publishers.CombineLatest( - self.domain.removeDuplicates(), - self.statusIDs.removeDuplicates() + self.$domain.removeDuplicates(), + self.$statusIDs.removeDuplicates() ) .receive(on: DispatchQueue.main) .sink { [weak self] domain, ids in @@ -78,21 +78,21 @@ final class StatusFetchedResultsController: NSObject { extension StatusFetchedResultsController { public func append(statusIDs: [Mastodon.Entity.Status.ID]) { - var result = self.statusIDs.value + var result = self.statusIDs for statusID in statusIDs where !result.contains(statusID) { result.append(statusID) } - self.statusIDs.value = result + self.statusIDs = result } } // MARK: - NSFetchedResultsControllerDelegate extension StatusFetchedResultsController: NSFetchedResultsControllerDelegate { - func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { + public func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - let indexes = statusIDs.value + let indexes = statusIDs let objects = fetchedResultsController.fetchedObjects ?? [] let items: [NSManagedObjectID] = objects diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/UserFetchedResultsController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/UserFetchedResultsController.swift index bd57314bf..d95a62bbb 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/UserFetchedResultsController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/UserFetchedResultsController.swift @@ -12,22 +12,22 @@ import CoreData import CoreDataStack import MastodonSDK -final class UserFetchedResultsController: NSObject { +public final class UserFetchedResultsController: NSObject { var disposeBag = Set() let fetchedResultsController: NSFetchedResultsController // input - @Published var domain: String? = nil - @Published var userIDs: [Mastodon.Entity.Account.ID] = [] - @Published var additionalPredicate: NSPredicate? + @Published public var domain: String? = nil + @Published public var userIDs: [Mastodon.Entity.Account.ID] = [] + @Published public var additionalPredicate: NSPredicate? // output let _objectIDs = CurrentValueSubject<[NSManagedObjectID], Never>([]) - @Published var records: [ManagedObjectRecord] = [] + @Published public private(set) var records: [ManagedObjectRecord] = [] - init( + public init( managedObjectContext: NSManagedObjectContext, domain: String?, additionalPredicate: NSPredicate? @@ -96,7 +96,7 @@ extension UserFetchedResultsController { // MARK: - NSFetchedResultsControllerDelegate extension UserFetchedResultsController: NSFetchedResultsControllerDelegate { - func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { + public func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) let indexes = userIDs diff --git a/MastodonSDK/Sources/MastodonUI/Model/PlaintextMetaContent.swift b/MastodonSDK/Sources/MastodonCore/Model/PlaintextMetaContent.swift similarity index 100% rename from MastodonSDK/Sources/MastodonUI/Model/PlaintextMetaContent.swift rename to MastodonSDK/Sources/MastodonCore/Model/PlaintextMetaContent.swift diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift index 520c566c1..68649d24c 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func accountInfo( + public func accountInfo( domain: String, userID: Mastodon.Entity.Account.ID, authorization: Mastodon.API.OAuth.Authorization @@ -50,7 +50,7 @@ extension APIService { extension APIService { - func accountVerifyCredentials( + public func accountVerifyCredentials( domain: String, authorization: Mastodon.API.OAuth.Authorization ) -> AnyPublisher, Error> { @@ -91,7 +91,7 @@ extension APIService { .eraseToAnyPublisher() } - func accountUpdateCredentials( + public func accountUpdateCredentials( domain: String, query: Mastodon.API.Account.UpdateCredentialQuery, authorization: Mastodon.API.OAuth.Authorization @@ -125,7 +125,7 @@ extension APIService { return response } - func accountRegister( + public func accountRegister( domain: String, query: Mastodon.API.Account.RegisterQuery, authorization: Mastodon.API.OAuth.Authorization @@ -138,7 +138,7 @@ extension APIService { ) } - func accountLookup( + public func accountLookup( domain: String, query: Mastodon.API.Account.AccountLookupQuery, authorization: Mastodon.API.OAuth.Authorization diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+App.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+App.swift index cb46c7e76..82d814294 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+App.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+App.swift @@ -21,7 +21,7 @@ extension APIService { private static let appWebsite = "https://app.joinmastodon.org/ios" - func createApplication(domain: String) -> AnyPublisher, Error> { + public func createApplication(domain: String) -> AnyPublisher, Error> { let query = Mastodon.API.App.CreateQuery( clientName: APIService.clientName, redirectURIs: APIService.oauthCallbackURL, diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Authentication.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Authentication.swift index ffd9afd77..d4d096f49 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Authentication.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Authentication.swift @@ -13,7 +13,7 @@ import MastodonSDK extension APIService { - func userAccessToken( + public func userAccessToken( domain: String, clientID: String, clientSecret: String, @@ -34,7 +34,7 @@ extension APIService { ) } - func applicationAccessToken( + public func applicationAccessToken( domain: String, clientID: String, clientSecret: String, diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Block.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Block.swift index 428401703..7c78a65f7 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Block.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Block.swift @@ -22,7 +22,7 @@ extension APIService { let isFollowing: Bool } - func toggleBlock( + public func toggleBlock( user: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Bookmark.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Bookmark.swift index 8100b3b58..0d8c243f8 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Bookmark.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Bookmark.swift @@ -19,7 +19,7 @@ extension APIService { let isBookmarked: Bool } - func bookmark( + public func bookmark( record: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { @@ -98,7 +98,7 @@ extension APIService { } extension APIService { - func bookmarkedStatuses( + public func bookmarkedStatuses( limit: Int = onceRequestStatusMaxCount, maxID: String? = nil, authenticationBox: MastodonAuthenticationBox diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Favorite.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Favorite.swift index 6ae2254e3..f7e595b81 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Favorite.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Favorite.swift @@ -12,6 +12,7 @@ import MastodonSDK import CoreData import CoreDataStack import CommonOSLog +import MastodonCore extension APIService { @@ -21,7 +22,7 @@ extension APIService { let favoritedCount: Int64 } - func favorite( + public func favorite( record: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { @@ -108,7 +109,7 @@ extension APIService { } extension APIService { - func favoritedStatuses( + public func favoritedStatuses( limit: Int = onceRequestStatusMaxCount, maxID: String? = nil, authenticationBox: MastodonAuthenticationBox @@ -152,7 +153,7 @@ extension APIService { } extension APIService { - func favoritedBy( + public func favoritedBy( status: ManagedObjectRecord, query: Mastodon.API.Statuses.FavoriteByQuery, authenticationBox: MastodonAuthenticationBox diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follow.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follow.swift index 1e908a2e4..cfb5b8ee2 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follow.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follow.swift @@ -30,7 +30,7 @@ extension APIService { /// - mastodonUser: target MastodonUser /// - activeMastodonAuthenticationBox: `AuthenticationService.MastodonAuthenticationBox` /// - Returns: publisher for `Relationship` - func toggleFollow( + public func toggleFollow( user: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+FollowRequest.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+FollowRequest.swift index 5c91d282c..f0f0bfb7b 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+FollowRequest.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+FollowRequest.swift @@ -5,8 +5,6 @@ // Created by sxiaojian on 2021/4/27. // -import Foundation - import UIKit import Combine import CoreData @@ -16,7 +14,7 @@ import MastodonSDK extension APIService { - func followRequest( + public func followRequest( userID: Mastodon.Entity.Account.ID, query: Mastodon.API.Account.FollowReqeustQuery, authenticationBox: MastodonAuthenticationBox diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follower.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follower.swift index f0350013f..0f0ea1a59 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follower.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Follower.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func followers( + public func followers( userID: Mastodon.Entity.Account.ID, maxID: String?, authenticationBox: MastodonAuthenticationBox diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Following.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Following.swift index d0cdc233f..313d715ed 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Following.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Following.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func following( + public func following( userID: Mastodon.Entity.Account.ID, maxID: String?, authenticationBox: MastodonAuthenticationBox diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+HashtagTimeline.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+HashtagTimeline.swift index 319cec4f3..d2fbe844a 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+HashtagTimeline.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+HashtagTimeline.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func hashtagTimeline( + public func hashtagTimeline( domain: String, sinceID: Mastodon.Entity.Status.ID? = nil, maxID: Mastodon.Entity.Status.ID? = nil, diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+HomeTimeline.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+HomeTimeline.swift index 612b60d55..4e65aeadc 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+HomeTimeline.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+HomeTimeline.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func homeTimeline( + public func homeTimeline( sinceID: Mastodon.Entity.Status.ID? = nil, maxID: Mastodon.Entity.Status.ID? = nil, limit: Int = onceRequestStatusMaxCount, diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Instance.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Instance.swift index 477b1a5b5..93bfcf09a 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Instance.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Instance.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func instance( + public func instance( domain: String ) -> AnyPublisher, Error> { return Mastodon.API.Instance.instance(session: session, domain: domain) diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Mute.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Mute.swift index c93dbcf6f..ee43ddce8 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Mute.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Mute.swift @@ -21,7 +21,7 @@ extension APIService { let isMuting: Bool } - func toggleMute( + public func toggleMute( user: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Notification.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Notification.swift index 871c8349c..31b6509de 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Notification.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Notification.swift @@ -15,32 +15,33 @@ import class CoreDataStack.Notification extension APIService { - enum MastodonNotificationScope: Hashable, CaseIterable { + public enum MastodonNotificationScope: Hashable, CaseIterable { case everything case mentions - var includeTypes: [MastodonNotificationType]? { + public var includeTypes: [MastodonNotificationType]? { switch self { case .everything: return nil case .mentions: return [.mention, .status] } } - var excludeTypes: [MastodonNotificationType]? { + public var excludeTypes: [MastodonNotificationType]? { switch self { case .everything: return nil case .mentions: return [.follow, .followRequest, .reblog, .favourite, .poll] } } - var _excludeTypes: [Mastodon.Entity.Notification.NotificationType]? { + public var _excludeTypes: [Mastodon.Entity.Notification.NotificationType]? { switch self { case .everything: return nil case .mentions: return [.follow, .followRequest, .reblog, .favourite, .poll] } } } - func notifications( + + public func notifications( maxID: Mastodon.Entity.Status.ID?, scope: MastodonNotificationScope, authenticationBox: MastodonAuthenticationBox @@ -158,7 +159,8 @@ extension APIService { } extension APIService { - func notification( + + public func notification( notificationID: Mastodon.Entity.Notification.ID, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Onboarding.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Onboarding.swift index 5cbf455a0..383763359 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Onboarding.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Onboarding.swift @@ -11,7 +11,7 @@ import MastodonSDK extension APIService { - func servers( + public func servers( language: String?, category: String? ) -> AnyPublisher, Error> { @@ -19,11 +19,11 @@ extension APIService { return Mastodon.API.Onboarding.servers(session: session, query: query) } - func categories() -> AnyPublisher, Error> { + public func categories() -> AnyPublisher, Error> { return Mastodon.API.Onboarding.categories(session: session) } - static func stubCategories() -> [Mastodon.Entity.Category] { + public static func stubCategories() -> [Mastodon.Entity.Category] { return Mastodon.Entity.Category.Kind.allCases.map { kind in return Mastodon.Entity.Category(category: kind.rawValue, serversCount: 0) } diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Poll.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Poll.swift index 9d2895857..5a4b38b29 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Poll.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Poll.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func poll( + public func poll( poll: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { @@ -55,7 +55,7 @@ extension APIService { extension APIService { - func vote( + public func vote( poll: ManagedObjectRecord, choices: [Int], authenticationBox: MastodonAuthenticationBox diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+PublicTimeline.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+PublicTimeline.swift index fd0c2f0cd..21f198299 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+PublicTimeline.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+PublicTimeline.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func publicTimeline( + public func publicTimeline( query: Mastodon.API.Timeline.PublicTimelineQuery, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Status]> { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Reblog.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Reblog.swift index 2542636c4..0dc1a40e5 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Reblog.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Reblog.swift @@ -20,7 +20,7 @@ extension APIService { let rebloggedCount: Int64 } - func reblog( + public func reblog( record: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { @@ -108,7 +108,7 @@ extension APIService { } extension APIService { - func rebloggedBy( + public func rebloggedBy( status: ManagedObjectRecord, query: Mastodon.API.Statuses.RebloggedByQuery, authenticationBox: MastodonAuthenticationBox diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Recommend.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Recommend.swift index f88d82305..14255fc82 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Recommend.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Recommend.swift @@ -14,7 +14,7 @@ import OSLog extension APIService { - func suggestionAccount( + public func suggestionAccount( query: Mastodon.API.Suggestions.Query?, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Account]> { @@ -44,7 +44,7 @@ extension APIService { return response } - func suggestionAccountV2( + public func suggestionAccountV2( query: Mastodon.API.Suggestions.Query?, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.V2.SuggestionAccount]> { @@ -77,7 +77,7 @@ extension APIService { extension APIService { - func familiarFollowers( + public func familiarFollowers( query: Mastodon.API.Account.FamiliarFollowersQuery, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.FamiliarFollowers]> { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Relationship.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Relationship.swift index a852eaf67..f5c108725 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Relationship.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Relationship.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func relationship( + public func relationship( records: [ManagedObjectRecord], authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Relationship]> { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Status.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Status.swift index b7d6484dd..52b169ee7 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Status.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Status.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func status( + public func status( statusID: Mastodon.Entity.Status.ID, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { @@ -47,7 +47,7 @@ extension APIService { return response } - func deleteStatus( + public func deleteStatus( status: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Thread.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Thread.swift index f6c36e5b6..ddd782856 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Thread.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Thread.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func statusContext( + public func statusContext( statusID: Mastodon.Entity.Status.ID, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Trend.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Trend.swift index 47dda6bd2..5432b02a0 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Trend.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Trend.swift @@ -10,7 +10,7 @@ import MastodonSDK extension APIService { - func trendHashtags( + public func trendHashtags( domain: String, query: Mastodon.API.Trends.HashtagQuery? ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Tag]> { @@ -23,7 +23,7 @@ extension APIService { return response } - func trendStatuses( + public func trendStatuses( domain: String, query: Mastodon.API.Trends.StatusQuery ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Status]> { @@ -53,7 +53,7 @@ extension APIService { return response } - func trendLinks( + public func trendLinks( domain: String, query: Mastodon.API.Trends.LinkQuery ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Link]> { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+UserTimeline.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+UserTimeline.swift index 85b8d6153..fdf90a2aa 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+UserTimeline.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+UserTimeline.swift @@ -14,7 +14,7 @@ import MastodonSDK extension APIService { - func userTimeline( + public func userTimeline( accountID: String, maxID: Mastodon.Entity.Status.ID? = nil, sinceID: Mastodon.Entity.Status.ID? = nil, diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+WebFinger.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+WebFinger.swift index c506d43dc..b542cbe8d 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+WebFinger.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+WebFinger.swift @@ -21,7 +21,7 @@ extension APIService { .appendingPathComponent("webfinger") } - func webFinger( + public func webFinger( domain: String ) -> AnyPublisher { let url = APIService.webFingerEndpointURL(domain: domain) diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService.swift index b151ee540..d89760576 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService.swift @@ -28,7 +28,7 @@ public final class APIService { let backgroundManagedObjectContext: NSManagedObjectContext // output - let error = PassthroughSubject() + public let error = PassthroughSubject() public init(backgroundManagedObjectContext: NSManagedObjectContext) { self.backgroundManagedObjectContext = backgroundManagedObjectContext diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+MastodonAuthentication.swift b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+MastodonAuthentication.swift index 15624f71d..1acb52a77 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+MastodonAuthentication.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+MastodonAuthentication.swift @@ -13,7 +13,7 @@ import MastodonSDK extension APIService.CoreData { - static func createOrMergeMastodonAuthentication( + public static func createOrMergeMastodonAuthentication( into managedObjectContext: NSManagedObjectContext, for authenticateMastodonUser: MastodonUser, in domain: String, diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Subscriptions.swift b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Subscriptions.swift index d5958cf8f..ec8eec8b2 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Subscriptions.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Subscriptions.swift @@ -13,7 +13,7 @@ import MastodonSDK extension APIService.CoreData { - static func createOrFetchSubscription( + public static func createOrFetchSubscription( into managedObjectContext: NSManagedObjectContext, setting: Setting, policy: Mastodon.API.Subscriptions.Policy diff --git a/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift b/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift index 105543d52..8d69c3558 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift @@ -137,7 +137,7 @@ extension AuthenticationService { .eraseToAnyPublisher() } - func signOutMastodonUser( + public func signOutMastodonUser( authenticationBox: MastodonAuthenticationBox ) async throws { let managedObjectContext = backgroundManagedObjectContext diff --git a/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService+CustomEmojiViewModel.swift b/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService+CustomEmojiViewModel.swift index f28dfa805..38e1e1f7a 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService+CustomEmojiViewModel.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService+CustomEmojiViewModel.swift @@ -17,8 +17,8 @@ extension EmojiService { var disposeBag = Set() // input - let domain: String - weak var service: EmojiService? + public let domain: String + public weak var service: EmojiService? // output private(set) lazy var stateMachine: GKStateMachine = { diff --git a/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService.swift b/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService.swift index 6f44178da..f912217d4 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService.swift @@ -26,7 +26,7 @@ public final class EmojiService { extension EmojiService { - func dequeueCustomEmojiViewModel(for domain: String) -> CustomEmojiViewModel? { + public func dequeueCustomEmojiViewModel(for domain: String) -> CustomEmojiViewModel? { var _customEmojiViewModel: CustomEmojiViewModel? workingQueue.sync { if let viewModel = customEmojiViewModelDict[domain] { diff --git a/MastodonSDK/Sources/MastodonCore/Service/Emoji/Trie.swift b/MastodonSDK/Sources/MastodonCore/Service/Emoji/Trie.swift index cfb9c4362..85f948599 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/Emoji/Trie.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/Emoji/Trie.swift @@ -41,19 +41,19 @@ extension Trie { } extension ArraySlice { - var decomposed: (Element, ArraySlice)? { + public var decomposed: (Element, ArraySlice)? { return isEmpty ? nil : (self[startIndex], self.dropFirst()) } } extension Trie { - func lookup(key: ArraySlice) -> Bool { + public func lookup(key: ArraySlice) -> Bool { guard let (head, tail) = key.decomposed else { return isElement } guard let subtrie = children[head] else { return false } return subtrie.lookup(key: tail) } - func lookup(key: ArraySlice) -> Trie? { + public func lookup(key: ArraySlice) -> Trie? { guard let (head, tail) = key.decomposed else { return self } guard let remainder = children[head] else { return nil } return remainder.lookup(key: tail) @@ -61,13 +61,13 @@ extension Trie { } extension Trie { - func complete(key: ArraySlice) -> [[Element]] { + public func complete(key: ArraySlice) -> [[Element]] { return lookup(key: key)?.elements ?? [] } } extension Trie { - mutating func inserted(_ key: ArraySlice, value: Any) { + public mutating func inserted(_ key: ArraySlice, value: Any) { guard let (head, tail) = key.decomposed else { self.valueSet.add(value) return @@ -83,7 +83,7 @@ extension Trie { } extension Trie { - func passthrough(_ key: ArraySlice) -> [Trie] { + public func passthrough(_ key: ArraySlice) -> [Trie] { guard let (head, tail) = key.decomposed else { return [self] } @@ -96,7 +96,7 @@ extension Trie { } } - var values: NSSet { + public var values: NSSet { let valueSet = NSMutableSet(set: self.valueSet) for (_, value) in children { valueSet.addObjects(from: Array(value.values)) diff --git a/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService+UploadState.swift b/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService+UploadState.swift index 8ff076dc1..c4a403fc9 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService+UploadState.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService+UploadState.swift @@ -12,14 +12,14 @@ import GameplayKit import MastodonSDK extension MastodonAttachmentService { - class UploadState: GKState { + public class UploadState: GKState { weak var service: MastodonAttachmentService? init(service: MastodonAttachmentService) { self.service = service } - override func didEnter(from previousState: GKState?) { + public override func didEnter(from previousState: GKState?) { os_log("%{public}s[%{public}ld], %{public}s: enter %s, previous: %s", ((#file as NSString).lastPathComponent), #line, #function, self.debugDescription, previousState.debugDescription) service?.uploadStateMachineSubject.send(self) } @@ -28,8 +28,8 @@ extension MastodonAttachmentService { extension MastodonAttachmentService.UploadState { - class Initial: MastodonAttachmentService.UploadState { - override func isValidNextState(_ stateClass: AnyClass) -> Bool { + public class Initial: MastodonAttachmentService.UploadState { + public override func isValidNextState(_ stateClass: AnyClass) -> Bool { guard service?.authenticationBox != nil else { return false } if stateClass == Initial.self { return true @@ -43,17 +43,17 @@ extension MastodonAttachmentService.UploadState { } } - class Uploading: MastodonAttachmentService.UploadState { + public class Uploading: MastodonAttachmentService.UploadState { var needsFallback = false - override func isValidNextState(_ stateClass: AnyClass) -> Bool { + public override func isValidNextState(_ stateClass: AnyClass) -> Bool { return stateClass == Fail.self || stateClass == Finish.self || stateClass == Uploading.self || stateClass == Processing.self } - override func didEnter(from previousState: GKState?) { + public override func didEnter(from previousState: GKState?) { super.didEnter(from: previousState) guard let service = service, let stateMachine = stateMachine else { return } @@ -110,16 +110,16 @@ extension MastodonAttachmentService.UploadState { } } - class Processing: MastodonAttachmentService.UploadState { + public class Processing: MastodonAttachmentService.UploadState { static let retryLimit = 10 var retryCount = 0 - override func isValidNextState(_ stateClass: AnyClass) -> Bool { + public override func isValidNextState(_ stateClass: AnyClass) -> Bool { return stateClass == Fail.self || stateClass == Finish.self || stateClass == Processing.self } - override func didEnter(from previousState: GKState?) { + public override func didEnter(from previousState: GKState?) { super.didEnter(from: previousState) guard let service = service, let stateMachine = stateMachine else { return } @@ -165,15 +165,15 @@ extension MastodonAttachmentService.UploadState { } } - class Fail: MastodonAttachmentService.UploadState { - override func isValidNextState(_ stateClass: AnyClass) -> Bool { + public class Fail: MastodonAttachmentService.UploadState { + public override func isValidNextState(_ stateClass: AnyClass) -> Bool { // allow discard publishing return stateClass == Uploading.self || stateClass == Finish.self } } - class Finish: MastodonAttachmentService.UploadState { - override func isValidNextState(_ stateClass: AnyClass) -> Bool { + public class Finish: MastodonAttachmentService.UploadState { + public override func isValidNextState(_ stateClass: AnyClass) -> Bool { return false } } diff --git a/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService.swift b/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService.swift index edb8e7ae6..1af18efbe 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService.swift @@ -13,29 +13,29 @@ import GameplayKit import MobileCoreServices import MastodonSDK -protocol MastodonAttachmentServiceDelegate: AnyObject { +public protocol MastodonAttachmentServiceDelegate: AnyObject { func mastodonAttachmentService(_ service: MastodonAttachmentService, uploadStateDidChange state: MastodonAttachmentService.UploadState?) } -final class MastodonAttachmentService { +public final class MastodonAttachmentService { - var disposeBag = Set() - weak var delegate: MastodonAttachmentServiceDelegate? + public var disposeBag = Set() + public weak var delegate: MastodonAttachmentServiceDelegate? - let identifier = UUID() + public let identifier = UUID() // input - let context: AppContext - var authenticationBox: MastodonAuthenticationBox? - let file = CurrentValueSubject(nil) - let description = CurrentValueSubject(nil) + public let context: AppContext + public var authenticationBox: MastodonAuthenticationBox? + public let file = CurrentValueSubject(nil) + public let description = CurrentValueSubject(nil) // output - let thumbnailImage = CurrentValueSubject(nil) - let attachment = CurrentValueSubject(nil) - let error = CurrentValueSubject(nil) + public let thumbnailImage = CurrentValueSubject(nil) + public let attachment = CurrentValueSubject(nil) + public let error = CurrentValueSubject(nil) - private(set) lazy var uploadStateMachine: GKStateMachine = { + public private(set) lazy var uploadStateMachine: GKStateMachine = { // exclude timeline middle fetcher state let stateMachine = GKStateMachine(states: [ UploadState.Initial(service: self), @@ -47,9 +47,9 @@ final class MastodonAttachmentService { stateMachine.enter(UploadState.Initial.self) return stateMachine }() - lazy var uploadStateMachineSubject = CurrentValueSubject(nil) + public lazy var uploadStateMachineSubject = CurrentValueSubject(nil) - init( + public init( context: AppContext, pickerResult: PHPickerResult, initialAuthenticationBox: MastodonAuthenticationBox? @@ -87,7 +87,7 @@ final class MastodonAttachmentService { .store(in: &disposeBag) } - init( + public init( context: AppContext, image: UIImage, initialAuthenticationBox: MastodonAuthenticationBox? @@ -102,7 +102,7 @@ final class MastodonAttachmentService { uploadStateMachine.enter(UploadState.Initial.self) } - init( + public init( context: AppContext, documentURL: URL, initialAuthenticationBox: MastodonAuthenticationBox? @@ -183,7 +183,7 @@ final class MastodonAttachmentService { } extension MastodonAttachmentService { - enum AttachmentError: Error { + public enum AttachmentError: Error { case invalidAttachmentType case attachmentTooLarge } @@ -199,11 +199,11 @@ extension MastodonAttachmentService { extension MastodonAttachmentService: Equatable, Hashable { - static func == (lhs: MastodonAttachmentService, rhs: MastodonAttachmentService) -> Bool { + public static func == (lhs: MastodonAttachmentService, rhs: MastodonAttachmentService) -> Bool { return lhs.identifier == rhs.identifier } - func hash(into hasher: inout Hasher) { + public func hash(into hasher: inout Hasher) { hasher.combine(identifier) } diff --git a/MastodonSDK/Sources/MastodonCore/Service/Notification/NotificationService.swift b/MastodonSDK/Sources/MastodonCore/Service/Notification/NotificationService.swift index 4e08cd659..fff84cd4e 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/Notification/NotificationService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/Notification/NotificationService.swift @@ -141,7 +141,7 @@ extension NotificationService { } extension NotificationService { - func clearNotificationCountForActiveUser() { + public func clearNotificationCountForActiveUser() { guard let authenticationService = self.authenticationService else { return } if let accessToken = authenticationService.activeMastodonAuthentication.value?.userAccessToken { UserDefaults.shared.setNotificationCountWithAccessToken(accessToken: accessToken, value: 0) diff --git a/MastodonSDK/Sources/MastodonCore/Service/SettingService.swift b/MastodonSDK/Sources/MastodonCore/Service/SettingService.swift index fc7151605..b0932450b 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/SettingService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/SettingService.swift @@ -27,7 +27,7 @@ public final class SettingService { // output let settingFetchedResultController: SettingFetchedResultController - let currentSetting = CurrentValueSubject(nil) + public let currentSetting = CurrentValueSubject(nil) init( apiService: APIService, @@ -176,7 +176,7 @@ public final class SettingService { extension SettingService { - static func openSettingsAlertController(title: String, message: String) -> UIAlertController { + public static func openSettingsAlertController(title: String, message: String) -> UIAlertController { let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert) let settingAction = UIAlertAction(title: L10n.Common.Controls.Actions.settings, style: .default) { _ in guard let url = URL(string: UIApplication.openSettingsURLString) else { return } diff --git a/MastodonSDK/Sources/MastodonCore/Service/StatusFilterService.swift b/MastodonSDK/Sources/MastodonCore/Service/StatusFilterService.swift index 692a43706..92bb10def 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/StatusFilterService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/StatusFilterService.swift @@ -20,10 +20,10 @@ public final class StatusFilterService { // input weak var apiService: APIService? weak var authenticationService: AuthenticationService? - let filterUpdatePublisher = PassthroughSubject() + public let filterUpdatePublisher = PassthroughSubject() // output - @Published var activeFilters: [Mastodon.Entity.Filter] = [] + @Published public var activeFilters: [Mastodon.Entity.Filter] = [] init( apiService: APIService, diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/FamiliarFollowersDashboardView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/FamiliarFollowersDashboardView+ViewModel.swift index a9bb2c5f0..8de1eead2 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/FamiliarFollowersDashboardView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/FamiliarFollowersDashboardView+ViewModel.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import CoreDataStack +import MastodonCore import MastodonMeta import MastodonLocalization diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView.swift index 5848844a2..cacb56a8a 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView.swift @@ -10,6 +10,7 @@ import UIKit import Combine import MetaTextKit import Meta +import MastodonCore import MastodonAsset import MastodonLocalization diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView+Configuration.swift b/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView+Configuration.swift index 350c43736..fcf83e75b 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView+Configuration.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView+Configuration.swift @@ -9,6 +9,7 @@ import Foundation import Combine import CoreDataStack import Meta +import MastodonCore import MastodonMeta import MastodonSDK diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift index 4c983df34..084dca3d1 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift @@ -11,6 +11,7 @@ import Combine import MetaTextKit import Meta import MastodonAsset +import MastodonCore import MastodonLocalization public protocol StatusViewDelegate: AnyObject { diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/UserView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/UserView+ViewModel.swift index 0a970e884..0cbad4f5b 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/UserView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/UserView+ViewModel.swift @@ -9,6 +9,7 @@ import os.log import UIKit import Combine import MetaTextKit +import MastodonCore extension UserView { public final class ViewModel: ObservableObject {