Selaa lähdekoodia

reuse appCoordinator's ability to show an arbitrary chat at a highlighted message in DocumentGalleryViewController's show-in-chat feature

cyberta 4 vuotta sitten
vanhempi
commit
92d9605ed5
1 muutettua tiedostoa jossa 3 lisäystä ja 11 poistoa
  1. 3 11
      deltachat-ios/Controller/DocumentGalleryController.swift

+ 3 - 11
deltachat-ios/Controller/DocumentGalleryController.swift

@@ -169,18 +169,10 @@ extension DocumentGalleryController {
 
 
     func redirectToMessage(of indexPath: IndexPath) {
     func redirectToMessage(of indexPath: IndexPath) {
         let msgId = fileMessageIds[indexPath.row]
         let msgId = fileMessageIds[indexPath.row]
+        let chatId = dcContext.getMessage(id: msgId).chatId
 
 
-        guard
-            let chatViewController = navigationController?.viewControllers.filter({ $0 is ChatViewController}).first as? ChatViewController,
-            let chatListController = navigationController?.viewControllers.filter({ $0 is ChatListController}).first as? ChatListController
-        else {
-            safe_fatalError("failed to retrieve chatViewController, chatListController in navigation stack")
-            return
+        if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
+            appDelegate.appCoordinator.showChat(chatId: chatId, msgId: msgId, animated: false, clearViewControllerStack: true)
         }
         }
-        self.navigationController?.viewControllers.remove(at: 1)
-        
-        chatViewController.highlightedMsg = msgId
-        self.navigationController?.pushViewController(chatViewController, animated: true)
-        self.navigationController?.setViewControllers([chatListController, chatViewController], animated: false)
     }
     }
 }
 }