diff --git a/app/app/build.gradle.kts b/app/app/build.gradle.kts index 1ac4278653..5fca68203d 100644 --- a/app/app/build.gradle.kts +++ b/app/app/build.gradle.kts @@ -107,7 +107,7 @@ android { dependencies { implementation(platform(libs.firebase.bom)) implementation(libs.androidx.activity.compose) - implementation(libs.androidx.compose.animation) + implementation(libs.androidx.compose.animationCore) implementation(libs.androidx.compose.foundation) implementation(libs.androidx.compose.material3) implementation(libs.androidx.compose.material3.windowSizeClass) diff --git a/app/app/src/main/kotlin/com/hedvig/android/app/navigation/HedvigNavHost.kt b/app/app/src/main/kotlin/com/hedvig/android/app/navigation/HedvigNavHost.kt index 545572ab1d..a9f9c043c0 100644 --- a/app/app/src/main/kotlin/com/hedvig/android/app/navigation/HedvigNavHost.kt +++ b/app/app/src/main/kotlin/com/hedvig/android/app/navigation/HedvigNavHost.kt @@ -183,11 +183,6 @@ internal fun HedvigNavHost( openUrl = openUrl, navigator = navigator, ) - changeTierGraph( - navigator = navigator, - navController = hedvigAppState.navController, - applicationId = hedvigBuildConstants.appId, - ) insuranceGraph( nestedGraphs = { terminateInsuranceGraph( @@ -327,7 +322,6 @@ internal fun HedvigNavHost( changeTierGraph( navigator = navigator, navController = hedvigAppState.navController, - applicationId = hedvigBuildConstants.appId, ) movingFlowGraph( navController = hedvigAppState.navController, diff --git a/app/audio-player-ui/build.gradle.kts b/app/audio-player-ui/build.gradle.kts index 82c962dac6..fc93958d88 100644 --- a/app/audio-player-ui/build.gradle.kts +++ b/app/audio-player-ui/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } dependencies { - implementation(libs.androidx.compose.animation) + implementation(libs.androidx.compose.animationCore) implementation(libs.androidx.compose.foundation) implementation(libs.androidx.compose.uiUtil) implementation(libs.androidx.lifecycle.compose) diff --git a/app/feature/feature-choose-tier/build.gradle.kts b/app/feature/feature-choose-tier/build.gradle.kts index 07cdb1cfb3..783039d1f2 100644 --- a/app/feature/feature-choose-tier/build.gradle.kts +++ b/app/feature/feature-choose-tier/build.gradle.kts @@ -30,7 +30,6 @@ dependencies { implementation(projects.composeUi) implementation(projects.coreCommonAndroidPublic) implementation(projects.coreCommonPublic) - implementation(projects.coreFileUpload) implementation(projects.coreResources) implementation(projects.coreUiData) implementation(projects.dataChangetier) @@ -46,6 +45,7 @@ dependencies { implementation(projects.navigationCompose) implementation(projects.navigationComposeTyped) implementation(projects.navigationCore) + implementation(projects.uiTiersAndAddons) testImplementation(libs.apollo.testingSupport) testImplementation(libs.assertK) diff --git a/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/di/ChooseTierModule.kt b/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/di/ChooseTierModule.kt index 44dae02f27..1b4a3457d2 100644 --- a/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/di/ChooseTierModule.kt +++ b/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/di/ChooseTierModule.kt @@ -1,7 +1,6 @@ package com.hedvig.android.feature.change.tier.di import com.apollographql.apollo.ApolloClient -import com.hedvig.android.core.fileupload.DownloadPdfUseCase import com.hedvig.android.data.changetier.data.ChangeTierRepository import com.hedvig.android.feature.change.tier.data.GetCurrentContractDataUseCase import com.hedvig.android.feature.change.tier.data.GetCurrentContractDataUseCaseImpl @@ -60,7 +59,6 @@ val chooseTierModule = module { params = params.get(), tierRepository = get(), getCurrentContractDataUseCase = get(), - downloadPdfUseCase = get(), ) } diff --git a/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/navigation/ChooseTierGraph.kt b/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/navigation/ChooseTierGraph.kt index a83de1bdf5..06c74880d2 100644 --- a/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/navigation/ChooseTierGraph.kt +++ b/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/navigation/ChooseTierGraph.kt @@ -3,7 +3,6 @@ package com.hedvig.android.feature.change.tier.navigation import androidx.compose.ui.platform.LocalContext import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder -import com.hedvig.android.core.common.android.sharePDF import com.hedvig.android.feature.change.tier.ui.chooseinsurance.ChooseInsuranceToChangeTierDestination import com.hedvig.android.feature.change.tier.ui.chooseinsurance.ChooseInsuranceViewModel import com.hedvig.android.feature.change.tier.ui.comparison.ComparisonDestination @@ -24,7 +23,7 @@ import com.hedvig.android.navigation.core.Navigator import org.koin.androidx.compose.koinViewModel import org.koin.core.parameter.parametersOf -fun NavGraphBuilder.changeTierGraph(navigator: Navigator, navController: NavController, applicationId: String) { +fun NavGraphBuilder.changeTierGraph(navigator: Navigator, navController: NavController) { navdestination { _ -> val viewModel: StartTierFlowViewModel = koinViewModel { parametersOf(this.insuranceId) @@ -115,9 +114,6 @@ fun NavGraphBuilder.changeTierGraph(navigator: Navigator, navController: NavCont onFailure = { navigator.navigateUnsafe(ChooseTierDestination.SubmitFailure) }, - sharePdf = { - context.sharePDF(it, applicationId) - }, onSuccess = { navigator.navigateUnsafe(ChooseTierDestination.SubmitSuccess(this.params.activationDate)) { typedPopUpTo { diff --git a/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/ui/stepsummary/SummaryDestination.kt b/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/ui/stepsummary/SummaryDestination.kt index 996191022a..66b5478450 100644 --- a/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/ui/stepsummary/SummaryDestination.kt +++ b/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/ui/stepsummary/SummaryDestination.kt @@ -1,24 +1,17 @@ package com.hedvig.android.feature.change.tier.ui.stepsummary -import androidx.compose.animation.AnimatedVisibility -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign @@ -26,7 +19,6 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle -import com.hedvig.android.compose.ui.stringWithShiftedLabel import com.hedvig.android.core.uidata.UiCurrencyCode.SEK import com.hedvig.android.core.uidata.UiMoney import com.hedvig.android.data.changetier.data.Deductible @@ -35,10 +27,8 @@ import com.hedvig.android.data.changetier.data.TierDeductibleQuote import com.hedvig.android.data.contract.ContractGroup import com.hedvig.android.data.contract.ContractType import com.hedvig.android.data.productvariant.ProductVariant -import com.hedvig.android.design.system.hedvig.ButtonDefaults.ButtonSize import com.hedvig.android.design.system.hedvig.ButtonDefaults.ButtonSize.Large import com.hedvig.android.design.system.hedvig.ButtonDefaults.ButtonStyle.Primary -import com.hedvig.android.design.system.hedvig.ButtonDefaults.ButtonStyle.Secondary import com.hedvig.android.design.system.hedvig.HedvigAlertDialog import com.hedvig.android.design.system.hedvig.HedvigButton import com.hedvig.android.design.system.hedvig.HedvigErrorSection @@ -48,22 +38,16 @@ import com.hedvig.android.design.system.hedvig.HedvigMultiScreenPreview import com.hedvig.android.design.system.hedvig.HedvigScaffold import com.hedvig.android.design.system.hedvig.HedvigText import com.hedvig.android.design.system.hedvig.HedvigTheme -import com.hedvig.android.design.system.hedvig.HedvigThreeDotsProgressIndicator -import com.hedvig.android.design.system.hedvig.HorizontalDivider import com.hedvig.android.design.system.hedvig.HorizontalItemsWithMaximumSpaceTaken -import com.hedvig.android.design.system.hedvig.Icon -import com.hedvig.android.design.system.hedvig.IconButton import com.hedvig.android.design.system.hedvig.Surface -import com.hedvig.android.design.system.hedvig.icon.ArrowNorthEast -import com.hedvig.android.design.system.hedvig.icon.HedvigIcons import com.hedvig.android.feature.change.tier.ui.stepcustomize.ContractData -import com.hedvig.android.feature.change.tier.ui.stepcustomize.PillAndBasicInfo import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryState.Failure import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryState.Loading import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryState.MakingChanges import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryState.Success +import com.hedvig.android.tiersandaddons.QuoteCard +import com.hedvig.android.tiersandaddons.QuoteDisplayItem import hedvig.resources.R -import java.io.File @Composable internal fun ChangeTierSummaryDestination( @@ -71,7 +55,6 @@ internal fun ChangeTierSummaryDestination( navigateUp: () -> Unit, onSuccess: () -> Unit, onFailure: () -> Unit, - sharePdf: (File) -> Unit, ) { val uiState: SummaryState by viewModel.uiState.collectAsStateWithLifecycle() SummaryScreen( @@ -87,17 +70,10 @@ internal fun ChangeTierSummaryDestination( viewModel.emit(SummaryEvent.ClearNavigation) onFailure() }, - sharePdf = { file -> - viewModel.emit(SummaryEvent.HandledSharingPdfFile) - sharePdf(file) - }, navigateUp = navigateUp, onSubmitQuoteClick = { viewModel.emit(SummaryEvent.SubmitQuote) }, - downloadFromUrl = { url -> - viewModel.emit(SummaryEvent.DownLoadFromUrl(url)) - }, ) } @@ -108,9 +84,7 @@ private fun SummaryScreen( onSuccess: () -> Unit, navigateUp: () -> Unit, onFailure: () -> Unit, - sharePdf: (File) -> Unit, onSubmitQuoteClick: () -> Unit, - downloadFromUrl: (url: String) -> Unit, ) { when (uiState) { Failure -> HedvigScaffold(navigateUp) { @@ -146,10 +120,6 @@ private fun SummaryScreen( uiState = uiState, navigateUp = navigateUp, onConfirmClick = onSubmitQuoteClick, - downloadFromUrl = downloadFromUrl, - sharePdf = { file -> - sharePdf(file) - }, ) } } @@ -164,18 +134,7 @@ private fun MakingChangesScreen() { } @Composable -private fun SummarySuccessScreen( - uiState: Success, - onConfirmClick: () -> Unit, - downloadFromUrl: (String) -> Unit, - sharePdf: (File) -> Unit, - navigateUp: () -> Unit, -) { - if (uiState.savedFileUri != null) { - LaunchedEffect(uiState.savedFileUri) { - sharePdf(uiState.savedFileUri) - } - } +private fun SummarySuccessScreen(uiState: Success, onConfirmClick: () -> Unit, navigateUp: () -> Unit) { HedvigScaffold( navigateUp, topAppBarText = stringResource(R.string.TIER_FLOW_SUMMARY_TITLE), @@ -196,7 +155,6 @@ private fun SummarySuccessScreen( modifier = Modifier .fillMaxWidth() .padding(16.dp), - downloadFromUrl = downloadFromUrl, ) Spacer(Modifier.weight(1f)) Spacer(Modifier.height(16.dp)) @@ -237,37 +195,21 @@ private fun SummarySuccessScreen( } @Composable -private fun SummaryCard(uiState: Success, downloadFromUrl: (url: String) -> Unit, modifier: Modifier = Modifier) { - var showExpanded by remember { mutableStateOf(false) } - Surface( - modifier = modifier, - shape = HedvigTheme.shapes.cornerXLarge, - ) { - Column(Modifier.padding(16.dp)) { - PillAndBasicInfo( - contractGroup = uiState.currentContractData.contractGroup, - displayName = uiState.quote.productVariant.displayName, - displaySubtitle = uiState.currentContractData.contractDisplaySubtitle, - ) - Spacer(Modifier.height(16.dp)) - HorizontalItemsWithMaximumSpaceTaken( - startSlot = { - HedvigText( - stringResource(R.string.TIER_FLOW_TOTAL), - style = HedvigTheme.typography.bodySmall, - ) - }, - spaceBetween = 8.dp, - endSlot = { - HedvigText( - text = stringResource(R.string.TERMINATION_FLOW_PAYMENT_PER_MONTH, uiState.quote.premium.amount.toInt()), - textAlign = TextAlign.End, - style = HedvigTheme.typography.bodySmall, - ) - }, +private fun SummaryCard(uiState: Success, modifier: Modifier = Modifier) { + QuoteCard( + productVariant = uiState.quote.productVariant, + subtitle = uiState.currentContractData.contractDisplaySubtitle, + premium = stringResource(R.string.TERMINATION_FLOW_PAYMENT_PER_MONTH, uiState.quote.premium.amount.toInt()), + displayItems = uiState.quote.displayItems.map { + QuoteDisplayItem( + it.displayTitle, + null, + it.displayValue, ) + }, + underTitleContent = { HedvigText( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier.fillMaxWidth().padding(top = 2.dp), textAlign = TextAlign.End, text = stringResource( R.string.TIER_FLOW_PREVIOUS_PRICE, @@ -276,129 +218,11 @@ private fun SummaryCard(uiState: Success, downloadFromUrl: (url: String) -> Unit style = HedvigTheme.typography.label, color = HedvigTheme.colorScheme.textSecondary, ) - AnimatedVisibility(showExpanded) { - ExtendedCardContent( - quote = uiState.quote, - downloadFromUrl = downloadFromUrl, - isPDFLoading = uiState.isLoadingPdf, - ) - } - Spacer(Modifier.height(16.dp)) - HedvigButton( - modifier = Modifier.fillMaxWidth(), - text = if (showExpanded) { - stringResource(R.string.TIER_FLOW_SUMMARY_HIDE_DETAILS_BUTTON) - } else { - stringResource(R.string.TIER_FLOW_SUMMARY_SHOW_DETAILS) - }, - onClick = { showExpanded = !showExpanded }, - enabled = true, - buttonStyle = Secondary, - buttonSize = ButtonSize.Medium, - ) - } - } -} - -@Composable -fun DisplayItemRowSecondaryColor(leftText: String, rightText: String) { - HorizontalItemsWithMaximumSpaceTaken( - startSlot = { - HedvigText(leftText, color = HedvigTheme.colorScheme.textSecondary) }, - endSlot = { - Row( - horizontalArrangement = Arrangement.End, - verticalAlignment = Alignment.CenterVertically, - ) { - HedvigText( - rightText, - color = HedvigTheme.colorScheme.textSecondary, - textAlign = TextAlign.End, - ) - } - }, - spaceBetween = 8.dp, + modifier = modifier, ) } -@Composable -private fun ExtendedCardContent( - isPDFLoading: Boolean, - quote: TierDeductibleQuote, - downloadFromUrl: (url: String) -> Unit, -) { - Column { - Spacer(Modifier.height(16.dp)) - HorizontalDivider() - Spacer(Modifier.height(16.dp)) - HedvigText(stringResource(R.string.TIER_FLOW_SUMMARY_OVERVIEW_SUBTITLE)) - quote.displayItems.forEachIndexed { _, item -> - DisplayItemRowSecondaryColor(item.displayTitle, item.displayValue) - } - Spacer(Modifier.height(16.dp)) - HedvigText(stringResource(R.string.TIER_FLOW_SUMMARY_COVERAGE_SUBTITLE)) - quote.productVariant.insurableLimits.forEach { insurableLimit -> - DisplayItemRowSecondaryColor(insurableLimit.label, insurableLimit.limit) - } - Spacer(Modifier.height(16.dp)) - Row(verticalAlignment = Alignment.CenterVertically) { - HedvigText(stringResource(R.string.TIER_FLOW_SUMMARY_DOCUMENTS_SUBTITLE)) - Spacer(Modifier.width(16.dp)) - AnimatedVisibility(isPDFLoading) { HedvigThreeDotsProgressIndicator() } - } - quote.productVariant.documents.forEach { document -> - DocumentRow( - name = document.displayName, - downloadFromUrl = { - downloadFromUrl(document.url) - }, - ) - } - } -} - -@Composable -private fun DocumentRow(name: String, downloadFromUrl: () -> Unit) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.clickable { downloadFromUrl() }, - ) { - HorizontalItemsWithMaximumSpaceTaken( - startSlot = { - Row(verticalAlignment = Alignment.CenterVertically) { - HedvigText( - color = HedvigTheme.colorScheme.textSecondary, - text = stringWithShiftedLabel( - text = name, - labelText = "PDF", - textColor = HedvigTheme.colorScheme.textSecondary, - textFontSize = HedvigTheme.typography.bodySmall.fontSize, - labelFontSize = HedvigTheme.typography.label.fontSize, - ), - ) - } - }, - endSlot = { - Row( - horizontalArrangement = Arrangement.End, - verticalAlignment = Alignment.CenterVertically, - ) { - IconButton( - modifier = Modifier.size(24.dp), - onClick = { - downloadFromUrl() - }, - ) { - Icon(HedvigIcons.ArrowNorthEast, null) - } - } - }, - spaceBetween = 8.dp, - ) - } -} - @HedvigMultiScreenPreview @Composable private fun PreviewChooseInsuranceScreen( @@ -415,8 +239,6 @@ private fun PreviewChooseInsuranceScreen( {}, {}, {}, - {}, - {}, ) } } diff --git a/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/ui/stepsummary/SummaryViewModel.kt b/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/ui/stepsummary/SummaryViewModel.kt index af956289f8..f1efe39c76 100644 --- a/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/ui/stepsummary/SummaryViewModel.kt +++ b/app/feature/feature-choose-tier/src/main/kotlin/com/hedvig/android/feature/change/tier/ui/stepsummary/SummaryViewModel.kt @@ -7,33 +7,27 @@ import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import com.hedvig.android.core.fileupload.DownloadPdfUseCase import com.hedvig.android.data.changetier.data.ChangeTierRepository import com.hedvig.android.data.changetier.data.TierDeductibleQuote import com.hedvig.android.feature.change.tier.data.GetCurrentContractDataUseCase import com.hedvig.android.feature.change.tier.navigation.SummaryParameters import com.hedvig.android.feature.change.tier.ui.stepcustomize.ContractData import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryEvent.ClearNavigation -import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryEvent.DownLoadFromUrl -import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryEvent.HandledSharingPdfFile import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryEvent.Reload import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryEvent.SubmitQuote import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryState.Failure import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryState.Loading import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryState.MakingChanges import com.hedvig.android.feature.change.tier.ui.stepsummary.SummaryState.Success -import com.hedvig.android.logger.LogPriority import com.hedvig.android.logger.LogPriority.ERROR import com.hedvig.android.logger.logcat import com.hedvig.android.molecule.android.MoleculeViewModel import com.hedvig.android.molecule.public.MoleculePresenter import com.hedvig.android.molecule.public.MoleculePresenterScope -import java.io.File internal class SummaryViewModel( params: SummaryParameters, tierRepository: ChangeTierRepository, - downloadPdfUseCase: DownloadPdfUseCase, getCurrentContractDataUseCase: GetCurrentContractDataUseCase, ) : MoleculeViewModel( initialState = Loading, @@ -41,14 +35,12 @@ internal class SummaryViewModel( params = params, tierRepository = tierRepository, getCurrentContractDataUseCase = getCurrentContractDataUseCase, - downloadPdfUseCase = downloadPdfUseCase, ), ) private class SummaryPresenter( private val params: SummaryParameters, private val tierRepository: ChangeTierRepository, - private val downloadPdfUseCase: DownloadPdfUseCase, private val getCurrentContractDataUseCase: GetCurrentContractDataUseCase, ) : MoleculePresenter { @Composable @@ -56,9 +48,6 @@ private class SummaryPresenter( var submitIteration by remember { mutableIntStateOf(0) } var loadDataIteration by remember { mutableIntStateOf(0) } var currentState by remember { mutableStateOf(lastState) } - var downloadingUrl by remember { - mutableStateOf(null) - } CollectEvents { event -> when (event) { @@ -77,19 +66,6 @@ private class SummaryPresenter( return@CollectEvents } } - - is DownLoadFromUrl -> { - if (currentState !is Success) return@CollectEvents - currentState = (currentState as Success).copy(isLoadingPdf = true) - downloadingUrl = event.url - } - - HandledSharingPdfFile -> { - if (currentState !is Success) return@CollectEvents - currentState = (currentState as Success).copy( - savedFileUri = null, - ) - } } } @@ -150,32 +126,6 @@ private class SummaryPresenter( }, ) } - - LaunchedEffect(downloadingUrl) { - val downloadingUrlValue = downloadingUrl ?: return@LaunchedEffect - logcat(LogPriority.INFO) { "Downloading terms and conditions with url:$downloadingUrl" } - downloadPdfUseCase.invoke(downloadingUrlValue) - .fold( - ifLeft = { errorMessage -> - logcat(LogPriority.ERROR) { "Downloading terms and conditions failed:$errorMessage" } - // we only putting log on this, but no error state in the UI - val state = currentState - if (state !is Success) return@LaunchedEffect - currentState = state.copy(isLoadingPdf = false) - downloadingUrl = null - }, - ifRight = { uri -> - logcat( - LogPriority.INFO, - ) { "Downloading terms and conditions succeeded. Result uri:${uri.absolutePath}" } - val state = currentState - if (state !is Success) return@LaunchedEffect - currentState = state.copy(isLoadingPdf = false, savedFileUri = uri) - downloadingUrl = null - }, - ) - } - return currentState } } @@ -190,8 +140,6 @@ internal sealed interface SummaryState { data class Success( val quote: TierDeductibleQuote, val currentContractData: ContractData, - val savedFileUri: File? = null, - val isLoadingPdf: Boolean = false, val navigateToFail: Boolean = false, ) : SummaryState @@ -204,8 +152,4 @@ internal sealed interface SummaryEvent { data object Reload : SummaryEvent data object ClearNavigation : SummaryEvent - - data object HandledSharingPdfFile : SummaryEvent - - data class DownLoadFromUrl(val url: String) : SummaryEvent } diff --git a/app/feature/feature-movingflow/build.gradle.kts b/app/feature/feature-movingflow/build.gradle.kts index 98f81438c0..0dd1c4e197 100644 --- a/app/feature/feature-movingflow/build.gradle.kts +++ b/app/feature/feature-movingflow/build.gradle.kts @@ -28,12 +28,12 @@ dependencies { implementation(projects.coreUiData) implementation(projects.dataContractAndroid) implementation(projects.dataProductVariantAndroid) - implementation(projects.uiTiersAndAddons) implementation(projects.dataProductVariantPublic) implementation(projects.designSystemHedvig) implementation(projects.moleculeAndroid) implementation(projects.moleculePublic) implementation(projects.navigationCompose) + implementation(projects.uiTiersAndAddons) } apollo { diff --git a/app/ui/placeholder/build.gradle.kts b/app/ui/placeholder/build.gradle.kts index 227f91670d..cba8395e4c 100644 --- a/app/ui/placeholder/build.gradle.kts +++ b/app/ui/placeholder/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } dependencies { - implementation(libs.androidx.compose.animation) + implementation(libs.androidx.compose.animationCore) implementation(libs.androidx.compose.material3) implementation(libs.androidx.compose.runtime) implementation(libs.androidx.compose.uiUtil) diff --git a/app/ui/pullrefresh/build.gradle.kts b/app/ui/pullrefresh/build.gradle.kts index d00c0d3385..d79d558748 100644 --- a/app/ui/pullrefresh/build.gradle.kts +++ b/app/ui/pullrefresh/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } dependencies { - implementation(libs.androidx.compose.animation) + implementation(libs.androidx.compose.animationCore) implementation(libs.androidx.compose.material3) implementation(libs.androidx.compose.runtime) } diff --git a/app/ui/ui-tiers-and-addons/build.gradle.kts b/app/ui/ui-tiers-and-addons/build.gradle.kts index 67df7e75a6..6defb52a1c 100644 --- a/app/ui/ui-tiers-and-addons/build.gradle.kts +++ b/app/ui/ui-tiers-and-addons/build.gradle.kts @@ -7,9 +7,21 @@ plugins { } dependencies { + api(libs.androidx.compose.runtime) + api(libs.androidx.compose.uiCore) + + implementation(libs.androidx.compose.animation) + implementation(libs.androidx.compose.animationCore) + implementation(libs.androidx.compose.foundation) + implementation(libs.androidx.compose.foundationLayout) + implementation(libs.androidx.compose.runtimeSaveable) + implementation(libs.androidx.compose.uiGraphics) + implementation(libs.androidx.compose.uiText) + implementation(libs.androidx.compose.uiUnit) implementation(projects.composeUi) implementation(projects.coreResources) implementation(projects.dataContractAndroid) + implementation(projects.dataContractPublic) implementation(projects.dataProductVariantPublic) implementation(projects.designSystemHedvig) } diff --git a/app/ui/ui-tiers-and-addons/src/main/kotlin/com/hedvig/android/tiersandaddons/QuoteDisplayItem.kt b/app/ui/ui-tiers-and-addons/src/main/kotlin/com/hedvig/android/tiersandaddons/QuoteCard.kt similarity index 86% rename from app/ui/ui-tiers-and-addons/src/main/kotlin/com/hedvig/android/tiersandaddons/QuoteDisplayItem.kt rename to app/ui/ui-tiers-and-addons/src/main/kotlin/com/hedvig/android/tiersandaddons/QuoteCard.kt index d80aeb6e82..5956f4d88f 100644 --- a/app/ui/ui-tiers-and-addons/src/main/kotlin/com/hedvig/android/tiersandaddons/QuoteDisplayItem.kt +++ b/app/ui/ui-tiers-and-addons/src/main/kotlin/com/hedvig/android/tiersandaddons/QuoteCard.kt @@ -33,7 +33,12 @@ import com.hedvig.android.compose.ui.preview.BooleanCollectionPreviewParameterPr import com.hedvig.android.data.contract.ContractGroup.DOG import com.hedvig.android.data.contract.ContractType.SE_HOUSE import com.hedvig.android.data.contract.android.toPillow +import com.hedvig.android.data.productvariant.InsurableLimit +import com.hedvig.android.data.productvariant.InsurableLimit.InsurableLimitType.BIKE +import com.hedvig.android.data.productvariant.InsuranceVariantDocument +import com.hedvig.android.data.productvariant.InsuranceVariantDocument.InsuranceDocumentType.GENERAL_TERMS import com.hedvig.android.data.productvariant.ProductVariant +import com.hedvig.android.data.productvariant.ProductVariantPeril import com.hedvig.android.design.system.hedvig.ButtonDefaults.ButtonSize.Medium import com.hedvig.android.design.system.hedvig.ButtonDefaults.ButtonStyle.Secondary import com.hedvig.android.design.system.hedvig.HedvigButton @@ -63,6 +68,7 @@ fun QuoteCard( premium: String, displayItems: List, modifier: Modifier = Modifier, + underTitleContent: @Composable () -> Unit = {}, ) { var showDetails by rememberSaveable { mutableStateOf(false) } QuoteCard( @@ -72,6 +78,7 @@ fun QuoteCard( subtitle = subtitle, premium = premium, displayItems = displayItems, + underTitleContent = underTitleContent, modifier = modifier, ) } @@ -85,6 +92,7 @@ private fun QuoteCard( premium: String, displayItems: List, modifier: Modifier = Modifier, + underTitleContent: @Composable () -> Unit = {}, ) { HedvigCard( modifier = modifier, @@ -126,6 +134,7 @@ private fun QuoteCard( ) }, ) + underTitleContent() AnimatedVisibility( visible = showDetails, enter = expandVertically(expandFrom = Alignment.Top), @@ -237,9 +246,31 @@ private fun PreviewQuoteCard( contractGroup = DOG, contractType = SE_HOUSE, partner = "partner", - perils = emptyList(), - insurableLimits = emptyList(), - documents = emptyList(), + perils = List(3) { + ProductVariantPeril( + id = it.toString(), + title = "title#$it", + description = "description#$it", + covered = emptyList(), + exceptions = emptyList(), + colorCode = "colorCode#$it", + ) + }, + insurableLimits = List(3) { + InsurableLimit( + label = "label#$it", + limit = "limit#$it", + description = "description#$it", + type = BIKE, + ) + }, + documents = List(3) { + InsuranceVariantDocument( + displayName = "displayName#$it", + url = "url#$it", + type = GENERAL_TERMS, + ) + }, displayTierName = "displayTierName", tierDescription = "tierDescription", ), diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dbae402703..e81dc15d12 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -87,7 +87,8 @@ accompanist-permissions = { module = "com.google.accompanist:accompanist-permiss androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" } androidx-activity-core = { module = "androidx.activity:activity", version.ref = "androidx-activity-core" } androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" } -androidx-compose-animation = { module = "androidx.compose.animation:animation-core" } +androidx-compose-animation = { module = "androidx.compose.animation:animation" } +androidx-compose-animationCore = { module = "androidx.compose.animation:animation-core" } androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-composeBom" } androidx-compose-foundation = { module = "androidx.compose.foundation:foundation" } androidx-compose-foundationLayout = { module = "androidx.compose.foundation:foundation-layout" } @@ -96,7 +97,9 @@ androidx-compose-material3-windowSizeClass = { module = "androidx.compose.materi androidx-compose-materialIconsCore = { module = "androidx.compose.material:material-icons-core" } androidx-compose-materialRipple = { module = "androidx.compose.material:material-ripple" } androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" } +androidx-compose-runtimeSaveable = { module = "androidx.compose.runtime:runtime-saveable" } androidx-compose-uiCore = { module = "androidx.compose.ui:ui" } +androidx-compose-uiText = { module = "androidx.compose.ui:ui-text" } androidx-compose-uiGraphics = { module = "androidx.compose.ui:ui-graphics" } androidx-compose-uiTestManifest = { module = "androidx.compose.ui:ui-test-manifest" } androidx-compose-uiTooling = { module = "androidx.compose.ui:ui-tooling" }