--- a/TalerWallet1/Views/Actions/Banking/QuiteSomeCoins.swift +++ b/TalerWallet1/Views/Actions/Banking/QuiteSomeCoins.swift @@ -42,10 +42,17 @@ init(details: WithdrawalDetailsForAmount?) { do { if let details { + let numCoins = details.numCoins ?? -1 // either the number of coins, or unknown + if numCoins == 0 && !details.amountRaw.isZero { + // wallet-core has no coin to offer for this amount (no denomination is + // withdrawable right now). amountEffective is zero then, and raw - effective + // would be the whole amount: that is not a fee, so don't show it as one. + self.init(numCoins: 0, fee: nil) // invalid + return + } // Incoming: fee = raw - effective let aFee = try details.amountRaw - details.amountEffective - self.init(numCoins: details.numCoins ?? -1, // either the number of coins, or unknown - fee: aFee) + self.init(numCoins: numCoins, fee: aFee) return } } catch {} --- a/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift +++ b/TalerWallet1/Views/Actions/Banking/ManualWithdraw.swift @@ -261,6 +261,14 @@ coinData: coinData, shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees feeIsNegative: true) + if coinData.invalid && !detailsForAmount.amountRaw.isZero { + // the button below is disabled: say why + Text("This amount cannot be withdrawn at the moment. Please try again later.") + .foregroundColor(WalletColors().attention) + .talerFont(.body) + .multilineTextAlignment(.leading) + .padding(.vertical, 6) + } // agePicker NavigationLink(destination: destination) { // VIEW_WITHDRAW_ACCEPT Text(withdrawButtonTitle(currency))