Browse Source

save drafts before view controller gets removed and new view controller appears

cyberta 3 years ago
parent
commit
c09785845b
1 changed files with 2 additions and 1 deletions
  1. 2 1
      deltachat-ios/Chat/ChatViewController.swift

+ 2 - 1
deltachat-ios/Chat/ChatViewController.swift

@@ -478,6 +478,7 @@ class ChatViewController: UITableViewController {
         if parent == nil {
             // logger.debug("chat observer: remove")
             removeObservers()
+            draft.save(context: dcContext)
         } else {
             // logger.debug("chat observer: setup")
             setupObservers()
@@ -622,6 +623,7 @@ class ChatViewController: UITableViewController {
     @objc func applicationWillResignActive(_ notification: NSNotification) {
         if navigationController?.visibleViewController == self {
             handleUserVisibility(isVisible: false)
+            draft.save(context: dcContext)
         }
     }
     
@@ -632,7 +634,6 @@ class ChatViewController: UITableViewController {
             markSeenMessagesInVisibleArea()
         } else {
             stopTimer()
-            draft.save(context: dcContext)
         }
     }