Fixed selecting selected TAN procedure and added a fallback if customersTanProcedures doesn't contain selected TAN procedure

This commit is contained in:
dankito 2020-07-26 16:33:38 +02:00
parent 62f56977f9
commit d0f5ed4902
1 changed files with 3 additions and 1 deletions

View File

@ -39,7 +39,9 @@ struct EnterTanDialog: View {
self.customersTanProcedures = customer.supportedTanProcedures.filter( {$0.type != .chiptanusb } ) // USB tan generators are not supported on iOS 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 self.customersTanMedia = customer.tanMediaSorted