Browse Source

handle default value in coordinator

nayooti 5 years ago
parent
commit
3a4c1512c3
1 changed files with 6 additions and 1 deletions
  1. 6 1
      deltachat-ios/Coordinator/AppCoordinator.swift

+ 6 - 1
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -81,7 +81,12 @@ class AppCoordinator: NSObject, Coordinator {
 
 
     public func start() {
     public func start() {
         let lastActiveTab = tabBarRestorer.restoreLastActiveTab()
         let lastActiveTab = tabBarRestorer.restoreLastActiveTab()
-        showTab(index: lastActiveTab)
+        if lastActiveTab == -1 {
+            // no stored tab
+            showTab(index: chatsTab)
+        } else {
+            showTab(index: lastActiveTab)
+        }
     }
     }
 
 
     func showTab(index: Int) {
     func showTab(index: Int) {