From d5ca3184541ddd1b36f7286e87cf28368bc78799 Mon Sep 17 00:00:00 2001 From: Fateme' Kazemi Date: Wed, 6 Feb 2019 12:24:42 +0330 Subject: [PATCH] Snackbar messages #49 --- .../AuthenticationPasswordPresenter.swift | 2 +- .../AuthenticationPasswordViewController.swift | 2 +- ...uthenticationDefinitionPasswordPresenter.swift | 2 +- ...ticationDefinitionPasswordViewController.swift | 15 +++++++-------- .../AuthenticationDefinition.storyboard | 3 +++ 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/MobileToken/ui/authentication/password/AuthenticationPasswordPresenter.swift b/MobileToken/ui/authentication/password/AuthenticationPasswordPresenter.swift index 4f6c28b..edaf8b2 100755 --- a/MobileToken/ui/authentication/password/AuthenticationPasswordPresenter.swift +++ b/MobileToken/ui/authentication/password/AuthenticationPasswordPresenter.swift @@ -32,7 +32,7 @@ class AuthenticationPasswordPresenter: AuthenticationPasswordPresenterProtocol { } else { self.authentication?.failAttempt() updateAuthentication(authentication: self.authentication!) - //self.authenticationPasswordView.showWrongPasswordError() + self.authenticationPasswordView.showWrongPasswordError() updateAuthentication(authentication: self.authentication!) if (authentication?.isLocked)! { self.authenticationPasswordView.navigateToLockView() diff --git a/MobileToken/ui/authentication/password/AuthenticationPasswordViewController.swift b/MobileToken/ui/authentication/password/AuthenticationPasswordViewController.swift index de84c7b..b4eee92 100755 --- a/MobileToken/ui/authentication/password/AuthenticationPasswordViewController.swift +++ b/MobileToken/ui/authentication/password/AuthenticationPasswordViewController.swift @@ -22,7 +22,6 @@ class AuthenticationPasswordViewController: UIViewController, UITextFieldDelegat func initUIComponent() { textFieldPassword.delegate = self - textFieldPassword.becomeFirstResponder() textFieldPassword.layer.borderColor = R.color.buttonColor()?.cgColor textFieldPassword.layer.borderWidth = 1 textFieldPassword.layer.cornerRadius = 5 @@ -46,6 +45,7 @@ class AuthenticationPasswordViewController: UIViewController, UITextFieldDelegat func showWrongPasswordError() { UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_wrong_password(), color: R.color.errorDark()!) + textFieldPassword.text = "" } func navigateToCardList() { diff --git a/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordPresenter.swift b/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordPresenter.swift index 8d8f3c3..e1810d8 100755 --- a/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordPresenter.swift +++ b/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordPresenter.swift @@ -42,7 +42,7 @@ class AuthenticationDefinitionPasswordPresenter: AuthenticationDefinitionPasswor if let error = repoResponse.error { print("\(error)") } else { - //UIHelper.showSuccessfulSnackBar(message: R.string.localizable.sb_successfully_done()) + UIHelper.showSuccessfulSnackBar(message: R.string.localizable.sb_successfully_done()) self!.authenticationDefinitionPasswordView.navigateToTabbar() self!.initScreenLocker() } diff --git a/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordViewController.swift b/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordViewController.swift index 358e345..bd3751f 100755 --- a/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordViewController.swift +++ b/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordViewController.swift @@ -24,7 +24,7 @@ class AuthenticationDefinitionPasswordViewController: UIViewController,UITextFie func initUIComponent() { self.hideKeyboardWhenTappedAround() textFieldPassword.addTarget(self, action: #selector(self.textFieldPasswordDidChange(_:)), for: UIControl.Event.editingChanged) - textFieldConfirmPassword.addTarget(self, action: #selector(self.textFieldConfirmPasswordDidChange(_:)), for: UIControl.Event.editingChanged) +// textFieldConfirmPassword.addTarget(self, action: #selector(self.textFieldConfirmPasswordDidChange(_:)), for: UIControl.Event.editingChanged) textFieldConfirmPassword.layer.cornerRadius = 5 textFieldConfirmPassword.isUserInteractionEnabled = false textFieldPassword.layer.cornerRadius = 5 @@ -60,16 +60,15 @@ class AuthenticationDefinitionPasswordViewController: UIViewController,UITextFie } + @IBAction func onDoneKeyboard(_ sender: Any) { + authenticationDefinitionPasswordPresenter?.checkPasswords(password: textFieldPassword.text!, confirmpassword: textFieldConfirmPassword.text!) + } @objc func textFieldPasswordDidChange(_ textField: UITextField) { if PasswordValidator.hasPasswordCapitalLetter(testStr: textField.text) { - } - - - if !checkPasswordIsValid(password: textFieldPassword.text!) { textFieldConfirmPassword.isUserInteractionEnabled = false textFieldConfirmPassword.text = nil @@ -86,9 +85,9 @@ class AuthenticationDefinitionPasswordViewController: UIViewController,UITextFie PasswordValidator.hasPasswordCustomCharacters(testStr: textFieldPassword.text)) } - @objc func textFieldConfirmPasswordDidChange(_ textField: UITextField) { - authenticationDefinitionPasswordPresenter?.checkPasswords(password: textFieldPassword.text!, confirmpassword: textFieldConfirmPassword.text!) - } +// @objc func textFieldConfirmPasswordDidChange(_ textField: UITextField) { +// authenticationDefinitionPasswordPresenter?.checkPasswords(password: textFieldPassword.text!, confirmpassword: textFieldConfirmPassword.text!) +// } func showNotMatchError() { UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_passwords_not_match(), color: R.color.errorDark()!) diff --git a/MobileToken/view/authenticationdefinition/AuthenticationDefinition.storyboard b/MobileToken/view/authenticationdefinition/AuthenticationDefinition.storyboard index bf7eb7c..baa4057 100644 --- a/MobileToken/view/authenticationdefinition/AuthenticationDefinition.storyboard +++ b/MobileToken/view/authenticationdefinition/AuthenticationDefinition.storyboard @@ -92,6 +92,9 @@ + + +