From 695f73fb9a8ec687dee8f9dc6c4561c9228752c7 Mon Sep 17 00:00:00 2001 From: mtgriego Date: Tue, 2 Apr 2024 16:37:52 -0700 Subject: [PATCH] Revert "Revert "fixed issues with bonus amount being displayed incorrectly and being unable to be decremented"" (#2005) This reverts commit 74128cac1ac4f1aaa85c2c519717ebf5db4f696f. --- .../compose/projectpage/ConfirmPledgeDetailsScreen.kt | 6 +++++- .../viewmodels/projectpage/ConfirmDetailsViewModel.kt | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/kickstarter/ui/activities/compose/projectpage/ConfirmPledgeDetailsScreen.kt b/app/src/main/java/com/kickstarter/ui/activities/compose/projectpage/ConfirmPledgeDetailsScreen.kt index bacc2c3a69..ae799f4e50 100644 --- a/app/src/main/java/com/kickstarter/ui/activities/compose/projectpage/ConfirmPledgeDetailsScreen.kt +++ b/app/src/main/java/com/kickstarter/ui/activities/compose/projectpage/ConfirmPledgeDetailsScreen.kt @@ -685,7 +685,11 @@ fun ItemizedRewardListContainer( Row { Text( - text = stringResource(id = R.string.Bonus_support), + text = stringResource( + id = + if (rewardsList.isNotEmpty()) R.string.Bonus_support + else R.string.Pledge_without_a_reward + ), style = typography.subheadlineMedium, color = colors.textSecondary ) diff --git a/app/src/main/java/com/kickstarter/viewmodels/projectpage/ConfirmDetailsViewModel.kt b/app/src/main/java/com/kickstarter/viewmodels/projectpage/ConfirmDetailsViewModel.kt index 1820ed56c4..364d1c76c8 100644 --- a/app/src/main/java/com/kickstarter/viewmodels/projectpage/ConfirmDetailsViewModel.kt +++ b/app/src/main/java/com/kickstarter/viewmodels/projectpage/ConfirmDetailsViewModel.kt @@ -99,6 +99,7 @@ class ConfirmDetailsViewModel(val environment: Environment) : ViewModel() { if (::projectData.isInitialized) { pledgeReason = pledgeDataAndPledgeReason(projectData, reward).second } + addedBonusSupport = 0.0 updateShippingAmount() @@ -230,7 +231,7 @@ class ConfirmDetailsViewModel(val environment: Environment) : ViewModel() { } fun decrementBonusSupport() { - if (addedBonusSupport - minStepAmount >= initialBonusSupport) { + if ((addedBonusSupport + initialBonusSupport) - minStepAmount >= initialBonusSupport) { addedBonusSupport -= minStepAmount totalAmount = calculateTotal() viewModelScope.launch {