Skip to content
This repository has been archived by the owner on Aug 4, 2019. It is now read-only.

Commit

Permalink
Snackbar messages #49
Browse files Browse the repository at this point in the history
  • Loading branch information
Fateme' Kazemi authored and Fateme' Kazemi committed Feb 6, 2019
1 parent 95834d9 commit a9e444d
Show file tree
Hide file tree
Showing 17 changed files with 106 additions and 52 deletions.
12 changes: 9 additions & 3 deletions MobileToken/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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" = "با موفقیت انجام شد";
Expand All @@ -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" = "شامل حداقل ۸ کاراکتر";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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() ,
Expand Down Expand Up @@ -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


}

Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()!)

}

Expand Down
16 changes: 8 additions & 8 deletions MobileToken/ui/importtoken/ImportTokenPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down
2 changes: 1 addition & 1 deletion MobileToken/ui/importtoken/ImportTokenViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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() ,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()!)

}

Expand Down
4 changes: 2 additions & 2 deletions MobileToken/util/UIHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading

0 comments on commit a9e444d

Please sign in to comment.