From d0f5ed490220085f730072a2c52590f8c6d3524a Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 26 Jul 2020 16:33:38 +0200 Subject: [PATCH] Fixed selecting selected TAN procedure and added a fallback if customersTanProcedures doesn't contain selected TAN procedure --- ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift index 4f004dbc..bc373480 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift @@ -39,7 +39,9 @@ struct EnterTanDialog: View { self.customersTanProcedures = customer.supportedTanProcedures.filter( {$0.type != .chiptanusb } ) // USB tan generators are not supported on iOS - _selectedTanProcedureIndex = State(initialValue: customer.supportedTanProcedures.firstIndex(of: tanChallenge.tanProcedure) ?? 0) + _selectedTanProcedureIndex = State(initialValue: customersTanProcedures.firstIndex(where: { $0.type == state.tanChallenge.tanProcedure.type } ) + ?? state.customer.supportedTanProcedures.firstIndex(where: { $0.type != .chiptanmanuell && $0.type != .chiptanusb } ) + ?? 0) self.customersTanMedia = customer.tanMediaSorted