commit 4a12f4abc70fab54e346dfcde866c838b894b7dc
parent 209e3d8c6021587e05f5c5e2af21a6327d49368b
Author: Iván Ávalos <avalos@disroot.org>
Date: Wed, 4 Feb 2026 17:52:03 +0100
[wallet] revert withdrawal QR code changes until feedback from Vlada
Diffstat:
5 files changed, 14 insertions(+), 110 deletions(-)
diff --git a/wallet/src/main/java/net/taler/wallet/compose/QrCodeUriComposable.kt b/wallet/src/main/java/net/taler/wallet/compose/QrCodeUriComposable.kt
@@ -75,7 +75,8 @@ fun ColumnScope.QrCodeUriComposable(
Box(
Modifier
.fillMaxWidth()
- .aspectRatio(1f),
+ .aspectRatio(1f)
+ .padding(bottom = if (showContents) 8.dp else 0.dp),
contentAlignment = Alignment.Center,
) {
qrState.value?.let { qrCode ->
@@ -108,7 +109,6 @@ fun ColumnScope.QrCodeUriComposable(
Row(
modifier = Modifier
.padding(horizontal = 16.dp)
- .padding(top = 8.dp)
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly,
) {
@@ -125,7 +125,6 @@ fun ColumnScope.QrCodeUriComposable(
}
ShareButton(
- modifier = if (shareAsQrCode) Modifier.weight(1f) else Modifier,
content = talerUri,
shareAsQrCode = shareAsQrCode,
colors = ButtonDefaults.buttonColors(
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/ActionButtonComposable.kt b/wallet/src/main/java/net/taler/wallet/transactions/ActionButtonComposable.kt
@@ -135,24 +135,17 @@ private fun ConfirmManualButton(
Text(stringResource(R.string.withdraw_manual_ready_details_intro))
}
- // only show in separate view when there's more than one transfer account
- // otherwise it will be shown on withdrawal details directly
- if (tx is TransactionWithdrawal
- && tx.withdrawalDetails is WithdrawalDetails.ManualTransfer
- && tx.withdrawalDetails.exchangeCreditAccountDetails != null
- && tx.withdrawalDetails.exchangeCreditAccountDetails.size > 1) {
- Button(
- onClick = { listener.onActionButtonClicked(tx, ActionListener.Type.SHOW_WIRE_QR) },
- modifier = modifier,
- ) {
- Icon(
- Icons.Default.QrCode,
- contentDescription = null,
- modifier = Modifier.size(ButtonDefaults.IconSize)
- )
- Spacer(Modifier.size(ButtonDefaults.IconSpacing))
- Text(stringResource(R.string.withdraw_manual_ready_details_qr))
- }
+ Button(
+ onClick = { listener.onActionButtonClicked(tx, ActionListener.Type.SHOW_WIRE_QR) },
+ modifier = modifier,
+ ) {
+ Icon(
+ Icons.Default.QrCode,
+ contentDescription = null,
+ modifier = Modifier.size(ButtonDefaults.IconSize)
+ )
+ Spacer(Modifier.size(ButtonDefaults.IconSpacing))
+ Text(stringResource(R.string.withdraw_manual_ready_details_qr))
}
}
}
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionWithdrawalFragment.kt
@@ -20,15 +20,10 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.ComposeView
import net.taler.wallet.compose.TalerSurface
import net.taler.wallet.compose.collectAsStateLifecycleAware
-import net.taler.wallet.withdraw.QrCodeSpec
import net.taler.wallet.withdraw.TransactionWithdrawalComposable
class TransactionWithdrawalFragment : TransactionDetailFragment(), ActionListener {
@@ -41,22 +36,9 @@ class TransactionWithdrawalFragment : TransactionDetailFragment(), ActionListene
setContent {
TalerSurface {
val t by transactionManager.selectedTransaction.collectAsStateLifecycleAware()
- var qrCodes by remember { mutableStateOf<List<QrCodeSpec>>(emptyList()) }
-
(t as? TransactionWithdrawal)?.let { tx ->
- LaunchedEffect(Unit) {
- if (tx.withdrawalDetails is WithdrawalDetails.ManualTransfer
- && tx.txState.minor == TransactionMinorState.ExchangeWaitReserve) {
- if (tx.withdrawalDetails.exchangeCreditAccountDetails?.size == 1) {
- val transfer = tx.withdrawalDetails.exchangeCreditAccountDetails[0]
- qrCodes = withdrawManager.getQrCodesForPayto(transfer.paytoUri)
- }
- }
- }
-
TransactionWithdrawalComposable(
t = tx,
- qrCodes = qrCodes,
devMode = devMode,
spec = exchangeManager.getSpecForCurrency(tx.amountRaw.currency, tx.scopes),
actionListener = this@TransactionWithdrawalFragment,
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt b/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt
@@ -17,7 +17,6 @@
package net.taler.wallet.withdraw
import androidx.compose.foundation.layout.Column
-import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
@@ -26,14 +25,10 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateMapOf
-import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
-import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import net.taler.common.Amount
@@ -65,12 +60,10 @@ import net.taler.wallet.transactions.TransactionWithdrawal
import net.taler.wallet.transactions.TransitionsComposable
import net.taler.wallet.transactions.WithdrawalDetails.ManualTransfer
import net.taler.wallet.transactions.WithdrawalExchangeAccountDetails
-import net.taler.wallet.transfer.PaytoQrCard
@Composable
fun TransactionWithdrawalComposable(
t: TransactionWithdrawal,
- qrCodes: List<QrCodeSpec> = emptyList(),
devMode: Boolean,
spec: CurrencySpecification?,
actionListener: ActionListener,
@@ -84,13 +77,6 @@ fun TransactionWithdrawalComposable(
horizontalAlignment = Alignment.CenterHorizontally,
) {
val context = LocalContext.current
- val qrExpandedStates = remember(qrCodes) {
- val map = mutableStateMapOf<QrCodeSpec, Boolean>()
- qrCodes.forEach {
- map[it] = qrCodes.size == 1
- }
- map
- }
TransactionStateComposable(state = t.txState, tx = t)
@@ -100,46 +86,6 @@ fun TransactionWithdrawalComposable(
style = MaterialTheme.typography.bodyLarge,
)
- if (qrCodes.isNotEmpty()) {
- Text(
- modifier = Modifier
- .padding(horizontal = 16.dp)
- .padding(top = 16.dp, bottom = 8.dp),
- style = MaterialTheme.typography.titleMedium,
- text = pluralStringResource(
- R.plurals.withdraw_qr_instruction,
- qrCodes.size,
- t.amountEffective.withSpec(spec).toString(),
- ),
- textAlign = TextAlign.Center,
- )
-
- qrCodes.forEach { spec ->
- PaytoQrCard(
- expanded = qrExpandedStates[spec]!!,
- setExpanded = { expanded ->
- if (expanded) { // un-expand all others
- qrExpandedStates.forEach { (k, _) ->
- qrExpandedStates[k] = false
- }
- }
- // expand only toggled one
- qrExpandedStates[spec] = expanded
- },
- qrCode = spec,
- )
- }
- }
-
- if (qrCodes.isNotEmpty()) Text(
- modifier = Modifier
- .padding(horizontal = 16.dp)
- .padding(top = 16.dp, bottom = 8.dp),
- style = MaterialTheme.typography.titleMedium,
- text = stringResource(R.string.withdraw_qr_manual),
- textAlign = TextAlign.Center,
- )
-
ActionButton(tx = t, listener = actionListener)
if (t.amountRaw != t.amountEffective) {
@@ -216,23 +162,12 @@ fun TransactionWithdrawalComposablePreview() {
url = "exchange.test.taler.net",
))
)
-
- val qrCodes = listOf(
- QrCodeSpec(
- type = QrCodeSpec.Type.SPC,
- qrContent = "something",
- ),
-// QrCodeSpec(
-// type = QrCodeSpec.Type.EpcQr,
-// qrContent = "something",
-// ),
- )
val listener = object : ActionListener {
override fun onActionButtonClicked(tx: Transaction, type: ActionListener.Type) {}
}
Surface {
- TransactionWithdrawalComposable(t, qrCodes, true, null, listener) {}
+ TransactionWithdrawalComposable(t, true, null, listener) {}
}
}
diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml
@@ -374,11 +374,6 @@ GNU Taler is immune to many types of fraud such as credit card data theft, phish
<string name="withdraw_manual_step_finish">Finish the wire transfer of %1$s 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.</string>
<string name="withdraw_manual_step_iban">If you don\'t already have it in your banking favorites list, then copy and paste recipient and IBAN into the recipient/IBAN fields in your banking app or website (and save it as favorite for the next time):</string>
<string name="withdraw_manual_step_subject">Copy this code and paste it into the subject/purpose field in your banking app or bank website:</string>
- <plurals name="withdraw_qr_instruction">
- <item quantity="one">Scan this QR code with your banking app to withdraw %1$s</item>
- <item quantity="other">Scan one of the following QR codes with your banking app to withdraw %1$s</item>
- </plurals>
- <string name="withdraw_qr_manual">Or follow the instructions to enter the transfer details into your banking app:</string>
<string name="withdraw_restrict_age">Restrict usage to age</string>
<string name="withdraw_restrict_age_unrestricted">Unrestricted</string>
<string name="withdraw_review_terms">You must first accept the payment service\'s terms of service before you can withdraw electronic cash to your wallet.</string>