소스 검색

cancel button to loginVC

nayooti 5 년 전
부모
커밋
f2d48552ed
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  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 {
 extension AppCoordinator: WelcomeCoordinator {
     func showLogin() {
     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)
         welcomeController.present(loginController, animated: true, completion: nil)
     }
     }
 
 
     func showQR() {
     func showQR() {
         return
         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
 // 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