Implemented showing 'Discard' instead of 'OK' to discard changes
This commit is contained in:
parent
aaa22bc2c1
commit
974d427e1a
|
@ -2,6 +2,7 @@
|
||||||
"OK" = "OK";
|
"OK" = "OK";
|
||||||
"Cancel" = "Cancel";
|
"Cancel" = "Cancel";
|
||||||
"Done" = "Done";
|
"Done" = "Done";
|
||||||
|
"Discard" = "Discard";
|
||||||
|
|
||||||
"Add" = "Add";
|
"Add" = "Add";
|
||||||
"New" = "New";
|
"New" = "New";
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"OK" = "OK";
|
"OK" = "OK";
|
||||||
"Cancel" = "Abbrechen";
|
"Cancel" = "Abbrechen";
|
||||||
"Done" = "Fertig";
|
"Done" = "Fertig";
|
||||||
|
"Discard" = "Verwerfen";
|
||||||
|
|
||||||
"Add" = "Hinzufügen";
|
"Add" = "Hinzufügen";
|
||||||
"New" = "Neu";
|
"New" = "Neu";
|
||||||
|
|
|
@ -107,8 +107,16 @@ extension Color {
|
||||||
|
|
||||||
extension Alert.Button {
|
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 {
|
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() {
|
private func cancelPressed() {
|
||||||
if hasUnsavedData {
|
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 {
|
else {
|
||||||
closeDialog()
|
closeDialog()
|
||||||
|
|
|
@ -109,7 +109,7 @@ struct BankSettingsDialog: View {
|
||||||
|
|
||||||
private func cancelPressed() {
|
private func cancelPressed() {
|
||||||
if hasUnsavedData {
|
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 {
|
else {
|
||||||
closeDialog()
|
closeDialog()
|
||||||
|
|
Loading…
Reference in New Issue