diff options
author | Marc Stibane <marc@taler.net> | 2023-11-21 17:16:44 +0100 |
---|---|---|
committer | Marc Stibane <marc@taler.net> | 2023-11-21 17:16:44 +0100 |
commit | b680c0e37d9f0b6deda4b1a2b0cd4a4b7dc31da8 (patch) | |
tree | 9187b5a422d08f881a9955c2849ed4003c50335a | |
parent | b01070bb22e17d14642c3ae7f11fba97c496a89d (diff) | |
download | taler-ios-b680c0e37d9f0b6deda4b1a2b0cd4a4b7dc31da8.tar.gz taler-ios-b680c0e37d9f0b6deda4b1a2b0cd4a4b7dc31da8.tar.bz2 taler-ios-b680c0e37d9f0b6deda4b1a2b0cd4a4b7dc31da8.zip |
badge, VoiceOver
5 files changed, 59 insertions, 30 deletions
diff --git a/TalerWallet1/Controllers/PublicConstants.swift b/TalerWallet1/Controllers/PublicConstants.swift index 1b5c9ae..da8bb9a 100644 --- a/TalerWallet1/Controllers/PublicConstants.swift +++ b/TalerWallet1/Controllers/PublicConstants.swift @@ -16,6 +16,11 @@ public let THIRTYDAYS: UInt = 30 // 10..30 public let EMPTYSTRING = "" // avoid automatic translation of empty "" textLiterals in Text() public let CONFIRM_BANK = "circle.fill" // badge in PendingRow, TransactionRow and TransactionDetail public let NEEDS_KYC = "star.fill" // badge in PendingRow, TransactionRow and TransactionDetail +public let PENDING_INCOMING = "plus.diamond" +public let PENDING_OUTGOING = "minus.diamond" +public let DONE_INCOMING = "plus.circle.fill" +public let DONE_OUTGOING = "minus.circle.fill" + public let HTTPS = "https://" //public let DEMOBANK = HTTPS + "bAnK.dEmO.tAlEr.nEt" // should be weird to read, but still work //public let DEMOEXCHANGE = HTTPS + "eXcHaNgE.dEmO.tAlEr.nEt" diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift index e7c390e..1e5cede 100644 --- a/TalerWallet1/Views/Balances/BalancesSectionView.swift +++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift @@ -190,6 +190,10 @@ fileprivate struct BalancesPendingRowView: View { reloadOneAction: reloadOneAction) } } label: { + let needsKYC = true + let shouldConfirm = false + let needsKYCStr = String(localized: ". Needs K Y C", comment: "VoiceOver") + let needsConfStr = String(localized: ". Needs bank confirmation", comment: "VoiceOver") VStack(spacing: 6) { var rows = 0 if !pendingIncoming.isZero { @@ -205,6 +209,13 @@ fileprivate struct BalancesPendingRowView: View { .accessibilityFont(.body) } } + .accessibilityElement(children: .combine) + .accessibilityValue(needsKYC && shouldConfirm ? needsKYCStr + needsConfStr : + needsKYC ? needsKYCStr : + shouldConfirm ? needsConfStr + : EMPTYSTRING) + .accessibilityHint("Will go to Pending transactions.") + } } // body diff --git a/TalerWallet1/Views/Balances/PendingRowView.swift b/TalerWallet1/Views/Balances/PendingRowView.swift index d6153f6..1c9b3ad 100644 --- a/TalerWallet1/Views/Balances/PendingRowView.swift +++ b/TalerWallet1/Views/Balances/PendingRowView.swift @@ -28,10 +28,8 @@ struct PendingRowView: View { var body: some View { let pendingColor = WalletColors().pendingColor(incoming) - let imageName = incoming ? "plus.diamond" // goforward.plus circle - : "minus.diamond" // - let iconBadge = IconBadge(imageName: imageName, foreColor: pendingColor, shouldConfirm: shouldConfirm, needsKYC: needsKYC) - + let iconBadge = IconBadge(foreColor: pendingColor, done: false, incoming: incoming, + shouldConfirm: shouldConfirm, needsKYC: needsKYC) let inTitle = iconOnly ? inTitle0 : inTitle1 let outTitle = iconOnly ? outTitle0 : outTitle1 let pendingTitle = incoming ? inTitle : outTitle diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift b/TalerWallet1/Views/Transactions/TransactionDetailView.swift index 661d354..4dd575f 100644 --- a/TalerWallet1/Views/Transactions/TransactionDetailView.swift +++ b/TalerWallet1/Views/Transactions/TransactionDetailView.swift @@ -212,8 +212,25 @@ struct TransactionDetailView: View { let withdrawalDetails = details.withdrawalDetails switch withdrawalDetails.type { case .manual: // "Make a wire transfer of \(amount) to" + if transaction.isPendingKYC { + if let kycUrl = common.kycUrl { + if let destination = URL(string: kycUrl) { + VStack(alignment: .leading) { // Show Hint that User must pass KYC on website + if !iconOnly { + Text("You need to pass a KYC procedure") + .fixedSize(horizontal: false, vertical: true) // wrap in scrollview + .multilineTextAlignment(.leading) // otherwise + .listRowSeparator(.hidden) + } + Link("Open KYC website", destination: destination) + .buttonStyle(TalerButtonStyle(type: .prominent, badge: NEEDS_KYC)) + .accessibilityHint("Will go to KYC website to confirm this withdrawal.") + } + } + } + } ManualDetailsV(common: common, details: withdrawalDetails) - + case .bankIntegrated: // "Confirm with bank" let confirmed = withdrawalDetails.confirmed ?? false if !confirmed { @@ -228,21 +245,7 @@ struct TransactionDetailView: View { } Link("Confirm with bank", destination: destination) .buttonStyle(TalerButtonStyle(type: .prominent, badge: CONFIRM_BANK)) - } - } - } - } else if transaction.isPendingKYC { - if let kycUrl = common.kycUrl { - if let destination = URL(string: kycUrl) { - VStack(alignment: .leading) { // Show Hint that User must pass KYC on website - if !iconOnly { - Text("You need to pass a KYC procedure") - .fixedSize(horizontal: false, vertical: true) // wrap in scrollview - .multilineTextAlignment(.leading) // otherwise - .listRowSeparator(.hidden) - } - Link("Open KYC website", destination: destination) - .buttonStyle(TalerButtonStyle(type: .prominent, badge: NEEDS_KYC)) + .accessibilityHint("Will go to bank website to confirm this withdrawal.") } } } diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift b/TalerWallet1/Views/Transactions/TransactionRowView.swift index b618c66..514c1d6 100644 --- a/TalerWallet1/Views/Transactions/TransactionRowView.swift +++ b/TalerWallet1/Views/Transactions/TransactionRowView.swift @@ -6,19 +6,29 @@ import SwiftUI import taler_swift struct IconBadge: View { - let imageName: String let foreColor:Color + let done: Bool +// let pending: Bool + let incoming: Bool let shouldConfirm: Bool let needsKYC: Bool var body: some View { + let imageName = incoming && done ? DONE_INCOMING + : incoming ? PENDING_INCOMING + // since the money already left the wallet, show DONE + : DONE_OUTGOING // PENDING_OUTGOING let badgeName = needsKYC ? NEEDS_KYC : CONFIRM_BANK HStack(alignment: .top, spacing: -8) { // TODO: adapt spacing to dynamic fontsize - Image(systemName: imageName) - .foregroundColor(foreColor) - .accessibilityFont(.largeTitle) - .accessibility(hidden: true) + ZStack { + // "plus.diamond" is wider than "plus.circle.fill" + // ZStack centers the main icon, and the badge will always be at the same position + Image(systemName: PENDING_INCOMING) + .foregroundColor(.clear) + Image(systemName: imageName) + .foregroundColor(foreColor) + }.accessibilityFont(.largeTitle) Image(systemName: badgeName) .accessibilityFont(.caption) .foregroundColor((needsKYC || shouldConfirm) ? .red : .clear) @@ -29,9 +39,11 @@ struct TransactionRowContentV: View { var centerTop: String var centerBottom: String let isHorizontal: Bool + let pending: Bool let incoming: Bool let shouldConfirm: Bool let needsKYC: Bool + let done: Bool let foreColor:Color public static func width(titles: (String, String?), isHorizontal: Bool, @@ -59,9 +71,8 @@ struct TransactionRowContentV: View { } var body: some View { - let imageName = incoming ? "plus.circle.fill" - : "minus.circle.fill" - let iconBadge = IconBadge(imageName: imageName, foreColor: foreColor, shouldConfirm: shouldConfirm, needsKYC: needsKYC) + let iconBadge = IconBadge(foreColor: foreColor, done: done, incoming: incoming, + shouldConfirm: shouldConfirm, needsKYC: needsKYC) HStack(spacing: 8) { iconBadge VStack(alignment: .leading) { @@ -117,8 +128,9 @@ struct TransactionRowView: View { TransactionRowContentV(centerTop: transaction.localizedType, centerBottom: dateString, isHorizontal: true, - incoming: incoming, shouldConfirm: shouldConfirm, - needsKYC: needsKYC, foreColor: foreColor) + pending: pending, incoming: incoming, + shouldConfirm: shouldConfirm, needsKYC: needsKYC, + done: done, foreColor: foreColor) } .accessibilityElement(children: .combine) .accessibilityValue(needsKYC ? ". Needs K Y C" : |