瀏覽代碼

Merge pull request #654 from deltachat/no-chatlist-flash

avoid flashing up the chatlist between qr-scan and enter-name
bjoern 5 年之前
父節點
當前提交
bf4f823bcf

+ 3 - 1
deltachat-ios/Controller/ProfileInfoViewController.swift

@@ -4,6 +4,8 @@ import DcCore
 class ProfileInfoViewController: UITableViewController {
 
     weak var coordinator: EditSettingsCoordinator?
+    var onClose: VoidFunction?
+
     private let dcContext: DcContext
 
     private var displayName: String?
@@ -130,7 +132,7 @@ class ProfileInfoViewController: UITableViewController {
 
     @objc private func doneButtonPressed(_ sender: UIBarButtonItem) {
         dcContext.displayname = displayName
-        self.dismiss(animated: true, completion: nil)
+        onClose?()
     }
 
     private func galleryButtonPressed(_ action: UIAlertAction) {

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

@@ -187,19 +187,17 @@ extension AppCoordinator: WelcomeCoordinator {
     }
 
     func handleQRAccountCreationSuccess() {
-        self.presentTabBarController()
-        showTab(index: 1)
-        presentProfileInfoController()
-    }
-
-    private func presentProfileInfoController() {
         let profileInfoController = ProfileInfoViewController(context: dcContext)
         let profileInfoNav = UINavigationController(rootViewController: profileInfoController)
         profileInfoNav.modalPresentationStyle = .fullScreen
         let coordinator = EditSettingsCoordinator(dcContext: dcContext, navigationController: profileInfoNav)
         profileInfoController.coordinator = coordinator
-        childCoordinators.append(coordinator)
-        tabBarController.present(profileInfoNav, animated: false, completion: nil)
+        profileInfoController.onClose = handleProfileInfoClosed
+        welcomeController?.present(profileInfoNav, animated: true, completion: nil)
+    }
+
+    private func handleProfileInfoClosed() {
+        presentTabBarController()
     }
 
     @objc private func cancelButtonPressed(_ sender: UIBarButtonItem) {