forked from shadowfacts/Tusker
Prevent dismissing compose screen while posting
This commit is contained in:
parent
b2b15b8b6e
commit
173eda1757
|
@ -58,7 +58,7 @@ public final class ComposeController: ViewController {
|
||||||
private var isDisappearing = false
|
private var isDisappearing = false
|
||||||
private var userConfirmedDelete = false
|
private var userConfirmedDelete = false
|
||||||
|
|
||||||
var isPosting: Bool {
|
public var isPosting: Bool {
|
||||||
poster != nil
|
poster != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,6 +424,7 @@ public final class ComposeController: ViewController {
|
||||||
// otherwise all Buttons in the nav bar are made semibold
|
// otherwise all Buttons in the nav bar are made semibold
|
||||||
.font(.system(size: 17, weight: .regular))
|
.font(.system(size: 17, weight: .regular))
|
||||||
}
|
}
|
||||||
|
.disabled(controller.isPosting)
|
||||||
.confirmationDialog("Are you sure?", isPresented: $controller.isShowingSaveDraftSheet) {
|
.confirmationDialog("Are you sure?", isPresented: $controller.isShowingSaveDraftSheet) {
|
||||||
// edit drafts can't be saved
|
// edit drafts can't be saved
|
||||||
if draft.editedStatusID == nil {
|
if draft.editedStatusID == nil {
|
||||||
|
|
|
@ -144,7 +144,9 @@ class ComposeHostingController: UIHostingController<ComposeHostingController.Vie
|
||||||
// MARK: Duckable
|
// MARK: Duckable
|
||||||
|
|
||||||
func duckableViewControllerShouldDuck() -> DuckAttemptAction {
|
func duckableViewControllerShouldDuck() -> DuckAttemptAction {
|
||||||
if controller.draft.hasContent {
|
if controller.isPosting {
|
||||||
|
return .block
|
||||||
|
} else if controller.draft.hasContent {
|
||||||
return .duck
|
return .duck
|
||||||
} else {
|
} else {
|
||||||
return .dismiss
|
return .dismiss
|
||||||
|
|
Loading…
Reference in New Issue