From 804636dcbbf6b182e87366c15e5b2cf008a08d42 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 28 Feb 2020 19:50:04 -0500 Subject: [PATCH] Don't show warning when loading draft on top of for empty statuses Closes #87 --- Tusker/Screens/Compose/ComposeViewController.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tusker/Screens/Compose/ComposeViewController.swift b/Tusker/Screens/Compose/ComposeViewController.swift index d1c9cae5..644cc863 100644 --- a/Tusker/Screens/Compose/ComposeViewController.swift +++ b/Tusker/Screens/Compose/ComposeViewController.swift @@ -632,7 +632,7 @@ extension ComposeViewController: DraftsTableViewControllerDelegate { } 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) alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (_) in completion(false) @@ -649,6 +649,10 @@ extension ComposeViewController: DraftsTableViewControllerDelegate { } func draftSelected(_ draft: DraftsManager.Draft) { + if hasChanges { + saveDraft() + } + self.currentDraft = draft inReplyToID = draft.inReplyToID