Skip to content

Commit

Permalink
Merge pull request #2363 from HedvigInsurance/fix/wrong-deductible-wh…
Browse files Browse the repository at this point in the history
…en-choosing-new-tier-moving

Fix/wrong deductible when choosing new tier moving
  • Loading branch information
panasetskaya authored Dec 20, 2024
2 parents b53fae5 + 3b0d968 commit d8ca771
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions app/feature/feature-movingflow/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ dependencies {
implementation(projects.navigationCompose)
implementation(projects.tierComparison)
implementation(projects.uiTiersAndAddons)
implementation(libs.compose.richtext)
implementation(libs.compose.richtextCommonmark)
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ private class ChoseCoverageLevelAndDeductiblePresenter(
when (event) {
is SelectCoverage -> {
val currentContent = tiersInfo.getOrNull() ?: return@CollectEvents
val newSelectedCoverage =
currentContent.allOptions.firstOrNull { it.id == event.homeQuoteId } ?: return@CollectEvents
val currentDeductible = currentContent.selectedDeductible?.deductible
val newlySelectedQuote = currentContent.allOptions.firstOrNull { it.id == event.homeQuoteId }
val newlySelectedTier = newlySelectedQuote?.tierName
val quoteWithSameDeductibleAndNewTier = currentContent.allOptions.firstOrNull {
it.tierName == newlySelectedTier && it.deductible == currentDeductible
}
val newSelectedCoverage = quoteWithSameDeductibleAndNewTier ?: newlySelectedQuote ?: return@CollectEvents
if (newSelectedCoverage == currentContent.selectedCoverage) return@CollectEvents
launch {
movingFlowRepository.updatePreselectedHomeQuoteId(newSelectedCoverage.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.halilibo.richtext.commonmark.Markdown
import com.hedvig.android.core.uidata.UiCurrencyCode.SEK
import com.hedvig.android.core.uidata.UiMoney
import com.hedvig.android.data.contract.ContractGroup
Expand All @@ -60,6 +61,7 @@ import com.hedvig.android.design.system.hedvig.HedvigTheme
import com.hedvig.android.design.system.hedvig.HorizontalItemsWithMaximumSpaceTaken
import com.hedvig.android.design.system.hedvig.NotificationDefaults.NotificationPriority.Info
import com.hedvig.android.design.system.hedvig.NotificationDefaults.NotificationPriority.InfoInline
import com.hedvig.android.design.system.hedvig.RichText
import com.hedvig.android.design.system.hedvig.Surface
import com.hedvig.android.design.system.hedvig.datepicker.HedvigDateTimeFormatterDefaults
import com.hedvig.android.design.system.hedvig.datepicker.getLocale
Expand Down Expand Up @@ -299,9 +301,14 @@ private fun AddonQuoteCard(quote: MovingFlowQuotes.AddonQuote, modifier: Modifie
Column {
Spacer(Modifier.height(16.dp))
HedvigNotificationCard(
"This addon can be removed by contacting support", // todo l10n
// stringResource(R.string.MOVING_FLOW_REMOVE_ADDON_INFO, deepLinkToNewChat),
// todo: add deep link to new conversation!
content = {
RichText {
Markdown(
content = stringResource(R.string.MOVING_FLOW_TRAVEL_ADDON_SUMMARY_DESCRIPTION),
)
}
},
// todo: add deep link to new conversation, not inbox! see: https://hedviginsurance.slack.com/archives/C07MM6F0DK2/p1734647206289359?thread_ts=1734613513.633699&cid=C07MM6F0DK2
InfoInline,
)
}
Expand Down

0 comments on commit d8ca771

Please sign in to comment.