1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/*
* This file is part of GNU Taler, ©2022-23 Taler Systems S.A.
* See LICENSE.md
*/
import SwiftUI
import taler_swift
struct ManualDetailsV: View {
var common : TransactionCommon
var details : WithdrawalDetails
@AppStorage("iconOnly") var iconOnly: Bool = false
var body: some View {
if let paytoUris = details.exchangePaytoUris {
let payto = paytoUris[0]
let payURL = URL(string: payto)
let iban = payURL?.iban ?? "unknown IBAN"
let amount = common.amountRaw.readableDescription
Group {
Text(iconOnly ? "Transfer \(amount) to the Exchange."
: "You need to transfer \(amount) from your regular bank account to the Exchange.")
Text(iconOnly ? "Step 1: Copy+Paste this subject:"
: "Step 1: Copy this code and paste it into the subject/purpose field in your banking app or bank website:")
.multilineTextAlignment(.leading)
.listRowSeparator(.hidden)
if !iconOnly {
Text("This is mandatory, otherwise your money will not arrive in this wallet.")
.bold()
.multilineTextAlignment(.leading)
.listRowSeparator(.hidden)
}
HStack {
Text(details.reservePub)
.monospacedDigit()
.accessibilityLabel("Cryptocode")
Spacer()
CopyButton(textToCopy: details.reservePub, vertical: true)
.accessibilityLabel("Copy the cryptocode")
.disabled(false)
} .padding(.leading)
.listRowSeparator(.hidden)
Text(iconOnly ? "Step 2: Copy+Paste this IBAN:"
: "Step 2: If you don't already have it in your banking favourites list, then copy and paste this IBAN into the receiver IBAN field in your banking app or website:")
.multilineTextAlignment(.leading)
.listRowSeparator(.hidden)
HStack {
Text(iban)
.monospacedDigit()
.accessibilityLabel("IBAN of the exchange")
Spacer()
CopyButton(textToCopy: iban, vertical: true)
.accessibilityLabel("Copy the IBAN")
.disabled(false)
} .padding(.leading)
.padding(.top, -8)
.listRowSeparator(.hidden)
Text(iconOnly ? "Step 3: Transfer \(amount)."
: "Step 3: Finish the wire transfer of \(amount) in your banking app or website, then this withdrawal will proceed automatically.")
.multilineTextAlignment(.leading)
.listRowSeparator(.visible)
Text(iconOnly ? "Or use this PayTo-Link:"
: "Alternative: If your bank already supports PayTo, you can use this PayTo-Link instead:")
.multilineTextAlignment(.leading)
.padding(.top, 2)
.listRowSeparator(.hidden)
HStack {
Text(verbatim: "|") // only reason for this leading-aligned text is to get a nice full length listRowSeparator
.accessibilityHidden(true)
.foregroundColor(Color.clear)
Spacer()
ShareButton(textToShare: payto)
.accessibilityLabel("Share the PayTo URL")
.disabled(false)
Spacer()
} .listRowSeparator(.automatic)
}
.accessibilityFont(.body)
}
}
}
// MARK: -
#if DEBUG
struct ManualDetails_Previews: PreviewProvider {
static var previews: some View {
let common = TransactionCommon(type: .withdrawal,
txState: TransactionState(major: .done),
amountEffective: try! Amount(fromString: LONGCURRENCY + ":1.1"),
amountRaw: try! Amount(fromString: LONGCURRENCY + ":2.2"),
transactionId: "someTxID",
timestamp: Timestamp(from: 1_666_666_000_000),
txActions: [])
let details = WithdrawalDetails(type: .manual, reservePub: "ReSeRvEpUbLiC_KeY_FoR_WiThDrAwAl", reserveIsReady: false,
exchangePaytoUris:["payto://iban/SANDBOXX/DE159593?receiver-name=Exchange+Company"])
List {
ManualDetailsV(common: common, details: details)
}
}
}
#endif
|