Fix crash when adding drawing attachment
This commit is contained in:
parent
8e570027a1
commit
7f64654800
|
@ -96,14 +96,17 @@ class AttachmentsListController: ViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func addImage() {
|
private func addImage() {
|
||||||
|
parent.deleteDraftOnDisappear = false
|
||||||
parent.config.presentAssetPicker?({ results in
|
parent.config.presentAssetPicker?({ results in
|
||||||
self.insertAttachments(at: self.draft.attachments.count, itemProviders: results.map(\.itemProvider))
|
self.insertAttachments(at: self.draft.attachments.count, itemProviders: results.map(\.itemProvider))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private func addDrawing() {
|
private func addDrawing() {
|
||||||
|
parent.deleteDraftOnDisappear = false
|
||||||
parent.config.presentDrawing?(PKDrawing()) { drawing in
|
parent.config.presentDrawing?(PKDrawing()) { drawing in
|
||||||
let attachment = DraftAttachment(context: DraftsPersistentContainer.shared.viewContext)
|
let attachment = DraftAttachment(context: DraftsPersistentContainer.shared.viewContext)
|
||||||
|
attachment.id = UUID()
|
||||||
attachment.drawing = drawing
|
attachment.drawing = drawing
|
||||||
attachment.draft = self.draft
|
attachment.draft = self.draft
|
||||||
self.draft.attachments.add(attachment)
|
self.draft.attachments.add(attachment)
|
||||||
|
|
|
@ -208,6 +208,7 @@ public final class ComposeController: ViewController {
|
||||||
do {
|
do {
|
||||||
try await poster.post()
|
try await poster.post()
|
||||||
|
|
||||||
|
deleteDraftOnDisappear = true
|
||||||
didPostSuccessfully = true
|
didPostSuccessfully = true
|
||||||
|
|
||||||
// wait .25 seconds so the user can see the progress bar has completed
|
// wait .25 seconds so the user can see the progress bar has completed
|
||||||
|
|
Loading…
Reference in New Issue