Skip to content

Commit

Permalink
Merge pull request #192 from makinosp/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
makinosp authored Nov 12, 2024
2 parents e61055d + caf0ddb commit 2cfc8d2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Harmonie.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions harmonie/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,16 @@
}
}
},
"Try again later" : {
"localizations" : {
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "もう一度お試しください"
}
}
}
},
"Two-step verification" : {
"localizations" : {
"ja" : {
Expand Down
43 changes: 23 additions & 20 deletions harmonie/Modifiers/View+ErrorAlertModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<E>(
_ isPresented: Binding<Bool>,
_ 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<E>(_ error: E) -> Text where E: LocalizedError {
Text(verbatim: error.failureReason ?? String(localized: "Try again later"))
}
}
2 changes: 1 addition & 1 deletion harmonie/Previews/Models/Instance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]
}

Expand Down

0 comments on commit 2cfc8d2

Please sign in to comment.