diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/Message.swift b/ui/BankingiOSApp/BankingiOSApp/ui/Message.swift index c0a34926..cc831db1 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/Message.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/Message.swift @@ -9,13 +9,20 @@ struct Message: Identifiable { let message: Text? + let primaryButton: Alert.Button - init(title: Text = Text(""), message: Text? = nil) { + let secondaryButton: Alert.Button? + + + init(title: Text = Text(""), message: Text? = nil, primaryButton: Alert.Button = .ok(), secondaryButton: Alert.Button? = nil) { self.title = title self.message = message + + self.primaryButton = primaryButton + self.secondaryButton = secondaryButton } - init(title: String = "", message: String? = nil) { + init(title: String = "", message: String? = nil, primaryButton: Alert.Button = .ok(), secondaryButton: Alert.Button? = nil) { self.title = Text(title) if let text = message { @@ -24,6 +31,9 @@ struct Message: Identifiable { else { self.message = nil } + + self.primaryButton = primaryButton + self.secondaryButton = secondaryButton } } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift index 1b8b1710..f9d080d3 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/AddAccountDialog.swift @@ -45,7 +45,7 @@ struct AddAccountDialog: View { } } .alert(item: $errorMessage) { message in - Alert(title: message.title, message: message.message, dismissButton: .ok()) + Alert(title: message.title, message: message.message, dismissButton: message.primaryButton) } .navigationBarTitle(Text("Add account"), displayMode: NavigationBarItem.TitleDisplayMode.inline) }