Implemented showing 'Discard' instead of 'OK' to discard changes
This commit is contained in:
parent
aaa22bc2c1
commit
974d427e1a
|
@ -2,6 +2,7 @@
|
|||
"OK" = "OK";
|
||||
"Cancel" = "Cancel";
|
||||
"Done" = "Done";
|
||||
"Discard" = "Discard";
|
||||
|
||||
"Add" = "Add";
|
||||
"New" = "New";
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
"OK" = "OK";
|
||||
"Cancel" = "Abbrechen";
|
||||
"Done" = "Fertig";
|
||||
"Discard" = "Verwerfen";
|
||||
|
||||
"Add" = "Hinzufügen";
|
||||
"New" = "Neu";
|
||||
|
|
|
@ -107,8 +107,16 @@ extension Color {
|
|||
|
||||
extension Alert.Button {
|
||||
|
||||
public static func `default`(_ label: String, _ action: (() -> Void)? = {}) -> Alert.Button {
|
||||
return .default(Text(label), action: action)
|
||||
}
|
||||
|
||||
public static func ok(_ action: (() -> Void)? = {}) -> Alert.Button {
|
||||
return .default(Text("OK"), action: action)
|
||||
return .default("OK", action)
|
||||
}
|
||||
|
||||
public static func discard(_ action: (() -> Void)? = {}) -> Alert.Button {
|
||||
return .destructive(Text("Discard"), action: action)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ struct BankAccountSettingsDialog: View {
|
|||
|
||||
private func cancelPressed() {
|
||||
if hasUnsavedData {
|
||||
self.unsavedChangesMessage = Message(title: Text("Unsaved changes"), message: Text("Changed data hasn't been saved. Are you sure you want to discard them?"), primaryButton: .ok(closeDialog), secondaryButton: .cancel())
|
||||
self.unsavedChangesMessage = Message(title: Text("Unsaved changes"), message: Text("Changed data hasn't been saved. Are you sure you want to discard them?"), primaryButton: .discard(closeDialog), secondaryButton: .cancel())
|
||||
}
|
||||
else {
|
||||
closeDialog()
|
||||
|
|
|
@ -109,7 +109,7 @@ struct BankSettingsDialog: View {
|
|||
|
||||
private func cancelPressed() {
|
||||
if hasUnsavedData {
|
||||
self.askUserToDeleteAccountOrSaveChangesMessage = Message(title: Text("Unsaved changes"), message: Text("Changed data hasn't been saved. Are you sure you want to discard them?"), primaryButton: .ok(closeDialog), secondaryButton: .cancel())
|
||||
self.askUserToDeleteAccountOrSaveChangesMessage = Message(title: Text("Unsaved changes"), message: Text("Changed data hasn't been saved. Are you sure you want to discard them?"), primaryButton: .discard(closeDialog), secondaryButton: .cancel())
|
||||
}
|
||||
else {
|
||||
closeDialog()
|
||||
|
|
Loading…
Reference in New Issue