refactor: improve alert error context and copy action
This commit is contained in:
@@ -195,7 +195,7 @@ public struct ClashModeCard: View {
|
||||
try LibboxNewStandaloneCommandClient()!.setClashMode(newMode)
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "set clash mode", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public struct ProfileCard: View {
|
||||
) { result in
|
||||
viewModel.exportDocument = nil
|
||||
if case let .failure(error) = result {
|
||||
viewModel.alert = AlertState(error: error)
|
||||
viewModel.alert = AlertState(action: "export profile", error: error)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -371,7 +371,7 @@ public struct ProfileCard: View {
|
||||
)
|
||||
#endif
|
||||
} catch {
|
||||
viewModel.alert = AlertState(error: error)
|
||||
viewModel.alert = AlertState(action: "share profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,7 +394,7 @@ public struct ProfileCard: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
viewModel.alert = AlertState(error: error)
|
||||
viewModel.alert = AlertState(action: "export profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -427,7 +427,7 @@ public struct ProfileCard: View {
|
||||
do {
|
||||
viewModel.qrsShareData = try await profile.origin.encodedContentDataAsync()
|
||||
} catch {
|
||||
viewModel.alert = AlertState(error: error)
|
||||
viewModel.alert = AlertState(action: "prepare QRS share", error: error)
|
||||
viewModel.showQRSShare = false
|
||||
}
|
||||
}
|
||||
@@ -536,7 +536,7 @@ extension ProfileCard {
|
||||
try await profile.updateRemoteProfile()
|
||||
environments.profileUpdate.send()
|
||||
} catch {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "update remote profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ struct ProfilePickerSheet: View {
|
||||
try await profile.origin.updateRemoteProfile()
|
||||
environments.profileUpdate.send()
|
||||
} catch {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "update remote profile", error: error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,7 +742,7 @@ private struct ProfilePickerRow: View {
|
||||
) { result in
|
||||
exportDocument = nil
|
||||
if case let .failure(error) = result {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "export profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -789,7 +789,7 @@ private struct ProfilePickerRow: View {
|
||||
) { result in
|
||||
exportDocument = nil
|
||||
if case let .failure(error) = result {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "export profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -919,7 +919,7 @@ private struct ProfilePickerRow: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "prepare QRS share", error: error)
|
||||
showQRSShare = false
|
||||
}
|
||||
}
|
||||
@@ -1015,7 +1015,7 @@ private struct ProfilePickerRow: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "export profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1067,7 +1067,7 @@ private struct ProfilePickerRow: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "share profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ private struct ProfilePickerRow: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "export profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1282,7 +1282,7 @@ private struct ProfilePickerRow: View {
|
||||
) { result in
|
||||
exportDocument = nil
|
||||
if case let .failure(error) = result {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "export profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1336,7 +1336,7 @@ private struct ProfilePickerRow: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "prepare QRS share", error: error)
|
||||
showQRSShare = false
|
||||
}
|
||||
}
|
||||
@@ -1405,7 +1405,7 @@ private struct ProfilePickerRow: View {
|
||||
}
|
||||
} catch {
|
||||
await MainActor.run {
|
||||
alert = AlertState(error: error)
|
||||
alert = AlertState(action: "export profile", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user