Fix crash when adding drawing attachment

This commit is contained in:
Shadowfacts 2023-05-16 10:57:27 -04:00
parent 8e570027a1
commit 7f64654800
2 changed files with 4 additions and 0 deletions

View File

@ -96,14 +96,17 @@ class AttachmentsListController: ViewController {
}
private func addImage() {
parent.deleteDraftOnDisappear = false
parent.config.presentAssetPicker?({ results in
self.insertAttachments(at: self.draft.attachments.count, itemProviders: results.map(\.itemProvider))
})
}
private func addDrawing() {
parent.deleteDraftOnDisappear = false
parent.config.presentDrawing?(PKDrawing()) { drawing in
let attachment = DraftAttachment(context: DraftsPersistentContainer.shared.viewContext)
attachment.id = UUID()
attachment.drawing = drawing
attachment.draft = self.draft
self.draft.attachments.add(attachment)

View File

@ -208,6 +208,7 @@ public final class ComposeController: ViewController {
do {
try await poster.post()
deleteDraftOnDisappear = true
didPostSuccessfully = true
// wait .25 seconds so the user can see the progress bar has completed