mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-22 00:11:00 +00:00
Fix Swift strict concurrency warnings
This commit is contained in:
parent
096996c242
commit
f16f0d514b
7 changed files with 10 additions and 11 deletions
|
@ -9,12 +9,11 @@ import Notifications
|
|||
import UIKit
|
||||
import UserNotifications
|
||||
|
||||
@MainActor
|
||||
class NotificationService: UNNotificationServiceExtension {
|
||||
var contentHandler: ((UNNotificationContent) -> Void)?
|
||||
var bestAttemptContent: UNMutableNotificationContent?
|
||||
|
||||
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
||||
@MainActor override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
||||
self.contentHandler = contentHandler
|
||||
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
|
||||
|
||||
|
@ -124,6 +123,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private func toRemoteNotification(localNotification: MastodonPushNotification) async -> Models.Notification? {
|
||||
do {
|
||||
if let account = AppAccountsManager.shared.availableAccounts.first(where: { $0.oauthToken?.accessToken == localNotification.accessToken }) {
|
||||
|
@ -137,6 +137,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
return nil
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private func buildMessageIntent(remoteNotification: Models.Notification,
|
||||
currentUser: String,
|
||||
avatarURL: URL) -> INSendMessageIntent
|
||||
|
|
|
@ -108,9 +108,7 @@ public struct ExploreView: View {
|
|||
}
|
||||
}
|
||||
.task(id: viewModel.searchQuery) {
|
||||
do {
|
||||
await viewModel.search()
|
||||
} catch {}
|
||||
await viewModel.search()
|
||||
}
|
||||
.onChange(of: scrollToTopSignal) {
|
||||
if viewModel.scrollToTopVisible {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Foundation
|
||||
import Models
|
||||
|
||||
public struct DeepLClient {
|
||||
public struct DeepLClient: Sendable {
|
||||
public enum DeepLError: Error {
|
||||
case notFound
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Foundation
|
||||
import Models
|
||||
|
||||
public struct InstanceSocialClient {
|
||||
public struct InstanceSocialClient: Sendable {
|
||||
private let authorization = "Bearer 8a4xx3D7Hzu1aFnf18qlkH8oU0oZ5ulabXxoS2FtQtwOy8G0DGQhr5PjTIjBnYAmFrSBuE2CcASjFocxJBonY8XGbLySB7MXd9ssrwlRHUXTQh3Z578lE1OfUtafvhML"
|
||||
private let listEndpoint = "https://instances.social/api/1.0/instances/list?count=1000&include_closed=false&include_dead=false&min_active_users=500"
|
||||
private let searchEndpoint = "https://instances.social/api/1.0/instances/search"
|
||||
|
|
|
@ -5,7 +5,7 @@ import SwiftUI
|
|||
import UIKit
|
||||
|
||||
extension StatusEditor {
|
||||
struct MediaContainer: Identifiable {
|
||||
struct MediaContainer: Identifiable, Sendable {
|
||||
let id: String
|
||||
let image: UIImage?
|
||||
let movieTransferable: MovieFileTranseferable?
|
||||
|
|
|
@ -72,7 +72,7 @@ extension StatusEditor {
|
|||
}
|
||||
|
||||
extension StatusEditor {
|
||||
final class MovieFileTranseferable: Transferable {
|
||||
final class MovieFileTranseferable: Transferable, Sendable {
|
||||
let url: URL
|
||||
|
||||
init(url: URL) {
|
||||
|
@ -94,7 +94,7 @@ extension StatusEditor {
|
|||
}
|
||||
}
|
||||
|
||||
final class GifFileTranseferable: Transferable {
|
||||
final class GifFileTranseferable: Transferable, Sendable {
|
||||
let url: URL
|
||||
|
||||
init(url: URL) {
|
||||
|
|
|
@ -670,7 +670,7 @@ extension StatusEditor {
|
|||
}
|
||||
}
|
||||
|
||||
func makeMediaContainer(from pickerItem: PhotosPickerItem) async -> MediaContainer? {
|
||||
nonisolated func makeMediaContainer(from pickerItem: PhotosPickerItem) async -> MediaContainer? {
|
||||
await withTaskGroup(of: MediaContainer?.self, returning: MediaContainer?.self) { taskGroup in
|
||||
taskGroup.addTask(priority: .high) { await Self.makeImageContainer(from: pickerItem) }
|
||||
taskGroup.addTask(priority: .high) { await Self.makeGifContainer(from: pickerItem) }
|
||||
|
|
Loading…
Reference in a new issue