From 6de255681c7ebe88886b6c1be199a629dc84e184 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 22 Aug 2024 11:08:27 -0400 Subject: [PATCH] Fix assorted warnings when building with Xcode 16 --- Tusker.xcodeproj/project.pbxproj | 4 ---- .../MastodonCachePersistentStore.swift | 2 +- Tusker/Extensions/Mastodon+Equatable.swift | 21 ------------------- .../Announcements/AnnouncementListRow.swift | 2 +- .../VideoGalleryContentViewController.swift | 12 ++++++----- .../PushInstanceSettingsView.swift | 12 +++++------ Tusker/Views/Attachments/GifvController.swift | 4 +++- 7 files changed, 18 insertions(+), 39 deletions(-) delete mode 100644 Tusker/Extensions/Mastodon+Equatable.swift diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index c4656be1..e65fce05 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -165,7 +165,6 @@ D663626C21361C6700C9CBA2 /* Account+Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D663626B21361C6700C9CBA2 /* Account+Preferences.swift */; }; D6674AEA23341F7600E8DF94 /* AppShortcutItems.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6674AE923341F7600E8DF94 /* AppShortcutItems.swift */; }; D6676CA527A8D0020052936B /* WebURLFoundationExtras in Frameworks */ = {isa = PBXBuildFile; productRef = D6676CA427A8D0020052936B /* WebURLFoundationExtras */; }; - D667E5F82135C3040057A976 /* Mastodon+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D667E5F72135C3040057A976 /* Mastodon+Equatable.swift */; }; D66A77BB233838DC0058F1EC /* UIFont+Traits.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66A77BA233838DC0058F1EC /* UIFont+Traits.swift */; }; D66C900B28DAB7FD00217BF2 /* TimelineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D66C900A28DAB7FD00217BF2 /* TimelineViewController.swift */; }; D674A50927F9128D00BA03AC /* Pachyderm in Frameworks */ = {isa = PBXBuildFile; productRef = D674A50827F9128D00BA03AC /* Pachyderm */; }; @@ -599,7 +598,6 @@ D6620ACD2511A0ED00312CA0 /* StatusStateResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusStateResolver.swift; sourceTree = ""; }; D663626B21361C6700C9CBA2 /* Account+Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Account+Preferences.swift"; sourceTree = ""; }; D6674AE923341F7600E8DF94 /* AppShortcutItems.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppShortcutItems.swift; sourceTree = ""; }; - D667E5F72135C3040057A976 /* Mastodon+Equatable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Mastodon+Equatable.swift"; sourceTree = ""; }; D66A77BA233838DC0058F1EC /* UIFont+Traits.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+Traits.swift"; sourceTree = ""; }; D66C900A28DAB7FD00217BF2 /* TimelineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineViewController.swift; sourceTree = ""; }; D671A6BE299DA96100A81FEA /* Tusker-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tusker-Bridging-Header.h"; sourceTree = ""; }; @@ -1324,7 +1322,6 @@ D667E5F62135C2ED0057A976 /* Extensions */ = { isa = PBXGroup; children = ( - D667E5F72135C3040057A976 /* Mastodon+Equatable.swift */, D663626B21361C6700C9CBA2 /* Account+Preferences.swift */, D6F4D79329ECB0AF00351B87 /* UIBackgroundConfiguration+AppColors.swift */, D6333B362137838300CE884A /* AttributedString+Helpers.swift */, @@ -2216,7 +2213,6 @@ D6674AEA23341F7600E8DF94 /* AppShortcutItems.swift in Sources */, D6DD8FFF2984D327002AD3FD /* BookmarksViewController.swift in Sources */, D646DCD22A06F2510059ECEB /* NotificationsCollectionViewController.swift in Sources */, - D667E5F82135C3040057A976 /* Mastodon+Equatable.swift in Sources */, D6B4A4FF2506B81A000C81C1 /* AccountDisplayNameView.swift in Sources */, D63D8DF42850FE7A008D95E1 /* ViewTags.swift in Sources */, D630C3CC2BC5FD4600208903 /* GetAuthorizationTokenService.swift in Sources */, diff --git a/Tusker/CoreData/MastodonCachePersistentStore.swift b/Tusker/CoreData/MastodonCachePersistentStore.swift index 44fd8bc9..0c9746f3 100644 --- a/Tusker/CoreData/MastodonCachePersistentStore.swift +++ b/Tusker/CoreData/MastodonCachePersistentStore.swift @@ -19,7 +19,7 @@ import UserAccounts fileprivate let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "PersistentStore") -class MastodonCachePersistentStore: NSPersistentCloudKitContainer { +class MastodonCachePersistentStore: NSPersistentCloudKitContainer, @unchecked Sendable { private let accountInfo: UserAccountInfo? diff --git a/Tusker/Extensions/Mastodon+Equatable.swift b/Tusker/Extensions/Mastodon+Equatable.swift deleted file mode 100644 index 3ee2f750..00000000 --- a/Tusker/Extensions/Mastodon+Equatable.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// Status+Equatable.swift -// Tusker -// -// Created by Shadowfacts on 8/28/18. -// Copyright © 2018 Shadowfacts. All rights reserved. -// - -import Pachyderm - -extension Status: Equatable { - public static func ==(lhs: Status, rhs: Status) -> Bool { - return lhs.id == rhs.id - } -} - -extension Account: Equatable { - public static func ==(lhs: Account, rhs: Account) -> Bool { - return lhs.id == rhs.id - } -} diff --git a/Tusker/Screens/Announcements/AnnouncementListRow.swift b/Tusker/Screens/Announcements/AnnouncementListRow.swift index 646c6edf..41233877 100644 --- a/Tusker/Screens/Announcements/AnnouncementListRow.swift +++ b/Tusker/Screens/Announcements/AnnouncementListRow.swift @@ -88,7 +88,7 @@ struct AnnouncementListRow: View { Button(role: .destructive) { Task { await dismissAnnouncement() - await removeAnnouncement() + removeAnnouncement() } } label: { Label("Dismiss", systemImage: "xmark") diff --git a/Tusker/Screens/Gallery/VideoGalleryContentViewController.swift b/Tusker/Screens/Gallery/VideoGalleryContentViewController.swift index 8301787b..c693b888 100644 --- a/Tusker/Screens/Gallery/VideoGalleryContentViewController.swift +++ b/Tusker/Screens/Gallery/VideoGalleryContentViewController.swift @@ -89,12 +89,14 @@ class VideoGalleryContentViewController: UIViewController, GalleryContentViewCon hideControlsWorkItem?.cancel() if player.rate > 0 && info.oldValue == 0 { hideControlsWorkItem = DispatchWorkItem { [weak self] in - guard let self, - let container = self.container, - container.galleryControlsVisible else { - return + MainActor.runUnsafely { + guard let self, + let container = self.container, + container.galleryControlsVisible else { + return + } + container.setGalleryControlsVisible(false, animated: true) } - container.setGalleryControlsVisible(false, animated: true) } DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(5), execute: hideControlsWorkItem!) } diff --git a/Tusker/Screens/Preferences/Notifications/PushInstanceSettingsView.swift b/Tusker/Screens/Preferences/Notifications/PushInstanceSettingsView.swift index 916b141f..98c68d6d 100644 --- a/Tusker/Screens/Preferences/Notifications/PushInstanceSettingsView.swift +++ b/Tusker/Screens/Preferences/Notifications/PushInstanceSettingsView.swift @@ -87,7 +87,7 @@ struct PushInstanceSettingsView: View { } let subscription = try await PushManager.shared.createSubscription(account: account) - let mastodonController = await MastodonController.getForAccount(account) + let mastodonController = MastodonController.getForAccount(account) do { let result = try await mastodonController.createPushSubscription(subscription: subscription) PushManager.logger.debug("Push subscription \(result.id, privacy: .public) created on \(account.instanceURL) with endpoint \(result.endpoint, privacy: .public)") @@ -95,25 +95,25 @@ struct PushInstanceSettingsView: View { return true } catch { // if creation failed, remove the subscription locally as well - await PushManager.shared.removeSubscription(account: account) + PushManager.shared.removeSubscription(account: account) throw error } } private func disableNotifications() async throws { - let mastodonController = await MastodonController.getForAccount(account) + let mastodonController = MastodonController.getForAccount(account) try await mastodonController.deletePushSubscription() - await PushManager.shared.removeSubscription(account: account) + PushManager.shared.removeSubscription(account: account) subscription = nil PushManager.logger.debug("Push subscription removed on \(account.instanceURL)") } private func updateSubscription(alerts: PushNotifications.PushSubscription.Alerts, policy: PushNotifications.PushSubscription.Policy) async -> Bool { - let mastodonController = await MastodonController.getForAccount(account) + let mastodonController = MastodonController.getForAccount(account) do { let result = try await mastodonController.updatePushSubscription(alerts: alerts, policy: policy) PushManager.logger.debug("Push subscription \(result.id, privacy: .public) updated on \(account.instanceURL)") - await PushManager.shared.updateSubscription(account: account, alerts: alerts, policy: policy) + PushManager.shared.updateSubscription(account: account, alerts: alerts, policy: policy) subscription?.alerts = alerts subscription?.policy = policy return true diff --git a/Tusker/Views/Attachments/GifvController.swift b/Tusker/Views/Attachments/GifvController.swift index cc4b2849..b89bd2d5 100644 --- a/Tusker/Views/Attachments/GifvController.swift +++ b/Tusker/Views/Attachments/GifvController.swift @@ -61,7 +61,9 @@ class GifvController { private func updatePresentationSizeObservation() { presentationSizeObservation = item.observe(\.presentationSize, changeHandler: { [unowned self] item, _ in - self.presentationSizeSubject.send(item.presentationSize) + DispatchQueue.main.async { + self.presentationSizeSubject.send(item.presentationSize) + } }) }