Parcourir la source

fixed bug that welcomescreen was stuck with spinner

nayooti il y a 5 ans
Parent
commit
7f213431a7

+ 1 - 1
deltachat-ios/Controller/AccountSetupController.swift

@@ -825,7 +825,7 @@ class AccountSetupController: UITableViewController {
             appDelegate.open()
             appDelegate.open()
             appDelegate.start()
             appDelegate.start()
 
 
-            appDelegate.appCoordinator.presentWelcomeController()
+            appDelegate.appCoordinator.presentWelcomeController(animated: true)
         }))
         }))
         alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel))
         alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel))
         present(alert, animated: true, completion: nil)
         present(alert, animated: true, completion: nil)

+ 15 - 2
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -88,7 +88,7 @@ class AppCoordinator: NSObject, Coordinator {
         if dcContext.isConfigured() {
         if dcContext.isConfigured() {
             presentTabBarController()
             presentTabBarController()
         } else {
         } else {
-            presentWelcomeController()
+            showWelomeController()
         }
         }
     }
     }
 
 
@@ -130,7 +130,19 @@ class AppCoordinator: NSObject, Coordinator {
         }
         }
     }
     }
 
 
-    func presentWelcomeController() {
+    func presentWelcomeController(animated: Bool) {
+        if animated {
+            welcomeController.setTransitionState(true)
+            showWelomeController()
+            DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
+                self.welcomeController.setTransitionState(false)
+            }
+        } else {
+            showWelomeController()
+        }
+    }
+
+    private func showWelomeController() {
         window.rootViewController = welcomeController
         window.rootViewController = welcomeController
         window.makeKeyAndVisible()
         window.makeKeyAndVisible()
     }
     }
@@ -166,6 +178,7 @@ extension AppCoordinator: WelcomeCoordinator {
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
             self.loginController.dismiss(animated: true) {
             self.loginController.dismiss(animated: true) {
                 self.presentTabBarController()
                 self.presentTabBarController()
+                self.welcomeController.setTransitionState(false)
             }
             }
         }
         }
     }
     }