From 003b4b3b551756018d0d31329867cfb4effc2b43 Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 24 Aug 2020 12:14:04 +0200 Subject: [PATCH] Added TanProcedures, TanMedia, TanChallenge, ImageTanChallenge and FlickerCodeTanChallenge to PreviewData --- .../Preview Content/PreviewData.swift | 27 +++++++++++++++++++ .../ui/views/EnterTanDialog.swift | 13 +++------ .../BankingiOSApp/ui/views/ImageTanView.swift | 4 +-- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift b/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift index d76a3557..cdd65dd4 100644 --- a/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift +++ b/ui/BankingiOSApp/BankingiOSApp/Preview Content/PreviewData.swift @@ -4,6 +4,17 @@ import BankingUiSwift let previewBanks = createPreviewBanks() +let previewTanProcedures = createPreviewTanProcedures() + +let previewTanMedia = createPreviewTanMedia() + +let previewTanChallenge = TanChallenge(messageToShowToUser: "Hier ist eine Nachricht deiner Bank, die dir die Welt erklaert", tanProcedure: previewTanProcedures[0]) + +let previewImageTanChallenge = ImageTanChallenge(image: TanImage(mimeType: "image/png", imageBytes: KotlinByteArray(size: 0), decodingError: nil), messageToShowToUser: "", tanProcedure: previewTanProcedures[1]) + +let previewFlickerCodeTanChallenge = FlickerCodeTanChallenge(flickerCode: FlickerCode(challengeHHD_UC: "", parsedDataSet: "", decodingError: nil), messageToShowToUser: "", tanProcedure: previewTanProcedures[0]) + + func createPreviewBanks() -> [Customer] { let bank1 = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Abzockbank", bic: "", customerName: "Marieke Musterfrau", userId: "", iconUrl: "", accounts: []) @@ -22,3 +33,19 @@ func createPreviewBanks() -> [Customer] { return [ bank1, bank2 ] } + + +func createPreviewTanProcedures() -> [TanProcedure] { + return [ + TanProcedure(displayName: "chipTAN optisch", type: .chiptanflickercode, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .numeric), + TanProcedure(displayName: "chipTAN QR", type: .chiptanqrcode, bankInternalProcedureCode: "", maxTanInputLength: 8, allowedTanFormat: .numeric), + TanProcedure(displayName: "Secure Super Duper Plus", type: .apptan, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .alphanumeric) + ] +} + +func createPreviewTanMedia() -> [TanMedium] { + return [ + TanMedium(displayName: "EC-Karte mit Nummer 12345678", status: .available), + TanMedium(displayName: "Handy mit Nummer 0170 / 12345678", status: .available) + ] +} diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift index 5f6d50e1..4f5cdae0 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/EnterTanDialog.swift @@ -213,18 +213,11 @@ struct EnterTanDialog: View { struct EnterTanDialog_Previews: PreviewProvider { static var previews: some View { let customer = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "") - customer.supportedTanProcedures = [ - TanProcedure(displayName: "chipTAN optisch", type: .chiptanflickercode, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .numeric), - TanProcedure(displayName: "chipTAN QR", type: .chiptanqrcode, bankInternalProcedureCode: "", maxTanInputLength: 8, allowedTanFormat: .numeric), - TanProcedure(displayName: "Secure Super Duper Plus", type: .apptan, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .alphanumeric) - ] + customer.supportedTanProcedures = previewTanProcedures - customer.tanMedia = [ - TanMedium(displayName: "EC-Karte mit Nummer 12345678", status: .available), - TanMedium(displayName: "Handy mit Nummer 0170 / 12345678", status: .available) - ] + customer.tanMedia = previewTanMedia - let tanChallenge = TanChallenge(messageToShowToUser: "Hier ist eine Nachricht deiner Bank, die dir die Welt erklaert", tanProcedure: customer.supportedTanProcedures[0]) + let tanChallenge = previewTanChallenge let enterTanState = EnterTanState(customer, tanChallenge, { result in }) diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/ImageTanView.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/ImageTanView.swift index 9087d105..e7ad9f20 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/ImageTanView.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/ImageTanView.swift @@ -72,9 +72,7 @@ struct ImageTanView: View { struct ImageTanView_Previews: PreviewProvider { static var previews: some View { - let tanChallenge = ImageTanChallenge(image: TanImage(mimeType: "image/png", imageBytes: KotlinByteArray(size: 0), decodingError: nil), messageToShowToUser: "", tanProcedure: TanProcedure(displayName: "", type: .phototan, bankInternalProcedureCode: "", maxTanInputLength: 6, allowedTanFormat: .numeric)) - - return ImageTanView(tanChallenge) + return ImageTanView(previewImageTanChallenge) } }