From 8aa8825269993fdca4eef5a05bdebbbcd08fb85c Mon Sep 17 00:00:00 2001 From: CMK Date: Sat, 7 May 2022 11:42:10 +0800 Subject: [PATCH] chore: suppress warnings --- Mastodon.xcodeproj/project.pbxproj | 4 ---- .../xcschemes/xcschememanagement.plist | 6 +++--- Mastodon/Coordinator/SceneCoordinator.swift | 2 +- .../Onboarding/PickServerSection.swift | 2 +- .../Diffiable/Settings/SettingsSection.swift | 2 +- .../MastodonSDK/Mastodon+Entity+Tag.swift | 19 +++++++++---------- .../Extension/UINavigationController.swift | 16 ---------------- .../DataSourceFacade+SearchHistory.swift | 2 +- ...er+NotificationTableViewCellDelegate.swift | 2 +- ...Provider+StatusTableViewCellDelegate.swift | 2 +- ...ider+TableViewControllerNavigateable.swift | 2 +- ...taSourceProvider+UITableViewDelegate.swift | 2 +- .../Scene/Account/AccountViewController.swift | 2 +- .../AutoCompleteViewModel+State.swift | 2 +- .../News/DiscoveryNewsViewModel+State.swift | 2 +- ...meTimelineViewController+DebugAction.swift | 2 +- .../Scene/Profile/ProfileViewController.swift | 4 ++-- .../Root/Sidebar/SidebarViewController.swift | 5 ++--- .../Settings/SettingsViewController.swift | 2 +- ...wViewControllerAnimatedTransitioning.swift | 2 ++ .../APIService/APIService+Thread.swift | 2 +- Mastodon/Service/InstanceService.swift | 2 +- .../MastodonUI/Extension/UIImage.swift | 1 + 23 files changed, 34 insertions(+), 53 deletions(-) delete mode 100644 Mastodon/Extension/UINavigationController.swift diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index 7ddc27ac5..0f49a3f4e 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -537,7 +537,6 @@ DBCBED1726132DB500B49291 /* UserTimelineViewModel+Diffable.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBCBED1626132DB500B49291 /* UserTimelineViewModel+Diffable.swift */; }; DBCBED1D26132E1A00B49291 /* StatusFetchedResultsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBCBED1C26132E1A00B49291 /* StatusFetchedResultsController.swift */; }; DBCC3B30261440A50045B23D /* UITabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBCC3B2F261440A50045B23D /* UITabBarController.swift */; }; - DBCC3B36261440BA0045B23D /* UINavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBCC3B35261440BA0045B23D /* UINavigationController.swift */; }; DBCC3B8F26148F7B0045B23D /* CachedProfileViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBCC3B8E26148F7B0045B23D /* CachedProfileViewModel.swift */; }; DBCC3B9526157E6E0045B23D /* APIService+Relationship.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBCC3B9426157E6E0045B23D /* APIService+Relationship.swift */; }; DBCCC71E25F73297007E1AB6 /* APIService+Reblog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBCCC71D25F73297007E1AB6 /* APIService+Reblog.swift */; }; @@ -1302,7 +1301,6 @@ DBCBED1626132DB500B49291 /* UserTimelineViewModel+Diffable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserTimelineViewModel+Diffable.swift"; sourceTree = ""; }; DBCBED1C26132E1A00B49291 /* StatusFetchedResultsController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusFetchedResultsController.swift; sourceTree = ""; }; DBCC3B2F261440A50045B23D /* UITabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITabBarController.swift; sourceTree = ""; }; - DBCC3B35261440BA0045B23D /* UINavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UINavigationController.swift; sourceTree = ""; }; DBCC3B8E26148F7B0045B23D /* CachedProfileViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CachedProfileViewModel.swift; sourceTree = ""; }; DBCC3B9426157E6E0045B23D /* APIService+Relationship.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "APIService+Relationship.swift"; sourceTree = ""; }; DBCCC71D25F73297007E1AB6 /* APIService+Reblog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "APIService+Reblog.swift"; sourceTree = ""; }; @@ -2792,7 +2790,6 @@ 2D84350425FF858100EECE90 /* UIScrollView.swift */, DB9E0D6E25EE008500CFDD76 /* UIInterpolatingMotionEffect.swift */, DBCC3B2F261440A50045B23D /* UITabBarController.swift */, - DBCC3B35261440BA0045B23D /* UINavigationController.swift */, DB73BF4827140BA300781945 /* UICollectionViewDiffableDataSource.swift */, DB73BF4A27140C0800781945 /* UITableViewDiffableDataSource.swift */, ); @@ -4029,7 +4026,6 @@ DB9D7C21269824B80054B3DF /* APIService+Filter.swift in Sources */, 2D38F1E525CD46C100561493 /* HomeTimelineViewModel.swift in Sources */, DB0FCB842796B2A2006C02E2 /* FavoriteViewController+DataSourceProvider.swift in Sources */, - DBCC3B36261440BA0045B23D /* UINavigationController.swift in Sources */, DB0FCB68279507EF006C02E2 /* DataSourceFacade+Meta.swift in Sources */, DB63F75C279956D000455B82 /* Persistence+Tag.swift in Sources */, 2D84350525FF858100EECE90 /* UIScrollView.swift in Sources */, diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 8853baadf..7f54b9011 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -109,7 +109,7 @@ MastodonIntent.xcscheme_^#shared#^_ orderHint - 35 + 20 MastodonIntents.xcscheme_^#shared#^_ @@ -124,12 +124,12 @@ NotificationService.xcscheme_^#shared#^_ orderHint - 36 + 19 ShareActionExtension.xcscheme_^#shared#^_ orderHint - 37 + 21 SuppressBuildableAutocreation diff --git a/Mastodon/Coordinator/SceneCoordinator.swift b/Mastodon/Coordinator/SceneCoordinator.swift index 819872c70..5e7fbf472 100644 --- a/Mastodon/Coordinator/SceneCoordinator.swift +++ b/Mastodon/Coordinator/SceneCoordinator.swift @@ -309,7 +309,7 @@ extension SceneCoordinator { if scene.isOnboarding { return OnboardingNavigationController(rootViewController: viewController) } else { - return UINavigationController(rootViewController: viewController) + return AdaptiveStatusBarStyleNavigationController(rootViewController: viewController) } }() modalNavigationController.modalPresentationCapturesStatusBarAppearance = true diff --git a/Mastodon/Diffiable/Onboarding/PickServerSection.swift b/Mastodon/Diffiable/Onboarding/PickServerSection.swift index 5faaefbcc..01a31f6f6 100644 --- a/Mastodon/Diffiable/Onboarding/PickServerSection.swift +++ b/Mastodon/Diffiable/Onboarding/PickServerSection.swift @@ -29,7 +29,7 @@ extension PickServerSection { weak dependency, weak pickServerCellDelegate ] tableView, indexPath, item -> UITableViewCell? in - guard let dependency = dependency else { return nil } + guard let _ = dependency else { return nil } switch item { case .header: let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: OnboardingHeadlineTableViewCell.self), for: indexPath) as! OnboardingHeadlineTableViewCell diff --git a/Mastodon/Diffiable/Settings/SettingsSection.swift b/Mastodon/Diffiable/Settings/SettingsSection.swift index adc7140be..6925303d8 100644 --- a/Mastodon/Diffiable/Settings/SettingsSection.swift +++ b/Mastodon/Diffiable/Settings/SettingsSection.swift @@ -51,7 +51,7 @@ extension SettingsSection { } cell.delegate = settingsAppearanceTableViewCellDelegate return cell - case .appearancePreference(let record, let appearanceType): + case .appearancePreference(let record, _): let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: SettingsToggleTableViewCell.self), for: indexPath) as! SettingsToggleTableViewCell cell.delegate = settingsToggleCellDelegate managedObjectContext.performAndWait { diff --git a/Mastodon/Extension/MastodonSDK/Mastodon+Entity+Tag.swift b/Mastodon/Extension/MastodonSDK/Mastodon+Entity+Tag.swift index e217d3a82..6251d1814 100644 --- a/Mastodon/Extension/MastodonSDK/Mastodon+Entity+Tag.swift +++ b/Mastodon/Extension/MastodonSDK/Mastodon+Entity+Tag.swift @@ -7,13 +7,12 @@ import MastodonSDK -extension Mastodon.Entity.Tag: Hashable { - public func hash(into hasher: inout Hasher) { - hasher.combine(name) - } - - public static func == (lhs: Mastodon.Entity.Tag, rhs: Mastodon.Entity.Tag) -> Bool { - return lhs.name == rhs.name - } -} - +//extension Mastodon.Entity.Tag: Hashable { +// public func hash(into hasher: inout Hasher) { +// hasher.combine(name) +// } +// +// public static func == (lhs: Mastodon.Entity.Tag, rhs: Mastodon.Entity.Tag) -> Bool { +// return lhs.name == rhs.name +// } +//} diff --git a/Mastodon/Extension/UINavigationController.swift b/Mastodon/Extension/UINavigationController.swift deleted file mode 100644 index 9a9c44ab3..000000000 --- a/Mastodon/Extension/UINavigationController.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// UINavigationController.swift -// Mastodon -// -// Created by MainasuK Cirno on 2021-3-31. -// - -import UIKit - -// This not works! -// SeeAlso: `AdaptiveStatusBarStyleNavigationController` -extension UINavigationController { - open override var childForStatusBarStyle: UIViewController? { - return visibleViewController - } -} diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+SearchHistory.swift b/Mastodon/Protocol/Provider/DataSourceFacade+SearchHistory.swift index cbc6bf348..8beaabbae 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+SearchHistory.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+SearchHistory.swift @@ -99,7 +99,7 @@ extension DataSourceFacade { try await managedObjectContext.performChanges { guard let authenticationBox = _authenticationBox else { return } - guard let me = authenticationBox.authenticationRecord.object(in: managedObjectContext)?.user else { return } + guard let _ = authenticationBox.authenticationRecord.object(in: managedObjectContext)?.user else { return } let request = SearchHistory.sortedFetchRequest request.predicate = SearchHistory.predicate( domain: authenticationBox.domain, diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+NotificationTableViewCellDelegate.swift b/Mastodon/Protocol/Provider/DataSourceProvider+NotificationTableViewCellDelegate.swift index f6e58673b..ca7fdeb18 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+NotificationTableViewCellDelegate.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+NotificationTableViewCellDelegate.swift @@ -486,7 +486,7 @@ extension NotificationTableViewCellDelegate where Self: DataSourceProvider { provider: self, user: user ) - case .notification(let notification): + case .notification: assertionFailure("TODO") default: assertionFailure("TODO") diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift b/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift index 9e5838e77..f00e14840 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewCellDelegate.swift @@ -494,7 +494,7 @@ extension StatusTableViewCellDelegate where Self: DataSourceProvider { provider: self, user: user ) - case .notification(let notification): + case .notification: assertionFailure("TODO") default: assertionFailure("TODO") diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+TableViewControllerNavigateable.swift b/Mastodon/Protocol/Provider/DataSourceProvider+TableViewControllerNavigateable.swift index f7e50cff8..50fa17866 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+TableViewControllerNavigateable.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+TableViewControllerNavigateable.swift @@ -138,7 +138,7 @@ extension TableViewControllerNavigateableCore where Self: DataSourceProvider { target: .status, status: record ) - case .notification(let record): + case .notification: assertionFailure() default: assertionFailure() diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift b/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift index 3968df110..c00c36971 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift @@ -93,7 +93,7 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV guard let image = mediaView.thumbnail(), let assetURLString = mediaView.configuration?.assetURL, let assetURL = URL(string: assetURLString), - let resourceType = mediaView.configuration?.resourceType + let _ = mediaView.configuration?.resourceType else { // not provide preview unless thumbnail ready return nil diff --git a/Mastodon/Scene/Account/AccountViewController.swift b/Mastodon/Scene/Account/AccountViewController.swift index 42c9e1d62..20d7b26a1 100644 --- a/Mastodon/Scene/Account/AccountViewController.swift +++ b/Mastodon/Scene/Account/AccountViewController.swift @@ -118,7 +118,7 @@ extension AccountListViewController { // the presentingViewController may deinit. // Hold it and check the window to prevent PanModel crash - guard let presentingViewController = presentingViewController else { return } + guard let _ = presentingViewController else { return } guard self.view.window != nil else { return } self.hasLoaded = true diff --git a/Mastodon/Scene/Compose/AutoComplete/AutoCompleteViewModel+State.swift b/Mastodon/Scene/Compose/AutoComplete/AutoCompleteViewModel+State.swift index ebda78a1e..632b57b66 100644 --- a/Mastodon/Scene/Compose/AutoComplete/AutoCompleteViewModel+State.swift +++ b/Mastodon/Scene/Compose/AutoComplete/AutoCompleteViewModel+State.swift @@ -77,7 +77,7 @@ extension AutoCompleteViewModel.State { override func didEnter(from previousState: GKState?) { super.didEnter(from: previousState) - guard let viewModel = viewModel, let stateMachine = stateMachine else { return } + guard let viewModel = viewModel, let _ = stateMachine else { return } let searchText = viewModel.inputText.value let searchType = AutoCompleteViewModel.SearchType(inputText: searchText) ?? .default diff --git a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+State.swift b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+State.swift index 8da975de2..92b84d176 100644 --- a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+State.swift +++ b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+State.swift @@ -68,7 +68,7 @@ extension DiscoveryNewsViewModel.State { override func didEnter(from previousState: GKState?) { super.didEnter(from: previousState) - guard let viewModel = viewModel, let stateMachine = stateMachine else { return } + guard let _ = viewModel, let stateMachine = stateMachine else { return } stateMachine.enter(Loading.self) } diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift index 8b6eb9f42..4fae66d33 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift @@ -186,7 +186,7 @@ extension HomeTimelineViewController { } func match(item: StatusItem) -> Bool { - let authenticationBox = AppContext.shared.authenticationService.activeMastodonAuthenticationBox.value + // let authenticationBox = AppContext.shared.authenticationService.activeMastodonAuthenticationBox.value switch item { case .feed(let record): guard let feed = record.object(in: AppContext.shared.managedObjectContext) else { return false } diff --git a/Mastodon/Scene/Profile/ProfileViewController.swift b/Mastodon/Scene/Profile/ProfileViewController.swift index d3de07cff..021f62ede 100644 --- a/Mastodon/Scene/Profile/ProfileViewController.swift +++ b/Mastodon/Scene/Profile/ProfileViewController.swift @@ -634,7 +634,7 @@ extension ProfileViewController { return nil } let name = user.displayNameWithFallback - let record = ManagedObjectRecord(objectID: user.objectID) + let _ = ManagedObjectRecord(objectID: user.objectID) let menu = MastodonMenu.setupMenu( actions: [ .muteUser(.init(name: name, isMuting: self.viewModel.isMuting.value)), @@ -649,7 +649,7 @@ extension ProfileViewController { .sink { [weak self] completion in guard let self = self else { return } switch completion { - case .failure(let error): + case .failure: self.moreMenuBarButtonItem.menu = nil case .finished: break diff --git a/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift b/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift index 7ac0f6e54..c7cf3d49d 100644 --- a/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift +++ b/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift @@ -154,10 +154,9 @@ extension SidebarViewController { coordinator.animate { context in self.collectionView.collectionViewLayout.invalidateLayout() - } completion: { [weak self] context in -// guard let self = self else { return } + } completion: { context in + // do nothing } - } } diff --git a/Mastodon/Scene/Settings/SettingsViewController.swift b/Mastodon/Scene/Settings/SettingsViewController.swift index 4cf20cd09..8455ac7d9 100644 --- a/Mastodon/Scene/Settings/SettingsViewController.swift +++ b/Mastodon/Scene/Settings/SettingsViewController.swift @@ -448,7 +448,7 @@ extension SettingsViewController: SettingsAppearanceTableViewCellDelegate { guard let dataSource = viewModel.dataSource else { return } guard let indexPath = tableView.indexPath(for: cell) else { return } let item = dataSource.itemIdentifier(for: indexPath) - guard case let .appearance(record) = item else { return } + guard case .appearance = item else { return } Task { @MainActor in switch appearanceMode { diff --git a/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift b/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift index f730e0b8b..1b2d62211 100644 --- a/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift +++ b/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift @@ -255,6 +255,8 @@ extension MediaHostToMediaPreviewViewControllerAnimatedTransitioning { rect.size.height -= offset return rect }() + + // FIXME: let maskLayerToFinalPath = maskLayerToFinalRect.flatMap { UIBezierPath(rect: $0) }?.cgPath if let maskLayerToPath = maskLayerToPath { diff --git a/Mastodon/Service/APIService/APIService+Thread.swift b/Mastodon/Service/APIService/APIService+Thread.swift index 782da5886..f6c36e5b6 100644 --- a/Mastodon/Service/APIService/APIService+Thread.swift +++ b/Mastodon/Service/APIService/APIService+Thread.swift @@ -34,7 +34,7 @@ extension APIService { let value = response.value.ancestors + response.value.descendants for entity in value { - Persistence.Status.createOrMerge( + _ = Persistence.Status.createOrMerge( in: managedObjectContext, context: Persistence.Status.PersistContext( domain: domain, diff --git a/Mastodon/Service/InstanceService.swift b/Mastodon/Service/InstanceService.swift index 4fb6309fd..03b8dfd4e 100644 --- a/Mastodon/Service/InstanceService.swift +++ b/Mastodon/Service/InstanceService.swift @@ -95,7 +95,7 @@ extension InstanceService { self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Instance] update instance for domain: \(domain)") } } receiveValue: { [weak self] response in - guard let self = self else { return } + guard let _ = self else { return } // do nothing } .store(in: &disposeBag) diff --git a/MastodonSDK/Sources/MastodonUI/Extension/UIImage.swift b/MastodonSDK/Sources/MastodonUI/Extension/UIImage.swift index 105b4c27d..141b723bc 100644 --- a/MastodonSDK/Sources/MastodonUI/Extension/UIImage.swift +++ b/MastodonSDK/Sources/MastodonUI/Extension/UIImage.swift @@ -14,4 +14,5 @@ extension UIImage { self.draw(in: CGRect(origin: .zero, size: size)) } } + }