Fix issue with not redirecting to sign in when refresh credentials fails

This commit is contained in:
Marcin Czachurski 2023-05-10 07:39:36 +02:00
parent 4e896e12b9
commit cfae36e267
6 changed files with 13 additions and 2 deletions

View File

@ -9,6 +9,8 @@
"global.title.showMore" = "Show more";
"global.title.showLess" = "Show less";
"global.title.close" = "Close";
"global.error.refreshingCredentialsTitle" = "Refreshing credentials error.";
"global.error.refreshingCredentialsSubtitle" = "Please sign in again to Pixelfed.";
// MARK: Global errors.
"global.error.unexpected" = "Unexpected error.";

View File

@ -9,6 +9,8 @@
"global.title.showMore" = "Erakutsi gehiago";
"global.title.showLess" = "Erakutsi gutxiago";
"global.title.close" = "Itxi";
"global.error.refreshingCredentialsTitle" = "Refreshing credentials error.";
"global.error.refreshingCredentialsSubtitle" = "Please sign in again to Pixelfed.";
// MARK: Global errors.
"global.error.unexpected" = "Espero ez zen errorea.";

View File

@ -9,6 +9,8 @@
"global.title.showMore" = "Montrer plus";
"global.title.showLess" = "Montrer moins";
"global.title.close" = "Fermer";
"global.error.refreshingCredentialsTitle" = "Refreshing credentials error.";
"global.error.refreshingCredentialsSubtitle" = "Please sign in again to Pixelfed.";
// MARK: Global errors.
"global.error.unexpected" = "Erreur inattendue.";

View File

@ -9,6 +9,8 @@
"global.title.showMore" = "Pokaż więcej";
"global.title.showLess" = "Pokaż mniej";
"global.title.close" = "Zamknij";
"global.error.refreshingCredentialsTitle" = "Błąd odświeżania danych uwierzytelniających.";
"global.error.refreshingCredentialsSubtitle" = "Prosimy o ponowne zalogowanie się do Pixelfed.";
// MARK: Global errors.
"global.error.unexpected" = "Wystąpił nieoczekiwany błąd.";

View File

@ -41,7 +41,10 @@ public class AuthorizationService {
let signedInAccountModel = try await self.refreshCredentials(for: accountModel, presentationContextProvider: session)
result(signedInAccountModel)
} catch {
ErrorService.shared.handle(error, message: "Issues during refreshing credentials.", showToastr: true)
ErrorService.shared.handle(error, message: "Issues during refreshing credentials.")
ToastrService.shared.showError(title: "global.error.refreshingCredentialsTitle",
subtitle: NSLocalizedString("global.error.refreshingCredentialsSubtitle", comment: ""))
result(nil)
}
}
}

View File

@ -279,7 +279,7 @@ struct MainView: View {
await AuthorizationService.shared.verifyAccount(session: authorizationSession, accountModel: accountModel) { signedInAccountModel in
guard let signedInAccountModel else {
ToastrService.shared.showError(subtitle: "mainview.error.switchAccounts")
ToastrService.shared.showError(subtitle: NSLocalizedString("mainview.error.switchAccounts", comment: "Cannot switch accounts."))
return
}