taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

commit 76f84c3759de8ffeb6921f2384bad330909bdabf
parent a7c9fd9dd1a30fab01c84477b8a426b3e0a995cb
Author: Iván Ávalos <avalos@disroot.org>
Date:   Sun,  4 May 2025 22:29:24 +0200

[wallet] unify cta-wire-transfer-details with iOS

bug 0009783

Diffstat:
Mwallet/src/main/java/net/taler/wallet/withdraw/manual/ScreenTransfer.kt | 38++++++++++++++++++++++++++++++++++----
Mwallet/src/main/java/net/taler/wallet/withdraw/manual/TransferIBAN.kt | 32++++++++++++++++++++++++--------
Mwallet/src/main/java/net/taler/wallet/withdraw/manual/TransferTaler.kt | 27++++++++++++---------------
Mwallet/src/main/res/values/strings.xml | 9+++++++--
4 files changed, 77 insertions(+), 29 deletions(-)

diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/manual/ScreenTransfer.kt b/wallet/src/main/java/net/taler/wallet/withdraw/manual/ScreenTransfer.kt @@ -21,18 +21,20 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ContentCopy import androidx.compose.material3.Button +import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ScrollableTabRow import androidx.compose.material3.Surface import androidx.compose.material3.Tab import androidx.compose.material3.Text +import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue @@ -44,7 +46,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.fromHtml import androidx.compose.ui.text.style.LineBreak import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview @@ -189,6 +193,29 @@ fun ScreenTransfer( } @Composable +fun TransferStep( + index: Int, + description: String, +) { + Text( + modifier = Modifier.padding( + top = 16.dp, + start = 6.dp, + end = 6.dp, + bottom = 6.dp, + ), + text = AnnotatedString.fromHtml( + stringResource( + R.string.withdraw_manual_step, + index, + description, + ) + ), + style = MaterialTheme.typography.bodyMedium, + ) +} + +@Composable fun DetailRow( label: String, content: String, @@ -224,13 +251,16 @@ fun DetailRow( ) if (copy) { - IconButton( + TextButton( onClick = { copyToClipBoard(context, label, content) }, ) { Icon( - imageVector = Icons.Default.ContentCopy, - contentDescription = stringResource(R.string.copy), + Icons.Default.ContentCopy, + contentDescription = null, + modifier = Modifier.size(ButtonDefaults.IconSize), ) + Spacer(Modifier.size(ButtonDefaults.IconSpacing)) + Text(stringResource(R.string.copy)) } } } diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferIBAN.kt b/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferIBAN.kt @@ -18,6 +18,7 @@ package net.taler.wallet.withdraw.manual import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -52,38 +53,53 @@ fun TransferIBAN( Text( text = stringResource( R.string.withdraw_manual_ready_intro, - transferAmount), + transferAmount, + transactionAmountEffective, + ), style = MaterialTheme.typography.bodyLarge, modifier = Modifier .padding(vertical = 8.dp) ) - WarningLabel( - modifier = Modifier.padding(8.dp), - label = stringResource(R.string.withdraw_manual_ready_warning), + HorizontalDivider( + modifier = Modifier.padding(vertical = 6.dp) ) + TransferStep(1, stringResource(R.string.withdraw_manual_step_subject)) + DetailRow( stringResource(R.string.withdraw_manual_ready_subject), transfer.subject, characterBreak = true, ) + WarningLabel( + modifier = Modifier.padding(8.dp), + label = stringResource(R.string.withdraw_manual_ready_warning), + ) + + TransferStep(2, stringResource(R.string.withdraw_manual_step_iban)) + transfer.receiverName?.let { DetailRow(stringResource(R.string.withdraw_manual_ready_receiver), it) } DetailRow(stringResource(R.string.withdraw_manual_ready_iban), transfer.iban) - TransactionInfoComposable( - label = stringResource(R.string.withdraw_exchange), - info = cleanExchange(exchangeBaseUrl), - ) + TransferStep(3, stringResource( + R.string.withdraw_manual_step_finish, + transferAmount, + )) WithdrawalAmountTransfer( amountRaw = transactionAmountRaw, amountEffective = transactionAmountEffective, conversionAmountRaw = transferAmount, ) + + TransactionInfoComposable( + label = stringResource(R.string.withdraw_exchange), + info = cleanExchange(exchangeBaseUrl), + ) } } \ No newline at end of file diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferTaler.kt b/wallet/src/main/java/net/taler/wallet/withdraw/manual/TransferTaler.kt @@ -16,9 +16,6 @@ package net.taler.wallet.withdraw.manual -import androidx.compose.foundation.BorderStroke -import androidx.compose.foundation.background -import androidx.compose.foundation.border import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.material3.MaterialTheme @@ -26,12 +23,12 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import net.taler.common.Amount import net.taler.wallet.R import net.taler.wallet.cleanExchange +import net.taler.wallet.compose.WarningLabel import net.taler.wallet.transactions.TransactionInfoComposable import net.taler.wallet.withdraw.TransferData @@ -55,22 +52,17 @@ fun TransferTaler( Text( text = stringResource( R.string.withdraw_manual_ready_intro, - transferAmount), + transferAmount, + transactionAmountEffective, + ), style = MaterialTheme.typography.bodyLarge, modifier = Modifier .padding(vertical = 8.dp) ) - Text( - text = stringResource(R.string.withdraw_manual_ready_warning), - style = MaterialTheme.typography.bodyMedium, - color = colorResource(R.color.notice_text), - modifier = Modifier - .align(Alignment.CenterHorizontally) - .padding(all = 8.dp) - .background(colorResource(R.color.notice_background)) - .border(BorderStroke(2.dp, colorResource(R.color.notice_border))) - .padding(all = 16.dp) + WarningLabel( + modifier = Modifier.padding(8.dp), + label = stringResource(R.string.withdraw_manual_ready_warning), ) DetailRow( @@ -79,6 +71,11 @@ fun TransferTaler( characterBreak = true, ) + WarningLabel( + modifier = Modifier.padding(8.dp), + label = stringResource(R.string.withdraw_manual_ready_warning), + ) + transfer.receiverName?.let { DetailRow(stringResource(R.string.withdraw_manual_ready_receiver), it) } diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml @@ -293,10 +293,15 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="withdraw_manual_ready_bank_button">Open in banking app</string> <string name="withdraw_manual_ready_details_intro">Bank transfer details</string> <string name="withdraw_manual_ready_iban">IBAN</string> - <string name="withdraw_manual_ready_intro">To complete the process you need to wire %s to the provider\'s bank account</string> - <string name="withdraw_manual_ready_receiver">Receiver name</string> +<!-- <string name="withdraw_manual_ready_intro">To complete the process you need to wire %s to the provider\'s bank account</string>--> + <string name="withdraw_manual_ready_intro">You need to transfer %1$s from your regular bank account to the payment service to receive %2$s as electronic cash in this wallet.</string> + <string name="withdraw_manual_ready_receiver">Recipient</string> <string name="withdraw_manual_ready_subject">Subject</string> <string name="withdraw_manual_ready_warning">Make sure to use the correct subject, otherwise the money will not arrive in this wallet.</string> + <string name="withdraw_manual_step">&lt;b&gt;Step %1$s:&lt;b/&gt; %2$s</string> + <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> <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>