Added context menu item to navigate to settings dialog
This commit is contained in:
parent
874d78d6ad
commit
9dc45cb53f
|
@ -19,11 +19,25 @@ struct BankAccountListItem : View {
|
|||
AmountLabel(amount: account.balance)
|
||||
}.frame(height: 35)
|
||||
}
|
||||
.contextMenu {
|
||||
Button(action: { self.navigateToBankAccountSettingsDialog() }) {
|
||||
HStack {
|
||||
Text("Settings")
|
||||
|
||||
Image(systemName: "gear")
|
||||
}
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
self.navigateToAccountTransactionsDialog = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private func navigateToBankAccountSettingsDialog() {
|
||||
SceneDelegate.navigateToView(BankAccountSettingsDialog(account))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,14 @@ struct BankListItem : View {
|
|||
}
|
||||
.frame(height: 35)
|
||||
.contextMenu {
|
||||
Button(action: { self.navigateToBankSettingsDialog() }) {
|
||||
HStack {
|
||||
Text("Settings")
|
||||
|
||||
Image(systemName: "gear")
|
||||
}
|
||||
}
|
||||
|
||||
Button(action: askUserToDeleteAccount) {
|
||||
HStack {
|
||||
Text("Delete account")
|
||||
|
@ -45,8 +53,12 @@ struct BankListItem : View {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private func navigateToBankSettingsDialog() {
|
||||
SceneDelegate.navigateToView(BankSettingsDialog(bank))
|
||||
}
|
||||
|
||||
func askUserToDeleteAccount() {
|
||||
private func askUserToDeleteAccount() {
|
||||
// couldn't believe it, .alert() didn't work as SwiftUI resetted @State variable to dislpay it instantly, therefore Alert never got displayed
|
||||
// TODO: use values from Message.createAskUserToDeleteAccountMessage(self.bank, self.deleteAccount)
|
||||
UIAlert(
|
||||
|
@ -57,7 +69,7 @@ struct BankListItem : View {
|
|||
).show()
|
||||
}
|
||||
|
||||
func deleteAccount(_ bank: Customer) {
|
||||
private func deleteAccount(_ bank: Customer) {
|
||||
presenter.deleteAccount(customer: bank)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue