diff --git a/Packages/ComposeUI/Sources/ComposeUI/Controllers/ComposeController.swift b/Packages/ComposeUI/Sources/ComposeUI/Controllers/ComposeController.swift index 0d10d17e..d5b94505 100644 --- a/Packages/ComposeUI/Sources/ComposeUI/Controllers/ComposeController.swift +++ b/Packages/ComposeUI/Sources/ComposeUI/Controllers/ComposeController.swift @@ -29,6 +29,7 @@ public final class ComposeController: ViewController { @Published public var currentAccount: (any AccountProtocol)? @Published public var showToolbar = true + @Published public var deleteDraftOnDisappear = true @Published var autocompleteController: AutocompleteController! @Published var toolbarController: ToolbarController! @@ -205,7 +206,7 @@ public final class ComposeController: ViewController { } func onDisappear() { - if !draft.hasContent || didPostSuccessfully { + if deleteDraftOnDisappear && (!draft.hasContent || didPostSuccessfully) { DraftsPersistentContainer.shared.viewContext.delete(draft) } DraftsPersistentContainer.shared.save() diff --git a/Tusker/Screens/Compose/ComposeHostingController.swift b/Tusker/Screens/Compose/ComposeHostingController.swift index 8713fac8..d1d2a281 100644 --- a/Tusker/Screens/Compose/ComposeHostingController.swift +++ b/Tusker/Screens/Compose/ComposeHostingController.swift @@ -137,6 +137,8 @@ class ComposeHostingController: UIHostingController