Added TanProcedures, TanMedia, TanChallenge, ImageTanChallenge and FlickerCodeTanChallenge to PreviewData

This commit is contained in:
dankito 2020-08-24 12:14:04 +02:00
parent 22c262f4c4
commit 003b4b3b55
3 changed files with 31 additions and 13 deletions

View File

@ -4,6 +4,17 @@ import BankingUiSwift
let previewBanks = createPreviewBanks() 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] { func createPreviewBanks() -> [Customer] {
let bank1 = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "", bankName: "Abzockbank", bic: "", customerName: "Marieke Musterfrau", userId: "", iconUrl: "", accounts: []) 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 ] 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)
]
}

View File

@ -213,18 +213,11 @@ struct EnterTanDialog: View {
struct EnterTanDialog_Previews: PreviewProvider { struct EnterTanDialog_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
let customer = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "") let customer = Customer(bankCode: "", customerId: "", password: "", finTsServerAddress: "")
customer.supportedTanProcedures = [ customer.supportedTanProcedures = previewTanProcedures
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.tanMedia = [ customer.tanMedia = previewTanMedia
TanMedium(displayName: "EC-Karte mit Nummer 12345678", status: .available),
TanMedium(displayName: "Handy mit Nummer 0170 / 12345678", status: .available)
]
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 }) let enterTanState = EnterTanState(customer, tanChallenge, { result in })

View File

@ -72,9 +72,7 @@ struct ImageTanView: View {
struct ImageTanView_Previews: PreviewProvider { struct ImageTanView_Previews: PreviewProvider {
static var previews: some View { 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(previewImageTanChallenge)
return ImageTanView(tanChallenge)
} }
} }