gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-android] 01/02: [wallet] properly show fee prefix for incom


From: gnunet
Subject: [taler-taler-android] 01/02: [wallet] properly show fee prefix for incoming peer debit/credit
Date: Wed, 22 Feb 2023 15:43:27 +0100

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a commit to branch master
in repository taler-android.

commit dfaf852dad332643f9e78556115a8fbb029a6fce
Author: Torsten Grote <t@grobox.de>
AuthorDate: Wed Feb 22 11:41:05 2023 -0300

    [wallet] properly show fee prefix for incoming peer debit/credit
---
 .../main/java/net/taler/wallet/peer/IncomingComposable.kt    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt 
b/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
index 11867f3..2e2ed8a 100644
--- a/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt
@@ -52,16 +52,19 @@ import 
net.taler.wallet.backend.TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED
 import net.taler.wallet.backend.TalerErrorInfo
 
 data class IncomingData(
+    val isCredit: Boolean,
     @StringRes val intro: Int,
     @StringRes val button: Int,
 )
 
 val incomingPush = IncomingData(
+    isCredit = true,
     intro = R.string.receive_peer_payment_intro,
     button = R.string.receive_peer_payment_title,
 )
 
 val incomingPull = IncomingData(
+    isCredit = false,
     intro = R.string.pay_peer_intro,
     button = R.string.payment_button_confirm,
 )
@@ -140,14 +143,19 @@ fun ColumnScope.PeerPullTermsComposable(
                 )
             }
             // this gets used for credit and debit, so fee calculation differs
-            val fee = if (terms.amountRaw > terms.amountEffective) {
+            val fee = if (data.isCredit) {
                 terms.amountRaw - terms.amountEffective
             } else {
                 terms.amountEffective - terms.amountRaw
             }
+            val feeStr = if (data.isCredit) {
+                stringResource(R.string.amount_negative, fee)
+            } else {
+                stringResource(R.string.amount_positive, fee)
+            }
             if (!fee.isZero()) Text(
                 modifier = Modifier.align(End),
-                text = stringResource(id = R.string.amount_negative, fee),
+                text = feeStr,
                 style = MaterialTheme.typography.bodyLarge,
                 color = MaterialTheme.colorScheme.error,
             )

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]