Merge branch 'VernissageApp:develop' into develop

This commit is contained in:
Xabi 2023-05-11 19:02:20 +02:00 committed by GitHub
commit 4d2f63feda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 22 additions and 10 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

@ -12,16 +12,17 @@ public class ErrorService {
private init() { }
public func handle(_ error: Error, message: String, showToastr: Bool = false) {
let localizedMessage = NSLocalizedString(message, comment: "Error message")
if showToastr {
switch error {
case is LocalizedError:
ToastrService.shared.showError(title: message, subtitle: error.localizedDescription)
default:
ToastrService.shared.showError(subtitle: message)
ToastrService.shared.showError(subtitle: localizedMessage)
}
}
let localizedMessage = NSLocalizedString(message, comment: "Error message")
print("Error ['\(localizedMessage)']: \(error.localizedDescription)")
}
}

View File

@ -1321,7 +1321,7 @@
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 141;
CURRENT_PROJECT_VERSION = 143;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageWidget/Info.plist;
@ -1349,7 +1349,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 141;
CURRENT_PROJECT_VERSION = 143;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageWidget/Info.plist;
@ -1376,7 +1376,7 @@
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 141;
CURRENT_PROJECT_VERSION = 143;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageShare/Info.plist;
@ -1403,7 +1403,7 @@
buildSettings = {
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 141;
CURRENT_PROJECT_VERSION = 143;
DEVELOPMENT_TEAM = B2U9FEKYP8;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = VernissageShare/Info.plist;
@ -1552,7 +1552,7 @@
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 141;
CURRENT_PROJECT_VERSION = 143;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES;
@ -1594,7 +1594,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 141;
CURRENT_PROJECT_VERSION = 143;
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
DEVELOPMENT_TEAM = B2U9FEKYP8;
ENABLE_PREVIEWS = YES;

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
}