From a9e444d083d9f83647dcaf43b41f87e545dff37f Mon Sep 17 00:00:00 2001 From: Fateme' Kazemi Date: Wed, 6 Feb 2019 11:55:52 +0330 Subject: [PATCH] Snackbar messages #49 --- MobileToken/en.lproj/Localizable.strings | 12 +++- ...AuthenticationPasswordViewController.swift | 4 +- .../AuthenticationPatternViewController.swift | 2 +- ...tionDefinitionPasswordViewController.swift | 6 +- ...ationDefinitionPatternViewController.swift | 6 +- .../ui/importtoken/ImportTokenPresenter.swift | 16 ++--- .../ImportTokenViewController.swift | 2 +- .../PhoneConfirmationViewController.swift | 6 +- .../phoneinput/PhoneInputViewController.swift | 4 +- ...tionDefinitionPasswordViewController.swift | 5 +- ...ationDefinitionPatternViewController.swift | 6 +- MobileToken/util/UIHelper.swift | 4 +- .../AuthenticationDefinition.storyboard | 19 +++++- .../nibs/addcard/AddCardPagerViewCell.swift | 4 +- .../nibs/addcard/AddCardPagerViewCell.xib | 2 +- .../view/nibs/otp/OtpViewDesignable.swift | 2 +- ...SettingAuthenticationDefinition.storyboard | 58 ++++++++++++++----- 17 files changed, 106 insertions(+), 52 deletions(-) diff --git a/MobileToken/en.lproj/Localizable.strings b/MobileToken/en.lproj/Localizable.strings index 56a1794..6cb6fee 100644 --- a/MobileToken/en.lproj/Localizable.strings +++ b/MobileToken/en.lproj/Localizable.strings @@ -8,11 +8,12 @@ // snackbar "sb_wrong_password" = "رمز اشتباه است"; "sb_wrong_pattern" = "الگو اشتباه است"; -"sb_try_for_second_time" = "برای بار دوم تلاش کنید"; -"sb_not_match" = "یکسان نیستند"; +"sb_try_for_second_time" = "برای بار دوم انجام دهید"; +"sb_patterns_not_match" = "الگو و تکرار آن مطابقت ندارند، دوباره تلاش کنید"; +"sb_passwords_not_match" = "رمز و تکرار آن برابر نیستند، دوباره تلاش کنید"; "sb_pattern_min_point_error" = "حداقل ۴ نقطه را متصل کنید"; "sb_bad_request" = "درخواست اشتباه است"; -"sb_activation_code_is_not_valid" = "کد فعال سازی معتبر نیست"; +"sb_activation_code_is_not_valid" = "کد فعال‌سازی اشتباه است"; "sb_SSM_is_not_available" = "SSM در دسترس نیست"; "sb_wrong_phone" = "شماره ای که وارد کردید اشتباه است"; "sb_successfully_done" = "با موفقیت انجام شد"; @@ -25,6 +26,11 @@ "sb_tokenimport_invalidcryptomoduleid" = "تفاوت در نوع رم"; "sb_tokenimport_invalidchecksum" = "عبارت ارزیابی اشتباه است"; +"sb_card_deleted_successfully" = "کارت حذف شد"; +"sb_card_deleted_unsuccessfully" = "حذف کارت با خطا مواجه شد"; +"sb_token_deleted_successfully" = "رمز اول/دوم با موفقیت حذف شد"; +"sb_token_deleted_unsuccessfully" = "حذف رمز اول/دوم با خطا مواجه شد"; +"sb_get_token_fail" = "اطلاعات دریافت رمز، اشتباه است"; //passWordHint "enter_at_least_eight_characters" = "شامل حداقل ۸ کاراکتر"; diff --git a/MobileToken/ui/authentication/password/AuthenticationPasswordViewController.swift b/MobileToken/ui/authentication/password/AuthenticationPasswordViewController.swift index 2fab06d..de84c7b 100755 --- a/MobileToken/ui/authentication/password/AuthenticationPasswordViewController.swift +++ b/MobileToken/ui/authentication/password/AuthenticationPasswordViewController.swift @@ -45,12 +45,12 @@ class AuthenticationPasswordViewController: UIViewController, UITextFieldDelegat } func showWrongPasswordError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_wrong_password(), color: R.color.errorColor()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_wrong_password(), color: R.color.errorDark()!) } func navigateToCardList() { self.authenticationDelegate?.navigateToCardList() - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_successfully_done(), color: R.color.eyeCatching()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_successfully_done(), color: R.color.secondaryDark()!) } func navigateToInputPhoneNumber() { diff --git a/MobileToken/ui/authentication/pattern/AuthenticationPatternViewController.swift b/MobileToken/ui/authentication/pattern/AuthenticationPatternViewController.swift index aaa29cd..464d048 100755 --- a/MobileToken/ui/authentication/pattern/AuthenticationPatternViewController.swift +++ b/MobileToken/ui/authentication/pattern/AuthenticationPatternViewController.swift @@ -38,7 +38,7 @@ class AuthenticationPatternViewController: UIViewController, AuthenticationPatte } func showWrongPatternError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_wrong_pattern(), color: R.color.errorColor()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_wrong_pattern(), color: R.color.errorDark()!) } func navigateToCardList() { diff --git a/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordViewController.swift b/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordViewController.swift index d7adad7..358e345 100755 --- a/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordViewController.swift +++ b/MobileToken/ui/authenticationdefinition/password/AuthenticationDefinitionPasswordViewController.swift @@ -6,6 +6,7 @@ class AuthenticationDefinitionPasswordViewController: UIViewController,UITextFie @IBOutlet weak var textFieldPassword: UITextField! @IBOutlet weak var textFieldConfirmPassword: UITextField! @IBOutlet var labelPasswordHint: UILabel! + @IBOutlet var labelSecondPassword: UILabel! var passwordIsValid = false var authenticationDefinitionPasswordPresenter: AuthenticationDefinitionPasswordPresenterProtocol? @@ -33,6 +34,7 @@ class AuthenticationDefinitionPasswordViewController: UIViewController,UITextFie textFieldConfirmPassword.layer.borderColor = R.color.buttonColor()?.cgColor textFieldPassword.becomeFirstResponder() labelPasswordHint.font = R.font.iranSansMobile(size: 12) + labelSecondPassword.font = R.font.iranSansMobile(size: 12) textFieldPassword.attributedPlaceholder = NSAttributedString(string: R.string.localizable.ph_password(), attributes: [NSAttributedString.Key.foregroundColor: R.color.buttonColor()!.withAlphaComponent(0.5)]) textFieldConfirmPassword.attributedPlaceholder = NSAttributedString(string:R.string.localizable.ph_confirm_password() , @@ -61,7 +63,7 @@ class AuthenticationDefinitionPasswordViewController: UIViewController,UITextFie @objc func textFieldPasswordDidChange(_ textField: UITextField) { if PasswordValidator.hasPasswordCapitalLetter(testStr: textField.text) { - var first = labelPasswordHint.text?.components(separatedBy: ",").first + } @@ -89,7 +91,7 @@ class AuthenticationDefinitionPasswordViewController: UIViewController,UITextFie } func showNotMatchError() { - + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_passwords_not_match(), color: R.color.errorDark()!) } func authenticationUpdatedAction() { diff --git a/MobileToken/ui/authenticationdefinition/pattern/AuthenticationDefinitionPatternViewController.swift b/MobileToken/ui/authenticationdefinition/pattern/AuthenticationDefinitionPatternViewController.swift index ef10c9c..96ca26f 100755 --- a/MobileToken/ui/authenticationdefinition/pattern/AuthenticationDefinitionPatternViewController.swift +++ b/MobileToken/ui/authenticationdefinition/pattern/AuthenticationDefinitionPatternViewController.swift @@ -43,17 +43,17 @@ class AuthenticationDefinitionPatternViewController: UIViewController, Authentic } func showNotMatchError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_not_match(), color: R.color.errorColor()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_patterns_not_match(), color: R.color.errorDark()!) } func showTryForSecondTimeMessage() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_try_for_second_time(), color: R.color.secondary()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_try_for_second_time(), color: R.color.secondaryDark()!) } func showPatternMinPointError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_pattern_min_point_error(), color: R.color.errorColor()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_pattern_min_point_error(), color: R.color.errorDark()!) } diff --git a/MobileToken/ui/importtoken/ImportTokenPresenter.swift b/MobileToken/ui/importtoken/ImportTokenPresenter.swift index c69a631..c6aea40 100644 --- a/MobileToken/ui/importtoken/ImportTokenPresenter.swift +++ b/MobileToken/ui/importtoken/ImportTokenPresenter.swift @@ -20,21 +20,21 @@ class ImportTokenPresenter: ImportTokenPresenterProtokol{ updateCard(card: card) } catch ParseTokenException.InvalidChecksumException{ - SnackBarHelper.init(message: R.string.localizable.sb_tokenimport_invalidchecksum(), color: R.color.primaryLight()!, duration: .middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_tokenimport_invalidchecksum(), color: R.color.errorDark()!, duration: .middle).show() } catch ParseTokenException.InvalidBankIdException { - SnackBarHelper.init(message: R.string.localizable.sb_tokenimport_invalidbankid(), color: R.color.primaryLight()!, duration: .middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_tokenimport_invalidbankid(), color: R.color.errorDark()!, duration: .middle).show() } catch ParseTokenException.InvalidCryptoModuleIdException { - SnackBarHelper.init(message: R.string.localizable.sb_tokenimport_invalidcryptomoduleid(), color: R.color.primaryLight()!, duration: .middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_tokenimport_invalidcryptomoduleid(), color: R.color.errorDark()!, duration: .middle).show() } catch ParseTokenException.NumberFormatException { - SnackBarHelper.init(message: R.string.localizable.everywhere_fail(), color: R.color.primaryLight()!, duration: .middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_get_token_fail(), color: R.color.errorDark()!, duration: .middle).show() } catch ParseTokenException.InvalidKeyException { - SnackBarHelper.init(message: R.string.localizable.everywhere_fail(), color: R.color.primaryLight()!, duration: .middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_get_token_fail(), color: R.color.errorDark()!, duration: .middle).show() } catch ParseTokenException.InvalidKeyException { - SnackBarHelper.init(message: R.string.localizable.everywhere_fail(), color: R.color.primaryLight()!, duration: .middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_get_token_fail(), color: R.color.errorDark()!, duration: .middle).show() } catch ParseTokenException.IllegalStateException { - SnackBarHelper.init(message: R.string.localizable.everywhere_fail(), color: R.color.primaryLight()!, duration: .middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_get_token_fail(), color: R.color.errorDark()!, duration: .middle).show() } catch { - SnackBarHelper.init(message: R.string.localizable.everywhere_fail(), color: R.color.primaryLight()!, duration: .middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_get_token_fail(), color: R.color.errorDark()!, duration: .middle).show() } } diff --git a/MobileToken/ui/importtoken/ImportTokenViewController.swift b/MobileToken/ui/importtoken/ImportTokenViewController.swift index a8096e9..1414c37 100644 --- a/MobileToken/ui/importtoken/ImportTokenViewController.swift +++ b/MobileToken/ui/importtoken/ImportTokenViewController.swift @@ -118,7 +118,7 @@ class ImportTokenViewController: BaseViewController,UITextViewDelegate,CardCellX @IBAction func onButtonAddCode(_ sender: UIButton) { if textViewAtmCode.text.count != 8 || textViewSmsCode.text.count != 120 { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_check_your_input(), color: R.color.errorColor()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_check_your_input(), color: R.color.errorDark()!) } else { let tokenPacket = textViewSmsCode.text + textViewAtmCode.text btConfirm.isEnabled = true diff --git a/MobileToken/ui/registration/phoneconfirmation/PhoneConfirmationViewController.swift b/MobileToken/ui/registration/phoneconfirmation/PhoneConfirmationViewController.swift index 5a1fec3..510f863 100644 --- a/MobileToken/ui/registration/phoneconfirmation/PhoneConfirmationViewController.swift +++ b/MobileToken/ui/registration/phoneconfirmation/PhoneConfirmationViewController.swift @@ -129,16 +129,16 @@ class PhoneConfirmationViewController: BaseViewController,PhoneConfirmationViewP func showBadRequestError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_activation_code_is_not_valid(), color: R.color.errorColor()!, duration: .middle) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_activation_code_is_not_valid(), color: R.color.errorDark()!, duration: .middle) } func showSSMNotAvailable() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_SSM_is_not_available(), color: R.color.errorColor()!, duration: .middle) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_SSM_is_not_available(), color: R.color.errorDark()!, duration: .middle) } func showServerError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_server_error(), color: R.color.errorColor()!, duration: .middle) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_server_error(), color: R.color.errorDark()!, duration: .middle) } func segue() { diff --git a/MobileToken/ui/registration/phoneinput/PhoneInputViewController.swift b/MobileToken/ui/registration/phoneinput/PhoneInputViewController.swift index fe93763..e8651c9 100644 --- a/MobileToken/ui/registration/phoneinput/PhoneInputViewController.swift +++ b/MobileToken/ui/registration/phoneinput/PhoneInputViewController.swift @@ -147,11 +147,11 @@ class PhoneInputViewController: BaseViewController, BankCollectionViewDelegate,C } //TODO(Fateme): CORRECT 400 AND STRINGS func showBadRequestError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_wrong_phone(), color: R.color.errorColor()!, duration: .middle) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_wrong_phone(), color: R.color.errorDark()!, duration: .middle) } func showServerError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_server_error(), color: R.color.errorColor()!, duration: .middle) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_server_error(), color: R.color.errorDark()!, duration: .middle) } func setBankList(banks : [Bank]) { diff --git a/MobileToken/ui/settings/settingauthenticationdefinition/password/SettingAuthenticationDefinitionPasswordViewController.swift b/MobileToken/ui/settings/settingauthenticationdefinition/password/SettingAuthenticationDefinitionPasswordViewController.swift index 2c16c4c..728a34a 100755 --- a/MobileToken/ui/settings/settingauthenticationdefinition/password/SettingAuthenticationDefinitionPasswordViewController.swift +++ b/MobileToken/ui/settings/settingauthenticationdefinition/password/SettingAuthenticationDefinitionPasswordViewController.swift @@ -5,6 +5,8 @@ class SettingAuthenticationDefinitionPasswordViewController: UIViewController,UI @IBOutlet weak var textFieldPassword: UITextField! @IBOutlet weak var textFieldConfirmPassword: UITextField! @IBOutlet var buttonConfirm: UIButton! + @IBOutlet var labelPasswordHint: UILabel! + @IBOutlet var labelSecondPassword: UILabel! var passwordIsValid = false var authenticationDefinitionPasswordPresenter: SettingAuthenticationDefinitionPasswordPresenterProtocol? @@ -32,7 +34,8 @@ class SettingAuthenticationDefinitionPasswordViewController: UIViewController,UI textFieldConfirmPassword.layer.borderWidth = 1 textFieldConfirmPassword.layer.borderColor = R.color.buttonColor()?.cgColor textFieldPassword.becomeFirstResponder() - //labelPasswordHint.font = R.font.iranSansMobile(size: 12) + labelPasswordHint.font = R.font.iranSansMobile(size: 12) + labelSecondPassword.font = R.font.iranSansMobile(size: 12) textFieldPassword.attributedPlaceholder = NSAttributedString(string: R.string.localizable.ph_password(), attributes: [NSAttributedString.Key.foregroundColor: R.color.buttonColor()!.withAlphaComponent(0.5)]) textFieldConfirmPassword.attributedPlaceholder = NSAttributedString(string:R.string.localizable.ph_confirm_password() , diff --git a/MobileToken/ui/settings/settingauthenticationdefinition/pattern/SettingAuthenticationDefinitionPatternViewController.swift b/MobileToken/ui/settings/settingauthenticationdefinition/pattern/SettingAuthenticationDefinitionPatternViewController.swift index 2759ebd..847d59c 100755 --- a/MobileToken/ui/settings/settingauthenticationdefinition/pattern/SettingAuthenticationDefinitionPatternViewController.swift +++ b/MobileToken/ui/settings/settingauthenticationdefinition/pattern/SettingAuthenticationDefinitionPatternViewController.swift @@ -45,17 +45,17 @@ class SettingAuthenticationDefinitionPatternViewController: UIViewController, Se } func showNotMatchError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_not_match(), color: R.color.errorColor()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_patterns_not_match(), color: R.color.errorDark()!) } func showTryForSecondTimeMessage() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_try_for_second_time(), color: R.color.secondary()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_try_for_second_time(), color: R.color.secondaryDark()!) } func showPatternMinPointError() { - UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_pattern_min_point_error(), color: R.color.errorColor()!) + UIHelper.showSpecificSnackBar(message: R.string.localizable.sb_pattern_min_point_error(), color: R.color.errorDark()!) } diff --git a/MobileToken/util/UIHelper.swift b/MobileToken/util/UIHelper.swift index 7b58cea..eef266f 100644 --- a/MobileToken/util/UIHelper.swift +++ b/MobileToken/util/UIHelper.swift @@ -40,11 +40,11 @@ class UIHelper { } static func showFailedSnackBar() { - SnackBarHelper.init(message: R.string.localizable.sb_bad_request(),color:R.color.errorColor()!, duration:TTGSnackbarDuration.middle).show() + SnackBarHelper.init(message: R.string.localizable.sb_bad_request(),color:R.color.errorDark()!, duration:TTGSnackbarDuration.middle).show() } static func showSuccessfulSnackBar(message:String) { - SnackBarHelper.init(message: message,color:R.color.eyeCatching()!, duration:TTGSnackbarDuration.middle).show() + SnackBarHelper.init(message: message,color:R.color.secondaryDark()!, duration:TTGSnackbarDuration.middle).show() } static func showSpecificSnackBar(message:String, color:UIColor) { diff --git a/MobileToken/view/authenticationdefinition/AuthenticationDefinition.storyboard b/MobileToken/view/authenticationdefinition/AuthenticationDefinition.storyboard index 63160e2..bf7eb7c 100644 --- a/MobileToken/view/authenticationdefinition/AuthenticationDefinition.storyboard +++ b/MobileToken/view/authenticationdefinition/AuthenticationDefinition.storyboard @@ -83,7 +83,7 @@ - + @@ -109,7 +109,13 @@ +