Don't show warning when loading draft on top of for empty statuses

Closes #87
This commit is contained in:
Shadowfacts 2020-02-28 19:50:04 -05:00
parent 5bed38f661
commit 804636dcbb
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 5 additions and 1 deletions

View File

@ -632,7 +632,7 @@ extension ComposeViewController: DraftsTableViewControllerDelegate {
} }
func shouldSelectDraft(_ draft: DraftsManager.Draft, completion: @escaping (Bool) -> Void) { func shouldSelectDraft(_ draft: DraftsManager.Draft, completion: @escaping (Bool) -> Void) {
if draft.inReplyToID != self.inReplyToID { if draft.inReplyToID != self.inReplyToID, hasChanges {
let alertController = UIAlertController(title: "Different Reply", message: "The selected draft is a reply to a different status, do you wish to use it?", preferredStyle: .alert) let alertController = UIAlertController(title: "Different Reply", message: "The selected draft is a reply to a different status, do you wish to use it?", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (_) in alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (_) in
completion(false) completion(false)
@ -649,6 +649,10 @@ extension ComposeViewController: DraftsTableViewControllerDelegate {
} }
func draftSelected(_ draft: DraftsManager.Draft) { func draftSelected(_ draft: DraftsManager.Draft) {
if hasChanges {
saveDraft()
}
self.currentDraft = draft self.currentDraft = draft
inReplyToID = draft.inReplyToID inReplyToID = draft.inReplyToID