commit 2c8a978e03176405ce99ab9fc549fc49c87d343b parent 046e0557f989664549fbd7f48d82838c1edc31bf Author: Iván Ávalos <avalos@disroot.org> Date: Wed, 15 May 2024 09:35:19 -0600 [wallet] remove no longer necessary isZero() fee checks bug 0008830 Diffstat:
13 files changed, 56 insertions(+), 76 deletions(-)
diff --git a/wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt b/wallet/src/main/java/net/taler/wallet/deposit/MakeDepositComposable.kt @@ -140,7 +140,7 @@ fun MakeDepositComposable( TransactionAmountComposable( label = stringResource(R.string.withdraw_fees), amount = fee.withSpec(amount.spec), - amountType = if (fee.isZero()) Positive else Negative, + amountType = Negative, ) } diff --git a/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt b/wallet/src/main/java/net/taler/wallet/deposit/TransactionDepositComposable.kt @@ -79,13 +79,11 @@ fun TransactionDepositComposable( if (t.amountEffective > t.amountRaw) { val fee = t.amountEffective - t.amountRaw - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee.withSpec(spec), - amountType = AmountType.Negative, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee.withSpec(spec), + amountType = AmountType.Negative, + ) } TransactionAmountComposable( diff --git a/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt b/wallet/src/main/java/net/taler/wallet/payment/TransactionPaymentComposable.kt @@ -84,13 +84,11 @@ fun TransactionPaymentComposable( if (t.amountEffective > t.amountRaw) { val fee = t.amountEffective - t.amountRaw - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee.withSpec(spec), - amountType = AmountType.Negative, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee.withSpec(spec), + amountType = AmountType.Negative, + ) } TransactionAmountComposable( diff --git a/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt b/wallet/src/main/java/net/taler/wallet/peer/IncomingComposable.kt @@ -157,7 +157,7 @@ fun ColumnScope.PeerPullTermsComposable( } else { stringResource(R.string.amount_positive, fee) } - if (!fee.isZero()) Text( + Text( modifier = Modifier.align(End), text = feeStr, style = MaterialTheme.typography.bodyLarge, diff --git a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullComposable.kt b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullComposable.kt @@ -150,7 +150,7 @@ fun OutgoingPullIntroComposable( if (state is OutgoingChecked && state.amountRaw > state.amountEffective) { val fee = state.amountRaw - state.amountEffective - if (!fee.isZero()) TransactionAmountComposable( + TransactionAmountComposable( label = stringResource(id = R.string.withdraw_fees), amount = fee.withSpec(amount.spec), amountType = AmountType.Negative, diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt @@ -56,13 +56,11 @@ fun ColumnScope.TransactionPeerPullCreditComposable(t: TransactionPeerPullCredit if (t.amountRaw > t.amountEffective) { val fee = t.amountRaw - t.amountEffective - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee.withSpec(spec), - amountType = AmountType.Negative, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee.withSpec(spec), + amountType = AmountType.Negative, + ) } TransactionAmountComposable( diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt @@ -48,13 +48,11 @@ fun TransactionPeerPullDebitComposable(t: TransactionPeerPullDebit, spec: Curren if (t.amountEffective > t.amountRaw) { val fee = t.amountEffective - t.amountRaw - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee.withSpec(spec), - amountType = AmountType.Negative, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee.withSpec(spec), + amountType = AmountType.Negative, + ) } TransactionAmountComposable( diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt @@ -48,13 +48,11 @@ fun TransactionPeerPushCreditComposable(t: TransactionPeerPushCredit, spec: Curr if (t.amountRaw > t.amountEffective) { val fee = t.amountRaw - t.amountEffective - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee.withSpec(spec), - amountType = AmountType.Negative, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee.withSpec(spec), + amountType = AmountType.Negative, + ) } TransactionAmountComposable( diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt @@ -67,13 +67,11 @@ fun ColumnScope.TransactionPeerPushDebitComposable(t: TransactionPeerPushDebit, if (t.amountEffective > t.amountRaw) { val fee = t.amountEffective - t.amountRaw - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee.withSpec(spec), - amountType = AmountType.Negative, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee.withSpec(spec), + amountType = AmountType.Negative, + ) } TransactionAmountComposable( diff --git a/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt b/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt @@ -83,13 +83,11 @@ fun TransactionRefundComposable( ) if (t.amountRaw > t.amountEffective) { val fee = t.amountRaw - t.amountEffective - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee.withSpec(spec), - amountType = AmountType.Negative, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee.withSpec(spec), + amountType = AmountType.Negative, + ) } TransactionInfoComposable( label = stringResource(id = R.string.transaction_order), diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt @@ -177,11 +177,9 @@ class PromptWithdrawFragment : Fragment() { if (amountRaw > amountEffective) { val fee = amountRaw - amountEffective - if (!fee.isZero()) { - ui.feeLabel.fadeIn() - ui.feeView.text = getString(R.string.amount_negative, fee.toString()) - ui.feeView.fadeIn() - } + ui.feeLabel.fadeIn() + ui.feeView.text = getString(R.string.amount_negative, fee.toString()) + ui.feeView.fadeIn() } ui.exchangeIntroView.fadeIn() diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt b/wallet/src/main/java/net/taler/wallet/withdraw/TransactionWithdrawalComposable.kt @@ -91,13 +91,11 @@ fun TransactionWithdrawalComposable( if (t.amountRaw > t.amountEffective) { val fee = t.amountRaw - t.amountEffective - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee.withSpec(spec), - amountType = AmountType.Negative, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee.withSpec(spec), + amountType = AmountType.Negative, + ) } TransactionAmountComposable( 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 @@ -208,19 +208,17 @@ fun WithdrawalAmountTransfer( if (amountRaw > amountEffective) { val fee = amountRaw - amountEffective - if (!fee.isZero()) { - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_fees), - amount = fee, - amountType = AmountType.Negative, - ) + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_fees), + amount = fee, + amountType = AmountType.Negative, + ) - TransactionAmountComposable( - label = stringResource(id = R.string.withdraw_total), - amount = amountEffective, - amountType = AmountType.Positive, - ) - } + TransactionAmountComposable( + label = stringResource(id = R.string.withdraw_total), + amount = amountEffective, + amountType = AmountType.Positive, + ) } } }