refactor: improve alert error context and copy action

This commit is contained in:
世界
2026-02-08 18:25:55 +08:00
parent a86dfc26d1
commit 8897e6deeb
32 changed files with 125 additions and 82 deletions
@@ -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)
}
}
}