diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index 0ee9fa7e8..501b47a0e 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -307,8 +307,6 @@ DB72602725E36A6F00235243 /* MastodonServerRulesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB72602625E36A6F00235243 /* MastodonServerRulesViewModel.swift */; }; DB7274F4273BB9B200577D95 /* ListBatchFetchViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB7274F3273BB9B200577D95 /* ListBatchFetchViewModel.swift */; }; DB73B490261F030A002E9E9F /* SafariActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB73B48F261F030A002E9E9F /* SafariActivity.swift */; }; - DB73BF4927140BA300781945 /* UICollectionViewDiffableDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB73BF4827140BA300781945 /* UICollectionViewDiffableDataSource.swift */; }; - DB73BF4B27140C0800781945 /* UITableViewDiffableDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB73BF4A27140C0800781945 /* UITableViewDiffableDataSource.swift */; }; DB75BF1E263C1C1B00EDBF1F /* CustomScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB75BF1D263C1C1B00EDBF1F /* CustomScheduler.swift */; }; DB789A0B25F9F2950071ACA0 /* ComposeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB789A0A25F9F2950071ACA0 /* ComposeViewController.swift */; }; DB789A1225F9F2CC0071ACA0 /* ComposeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB789A1125F9F2CC0071ACA0 /* ComposeViewModel.swift */; }; @@ -881,8 +879,6 @@ DB72602625E36A6F00235243 /* MastodonServerRulesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonServerRulesViewModel.swift; sourceTree = ""; }; DB7274F3273BB9B200577D95 /* ListBatchFetchViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListBatchFetchViewModel.swift; sourceTree = ""; }; DB73B48F261F030A002E9E9F /* SafariActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariActivity.swift; sourceTree = ""; }; - DB73BF4827140BA300781945 /* UICollectionViewDiffableDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UICollectionViewDiffableDataSource.swift; sourceTree = ""; }; - DB73BF4A27140C0800781945 /* UITableViewDiffableDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITableViewDiffableDataSource.swift; sourceTree = ""; }; DB75BF1D263C1C1B00EDBF1F /* CustomScheduler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScheduler.swift; sourceTree = ""; }; DB789A0A25F9F2950071ACA0 /* ComposeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewController.swift; sourceTree = ""; }; DB789A1125F9F2CC0071ACA0 /* ComposeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewModel.swift; sourceTree = ""; }; @@ -2285,8 +2281,6 @@ DB9E0D6E25EE008500CFDD76 /* UIInterpolatingMotionEffect.swift */, 2AE244472927831100BDBF7C /* UIImage+SFSymbols.swift */, DBCC3B2F261440A50045B23D /* UITabBarController.swift */, - DB73BF4827140BA300781945 /* UICollectionViewDiffableDataSource.swift */, - DB73BF4A27140C0800781945 /* UITableViewDiffableDataSource.swift */, 2A1FE47D2938C11200784BF1 /* Collection+IsNotEmpty.swift */, ); path = Extension; @@ -3319,7 +3313,6 @@ DB5B729E273113F300081888 /* FollowingListViewModel+State.swift in Sources */, DBF9814C265E339500E4BA07 /* ProfileFieldAddEntryCollectionViewCell.swift in Sources */, DB63F76227996B6600455B82 /* SearchHistoryViewController+DataSourceProvider.swift in Sources */, - DB73BF4927140BA300781945 /* UICollectionViewDiffableDataSource.swift in Sources */, DBA5E7AB263BD3F5004598BB /* TimelineTableViewCellContextMenuConfiguration.swift in Sources */, DB73B490261F030A002E9E9F /* SafariActivity.swift in Sources */, 2AE244482927831100BDBF7C /* UIImage+SFSymbols.swift in Sources */, @@ -3409,7 +3402,6 @@ DB1E346825F518E20079D7DF /* CategoryPickerSection.swift in Sources */, DB7274F4273BB9B200577D95 /* ListBatchFetchViewModel.swift in Sources */, DB0618052785A73D0030EE79 /* RegisterItem.swift in Sources */, - DB73BF4B27140C0800781945 /* UITableViewDiffableDataSource.swift in Sources */, DBB525642612C988002F1F29 /* MeProfileViewModel.swift in Sources */, DB3EA8EF281B837000598866 /* DiscoveryCommunityViewController+DataSourceProvider.swift in Sources */, DB6B74EF272FB55000C70B6E /* FollowerListViewController.swift in Sources */, @@ -3831,7 +3823,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INTENTS_CODEGEN_LANGUAGE = Swift; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -3889,7 +3881,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INTENTS_CODEGEN_LANGUAGE = Swift; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -4091,7 +4083,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INTENTS_CODEGEN_LANGUAGE = Swift; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -4373,7 +4365,7 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; INTENTS_CODEGEN_LANGUAGE = Swift; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; diff --git a/Mastodon/Diffable/Status/StatusSection.swift b/Mastodon/Diffable/Status/StatusSection.swift index 9b45bae62..ac02273e9 100644 --- a/Mastodon/Diffable/Status/StatusSection.swift +++ b/Mastodon/Diffable/Status/StatusSection.swift @@ -228,11 +228,7 @@ extension StatusSection { } var _snapshot = NSDiffableDataSourceSnapshot() _snapshot.appendSections([.main]) - if #available(iOS 15.0, *) { - statusView.pollTableViewDiffableDataSource?.applySnapshotUsingReloadData(_snapshot) - } else { - statusView.pollTableViewDiffableDataSource?.apply(_snapshot, animatingDifferences: false) - } + statusView.pollTableViewDiffableDataSource?.applySnapshotUsingReloadData(_snapshot) } } diff --git a/Mastodon/Extension/UICollectionViewDiffableDataSource.swift b/Mastodon/Extension/UICollectionViewDiffableDataSource.swift deleted file mode 100644 index 07d2fbd12..000000000 --- a/Mastodon/Extension/UICollectionViewDiffableDataSource.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// UICollectionViewDiffableDataSource.swift -// Mastodon -// -// Created by Cirno MainasuK on 2021-10-11. -// - -import UIKit - -// ref: https://www.jessesquires.com/blog/2021/07/08/diffable-data-source-behavior-changes-and-reconfiguring-cells-in-ios-15/ -extension UICollectionViewDiffableDataSource { - func reloadData( - snapshot: NSDiffableDataSourceSnapshot, - completion: (() -> Void)? = nil - ) { - if #available(iOS 15.0, *) { - self.applySnapshotUsingReloadData(snapshot, completion: completion) - } else { - self.apply(snapshot, animatingDifferences: false, completion: completion) - } - } - - func applySnapshot( - _ snapshot: NSDiffableDataSourceSnapshot, - animated: Bool, - completion: (() -> Void)? = nil) { - - if #available(iOS 15.0, *) { - self.apply(snapshot, animatingDifferences: animated, completion: completion) - } else { - if animated { - self.apply(snapshot, animatingDifferences: true, completion: completion) - } else { - UIView.performWithoutAnimation { - self.apply(snapshot, animatingDifferences: true, completion: completion) - } - } - } - } -} diff --git a/Mastodon/Extension/UITableViewDiffableDataSource.swift b/Mastodon/Extension/UITableViewDiffableDataSource.swift deleted file mode 100644 index 5006417a4..000000000 --- a/Mastodon/Extension/UITableViewDiffableDataSource.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// UITableViewDiffableDataSource.swift -// Mastodon -// -// Created by Cirno MainasuK on 2021-10-11. -// - -import UIKit - -// ref: https://www.jessesquires.com/blog/2021/07/08/diffable-data-source-behavior-changes-and-reconfiguring-cells-in-ios-15/ -extension UITableViewDiffableDataSource { - func reloadData( - snapshot: NSDiffableDataSourceSnapshot, - completion: (() -> Void)? = nil - ) { - if #available(iOS 15.0, *) { - self.applySnapshotUsingReloadData(snapshot, completion: completion) - } else { - self.apply(snapshot, animatingDifferences: false, completion: completion) - } - } - - func applySnapshot( - _ snapshot: NSDiffableDataSourceSnapshot, - animated: Bool, - completion: (() -> Void)? = nil) { - - if #available(iOS 15.0, *) { - self.apply(snapshot, animatingDifferences: animated, completion: completion) - } else { - if animated { - self.apply(snapshot, animatingDifferences: true, completion: completion) - } else { - UIView.performWithoutAnimation { - self.apply(snapshot, animatingDifferences: true, completion: completion) - } - } - } - } -} diff --git a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+Diffable.swift b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+Diffable.swift index caa1f8460..a25dbaf1c 100644 --- a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+Diffable.swift +++ b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel+Diffable.swift @@ -59,7 +59,7 @@ extension DiscoveryCommunityViewModel { } } - diffableDataSource.applySnapshot(snapshot, animated: false) + diffableDataSource.apply(snapshot, animatingDifferences: false) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewModel+Diffable.swift b/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewModel+Diffable.swift index af8d6ff47..31b14c55d 100644 --- a/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewModel+Diffable.swift +++ b/Mastodon/Scene/Discovery/ForYou/DiscoveryForYouViewModel+Diffable.swift @@ -41,7 +41,7 @@ extension DiscoveryForYouViewModel { let items = records.map { DiscoveryItem.user($0) } snapshot.appendItems(items, toSection: .forYou) - diffableDataSource.applySnapshot(snapshot, animated: false) + diffableDataSource.apply(snapshot, animatingDifferences: false) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+Diffable.swift b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+Diffable.swift index 11334dee8..deb8f48a7 100644 --- a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+Diffable.swift +++ b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+Diffable.swift @@ -52,7 +52,7 @@ extension DiscoveryNewsViewModel { } } - diffableDataSource.applySnapshot(snapshot, animated: false) + diffableDataSource.apply(snapshot, animatingDifferences: false) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+Diffable.swift b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+Diffable.swift index f36812538..99d68796d 100644 --- a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+Diffable.swift +++ b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+Diffable.swift @@ -59,7 +59,7 @@ extension DiscoveryPostsViewModel { } } - diffableDataSource.applySnapshot(snapshot, animated: false) + diffableDataSource.apply(snapshot, animatingDifferences: false) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+Diffable.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+Diffable.swift index ff3224d3d..3d59b3403 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+Diffable.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+Diffable.swift @@ -131,17 +131,13 @@ extension HomeTimelineViewModel { snapshot: NSDiffableDataSourceSnapshot, animatingDifferences: Bool ) async { - diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences) + await diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences) } @MainActor func updateSnapshotUsingReloadData( snapshot: NSDiffableDataSourceSnapshot ) { - if #available(iOS 15.0, *) { - self.diffableDataSource?.applySnapshotUsingReloadData(snapshot) - } else { - diffableDataSource?.applySnapshot(snapshot, animated: false, completion: nil) - } + self.diffableDataSource?.applySnapshotUsingReloadData(snapshot) } struct Difference { diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift index 1bf54cdfe..c7c967305 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift @@ -148,12 +148,7 @@ extension HomeTimelineViewModel { } // reconfigure item - if #available(iOS 15.0, *) { - snapshot.reconfigureItems([item]) - } else { - // Fallback on earlier versions - snapshot.reloadItems([item]) - } + snapshot.reconfigureItems([item]) await updateSnapshotUsingReloadData(snapshot: snapshot) // fetch data @@ -176,15 +171,10 @@ extension HomeTimelineViewModel { } // reconfigure item again - if #available(iOS 15.0, *) { - snapshot.reconfigureItems([item]) - } else { - // Fallback on earlier versions - snapshot.reloadItems([item]) - } + snapshot.reconfigureItems([item]) await updateSnapshotUsingReloadData(snapshot: snapshot) } - + } // MARK: - SuggestionAccountViewModelDelegate diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+Diffable.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+Diffable.swift index cb623ff15..0331f401e 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+Diffable.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+Diffable.swift @@ -111,17 +111,13 @@ extension NotificationTimelineViewModel { snapshot: NSDiffableDataSourceSnapshot, animatingDifferences: Bool ) async { - diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences) + await diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences) } @MainActor func updateSnapshotUsingReloadData( snapshot: NSDiffableDataSourceSnapshot ) async { - if #available(iOS 15.0, *) { - await self.diffableDataSource?.applySnapshotUsingReloadData(snapshot) - } else { - diffableDataSource?.applySnapshot(snapshot, animated: false, completion: nil) - } + await self.diffableDataSource?.applySnapshotUsingReloadData(snapshot) } } diff --git a/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift b/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift index e9965fdde..9f9ce5d75 100644 --- a/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift +++ b/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift @@ -271,7 +271,7 @@ extension MastodonLoginViewController: MastodonLoginViewModelDelegate { snapshot.appendSections([MastodonLoginViewSection.servers]) snapshot.appendItems(viewModel.filteredServers) - dataSource?.applySnapshot(snapshot, animated: false) + dataSource?.apply(snapshot, animatingDifferences: false) OperationQueue.main.addOperation { let numberOfResults = viewModel.filteredServers.count diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift index 7e832ddca..057c742c1 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift @@ -43,11 +43,7 @@ final class MastodonPickServerViewController: UIViewController, NeedsDependency tableView.separatorStyle = .none tableView.backgroundColor = .clear tableView.keyboardDismissMode = .onDrag - if #available(iOS 15.0, *) { - tableView.sectionHeaderTopPadding = .leastNonzeroMagnitude - } else { - // Fallback on earlier versions - } + tableView.sectionHeaderTopPadding = .leastNonzeroMagnitude return tableView }() diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel+Diffable.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel+Diffable.swift index 7edbfd2ac..5db98c218 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel+Diffable.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel+Diffable.swift @@ -24,7 +24,7 @@ extension MastodonPickServerViewModel { sectionHeaderSnapshot.appendSections([.main]) sectionHeaderSnapshot.appendItems(categoryPickerItems, toSection: .main) serverSectionHeaderView.delegate = pickServerServerSectionTableHeaderViewDelegate - serverSectionHeaderView.diffableDataSource?.applySnapshot(sectionHeaderSnapshot, animated: false) { [weak self] in + serverSectionHeaderView.diffableDataSource?.apply(sectionHeaderSnapshot, animatingDifferences: false) { [weak self] in guard let self = self else { return } guard let indexPath = self.serverSectionHeaderView.diffableDataSource?.indexPath(for: .all) else { return } self.serverSectionHeaderView.collectionView.selectItem(at: indexPath, animated: false, scrollPosition: .centeredHorizontally) diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift index 4f28353b0..e5ca2798a 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift @@ -55,19 +55,10 @@ struct MastodonRegisterView: View { // Delete if viewModel.avatarImage != nil { Divider() - if #available(iOS 15.0, *) { - Button(role: .destructive) { - viewModel.avatarMediaMenuActionPublisher.send(.delete) - } label: { - Label(L10n.Scene.Register.Input.Avatar.delete, systemImage: "delete.left") - } - } else { - // Fallback on earlier ve rsions - Button { - viewModel.avatarMediaMenuActionPublisher.send(.delete) - } label: { - Label(L10n.Scene.Register.Input.Avatar.delete, systemImage: "delete.left") - } + Button(role: .destructive) { + viewModel.avatarMediaMenuActionPublisher.send(.delete) + } label: { + Label(L10n.Scene.Register.Input.Avatar.delete, systemImage: "delete.left") } } } label: { diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift index ea0b58e28..f850991f2 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift @@ -37,11 +37,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency tableView.separatorStyle = .none tableView.backgroundColor = .clear tableView.keyboardDismissMode = .onDrag - if #available(iOS 15.0, *) { - tableView.sectionHeaderTopPadding = 0 - } else { - // Fallback on earlier versions - } + tableView.sectionHeaderTopPadding = 0 return tableView }() diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel+Diffable.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel+Diffable.swift index f6385a529..ecb868eb0 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel+Diffable.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel+Diffable.swift @@ -21,6 +21,6 @@ extension MastodonServerRulesViewModel { return ServerRuleItem.rule(ruleContext) } snapshot.appendItems(ruleItems, toSection: .rules) - diffableDataSource?.applySnapshot(snapshot, animated: false, completion: nil) + diffableDataSource?.apply(snapshot, animatingDifferences: false) } } diff --git a/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift b/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift index ee01b99e8..89d77435d 100644 --- a/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift +++ b/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift @@ -66,11 +66,7 @@ extension OnboardingViewControllerAppearance { navigationItem.standardAppearance = barAppearance navigationItem.compactAppearance = barAppearance navigationItem.scrollEdgeAppearance = barAppearance - if #available(iOS 15.0, *) { - navigationItem.compactScrollEdgeAppearance = barAppearance - } else { - // Fallback on earlier versions - } + navigationItem.compactScrollEdgeAppearance = barAppearance } func setupNavigationBarBackgroundView() { diff --git a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift index 241b1eacc..b0d2f3c71 100644 --- a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift +++ b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift @@ -336,11 +336,7 @@ extension WelcomeViewController: OnboardingViewControllerAppearance { navigationItem.standardAppearance = barAppearance navigationItem.compactAppearance = barAppearance navigationItem.scrollEdgeAppearance = barAppearance - if #available(iOS 15.0, *) { - navigationItem.compactScrollEdgeAppearance = barAppearance - } else { - // Fallback on earlier versions - } + navigationItem.compactScrollEdgeAppearance = barAppearance } } diff --git a/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+Diffable.swift b/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+Diffable.swift index bb9148687..d52309e92 100644 --- a/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+Diffable.swift +++ b/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+Diffable.swift @@ -59,7 +59,7 @@ extension BookmarkViewModel { } } - diffableDataSource.applySnapshot(snapshot, animated: false) + diffableDataSource.apply(snapshot, animatingDifferences: false) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+Diffable.swift b/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+Diffable.swift index e0f741f62..367a4d51f 100644 --- a/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+Diffable.swift +++ b/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+Diffable.swift @@ -59,7 +59,7 @@ extension FavoriteViewModel { } } - diffableDataSource.applySnapshot(snapshot, animated: false) + diffableDataSource.apply(snapshot, animatingDifferences: false) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewModel.swift b/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewModel.swift index 75464092e..dbcf4d756 100644 --- a/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewModel.swift +++ b/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewModel.swift @@ -47,7 +47,7 @@ final class FollowedTagsViewModel: NSObject { var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.main]) snapshot.appendItems(records.map {.hashtag($0) }) - self.diffableDataSource?.applySnapshot(snapshot, animated: true) + self.diffableDataSource?.apply(snapshot, animatingDifferences: true) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Profile/Follower/FollowerListViewModel+Diffable.swift b/Mastodon/Scene/Profile/Follower/FollowerListViewModel+Diffable.swift index 7a30c3234..199879c83 100644 --- a/Mastodon/Scene/Profile/Follower/FollowerListViewModel+Diffable.swift +++ b/Mastodon/Scene/Profile/Follower/FollowerListViewModel+Diffable.swift @@ -27,12 +27,7 @@ extension FollowerListViewModel { var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.main]) snapshot.appendItems([.bottomLoader], toSection: .main) - if #available(iOS 15.0, *) { - diffableDataSource?.applySnapshotUsingReloadData(snapshot, completion: nil) - } else { - // Fallback on earlier versions - diffableDataSource?.apply(snapshot, animatingDifferences: false) - } + diffableDataSource?.applySnapshotUsingReloadData(snapshot, completion: nil) userFetchedResultsController.$records .receive(on: DispatchQueue.main) diff --git a/Mastodon/Scene/Profile/Following/FollowingListViewModel+Diffable.swift b/Mastodon/Scene/Profile/Following/FollowingListViewModel+Diffable.swift index e022c5736..f139a3b79 100644 --- a/Mastodon/Scene/Profile/Following/FollowingListViewModel+Diffable.swift +++ b/Mastodon/Scene/Profile/Following/FollowingListViewModel+Diffable.swift @@ -28,13 +28,8 @@ extension FollowingListViewModel { var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.main]) snapshot.appendItems([.bottomLoader], toSection: .main) - if #available(iOS 15.0, *) { - diffableDataSource?.applySnapshotUsingReloadData(snapshot, completion: nil) - } else { - // Fallback on earlier versions - diffableDataSource?.apply(snapshot, animatingDifferences: false) - } - + diffableDataSource?.applySnapshotUsingReloadData(snapshot) + userFetchedResultsController.$records .receive(on: DispatchQueue.main) .sink { [weak self] records in diff --git a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+Diffable.swift b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+Diffable.swift index 4992e653a..67f2b8035 100644 --- a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+Diffable.swift +++ b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+Diffable.swift @@ -83,7 +83,7 @@ extension UserTimelineViewModel { } } - diffableDataSource.applySnapshot(snapshot, animated: false) + diffableDataSource.apply(snapshot, animatingDifferences: false) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Profile/UserLIst/UserListViewModel+Diffable.swift b/Mastodon/Scene/Profile/UserLIst/UserListViewModel+Diffable.swift index acd225f0c..e843dd005 100644 --- a/Mastodon/Scene/Profile/UserLIst/UserListViewModel+Diffable.swift +++ b/Mastodon/Scene/Profile/UserLIst/UserListViewModel+Diffable.swift @@ -28,13 +28,8 @@ extension UserListViewModel { var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.main]) snapshot.appendItems([.bottomLoader], toSection: .main) - if #available(iOS 15.0, *) { - diffableDataSource?.applySnapshotUsingReloadData(snapshot, completion: nil) - } else { - // Fallback on earlier versions - diffableDataSource?.apply(snapshot, animatingDifferences: false) - } - + diffableDataSource?.applySnapshotUsingReloadData(snapshot) + // trigger initial loading stateMachine.enter(UserListViewModel.State.Reloading.self) diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift index 10e1ec3cd..3385a12ef 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift @@ -47,11 +47,7 @@ class ReportStatusViewController: UIViewController, NeedsDependency, ReportViewC tableView.backgroundColor = .clear tableView.keyboardDismissMode = .onDrag tableView.allowsMultipleSelection = true - if #available(iOS 15.0, *) { - tableView.sectionHeaderTopPadding = .leastNonzeroMagnitude - } else { - // Fallback on earlier versions - } + tableView.sectionHeaderTopPadding = .leastNonzeroMagnitude return tableView }() diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+Diffable.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+Diffable.swift index 9879863d6..fce56a2b9 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+Diffable.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+Diffable.swift @@ -65,7 +65,7 @@ extension ReportStatusViewModel { break } - diffableDataSource.applySnapshot(snapshot, animated: false) { [weak self] in + diffableDataSource.apply(snapshot, animatingDifferences: false) { [weak self] in guard let self = self else { return } guard let diffableDataSource = self.diffableDataSource else { return } diff --git a/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift b/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift index 76f312273..a84a3a650 100644 --- a/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift +++ b/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift @@ -52,11 +52,7 @@ final class ReportSupplementaryViewController: UIViewController, NeedsDependency tableView.separatorStyle = .none tableView.backgroundColor = .clear tableView.keyboardDismissMode = .onDrag - if #available(iOS 15.0, *) { - tableView.sectionHeaderTopPadding = .leastNonzeroMagnitude - } else { - // Fallback on earlier versions - } + tableView.sectionHeaderTopPadding = .leastNonzeroMagnitude return tableView }() diff --git a/Mastodon/Scene/Report/Share/ReportViewControllerAppearance.swift b/Mastodon/Scene/Report/Share/ReportViewControllerAppearance.swift index fb9bcd63f..34d59a437 100644 --- a/Mastodon/Scene/Report/Share/ReportViewControllerAppearance.swift +++ b/Mastodon/Scene/Report/Share/ReportViewControllerAppearance.swift @@ -42,11 +42,7 @@ extension ReportViewControllerAppearance { navigationItem.standardAppearance = barAppearance navigationItem.compactAppearance = barAppearance navigationItem.scrollEdgeAppearance = barAppearance - if #available(iOS 15.0, *) { - navigationItem.compactScrollEdgeAppearance = barAppearance - } else { - // Fallback on earlier versions - } + navigationItem.compactScrollEdgeAppearance = barAppearance } func setupNavigationBarBackgroundView() { diff --git a/Mastodon/Scene/Search/Search/SearchViewController.swift b/Mastodon/Scene/Search/Search/SearchViewController.swift index c190a1a4c..e1505121d 100644 --- a/Mastodon/Scene/Search/Search/SearchViewController.swift +++ b/Mastodon/Scene/Search/Search/SearchViewController.swift @@ -135,10 +135,7 @@ extension SearchViewController { navigationItem.standardAppearance = navigationBarAppearance navigationItem.scrollEdgeAppearance = navigationBarAppearance navigationItem.compactAppearance = navigationBarAppearance - - if #available(iOS 15, *) { - navigationItem.compactScrollEdgeAppearance = navigationBarAppearance - } + navigationItem.compactScrollEdgeAppearance = navigationBarAppearance } private func setupSearchBar() { diff --git a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel+Diffable.swift b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel+Diffable.swift index c559523a7..201fa10d2 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel+Diffable.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewModel+Diffable.swift @@ -54,7 +54,7 @@ extension SearchHistoryViewModel { var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.main]) snapshot.appendItems(items, toSection: .main) - diffableDataSource.apply(snapshot, animatingDifferences: false) + await diffableDataSource.apply(snapshot, animatingDifferences: false) } catch { // do nothing } diff --git a/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewModel+Diffable.swift b/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewModel+Diffable.swift index 35ba305bc..afb3eb7ec 100644 --- a/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewModel+Diffable.swift +++ b/Mastodon/Scene/SuggestionAccount/SuggestionAccountViewModel+Diffable.swift @@ -34,12 +34,7 @@ extension SuggestionAccountViewModel { let items: [RecommendAccountItem] = records.map { RecommendAccountItem.account($0) } snapshot.appendItems(items, toSection: .main) - if #available(iOS 15.0, *) { - tableViewDiffableDataSource.applySnapshotUsingReloadData(snapshot, completion: nil) - } else { - // Fallback on earlier versions - tableViewDiffableDataSource.applySnapshot(snapshot, animated: false, completion: nil) - } + tableViewDiffableDataSource.applySnapshotUsingReloadData(snapshot, completion: nil) } .store(in: &disposeBag) } @@ -71,13 +66,7 @@ extension SuggestionAccountViewModel { } snapshot.appendItems(items, toSection: .main) - - if #available(iOS 15.0, *) { - collectionViewDiffableDataSource.applySnapshotUsingReloadData(snapshot, completion: nil) - } else { - // Fallback on earlier versions - collectionViewDiffableDataSource.applySnapshot(snapshot, animated: false, completion: nil) - } + collectionViewDiffableDataSource.applySnapshotUsingReloadData(snapshot, completion: nil) } .store(in: &disposeBag) } diff --git a/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift b/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift index 8846c8b95..850c6bab2 100644 --- a/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift +++ b/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift @@ -154,17 +154,13 @@ extension ThreadViewModel { snapshot: NSDiffableDataSourceSnapshot, animatingDifferences: Bool ) async { - diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences) + await diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences) } @MainActor func updateSnapshotUsingReloadData( snapshot: NSDiffableDataSourceSnapshot ) async { - if #available(iOS 15.0, *) { - await self.diffableDataSource?.applySnapshotUsingReloadData(snapshot) - } else { - diffableDataSource?.applySnapshot(snapshot, animated: false, completion: nil) - } + await self.diffableDataSource?.applySnapshotUsingReloadData(snapshot) } // Some UI tweaks to present replies and conversation smoothly diff --git a/MastodonSDK/Package.swift b/MastodonSDK/Package.swift index 1ac22e6a7..02bde117b 100644 --- a/MastodonSDK/Package.swift +++ b/MastodonSDK/Package.swift @@ -7,7 +7,7 @@ let package = Package( name: "MastodonSDK", defaultLocalization: "en", platforms: [ - .iOS(.v14), + .iOS(.v15), ], products: [ .library( diff --git a/MastodonSDK/Sources/CoreDataStack/Extension/NSManagedObjectContext.swift b/MastodonSDK/Sources/CoreDataStack/Extension/NSManagedObjectContext.swift index b921de819..3b4818992 100644 --- a/MastodonSDK/Sources/CoreDataStack/Extension/NSManagedObjectContext.swift +++ b/MastodonSDK/Sources/CoreDataStack/Extension/NSManagedObjectContext.swift @@ -50,43 +50,16 @@ extension NSManagedObjectContext { extension NSManagedObjectContext { public func perform(block: @escaping () throws -> T) async throws -> T { - if #available(iOS 15.0, *) { - return try await perform(schedule: .enqueued) { - try block() - } - } else { - return try await withCheckedThrowingContinuation { continuation in - self.perform { - do { - let value = try block() - continuation.resume(returning: value) - } catch { - continuation.resume(throwing: error) - } - } - } // end return + return try await perform(schedule: .enqueued) { + try block() } } - + public func performChanges(block: @escaping () throws -> T) async throws -> T { - if #available(iOS 15.0, *) { - return try await perform(schedule: .enqueued) { - let value = try block() - try self.saveOrRollback() - return value - } - } else { - return try await withCheckedThrowingContinuation { continuation in - self.perform { - do { - let value = try block() - try self.saveOrRollback() - continuation.resume(returning: value) - } catch { - continuation.resume(throwing: error) - } - } - } // end return + return try await perform(schedule: .enqueued) { + let value = try block() + try self.saveOrRollback() + return value } } // end func } diff --git a/MastodonSDK/Sources/MastodonCore/Service/Theme/ThemeService.swift b/MastodonSDK/Sources/MastodonCore/Service/Theme/ThemeService.swift index 869e6875f..446fb5b63 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/Theme/ThemeService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/Theme/ThemeService.swift @@ -52,9 +52,7 @@ extension ThemeService { UINavigationBar.appearance().standardAppearance = appearance UINavigationBar.appearance().compactAppearance = appearance UINavigationBar.appearance().scrollEdgeAppearance = appearance - if #available(iOS 15.0, *) { - UINavigationBar.appearance().compactScrollEdgeAppearance = appearance - } + UINavigationBar.appearance().compactScrollEdgeAppearance = appearance // set tab bar appearance let tabBarAppearance = UITabBarAppearance() @@ -76,11 +74,7 @@ extension ThemeService { tabBarAppearance.backgroundColor = theme.tabBarBackgroundColor tabBarAppearance.selectionIndicatorTintColor = ThemeService.tintColor UITabBar.appearance().standardAppearance = tabBarAppearance - if #available(iOS 15.0, *) { - UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance - } else { - // Fallback on earlier versions - } + UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance UITabBar.appearance().barTintColor = theme.tabBarBackgroundColor // set table view cell appearance diff --git a/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift b/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift index 9899620fe..ad26e0ceb 100644 --- a/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift +++ b/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift @@ -48,13 +48,13 @@ extension ItemProviderLoader { let maxPixelSize: Int = 1536 // fit 120MB RAM limit #endif - let downsampleOptions = [ + let downsampleOptions: [CFString: Any] = [ kCGImageSourceCreateThumbnailFromImageAlways: true, kCGImageSourceCreateThumbnailWithTransform: true, kCGImageSourceThumbnailMaxPixelSize: maxPixelSize, - ] as CFDictionary + ] - guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, downsampleOptions) else { + guard let cgImage = CGImageSourceCreateThumbnailAtIndex(source, 0, downsampleOptions as CFDictionary) else { // fallback to loadItem when create thumbnail failure itemProvider.loadItem(forTypeIdentifier: UTType.image.identifier, options: nil) { image, error in if let error = error { @@ -77,7 +77,7 @@ extension ItemProviderLoader { } let data = NSMutableData() - guard let imageDestination = CGImageDestinationCreateWithData(data, kUTTypeJPEG, 1, nil) else { + guard let imageDestination = CGImageDestinationCreateWithData(data, UTType.jpeg.identifier as CFString, 1, nil) else { promise(.success(nil)) return } diff --git a/MastodonSDK/Sources/MastodonUI/Extension/Date.swift b/MastodonSDK/Sources/MastodonUI/Extension/Date.swift index 549dd550b..2b0cb9098 100644 --- a/MastodonSDK/Sources/MastodonUI/Extension/Date.swift +++ b/MastodonSDK/Sources/MastodonUI/Extension/Date.swift @@ -48,14 +48,10 @@ extension Date { if earlierDate.timeIntervalSince(latestDate) < -(7 * 24 * 60 * 60) { let currentYear = Date.calendar.dateComponents([.year], from: Date()) let earlierDateYear = Date.calendar.dateComponents([.year], from: earlierDate) - if #available(iOS 15.0, *) { - if currentYear.year! > earlierDateYear.year! { - return earlierDate.formatted(.dateTime.year().month(.abbreviated).day()) - } else { - return earlierDate.formatted(.dateTime.month(.abbreviated).day()) - } + if currentYear.year! > earlierDateYear.year! { + return earlierDate.formatted(.dateTime.year().month(.abbreviated).day()) } else { - return Date.abbreviatedDateFormatter.string(from: earlierDate) + return earlierDate.formatted(.dateTime.month(.abbreviated).day()) } } else { return Date.relativeTimestampFormatter.localizedString(for: earlierDate, relativeTo: latestDate) diff --git a/MastodonSDK/Sources/MastodonUI/Vendor/MetaTextView+PasteExtensions.swift b/MastodonSDK/Sources/MastodonUI/Vendor/MetaTextView+PasteExtensions.swift index 12e6632a7..f3fa8e0e4 100644 --- a/MastodonSDK/Sources/MastodonUI/Vendor/MetaTextView+PasteExtensions.swift +++ b/MastodonSDK/Sources/MastodonUI/Vendor/MetaTextView+PasteExtensions.swift @@ -15,19 +15,17 @@ extension MetaTextView { // fix #660 // https://github.com/mastodon/mastodon-ios/issues/660 - if #available(iOS 15.0, *) { - var nextResponder = self.next; - - // Force the event to bubble through ALL responders - // This is a workaround as somewhere down the chain the paste event gets eaten - while (nextResponder != nil) { - if let nextResponder = nextResponder { - if (nextResponder.responds(to: #selector(UIResponderStandardEditActions.paste(_:)))) { - nextResponder.perform(#selector(UIResponderStandardEditActions.paste(_:)), with: sender) - } + var nextResponder = self.next; + + // Force the event to bubble through ALL responders + // This is a workaround as somewhere down the chain the paste event gets eaten + while (nextResponder != nil) { + if let nextResponder = nextResponder { + if (nextResponder.responds(to: #selector(UIResponderStandardEditActions.paste(_:)))) { + nextResponder.perform(#selector(UIResponderStandardEditActions.paste(_:)), with: sender) } - nextResponder = nextResponder?.next; } - } // end if + nextResponder = nextResponder?.next; + } } } diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift index 228159d1f..530ceea20 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusCardControl.swift @@ -33,21 +33,15 @@ public final class StatusCardControl: UIControl { private let titleLabel = UILabel() private let linkLabel = UILabel() private lazy var showEmbedButton: UIButton = { - if #available(iOS 15.0, *) { - var configuration = UIButton.Configuration.gray() - configuration.background.visualEffect = UIBlurEffect(style: .systemUltraThinMaterial) - configuration.baseBackgroundColor = .clear - configuration.cornerStyle = .capsule - configuration.buttonSize = .large - configuration.title = L10n.Common.Controls.Status.loadEmbed - configuration.image = UIImage(systemName: "play.fill") - configuration.imagePadding = 12 - return UIButton(configuration: configuration, primaryAction: UIAction { [weak self] _ in - self?.showWebView() - }) - } - - return UIButton(type: .system, primaryAction: UIAction { [weak self] _ in + var configuration = UIButton.Configuration.gray() + configuration.background.visualEffect = UIBlurEffect(style: .systemUltraThinMaterial) + configuration.baseBackgroundColor = .clear + configuration.cornerStyle = .capsule + configuration.buttonSize = .large + configuration.title = L10n.Common.Controls.Status.loadEmbed + configuration.image = UIImage(systemName: "play.fill") + configuration.imagePadding = 12 + return UIButton(configuration: configuration, primaryAction: UIAction { [weak self] _ in self?.showWebView() }) }() @@ -85,10 +79,7 @@ public final class StatusCardControl: UIControl { layer.cornerCurve = .continuous layer.cornerRadius = 10 - if #available(iOS 15, *) { - maximumContentSizeCategory = .accessibilityLarge - } - + maximumContentSizeCategory = .accessibilityLarge highlightView.backgroundColor = UIColor.label.withAlphaComponent(0.1) highlightView.isHidden = true diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift index cda49d579..fa16e50e0 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift @@ -421,12 +421,7 @@ extension StatusView.ViewModel { var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.main]) snapshot.appendItems(items, toSection: .main) - if #available(iOS 15.0, *) { - statusView.pollTableViewDiffableDataSource?.applySnapshotUsingReloadData(snapshot) - } else { - // Fallback on earlier versions - statusView.pollTableViewDiffableDataSource?.apply(snapshot, animatingDifferences: false) - } + statusView.pollTableViewDiffableDataSource?.applySnapshotUsingReloadData(snapshot) statusView.pollTableViewHeightLayoutConstraint.constant = CGFloat(items.count) * PollOptionTableViewCell.height statusView.setPollDisplay() diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift index d2c5e75e7..b2e5a49ae 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift @@ -260,12 +260,7 @@ public final class StatusView: UIView { authorView.avatarButton.avatarImageView.cancelTask() if var snapshot = pollTableViewDiffableDataSource?.snapshot() { snapshot.deleteAllItems() - if #available(iOS 15.0, *) { - pollTableViewDiffableDataSource?.applySnapshotUsingReloadData(snapshot) - } else { - // Fallback on earlier versions - pollTableViewDiffableDataSource?.apply(snapshot, animatingDifferences: false) - } + pollTableViewDiffableDataSource?.applySnapshotUsingReloadData(snapshot) } setHeaderDisplay(isDisplay: false) diff --git a/MastodonTests/MastodonTests.swift b/MastodonTests/MastodonTests.swift index ec572fd92..91d2318da 100644 --- a/MastodonTests/MastodonTests.swift +++ b/MastodonTests/MastodonTests.swift @@ -46,7 +46,6 @@ extension MastodonTests { wait(for: [expectation], timeout: 10) } - @available(iOS 15.0, *) func testConnectOnion() async throws { let request = URLRequest( url: URL(string: "http://a232ncr7jexk2chvubaq2v6qdizbocllqap7mnn7w7vrdutyvu32jeyd.onion/@k0gen")!, diff --git a/Podfile b/Podfile index 022d37082..618b28bb3 100644 --- a/Podfile +++ b/Podfile @@ -1,5 +1,5 @@ source 'https://cdn.cocoapods.org/' -platform :ios, '14.0' +platform :ios, '15.0' target 'Mastodon' do # Comment the next line if you don't want to use dynamic frameworks