Bläddra i källkod

allow to open a chat from every coordinator

cyberta 6 år sedan
förälder
incheckning
204c5a684f
1 ändrade filer med 14 tillägg och 0 borttagningar
  1. 14 0
      deltachat-ios/Coordinator/AppCoordinator.swift

+ 14 - 0
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -98,6 +98,15 @@ class AppCoordinator: NSObject, Coordinator {
         tabBarController.selectedIndex = index
     }
 
+    func showChat(chatId: Int) {
+        showTab(index: 3)
+        let navController = self.chatListController as! UINavigationController
+        let chatVC = ChatViewController(chatId: chatId)
+        let coordinator = ChatViewCoordinator(navigationController: navController, chatId: chatId)
+        chatVC.coordinator = coordinator
+        navController.pushViewController(chatVC, animated: true)
+    }
+
     func presentLoginController() {
         let accountSetupController = AccountSetupController()
         let accountSetupNav = DCNavigationController(rootViewController: accountSetupController)
@@ -182,6 +191,11 @@ class ProfileCoordinator: Coordinator {
 	init(navigationController: UINavigationController) {
 		self.navigationController = navigationController
     }
+
+    func showChat(chatId: Int) {
+        let appDelegate = UIApplication.shared.delegate as! AppDelegate
+        appDelegate.appCoordinator.showChat(chatId: chatId)
+    }
 }
 
 class ChatListCoordinator: Coordinator {