diff --git a/Harmonie.xcodeproj/project.pbxproj b/Harmonie.xcodeproj/project.pbxproj index cbe91dd..c69bee5 100644 --- a/Harmonie.xcodeproj/project.pbxproj +++ b/Harmonie.xcodeproj/project.pbxproj @@ -474,7 +474,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 0.9.8; + MARKETING_VERSION = 0.9.9; PRODUCT_BUNDLE_IDENTIFIER = jp.mknn.harmonie; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -510,7 +510,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 0.9.8; + MARKETING_VERSION = 0.9.9; PRODUCT_BUNDLE_IDENTIFIER = jp.mknn.harmonie; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/harmonie/Localization/Localizable.xcstrings b/harmonie/Localization/Localizable.xcstrings index 83405af..7092f38 100644 --- a/harmonie/Localization/Localizable.xcstrings +++ b/harmonie/Localization/Localizable.xcstrings @@ -1323,6 +1323,16 @@ } } }, + "Try again later" : { + "localizations" : { + "ja" : { + "stringUnit" : { + "state" : "translated", + "value" : "もう一度お試しください" + } + } + } + }, "Two-step verification" : { "localizations" : { "ja" : { diff --git a/harmonie/Modifiers/View+ErrorAlertModifier.swift b/harmonie/Modifiers/View+ErrorAlertModifier.swift index 8c68509..c2ac5ed 100644 --- a/harmonie/Modifiers/View+ErrorAlertModifier.swift +++ b/harmonie/Modifiers/View+ErrorAlertModifier.swift @@ -36,25 +36,28 @@ extension ErrorAlertModifier: ViewModifier { func body(content: Content) -> some View { @Bindable var appVM = appVM content - .alert( - isPresented: isThrownError(\.vrckError), - error: appVM.vrckError - ) { _ in - Button("OK") { - action() - } - } message: { error in - Text(error.failureReason ?? "Try again later.") - } - .alert( - isPresented: isThrownError(\.applicationError), - error: appVM.applicationError - ) { _ in - Button("OK") { - action() - } - } message: { error in - Text(error.failureReason ?? "Try again later.") - } + .errorAlert(isThrownError(\.vrckError), appVM.vrckError, action) + .errorAlert(isThrownError(\.applicationError), appVM.applicationError, action) + } +} + +private extension View { + func errorAlert( + _ isPresented: Binding, + _ error: E?, + _ action: @escaping () -> Void + ) -> some View where E: LocalizedError { + alert( + isPresented: isPresented, + error: error + ) { _ in + Button("OK", action: action) + } message: { error in + errorText(error) + } + } + + private func errorText(_ error: E) -> Text where E: LocalizedError { + Text(verbatim: error.failureReason ?? String(localized: "Try again later")) } } diff --git a/harmonie/Previews/Models/Instance.swift b/harmonie/Previews/Models/Instance.swift index f1caf06..fa6b160 100644 --- a/harmonie/Previews/Models/Instance.swift +++ b/harmonie/Previews/Models/Instance.swift @@ -26,7 +26,7 @@ extension PreviewData { instanceId(casino): Instance(world: casino, userCount: 25), instanceId(fuji): Instance(world: fuji, userCount: 25), instanceId(chinatown): Instance(world: chinatown, userCount: 25), - instanceId(nightCity): Instance(world: nightCity, userCount: 25), + instanceId(nightCity): Instance(world: nightCity, userCount: 25) ] }