From 2249e5a3156d9f6294ffeef0e6d9c27071e44240 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 22 Apr 2023 22:03:52 -0400 Subject: [PATCH] Fix DraftAttachment being accessed off main thread --- Packages/ComposeUI/Sources/ComposeUI/API/PostService.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Packages/ComposeUI/Sources/ComposeUI/API/PostService.swift b/Packages/ComposeUI/Sources/ComposeUI/API/PostService.swift index 53b6e3b4..46025789 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/API/PostService.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/API/PostService.swift @@ -10,6 +10,7 @@ import Foundation import Pachyderm import UniformTypeIdentifiers +@MainActor class PostService: ObservableObject { private let mastodonController: ComposeMastodonContext private let config: ComposeUIConfig @@ -26,7 +27,6 @@ class PostService: ObservableObject { self.totalSteps = 2 + (draft.attachments.count * 2) } - @MainActor func post() async throws { guard draft.hasContent else { return @@ -65,7 +65,6 @@ class PostService: ObservableObject { } } - @MainActor private func uploadAttachments() async throws -> [Attachment] { var attachments: [Attachment] = [] attachments.reserveCapacity(draft.attachments.count)