commit fa6d468ae759db554266ba219a117d8b831ace70
parent 9dfd94d15bbe4198abd1b399f5fc4309225550f6
Author: Marc Stibane <marc@taler.net>
Date: Thu, 8 Aug 2024 06:19:07 +0200
ManualDetailsWireV
Diffstat:
4 files changed, 181 insertions(+), 103 deletions(-)
diff --git a/TalerWallet.xcodeproj/project.pbxproj b/TalerWallet.xcodeproj/project.pbxproj
@@ -178,6 +178,8 @@
4E8C17222A6509BB005B2392 /* Atkinson-Hyperlegible-Bold-102.otf in Resources */ = {isa = PBXBuildFile; fileRef = 4E8C171E2A6509BB005B2392 /* Atkinson-Hyperlegible-Bold-102.otf */; };
4E8C17232A6509BB005B2392 /* Atkinson-Hyperlegible-BoldItalic-102.otf in Resources */ = {isa = PBXBuildFile; fileRef = 4E8C171F2A6509BB005B2392 /* Atkinson-Hyperlegible-BoldItalic-102.otf */; };
4E8E25332A1CD39700A27BFA /* EqualIconWidthDomain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8E25322A1CD39700A27BFA /* EqualIconWidthDomain.swift */; };
+ 4E8EADA52C6470B900C6CDC4 /* ManualDetailsWireV.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8EADA42C6470B800C6CDC4 /* ManualDetailsWireV.swift */; };
+ 4E8EADA62C6470B900C6CDC4 /* ManualDetailsWireV.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E8EADA42C6470B800C6CDC4 /* ManualDetailsWireV.swift */; };
4E9320432A14F6EA00A87B0E /* WalletColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E9320422A14F6EA00A87B0E /* WalletColors.swift */; };
4E9320452A1645B600A87B0E /* RequestPayment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E9320442A1645B600A87B0E /* RequestPayment.swift */; };
4E96583C2B79656E00404A68 /* DepositAmountV.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E96583B2B79656E00404A68 /* DepositAmountV.swift */; };
@@ -401,6 +403,7 @@
4E8C171E2A6509BB005B2392 /* Atkinson-Hyperlegible-Bold-102.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Atkinson-Hyperlegible-Bold-102.otf"; sourceTree = "<group>"; };
4E8C171F2A6509BB005B2392 /* Atkinson-Hyperlegible-BoldItalic-102.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Atkinson-Hyperlegible-BoldItalic-102.otf"; sourceTree = "<group>"; };
4E8E25322A1CD39700A27BFA /* EqualIconWidthDomain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EqualIconWidthDomain.swift; sourceTree = "<group>"; };
+ 4E8EADA42C6470B800C6CDC4 /* ManualDetailsWireV.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManualDetailsWireV.swift; sourceTree = "<group>"; };
4E9320422A14F6EA00A87B0E /* WalletColors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WalletColors.swift; sourceTree = "<group>"; };
4E9320442A1645B600A87B0E /* RequestPayment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestPayment.swift; sourceTree = "<group>"; };
4E96583B2B79656E00404A68 /* DepositAmountV.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DepositAmountV.swift; sourceTree = "<group>"; };
@@ -791,6 +794,7 @@
4E6EF56D2B669C7000AF252A /* TransactionPayDetailV.swift */,
4E87C8722A31CB7F001C6406 /* TransactionsEmptyView.swift */,
4E6EDD842A3615BE0031D520 /* ManualDetailsV.swift */,
+ 4E8EADA42C6470B800C6CDC4 /* ManualDetailsWireV.swift */,
4ED2F94A2A278F5100453B40 /* ThreeAmountsSection.swift */,
);
path = Transactions;
@@ -1244,6 +1248,7 @@
4E3EAE502A990778009F1BE8 /* Model+Transactions.swift in Sources */,
4E6EF56E2B669C7000AF252A /* TransactionPayDetailV.swift in Sources */,
4E3EAE512A990778009F1BE8 /* Controller+playSound.swift in Sources */,
+ 4E8EADA52C6470B900C6CDC4 /* ManualDetailsWireV.swift in Sources */,
4EE77E882C101F5B007C9064 /* OverviewSectionV.swift in Sources */,
4E3EAE522A990778009F1BE8 /* WalletEmptyView.swift in Sources */,
4E3EAE532A990778009F1BE8 /* CurrencySpecification.swift in Sources */,
@@ -1373,6 +1378,7 @@
4EB095592989CBFE0043A8A1 /* Model+Transactions.swift in Sources */,
4E6EF56F2B669C7000AF252A /* TransactionPayDetailV.swift in Sources */,
4E578E922A481D8600F21F1C /* Controller+playSound.swift in Sources */,
+ 4E8EADA62C6470B900C6CDC4 /* ManualDetailsWireV.swift in Sources */,
4EE77E892C101F5B007C9064 /* OverviewSectionV.swift in Sources */,
4EB0955F2989CBFE0043A8A1 /* WalletEmptyView.swift in Sources */,
4E16E12329F3BB99008B9C86 /* CurrencySpecification.swift in Sources */,
diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift
@@ -44,7 +44,8 @@ public let VIEW_TRANSACTIONDETAIL = VIEW_TRANSACTIONSUMMARY + 1 // 23 Transa
// receive coins from bank ==> shows payee, IBAN + Purpose/Subject for manual wire transfer
public let VIEW_WITHDRAWAL = VIEW_EMPTY_HISTORY + 10 // 30 WithdrawAmount
public let VIEW_WITHDRAW_TOS = VIEW_WITHDRAWAL + 1 // 31 WithdrawTOSView
-public let VIEW_WITHDRAW_ACCEPT = VIEW_WITHDRAW_TOS + 1 // 32
+public let VIEW_WITHDRAW_ACCEPT = VIEW_WITHDRAW_TOS + 1 // 32 ManualWithdrawDone
+public let VIEW_WITHDRAW_INSTRUCTIONS = VIEW_WITHDRAW_ACCEPT + 1 // 33 ManualDetailsWireV
// MARK: Manual Deposit (from Banking / ExchangeList)
// send coins back to customer ==> instruct exchange to make the wire transfer to the customer's bank account
diff --git a/TalerWallet1/Views/Transactions/ManualDetailsV.swift b/TalerWallet1/Views/Transactions/ManualDetailsV.swift
@@ -221,125 +221,34 @@ struct ManualDetailsV: View {
let payURL = URL(string: payto)
if let queryParameters = payURL?.queryParameters {
- let receiverStr = (queryParameters["receiver-name"] ?? EMPTYSTRING).replacingOccurrences(of: "+", with: " ")
-// let amountStr = queryParameters["amount"] ?? EMPTYSTRING
-// let messageStr = queryParameters["message"] ?? EMPTYSTRING
-// let senderStr = queryParameters["sender-name"] ?? EMPTYSTRING
-
let iban = payURL?.iban
let xTaler = payURL?.xTaler ??
// payURL?.host() ??
String(localized: "unknown payment method")
- let cryptocode = HStack {
- Text(details.reservePub)
- .monospacedDigit()
- .accessibilityLabel(Text("Cryptocode", comment: "VoiceOver"))
- .frame(maxWidth: .infinity, alignment: .leading)
- CopyButton(textToCopy: details.reservePub, vertical: true)
- .accessibilityLabel(Text("Copy the cryptocode", comment: "VoiceOver"))
- .disabled(false)
- } .padding(.leading)
- let payeeCode = HStack {
- VStack(alignment: .leading) {
- Text("Payee:")
- .talerFont(.subheadline)
- Text(receiverStr)
- .monospacedDigit()
- .padding(.leading)
- } .frame(maxWidth: .infinity, alignment: .leading)
- .accessibilityElement(children: .combine)
- .accessibilityLabel(Text("Payee", comment: "VoiceOver"))
- CopyButton(textToCopy: receiverStr, vertical: true)
- .accessibilityLabel(Text("Copy the payee", comment: "VoiceOver"))
- .disabled(false)
- } .padding(.top, -8)
- let ibanCode = HStack {
- VStack(alignment: .leading) {
- Text("IBAN:")
- .talerFont(.subheadline)
- Text(iban ?? EMPTYSTRING)
- .monospacedDigit()
- .padding(.leading)
- } .frame(maxWidth: .infinity, alignment: .leading)
- .accessibilityElement(children: .combine)
- .accessibilityLabel(Text("IBAN of the payee", comment: "VoiceOver"))
- CopyButton(textToCopy: iban ?? EMPTYSTRING, vertical: true)
- .accessibilityLabel(Text("Copy the IBAN", comment: "VoiceOver"))
- .disabled(false)
- } .padding(.top, -8)
- let xTalerCode = HStack {
- VStack(alignment: .leading) {
- Text("Account:")
- .talerFont(.subheadline)
- Text(xTaler)
- .monospacedDigit()
- .padding(.leading)
- } .frame(maxWidth: .infinity, alignment: .leading)
- .accessibilityElement(children: .combine)
- .accessibilityLabel(Text("account of the payee", comment: "VoiceOver"))
- CopyButton(textToCopy: xTaler, vertical: true)
- .accessibilityLabel(Text("Copy the account", comment: "VoiceOver"))
- .disabled(false)
- } .padding(.top, -8)
-
- let step1 = Text(minimalistic ? "**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)
- let mandatory = Text("This is mandatory, otherwise your money will not arrive in this wallet.")
- .bold()
- .multilineTextAlignment(.leading)
- .listRowSeparator(.hidden)
- let step2i = Text(minimalistic ? "**Step 2:** Copy+Paste payee and IBAN:"
- : "**Step 2:** If you don't already have it in your banking favorites list, then copy and paste payee and IBAN into the payee/IBAN fields in your banking app or website (and save it as favorite for the next time):")
- .multilineTextAlignment(.leading)
- .padding(.top)
- let step2x = Text(minimalistic ? "**Step 2:** Copy+Paste payee and account:"
- : "**Step 2:** Copy and paste payee and account into the corresponding fields in your banking app or website:")
- .multilineTextAlignment(.leading)
- .padding(.top)
- let amountNBS = amountStr.nbs
- let step3 = Text(minimalistic ? "**Step 3:** Transfer \(amountNBS)."
- : "**Step 3:** Finish the wire transfer of \(amountNBS) in your banking app or website, then this withdrawal will proceed automatically. Depending on your bank the transfer can take from minutes to two working days, please be patient.")
- .multilineTextAlignment(.leading)
- .padding(.top)
+ let wireDetails = ManualDetailsWireV(stack: stack.push(),
+ details: details,
+ queryParameters: queryParameters,
+ iban: iban,
+ xTaler: xTaler,
+ amountStr: amountStr,
+ obtainStr: obtainStr,
+ account: account)
Group {
- TransferRestrictionsV(amountStr: amountStr,
- obtainStr: obtainStr,
- restrictions: account.creditRestrictions)
- .listRowSeparator(.visible)
- step1.listRowSeparator(.hidden)
- if !minimalistic {
- mandatory
- }
- cryptocode.listRowSeparator(.hidden)
- if iban != nil {
- step2i.listRowSeparator(.hidden)
- payeeCode.listRowSeparator(.hidden)
- ibanCode.listRowSeparator(.hidden)
- } else {
- step2x.listRowSeparator(.hidden)
- payeeCode.listRowSeparator(.hidden)
- xTalerCode.listRowSeparator(.hidden)
+ NavigationLink(destination: wireDetails) {
+ Text(minimalistic ? "Instructions"
+ : "Wire transfer instructions")
}
- step3.listRowSeparator(.visible)
Text(minimalistic ? "**Alternative:** Use this PayTo-Link:"
: "**Alternative:** If your bank already supports PayTo, you can use this PayTo-Link instead:")
.multilineTextAlignment(.leading)
.padding(.top)
.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()
let title = String(localized: "Share the PayTo URL", comment: "VoiceOver")
let minTitle = String(localized: "Share PayTo", comment: "mini")
ShareButton(textToShare: payto, title: minimalistic ? minTitle : title)
.frame(maxWidth: .infinity, alignment: .center)
.accessibilityLabel(Text(title))
.disabled(false)
-// Spacer()
- } .listRowSeparator(.automatic)
qrCodesForPayto
}.id(listID)
.talerFont(.body)
diff --git a/TalerWallet1/Views/Transactions/ManualDetailsWireV.swift b/TalerWallet1/Views/Transactions/ManualDetailsWireV.swift
@@ -0,0 +1,162 @@
+/*
+ * This file is part of GNU Taler, ©2022-24 Taler Systems S.A.
+ * See LICENSE.md
+ */
+/**
+ * @author Marc Stibane
+ */
+import SwiftUI
+import OrderedCollections
+import taler_swift
+
+struct ManualDetailsWireV: View {
+ let stack: CallStack
+ let details : WithdrawalDetails
+ let queryParameters: [String:String]
+ let iban: String?
+ let xTaler: String
+ let amountStr: String
+ let obtainStr: String
+ let account: WithdrawalExchangeAccountDetails
+
+ @AppStorage("minimalistic") var minimalistic: Bool = false
+ let navTitle = String(localized: "Wire transfer", comment: "ViewTitle of wire-transfer instructions")
+
+ var body: some View {
+ List {
+ let receiverStr = (queryParameters["receiver-name"] ?? EMPTYSTRING).replacingOccurrences(of: "+", with: " ")
+// let amountStr = queryParameters["amount"] ?? EMPTYSTRING
+// let messageStr = queryParameters["message"] ?? EMPTYSTRING
+// let senderStr = queryParameters["sender-name"] ?? EMPTYSTRING
+
+ let cryptocode = HStack {
+ Text(details.reservePub)
+ .monospacedDigit()
+ .accessibilityLabel(Text("Cryptocode", comment: "VoiceOver"))
+ .frame(maxWidth: .infinity, alignment: .leading)
+ CopyButton(textToCopy: details.reservePub, vertical: true)
+ .accessibilityLabel(Text("Copy the cryptocode", comment: "VoiceOver"))
+ .disabled(false)
+ } .padding(.leading)
+ let payeeCode = HStack {
+ VStack(alignment: .leading) {
+ Text("Payee:")
+ .talerFont(.subheadline)
+ Text(receiverStr)
+ .monospacedDigit()
+ .padding(.leading)
+ } .frame(maxWidth: .infinity, alignment: .leading)
+ .accessibilityElement(children: .combine)
+ .accessibilityLabel(Text("Payee", comment: "VoiceOver"))
+ CopyButton(textToCopy: receiverStr, vertical: true)
+ .accessibilityLabel(Text("Copy the payee", comment: "VoiceOver"))
+ .disabled(false)
+ } .padding(.top, -8)
+ let ibanCode = HStack {
+ VStack(alignment: .leading) {
+ Text("IBAN:")
+ .talerFont(.subheadline)
+ Text(iban ?? EMPTYSTRING)
+ .monospacedDigit()
+ .padding(.leading)
+ } .frame(maxWidth: .infinity, alignment: .leading)
+ .accessibilityElement(children: .combine)
+ .accessibilityLabel(Text("IBAN of the payee", comment: "VoiceOver"))
+ CopyButton(textToCopy: iban ?? EMPTYSTRING, vertical: true)
+ .accessibilityLabel(Text("Copy the IBAN", comment: "VoiceOver"))
+ .disabled(false)
+ } .padding(.top, -8)
+ let xTalerCode = HStack {
+ VStack(alignment: .leading) {
+ Text("Account:")
+ .talerFont(.subheadline)
+ Text(xTaler)
+ .monospacedDigit()
+ .padding(.leading)
+ } .frame(maxWidth: .infinity, alignment: .leading)
+ .accessibilityElement(children: .combine)
+ .accessibilityLabel(Text("account of the payee", comment: "VoiceOver"))
+ CopyButton(textToCopy: xTaler, vertical: true)
+ .accessibilityLabel(Text("Copy the account", comment: "VoiceOver"))
+ .disabled(false)
+ } .padding(.top, -8)
+ let step1 = Text(minimalistic ? "**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)
+ let mandatory = Text("This is mandatory, otherwise your money will not arrive in this wallet.")
+ .bold()
+ .multilineTextAlignment(.leading)
+ .listRowSeparator(.hidden)
+ let step2i = Text(minimalistic ? "**Step 2:** Copy+Paste payee and IBAN:"
+ : "**Step 2:** If you don't already have it in your banking favorites list, then copy and paste payee and IBAN into the payee/IBAN fields in your banking app or website (and save it as favorite for the next time):")
+ .multilineTextAlignment(.leading)
+ .padding(.top)
+ let step2x = Text(minimalistic ? "**Step 2:** Copy+Paste payee and account:"
+ : "**Step 2:** Copy and paste payee and account into the corresponding fields in your banking app or website:")
+ .multilineTextAlignment(.leading)
+ .padding(.top)
+ let amountNBS = amountStr.nbs
+ let step3 = Text(minimalistic ? "**Step 3:** Transfer \(amountNBS)."
+ : "**Step 3:** Finish the wire transfer of \(amountNBS) in your banking app or website, then this withdrawal will proceed automatically. Depending on your bank the transfer can take from minutes to two working days, please be patient.")
+ .multilineTextAlignment(.leading)
+ .padding(.top)
+
+ Group {
+ TransferRestrictionsV(amountStr: amountStr,
+ obtainStr: obtainStr,
+ restrictions: account.creditRestrictions)
+ .listRowSeparator(.visible)
+ step1.listRowSeparator(.hidden)
+ if !minimalistic {
+ mandatory
+ }
+ cryptocode.listRowSeparator(.hidden)
+ if iban != nil {
+ step2i.listRowSeparator(.hidden)
+ payeeCode.listRowSeparator(.hidden)
+ ibanCode.listRowSeparator(.hidden)
+ } else {
+ step2x.listRowSeparator(.hidden)
+ payeeCode.listRowSeparator(.hidden)
+ xTalerCode.listRowSeparator(.hidden)
+ }
+ step3.listRowSeparator(.visible)
+ }
+ }
+ .navigationTitle(navTitle)
+ .onAppear() {
+// symLog.log("onAppear")
+ DebugViewC.shared.setViewID(VIEW_WITHDRAW_INSTRUCTIONS, stack: stack.push())
+ }
+ }
+}
+
+// MARK: -
+#if DEBUG
+//struct ManualDetailsWire_Previews: PreviewProvider {
+// static var previews: some View {
+// let common = TransactionCommon(type: .withdrawal,
+// txState: TransactionState(major: .done),
+// amountEffective: Amount(currency: LONGCURRENCY, cent: 110),
+// amountRaw: Amount(currency: LONGCURRENCY, cent: 220),
+// transactionId: "someTxID",
+// timestamp: Timestamp(from: 1_666_666_000_000),
+// txActions: [])
+// let payto = "payto://iban/SANDBOXX/DE159593?receiver-name=Exchange+Company"
+// let details = WithdrawalDetails(type: .manual,
+// reservePub: "ReSeRvEpUbLiC_KeY_FoR_WiThDrAwAl",
+// reserveIsReady: false,
+// confirmed: false)
+// List {
+// ManualDetailsWireV(stack: CallStack("Preview"),
+// details: details,
+// queryParameters: <#T##[String : String]#>,
+// iban: <#T##String?#>,
+// xTaler: <#T##String#>,
+// amountStr: <#T##String#>,
+// obtainStr: <#T##String#>,
+// account: <#T##WithdrawalExchangeAccountDetails#>)
+// }
+// }
+//}
+#endif