Fix DraftAttachment being accessed off main thread

This commit is contained in:
Shadowfacts 2023-04-22 22:03:52 -04:00
parent bff1ea8b9d
commit 2249e5a315
1 changed files with 1 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import Foundation
import Pachyderm import Pachyderm
import UniformTypeIdentifiers import UniformTypeIdentifiers
@MainActor
class PostService: ObservableObject { class PostService: ObservableObject {
private let mastodonController: ComposeMastodonContext private let mastodonController: ComposeMastodonContext
private let config: ComposeUIConfig private let config: ComposeUIConfig
@ -26,7 +27,6 @@ class PostService: ObservableObject {
self.totalSteps = 2 + (draft.attachments.count * 2) self.totalSteps = 2 + (draft.attachments.count * 2)
} }
@MainActor
func post() async throws { func post() async throws {
guard draft.hasContent else { guard draft.hasContent else {
return return
@ -65,7 +65,6 @@ class PostService: ObservableObject {
} }
} }
@MainActor
private func uploadAttachments() async throws -> [Attachment] { private func uploadAttachments() async throws -> [Attachment] {
var attachments: [Attachment] = [] var attachments: [Attachment] = []
attachments.reserveCapacity(draft.attachments.count) attachments.reserveCapacity(draft.attachments.count)