Forráskód Böngészése

cancel button to loginVC

nayooti 5 éve
szülő
commit
f2d48552ed
1 módosított fájl, 12 hozzáadás és 0 törlés
  1. 12 0
      deltachat-ios/Coordinator/AppCoordinator.swift

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

@@ -145,12 +145,24 @@ class AppCoordinator: NSObject, Coordinator {
 
 extension AppCoordinator: WelcomeCoordinator {
     func showLogin() {
+        // add cancel button item to accountSetupController
+        if let nav = loginController as? UINavigationController, let viewController = nav.topViewController {
+            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(
+                title: String.localized("cancel"),
+                style: .done,
+                target: self, action: #selector(cancelButtonPressed(_:))
+            )
+        }
         welcomeController.present(loginController, animated: true, completion: nil)
     }
 
     func showQR() {
         return
     }
+
+    @objc private func cancelButtonPressed(_ sender: UIBarButtonItem) {
+        loginController.dismiss(animated: true, completion: nil)
+    }
 }
 
 // since mailbox and chatView -tab both use ChatViewController we want to be able to assign different functionality via coordinators -> therefore we override unneeded functions such as showChatDetail -> maybe find better solution in longterm