Showing an error message if user selects a bank that does not support FinTS 3.0
This commit is contained in:
parent
685693ab23
commit
4d2f464569
|
@ -21,6 +21,9 @@
|
||||||
"Select Bank Dialog Title" = "Select your bank ...";
|
"Select Bank Dialog Title" = "Select your bank ...";
|
||||||
"Search by bank code, bank name or city" = "Search by bank code, bank name or city";
|
"Search by bank code, bank name or city" = "Search by bank code, bank name or city";
|
||||||
|
|
||||||
|
"Bank does not support FinTS 3.0" = "Bank does not support FinTS 3.0";
|
||||||
|
"%@ does not support FinTS 3.0." = "%@ does not support FinTS 3.0.\n\nIn this app only banks supporting the German banking standard FinTS 3.0 can be used.";
|
||||||
|
|
||||||
|
|
||||||
/* AddAccountDialog */
|
/* AddAccountDialog */
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
"Select Bank Dialog Title" = "Bank auswählen";
|
"Select Bank Dialog Title" = "Bank auswählen";
|
||||||
"Search by bank code, bank name or city" = "Suche mittels Bankleitzahl, Bankname oder Ort";
|
"Search by bank code, bank name or city" = "Suche mittels Bankleitzahl, Bankname oder Ort";
|
||||||
|
|
||||||
|
"Bank does not support FinTS 3.0" = "FinTS 3.0 wird von Bank nicht unterstützt";
|
||||||
|
"%@ does not support FinTS 3.0." = "%@ unterstützt FinTS 3.0 nicht.\n\nIn dieser App können nur Banken verwendet werden, die den deutschen Online-Banking Standard FinTS 3.0 unterstützen.";
|
||||||
|
|
||||||
|
|
||||||
/* AddAccountDialog */
|
/* AddAccountDialog */
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,9 @@ struct SelectBankDialog: View {
|
||||||
@State private var searchResult: [BankInfo]
|
@State private var searchResult: [BankInfo]
|
||||||
|
|
||||||
|
|
||||||
|
@State private var errorMessage: Message? = nil
|
||||||
|
|
||||||
|
|
||||||
init(_ selectedBank: Binding<BankInfo?>) {
|
init(_ selectedBank: Binding<BankInfo?>) {
|
||||||
self._selectedBank = selectedBank
|
self._selectedBank = selectedBank
|
||||||
|
|
||||||
|
@ -55,12 +58,15 @@ struct SelectBankDialog: View {
|
||||||
// TODO: showing only the first 100 items is a workaround as SwiftUI tries to compare the two lists (to be able to animate them!) which takes extremely long for the full data set
|
// TODO: showing only the first 100 items is a workaround as SwiftUI tries to compare the two lists (to be able to animate them!) which takes extremely long for the full data set
|
||||||
List(searchResult.prefix(100), id: \.self) { bank in
|
List(searchResult.prefix(100), id: \.self) { bank in
|
||||||
BankInfoListItem(bank: bank)
|
BankInfoListItem(bank: bank)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
self.handleSelectedBank(bank)
|
self.handleSelectedBank(bank)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.alert(item: $errorMessage) { message in
|
||||||
|
Alert(title: message.title, message: message.message, dismissButton: message.primaryButton)
|
||||||
|
}
|
||||||
.showNavigationBarTitle("Select Bank Dialog Title")
|
.showNavigationBarTitle("Select Bank Dialog Title")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,9 +76,16 @@ struct SelectBankDialog: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func handleSelectedBank(_ bank: BankInfo) {
|
private func handleSelectedBank(_ bank: BankInfo) {
|
||||||
self.selectedBank = bank
|
if bank.supportsFinTs3_0 {
|
||||||
|
self.selectedBank = bank
|
||||||
|
|
||||||
presentation.wrappedValue.dismiss()
|
presentation.wrappedValue.dismiss()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self.selectedBank = nil
|
||||||
|
|
||||||
|
self.errorMessage = Message(title: Text("Bank does not support FinTS 3.0"), message: Text("\(bank.name) does not support FinTS 3.0."))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue