Prevent dismissing compose screen while posting

This commit is contained in:
Shadowfacts 2023-09-09 11:35:46 -04:00
parent b2b15b8b6e
commit 173eda1757
2 changed files with 5 additions and 2 deletions

View File

@ -58,7 +58,7 @@ public final class ComposeController: ViewController {
private var isDisappearing = false
private var userConfirmedDelete = false
var isPosting: Bool {
public var isPosting: Bool {
poster != nil
}
@ -424,6 +424,7 @@ public final class ComposeController: ViewController {
// otherwise all Buttons in the nav bar are made semibold
.font(.system(size: 17, weight: .regular))
}
.disabled(controller.isPosting)
.confirmationDialog("Are you sure?", isPresented: $controller.isShowingSaveDraftSheet) {
// edit drafts can't be saved
if draft.editedStatusID == nil {

View File

@ -144,7 +144,9 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
// MARK: Duckable
func duckableViewControllerShouldDuck() -> DuckAttemptAction {
if controller.draft.hasContent {
if controller.isPosting {
return .block
} else if controller.draft.hasContent {
return .duck
} else {
return .dismiss