Skip to content

Commit

Permalink
🌐 (AccountKit): Add SignOut localization and fixup previous
Browse files Browse the repository at this point in the history
  • Loading branch information
macteuts committed Feb 5, 2024
1 parent 6440154 commit f53b264
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 76 deletions.
128 changes: 73 additions & 55 deletions Modules/AccountKit/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
@@ -1,60 +1,78 @@
{
"version": "1.0",
"sourceLanguage": "en",
"strings": {
"accountkit.auth_manager.signup_failed_error": {
"comment": "Sign-up failure error message",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Sign-up failed. Please try again later."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "L'inscription a \u00e9chou\u00e9. Veuillez r\u00e9essayer plus tard."
}
}
}
"sourceLanguage": "en",
"strings": {
"accountkit.auth_manager_view_model.verification_email_success_notification": {
"comment": "Verification email success notification message",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Verification email sent. Please check your inbox."
}
},
"accountkit.auth_manager.verification_email_failed_error": {
"comment": "Verification email failure error message",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "There was an error sending the verification email. Please try again later."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Une erreur s'est produite lors de l'envoi de l'e-mail de v\u00e9rification. Veuillez r\u00e9essayer plus tard."
}
}
}
"fr": {
"stringUnit": {
"state": "translated",
"value": "L'email de vérification a été envoyé. Veuillez vérifier votre boîte de réception."
}
}
}
},
"accountkit.auth_manager.signup_failed_error": {
"comment": "Sign-up failure error message",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Sign-up failed. Please try again later."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "L'inscription a échoué. Veuillez réessayer plus tard."
}
}
}
},
"accountkit.auth_manager.verification_email_failed_error": {
"comment": "Verification email failure error message",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "There was an error sending the verification email. Please try again later."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "Une erreur s'est produite lors de l'envoi de l'e-mail de vérification. Veuillez réessayer plus tard."
}
}
}
},
"accountkit.auth_manager.signout_failed_error": {
"comment": "Sign-out failure error message",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Failed to sign out. Please try again."
}
},
"accountkit.auth_manager_view_model.verification_email_success_notification": {
"comment": "Verification email success notification message",
"extractionState": "extracted_with_value",
"localizations": {
"en": {
"stringUnit": {
"state": "new",
"value": "Verification email sent. Please check your inbox."
}
},
"fr": {
"stringUnit": {
"state": "translated",
"value": "L'email de v\u00e9rification a \u00e9t\u00e9 envoy\u00e9. Veuillez v\u00e9rifier votre bo\u00eete de r\u00e9ception."
}
}
}
"fr": {
"stringUnit": {
"state": "translated",
"value": "La déconnexion a échoué. Veuillez réessayer."
}
}
}
}
}
},
"version": "1.0"
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import LocalizationKit
// swiftlint:disable line_length

extension l10n {
enum AccountManager {
enum AuthManager {
static let signupFailedError = LocalizedString("accountkit.auth_manager.signup_failed_error", value: "Sign-up failed. Please try again later.", comment: "Sign-up failure error message")

static let verificationEmailFailure = LocalizedString("accountkit.auth_manager.verification_email_failed_error", value: "There was an error sending the verification email. Please try again later.", comment: "Verification email failure error message")

static let signOutFailedError = LocalizedString("accountkit.auth_manager.signout_failed_error", value: "Failed to sign out. Please try again.", comment: "Sign-out failure error message")
}
}

Expand Down
8 changes: 4 additions & 4 deletions Modules/AccountKit/Sources/Authentication/AuthManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class AuthManager {
break
case let .failure(error):
log.error("\(error.localizedDescription)")
let errorMessage = "Sign-up failed. Please try again later."
let errorMessage = String(l10n.AuthManager.signupFailedError.characters)
self?.authenticationError.send(AuthenticationError.custom(message: errorMessage))
}
}, receiveValue: { [weak self] result in
Expand All @@ -52,7 +52,7 @@ public class AuthManager {
currentUser.sendEmailVerification { [weak self] error in
if let error {
log.error("\(error.localizedDescription)")
let errorMessage = "There was an error sending the verification email. Please try again later."
let errorMessage = String(l10n.AuthManager.verificationEmailFailure.characters)
self?.authenticationError.send(AuthenticationError.custom(message: errorMessage))
return
}
Expand All @@ -63,10 +63,10 @@ public class AuthManager {
do {
try self.auth.signOut()
self.authenticationState.send(.loggedOut)
log.notice("User was successfully signed out.")
log.info("User was successfully signed out.")
} catch {
log.error("Sign out failed: \(error.localizedDescription)")
let errorMessage = "Failed to sign out. Please try again."
let errorMessage = String(l10n.AuthManager.signOutFailedError.characters)
self.authenticationError.send(AuthenticationError.custom(message: errorMessage))
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Leka - iOS Monorepo
// Copyright APF France handicap
// SPDX-License-Identifier: Apache-2.0

import LocalizationKit

// swiftlint:disable line_length

extension l10n {
enum AuthManagerViewModel {
static let successfulEmailVerification = LocalizedString("accountkit.auth_manager_view_model.verification_email_success_notification", value: "Verification email sent. Please check your inbox.", comment: "Verification email success notification message")
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class AuthManagerViewModel: ObservableObject {
switch state {
case .loggedIn:
if self.userIsSigningUp {
self.notificationMessage = "Verification email sent. Please check your inbox."
self.notificationMessage = String(l10n.AuthManagerViewModel.successfulEmailVerification.characters)
self.showNotificationAlert = true
} else {
// Handle unverified Sign-in
Expand Down

0 comments on commit f53b264

Please sign in to comment.