Przeglądaj źródła

target comments of @jonasreinsch

B. Petersen 6 lat temu
rodzic
commit
f3fbb2de15

+ 7 - 5
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -100,12 +100,14 @@ class AppCoordinator: NSObject, Coordinator {
 
 
     func showChat(chatId: Int) {
     func showChat(chatId: Int) {
         showTab(index: 3)
         showTab(index: 3)
-        if let navController = self.chatListController as? UINavigationController {
-            let chatVC = ChatViewController(dcContext: dcContext, chatId: chatId)
-            let coordinator = ChatViewCoordinator(dcContext: dcContext, navigationController: navController, chatId: chatId)
-            chatVC.coordinator = coordinator
-            navController.pushViewController(chatVC, animated: true)
+        guard let navController = self.chatListController as? UINavigationController else {
+            assertionFailure("huh? why no nav controller?")
+            return
         }
         }
+        let chatVC = ChatViewController(dcContext: dcContext, chatId: chatId)
+        let coordinator = ChatViewCoordinator(dcContext: dcContext, navigationController: navController, chatId: chatId)
+        chatVC.coordinator = coordinator
+        navController.pushViewController(chatVC, animated: true)
     }
     }
 
 
     func presentLoginController() {
     func presentLoginController() {

+ 1 - 3
deltachat-ios/DC/events.swift

@@ -48,9 +48,7 @@ public func callbackSwift(event: CInt, data1: CUnsignedLong, data2: CUnsignedLon
             if done {
             if done {
                 UserDefaults.standard.set(true, forKey: Constants.Keys.deltachatUserProvidedCredentialsKey)
                 UserDefaults.standard.set(true, forKey: Constants.Keys.deltachatUserProvidedCredentialsKey)
                 UserDefaults.standard.synchronize()
                 UserDefaults.standard.synchronize()
-                if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
-                    AppDelegate.lastErrorDuringConfig = nil
-                }
+                AppDelegate.lastErrorDuringConfig = nil
             }
             }
         }
         }
     case DC_EVENT_ERROR_NETWORK:
     case DC_EVENT_ERROR_NETWORK: