diff --git a/Session/Meta/Translations/de.lproj/Localizable.strings b/Session/Meta/Translations/de.lproj/Localizable.strings index 7a28e9977..b170774e7 100644 --- a/Session/Meta/Translations/de.lproj/Localizable.strings +++ b/Session/Meta/Translations/de.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/en.lproj/Localizable.strings b/Session/Meta/Translations/en.lproj/Localizable.strings index a44ec41ba..0ad0d0574 100644 --- a/Session/Meta/Translations/en.lproj/Localizable.strings +++ b/Session/Meta/Translations/en.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/es.lproj/Localizable.strings b/Session/Meta/Translations/es.lproj/Localizable.strings index cae2e1ba5..29166efa9 100644 --- a/Session/Meta/Translations/es.lproj/Localizable.strings +++ b/Session/Meta/Translations/es.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/fa.lproj/Localizable.strings b/Session/Meta/Translations/fa.lproj/Localizable.strings index 09deab863..3a620631a 100644 --- a/Session/Meta/Translations/fa.lproj/Localizable.strings +++ b/Session/Meta/Translations/fa.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/fi.lproj/Localizable.strings b/Session/Meta/Translations/fi.lproj/Localizable.strings index 94f286050..c94ad7498 100644 --- a/Session/Meta/Translations/fi.lproj/Localizable.strings +++ b/Session/Meta/Translations/fi.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/fr.lproj/Localizable.strings b/Session/Meta/Translations/fr.lproj/Localizable.strings index 28d7361a6..2e8cd975b 100644 --- a/Session/Meta/Translations/fr.lproj/Localizable.strings +++ b/Session/Meta/Translations/fr.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/hi.lproj/Localizable.strings b/Session/Meta/Translations/hi.lproj/Localizable.strings index df4852ab5..e1e8c7d04 100644 --- a/Session/Meta/Translations/hi.lproj/Localizable.strings +++ b/Session/Meta/Translations/hi.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/hr.lproj/Localizable.strings b/Session/Meta/Translations/hr.lproj/Localizable.strings index 061e61827..72364f2e5 100644 --- a/Session/Meta/Translations/hr.lproj/Localizable.strings +++ b/Session/Meta/Translations/hr.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/id-ID.lproj/Localizable.strings b/Session/Meta/Translations/id-ID.lproj/Localizable.strings index a92c316ba..cb2d89ebc 100644 --- a/Session/Meta/Translations/id-ID.lproj/Localizable.strings +++ b/Session/Meta/Translations/id-ID.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/it.lproj/Localizable.strings b/Session/Meta/Translations/it.lproj/Localizable.strings index e4f77fb83..f3f595d72 100644 --- a/Session/Meta/Translations/it.lproj/Localizable.strings +++ b/Session/Meta/Translations/it.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/ja.lproj/Localizable.strings b/Session/Meta/Translations/ja.lproj/Localizable.strings index b5d91bc73..9c40469eb 100644 --- a/Session/Meta/Translations/ja.lproj/Localizable.strings +++ b/Session/Meta/Translations/ja.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/nl.lproj/Localizable.strings b/Session/Meta/Translations/nl.lproj/Localizable.strings index e771530de..786bd4f0a 100644 --- a/Session/Meta/Translations/nl.lproj/Localizable.strings +++ b/Session/Meta/Translations/nl.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/pl.lproj/Localizable.strings b/Session/Meta/Translations/pl.lproj/Localizable.strings index cf81ca9d6..66e3913b2 100644 --- a/Session/Meta/Translations/pl.lproj/Localizable.strings +++ b/Session/Meta/Translations/pl.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings index 482cef21b..2fe421932 100644 --- a/Session/Meta/Translations/pt_BR.lproj/Localizable.strings +++ b/Session/Meta/Translations/pt_BR.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/ru.lproj/Localizable.strings b/Session/Meta/Translations/ru.lproj/Localizable.strings index d3b8ec6da..ba6d89b2a 100644 --- a/Session/Meta/Translations/ru.lproj/Localizable.strings +++ b/Session/Meta/Translations/ru.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/si.lproj/Localizable.strings b/Session/Meta/Translations/si.lproj/Localizable.strings index b9d5dbd4a..159065011 100644 --- a/Session/Meta/Translations/si.lproj/Localizable.strings +++ b/Session/Meta/Translations/si.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/sk.lproj/Localizable.strings b/Session/Meta/Translations/sk.lproj/Localizable.strings index c8dcc438b..1d092ae6a 100644 --- a/Session/Meta/Translations/sk.lproj/Localizable.strings +++ b/Session/Meta/Translations/sk.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/sv.lproj/Localizable.strings b/Session/Meta/Translations/sv.lproj/Localizable.strings index 89db9b794..e2f327681 100644 --- a/Session/Meta/Translations/sv.lproj/Localizable.strings +++ b/Session/Meta/Translations/sv.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/th.lproj/Localizable.strings b/Session/Meta/Translations/th.lproj/Localizable.strings index bd813f517..8ead19603 100644 --- a/Session/Meta/Translations/th.lproj/Localizable.strings +++ b/Session/Meta/Translations/th.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings index 87d515e00..897b50013 100644 --- a/Session/Meta/Translations/vi-VN.lproj/Localizable.strings +++ b/Session/Meta/Translations/vi-VN.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings index 8a8b52243..fa0ce4e0c 100644 --- a/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh-Hant.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings index e5a2e0ced..3906dae4c 100644 --- a/Session/Meta/Translations/zh_CN.lproj/Localizable.strings +++ b/Session/Meta/Translations/zh_CN.lproj/Localizable.strings @@ -681,3 +681,6 @@ "onboarding_load_account_title" = "Load Account"; "onboarding_load_account_waiting" = "One moment please.."; "onboarding_loading_account" = "Loading your account"; +"recovery_password_error_length" = "The Recovery Password you entered is not long enough. Please check and try again."; +"recovery_password_error_invalid" = "Some of the words in your Recovery Password are incorrect. Please check and try again."; +"recovery_password_error_generic" = "Please check your Recovery Password and try again."; diff --git a/Session/Onboarding/LoadAccountView.swift b/Session/Onboarding/LoadAccountView.swift index bfc5efd92..7263b2099 100644 --- a/Session/Onboarding/LoadAccountView.swift +++ b/Session/Onboarding/LoadAccountView.swift @@ -10,7 +10,7 @@ struct LoadAccountView: View { @State var tabIndex = 0 @State private var recoveryPassword: String = "" - @State private var error: String? = nil + @State private var errorString: String? = nil var body: some View { NavigationView { @@ -29,8 +29,8 @@ struct LoadAccountView: View { if tabIndex == 0 { EnterRecoveryPasswordView( $recoveryPassword, - error: $error, - continueWithSeed: continueWithSeed + error: $errorString, + continueWithMnemonic: continueWithMnemonic ) } else { @@ -41,9 +41,26 @@ struct LoadAccountView: View { } } - func continueWithSeed() { + func continueWithMnemonic() { let mnemonic = recoveryPassword.lowercased() - guard let hexEncodedSeed = try? Mnemonic.decode(mnemonic: mnemonic) else { return } + let hexEncodedSeed: String + do { + hexEncodedSeed = try Mnemonic.decode(mnemonic: mnemonic) + } catch { + if let decodingError = error as? Mnemonic.DecodingError { + switch decodingError { + case .inputTooShort: + errorString = "recovery_password_error_length".localized() + case .invalidWord: + errorString = "recovery_password_error_invalid".localized() + default: + errorString = "recovery_password_error_generic".localized() + } + } else { + errorString = "recovery_password_error_generic".localized() + } + return + } let seed = Data(hex: hexEncodedSeed) if (seed.count != 16) { //TODO: show error @@ -134,16 +151,16 @@ struct EnterRecoveryPasswordView: View{ @Binding var recoveryPassword: String @Binding var error: String? - var continueWithSeed: (() -> Void)? + var continueWithMnemonic: (() -> Void)? init( _ recoveryPassword: Binding, error: Binding, - continueWithSeed: (() -> Void)? + continueWithMnemonic: (() -> Void)? ) { self._recoveryPassword = recoveryPassword self._error = error - self.continueWithSeed = continueWithSeed + self.continueWithMnemonic = continueWithMnemonic } var body: some View{ @@ -179,7 +196,7 @@ struct EnterRecoveryPasswordView: View{ Spacer() Button { - continueWithSeed?() + continueWithMnemonic?() } label: { Text("continue_2".localized()) .bold()