taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 8e4acf1cdf0c7cc7ff29b19edc25fbc49f1c2d3d
parent 9160f682811886295a77a66c0c50d4c58b873ad6
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 20 Aug 2026 13:03:40 +0200

AI: don't disable expiration of 7 and 30

Diffstat:
MTalerWallet1/Views/Actions/Peer2peer/P2PReadyV.swift | 3++-
MTalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift | 1-
MTalerWallet1/Views/HelperViews/SelectDays.swift | 110+++++++++++++++++++++++++++++++++++++------------------------------------------
3 files changed, 54 insertions(+), 60 deletions(-)

diff --git a/TalerWallet1/Views/Actions/Peer2peer/P2PReadyV.swift b/TalerWallet1/Views/Actions/Peer2peer/P2PReadyV.swift @@ -45,12 +45,13 @@ struct P2PReadyV: View { return } transactionStarted = true + // keep expiration of outgoing P2P in developer mode for debugging let timestamp = developerMode ? Timestamp.inSomeMinutes(expireDays > 20 ? (24*60) // 24h : expireDays > 5 ? 60 // 1h : 3) // 3m : Timestamp.inSomeDays(expireDays) let purseExpiration = developerMode ? timestamp - : outgoing ? nil : timestamp + : outgoing ? nil : timestamp // nil for outgoing (non-dev) let terms = PeerContractTerms(amount: amountToTransfer, summary: summary, purse_expiration: purseExpiration, diff --git a/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift b/TalerWallet1/Views/Actions/Peer2peer/P2PSubjectV.swift @@ -89,7 +89,6 @@ struct P2PSubjectV: View { maxExpirationDate = ppCheck.maxExpirationDate } else { print("❗️ checkPeerPushDebitM failed") - } } } diff --git a/TalerWallet1/Views/HelperViews/SelectDays.swift b/TalerWallet1/Views/HelperViews/SelectDays.swift @@ -43,70 +43,64 @@ struct SelectDays: View { let _ = Self._printChanges() // let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear #endif - let maxExpiration = maxExpirationHours / 24 - let chooseExpiration = Section { // (alignment: .leading) - Text("Expires in:") - .accessibilityLabel(Text("Choose the expiration duration", comment: "a11y")) - .accessibilityAddTraits(.isHeader) - .accessibilityRemoveTraits(.isStaticText) - .talerFont(.title3) - HStack { - Button(action: oneDayAction) { - if developerMode { - Text(verbatim: "3 Min.") - } else { - Text("\(ONEDAY) Day", comment: "1 Day, might get plural (e.g. 2..3 Days), 4 letters max., abbreviate if longer") // TODO: Plural - } - }.buttonStyle(TalerButtonStyle(type: (selected == ONEDAY) ? .prominent : .bordered, - dimmed: true)) - .accessibilityAddTraits(selected == ONEDAY ? .isSelected : []) - - Button(action: sevenDayAction) { - if developerMode { - Text(verbatim: "1 Hour") - } else { - Text("\(SEVENDAYS) Days", comment: "7 Days, always plural (3..9), 4 letters max., abbreviate if longer") - } - }.buttonStyle(TalerButtonStyle(type: (selected == SEVENDAYS) ? .prominent : .bordered, dimmed: true, - disabled: maxExpiration < SEVENDAYS)) - .accessibilityAddTraits(selected == SEVENDAYS ? .isSelected : []) - .disabled(maxExpiration < SEVENDAYS) - - Button(action: thirtyDayAction) { - if developerMode { - Text(verbatim: "1 Day") - } else { - let thirtyDays = String(localized: "thirtyDays", defaultValue: "\(THIRTYDAYS) Days", comment: "30 Days, always plural (10..30), 4 letters max., abbreviate if longer") - Text(thirtyDays) - } - }.buttonStyle(TalerButtonStyle(type: (selected == THIRTYDAYS) ? .prominent : .bordered, dimmed: true, - disabled: maxExpiration < THIRTYDAYS)) - .accessibilityAddTraits(selected == THIRTYDAYS ? .isSelected : []) - .disabled(maxExpiration < THIRTYDAYS) - } // 3 buttons - if !minimalistic { - Text(outgoing ? "The payment service will send your money back if it won't get collected on time, or when you abort the operation." - : "This request will be cancelled if it doesn't get paid on time, or when you abort the operation.") - .talerFont(.body) - } - } -#if TALER_WALLET - chooseExpiration -#else - if developerMode { - chooseExpiration - } else if outgoing { + if outgoing && !developerMode { if !minimalistic { Section { // (alignment: .leading) - Text(defaultExpirationHours < 49 ? "The payment service will send your money back if it won't get collected in the next \(defaultExpirationHours) hours, or when you abort the operation." - : "The payment service will send your money back if it won't get collected in the next \(defaultExpirationHours/24) days, or when you abort the operation.") - .talerFont(.body) + let hours = defaultExpirationHours < 49 + Text(hours ? "The payment service will send your money back if it won't get collected in the next \(defaultExpirationHours) hours, or when you abort the operation." + : "The payment service will send your money back if it won't get collected in the next \(defaultExpirationHours/24) days, or when you abort the operation.") + .talerFont(.body) } } } else { - chooseExpiration + let maxExpiration = maxExpirationHours / 24 + Section { // (alignment: .leading) + Text("Expires in:") + .accessibilityLabel(Text("Choose the expiration duration", comment: "a11y")) + .accessibilityAddTraits(.isHeader) + .accessibilityRemoveTraits(.isStaticText) + .talerFont(.title3) + HStack { + Button(action: oneDayAction) { + if developerMode { + Text(verbatim: "3 Min.") + } else { + Text("\(ONEDAY) Day", comment: "1 Day, might get plural (e.g. 2..3 Days), 4 letters max., abbreviate if longer") // TODO: Plural + } + }.buttonStyle(TalerButtonStyle(type: (selected == ONEDAY) ? .prominent : .bordered, + dimmed: true)) + .accessibilityAddTraits(selected == ONEDAY ? .isSelected : []) + + Button(action: sevenDayAction) { + if developerMode { + Text(verbatim: "1 Hour") + } else { + Text("\(SEVENDAYS) Days", comment: "7 Days, always plural (3..9), 4 letters max., abbreviate if longer") + } + }.buttonStyle(TalerButtonStyle(type: (selected == SEVENDAYS) ? .prominent : .bordered, dimmed: true, + disabled: maxExpiration < SEVENDAYS)) + .accessibilityAddTraits(selected == SEVENDAYS ? .isSelected : []) + .disabled(maxExpiration < SEVENDAYS) + + Button(action: thirtyDayAction) { + if developerMode { + Text(verbatim: "1 Day") + } else { + let thirtyDays = String(localized: "thirtyDays", defaultValue: "\(THIRTYDAYS) Days", comment: "30 Days, always plural (10..30), 4 letters max., abbreviate if longer") + Text(thirtyDays) + } + }.buttonStyle(TalerButtonStyle(type: (selected == THIRTYDAYS) ? .prominent : .bordered, dimmed: true, + disabled: maxExpiration < THIRTYDAYS)) + .accessibilityAddTraits(selected == THIRTYDAYS ? .isSelected : []) + .disabled(maxExpiration < THIRTYDAYS) + } // 3 buttons + if !minimalistic { + Text(outgoing ? "The payment service will send your money back if it won't get collected on time, or when you abort the operation." + : "This request will be cancelled if it doesn't get paid on time, or when you abort the operation.") + .talerFont(.body) + } + } } -#endif } } // MARK: -