diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift index 144f85c9..9ba7ca6b 100755 --- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift +++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawAcceptDone.swift @@ -36,17 +36,35 @@ struct WithdrawAcceptDone: View { if let exchangeBaseUrl { do { // TODO: restrictAge - let result = try await model.acceptBankIntWithdrawal(exchangeBaseUrl, + // `acceptBankIntWithdrawal` returns an OPTIONAL response, so + // the `if let` here is doing a different job from the `try`: + // the old `if let result = try? await ...` unwrapped both at + // once, and replacing it with a bare `try` left the optional + // behind -- which is how the first version of this patch + // failed to compile (`value of optional type + // 'AcceptWithdrawalResponse?' must be unwrapped`). + if let result = try await model.acceptBankIntWithdrawal(exchangeBaseUrl, withdrawURL: url.trimmedString, amount: amountToTransfer, - restrictAge: nil) - controller.removeURL(url) - let confirmTransferUrl = result.confirmTransferUrl - symLog.log(confirmTransferUrl) - if amountToTransfer == nil { - dismissTop(stack.push()) + restrictAge: nil) { + controller.removeURL(url) + let confirmTransferUrl = result.confirmTransferUrl + symLog.log(confirmTransferUrl) + if amountToTransfer == nil { + dismissTop(stack.push()) + } else { + transactionId = result.transactionId + } } else { - transactionId = result.transactionId + // Success with no body. Not observed, and handled + // explicitly anyway: letting it fall through is how the + // spinner this patch exists to remove gets back in. + // `deserializationError` is the nearest existing case -- + // there is no response value to work with -- and adding + // an enum case would widen a shared type for a path + // nobody has seen. + symLog.log("acceptBankIntWithdrawal returned no response") + acceptError = WalletBackendError.deserializationError } } catch { // This used to be `try?`. The failure that matters is 7046