Skip to content

Commit

Permalink
Merge pull request #783 from mastodon/ios_15
Browse files Browse the repository at this point in the history
Bump Deplyment Target to iOS 15
  • Loading branch information
zeitschlag authored Dec 22, 2022
2 parents 7ee51d0 + cb1b35c commit 3e2282c
Show file tree
Hide file tree
Showing 45 changed files with 86 additions and 325 deletions.
16 changes: 4 additions & 12 deletions Mastodon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -881,8 +879,6 @@
DB72602625E36A6F00235243 /* MastodonServerRulesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonServerRulesViewModel.swift; sourceTree = "<group>"; };
DB7274F3273BB9B200577D95 /* ListBatchFetchViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListBatchFetchViewModel.swift; sourceTree = "<group>"; };
DB73B48F261F030A002E9E9F /* SafariActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariActivity.swift; sourceTree = "<group>"; };
DB73BF4827140BA300781945 /* UICollectionViewDiffableDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UICollectionViewDiffableDataSource.swift; sourceTree = "<group>"; };
DB73BF4A27140C0800781945 /* UITableViewDiffableDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITableViewDiffableDataSource.swift; sourceTree = "<group>"; };
DB75BF1D263C1C1B00EDBF1F /* CustomScheduler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomScheduler.swift; sourceTree = "<group>"; };
DB789A0A25F9F2950071ACA0 /* ComposeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewController.swift; sourceTree = "<group>"; };
DB789A1125F9F2CC0071ACA0 /* ComposeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions Mastodon/Diffable/Status/StatusSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,7 @@ extension StatusSection {
}
var _snapshot = NSDiffableDataSourceSnapshot<PollSection, PollItem>()
_snapshot.appendSections([.main])
if #available(iOS 15.0, *) {
statusView.pollTableViewDiffableDataSource?.applySnapshotUsingReloadData(_snapshot)
} else {
statusView.pollTableViewDiffableDataSource?.apply(_snapshot, animatingDifferences: false)
}
statusView.pollTableViewDiffableDataSource?.applySnapshotUsingReloadData(_snapshot)
}
}

Expand Down
40 changes: 0 additions & 40 deletions Mastodon/Extension/UICollectionViewDiffableDataSource.swift

This file was deleted.

40 changes: 0 additions & 40 deletions Mastodon/Extension/UITableViewDiffableDataSource.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extension DiscoveryCommunityViewModel {
}
}

diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension DiscoveryNewsViewModel {
}
}

diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extension DiscoveryPostsViewModel {
}
}

diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,13 @@ extension HomeTimelineViewModel {
snapshot: NSDiffableDataSourceSnapshot<StatusSection, StatusItem>,
animatingDifferences: Bool
) async {
diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences)
await diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences)
}

@MainActor func updateSnapshotUsingReloadData(
snapshot: NSDiffableDataSourceSnapshot<StatusSection, StatusItem>
) {
if #available(iOS 15.0, *) {
self.diffableDataSource?.applySnapshotUsingReloadData(snapshot)
} else {
diffableDataSource?.applySnapshot(snapshot, animated: false, completion: nil)
}
self.diffableDataSource?.applySnapshotUsingReloadData(snapshot)
}

struct Difference<T> {
Expand Down
16 changes: 3 additions & 13 deletions Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,13 @@ extension NotificationTimelineViewModel {
snapshot: NSDiffableDataSourceSnapshot<NotificationSection, NotificationItem>,
animatingDifferences: Bool
) async {
diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences)
await diffableDataSource?.apply(snapshot, animatingDifferences: animatingDifferences)
}

@MainActor func updateSnapshotUsingReloadData(
snapshot: NSDiffableDataSourceSnapshot<NotificationSection, NotificationItem>
) async {
if #available(iOS 15.0, *) {
await self.diffableDataSource?.applySnapshotUsingReloadData(snapshot)
} else {
diffableDataSource?.applySnapshot(snapshot, animated: false, completion: nil)
}
await self.diffableDataSource?.applySnapshotUsingReloadData(snapshot)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 4 additions & 13 deletions Mastodon/Scene/Onboarding/Register/MastodonRegisterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extension BookmarkViewModel {
}
}

diffableDataSource.applySnapshot(snapshot, animated: false)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
.store(in: &disposeBag)
}
Expand Down
Loading

0 comments on commit 3e2282c

Please sign in to comment.