From 0b1c376e910423b6462233efbad4692c7c60ce51 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 2 Apr 2024 15:54:29 -0700 Subject: [PATCH] fixed issues with bonus amount being displayed incorrectly and being unable to be decremented --- .../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 {