From a7f1ec3963b35ebe30e46fba940154379da8899a Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Tue, 17 Oct 2023 16:35:35 +0200 Subject: [PATCH 01/19] Enable octopus moving flow with movingFlowClient feature flag --- .../featureflags/flags/HAnalyticsFeatureFlagProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/hanalytics/hanalytics-feature-flags-public/src/main/kotlin/com/hedvig/android/hanalytics/featureflags/flags/HAnalyticsFeatureFlagProvider.kt b/app/hanalytics/hanalytics-feature-flags-public/src/main/kotlin/com/hedvig/android/hanalytics/featureflags/flags/HAnalyticsFeatureFlagProvider.kt index 131a5c8d6f..93f62704f5 100644 --- a/app/hanalytics/hanalytics-feature-flags-public/src/main/kotlin/com/hedvig/android/hanalytics/featureflags/flags/HAnalyticsFeatureFlagProvider.kt +++ b/app/hanalytics/hanalytics-feature-flags-public/src/main/kotlin/com/hedvig/android/hanalytics/featureflags/flags/HAnalyticsFeatureFlagProvider.kt @@ -20,7 +20,7 @@ internal class HAnalyticsFeatureFlagProvider( Feature.TERMINATION_FLOW -> hAnalytics.terminationFlow() Feature.UPDATE_NECESSARY -> hAnalytics.updateNecessary() Feature.USE_NATIVE_CLAIMS_FLOW -> hAnalytics.claimsFlow() - Feature.NEW_MOVING_FLOW -> false + Feature.NEW_MOVING_FLOW -> hAnalytics.movingFlowClient() Feature.CLAIMS_TRIAGING -> hAnalytics.claimsTriaging() Feature.TRAVEL_CERTIFICATE -> hAnalytics.travelInsurance() } From dce6c58670c1bc6a7eec834900325426f07289e3 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Tue, 17 Oct 2023 16:55:02 +0200 Subject: [PATCH 02/19] Remove unused deep links list to moving_flow feature --- .../feature/changeaddress/navigation/ChangeAddressGraph.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt index b8b15e04df..eeaf25c128 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt @@ -26,7 +26,6 @@ fun NavGraphBuilder.changeAddressGraph( ) { navigation( startDestination = createRoutePattern(), - deepLinks = listOf(), ) { composable { navBackStackEntry -> val viewModel: ChangeAddressViewModel = destinationScopedViewModel( From d15ed60d77956143a2f3a9feac491ca08661f609 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:00:29 +0200 Subject: [PATCH 03/19] Use `Icon` instead of `Image` to support dark mode Also use the hedvig icon instead of the generic one. Remove the content description which was not precicly describing the action. --- app/feature/feature-changeaddress/build.gradle.kts | 1 + .../ui/extrabuildings/ExtraBuildingContainer.kt | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/feature/feature-changeaddress/build.gradle.kts b/app/feature/feature-changeaddress/build.gradle.kts index 3c5a82e751..23346966a0 100644 --- a/app/feature/feature-changeaddress/build.gradle.kts +++ b/app/feature/feature-changeaddress/build.gradle.kts @@ -28,6 +28,7 @@ dependencies { implementation(projects.apolloOctopusPublic) implementation(projects.coreCommonPublic) implementation(projects.coreDesignSystem) + implementation(projects.coreIcons) implementation(projects.coreResources) implementation(projects.coreUi) implementation(projects.coreUiData) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingContainer.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingContainer.kt index 2e548cf237..0ef1f12a23 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingContainer.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingContainer.kt @@ -76,11 +76,9 @@ fun ExtraBuildingContainer( Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.weight(1f)) IconButton(onClick = { onRemoveExtraBuildingClicked(extraBuilding) }) { - Image( - imageVector = Icons.Filled.Clear, - contentDescription = stringResource( - R.string.login_text_input_email_address_icon_description_clear_all, - ), + Icon( + imageVector = Icons.Hedvig.X, + contentDescription = null, ) } } From 2e6c2c83374baef9f5f4c24dab1c633572e62549 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:02:39 +0200 Subject: [PATCH 04/19] Fixes in ExtraBuildingContainer Make buildings content animate in individually, and not all items at all times whenever there is any chane. Done by applying the animation per item instead of for all items together. Use correct contentColor for button. Fix visibility modifiers for both functions Fix using `height` as a spacer in a row instead of `width` Fix greyed out text to use `onSurfaceVariant` --- .../extrabuildings/ExtraBuildingContainer.kt | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingContainer.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingContainer.kt index 0ef1f12a23..fe0558971e 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingContainer.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingContainer.kt @@ -1,40 +1,46 @@ package com.hedvig.android.feature.changeaddress.ui.extrabuildings -import androidx.compose.animation.AnimatedContent -import androidx.compose.foundation.Image +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.core.MutableTransitionState +import androidx.compose.animation.expandVertically +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.shrinkVertically import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Clear import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.Icon import androidx.compose.material3.IconButton -import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.hedvig.android.core.designsystem.component.button.HedvigContainedSmallButton import com.hedvig.android.core.designsystem.component.card.HedvigCard +import com.hedvig.android.core.designsystem.material3.onTypeContainer import com.hedvig.android.core.designsystem.material3.typeContainer import com.hedvig.android.core.designsystem.preview.HedvigPreview import com.hedvig.android.core.designsystem.theme.HedvigTheme +import com.hedvig.android.core.icons.Hedvig +import com.hedvig.android.core.icons.hedvig.normal.X import com.hedvig.android.feature.changeaddress.data.ExtraBuilding import com.hedvig.android.feature.changeaddress.data.ExtraBuildingType import com.hedvig.android.feature.changeaddress.data.stringRes import hedvig.resources.R @Composable -fun ExtraBuildingContainer( +internal fun ExtraBuildingContainer( extraBuildings: List, onAddExtraBuildingClicked: () -> Unit, - onExtraBuildingItemClicked: (ExtraBuilding) -> Unit, onRemoveExtraBuildingClicked: (ExtraBuilding) -> Unit, modifier: Modifier = Modifier, ) { @@ -46,12 +52,22 @@ fun ExtraBuildingContainer( style = MaterialTheme.typography.bodyMedium, modifier = Modifier.padding(vertical = 12.dp, horizontal = 16.dp), ) - AnimatedContent(targetState = extraBuildings, label = "extraBuildings") { - Column { - it.forEach { extraBuilding -> + Column { + extraBuildings.forEach { extraBuilding: ExtraBuilding -> + val visibleState = remember { + MutableTransitionState(false).apply { + targetState = true + } + } + AnimatedVisibility( + visibleState = visibleState, + enter = fadeIn() + expandVertically(expandFrom = Alignment.CenterVertically), + exit = fadeOut() + shrinkVertically(shrinkTowards = Alignment.CenterVertically), + label = "extraBuilding", + ) { Row( modifier = Modifier - // .clickable { onExtraBuildingItemClicked(extraBuilding) } // TODO +// .clickable { onExtraBuildingItemClicked(extraBuilding) } // TODO .padding(horizontal = 16.dp, vertical = 8.dp), verticalAlignment = Alignment.CenterVertically, ) { @@ -62,18 +78,18 @@ fun ExtraBuildingContainer( ) Text( text = stringResource(id = R.string.CHANGE_ADDRESS_EXTRA_BUILDINGS_SIZE_LABEL, extraBuilding.size), - color = MaterialTheme.colorScheme.secondary, + color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodyMedium, ) if (extraBuilding.hasWaterConnected) { Text( text = stringResource(id = R.string.CHANGE_ADDRESS_EXTRA_BUILDINGS_WATER_LABEL), - color = MaterialTheme.colorScheme.secondary, + color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodyMedium, ) } } - Spacer(modifier = Modifier.height(16.dp)) + Spacer(modifier = Modifier.width(16.dp)) Spacer(modifier = Modifier.weight(1f)) IconButton(onClick = { onRemoveExtraBuildingClicked(extraBuilding) }) { Icon( @@ -91,7 +107,7 @@ fun ExtraBuildingContainer( onClick = onAddExtraBuildingClicked, colors = ButtonDefaults.buttonColors( containerColor = MaterialTheme.colorScheme.typeContainer, - contentColor = LocalContentColor.current, + contentColor = MaterialTheme.colorScheme.onTypeContainer, ), modifier = Modifier.padding(vertical = 12.dp, horizontal = 16.dp), ) @@ -101,7 +117,7 @@ fun ExtraBuildingContainer( @HedvigPreview @Composable -fun PreviewExtraBuildingContainer() { +private fun PreviewExtraBuildingContainer() { HedvigTheme { Surface { ExtraBuildingContainer( @@ -117,7 +133,6 @@ fun PreviewExtraBuildingContainer() { hasWaterConnected = true, ), ), - onExtraBuildingItemClicked = {}, onAddExtraBuildingClicked = {}, onRemoveExtraBuildingClicked = {}, ) From b9ec654b14285bc955aac39142c9de366b36cf40 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:08:56 +0200 Subject: [PATCH 05/19] Fix crash when entering an empty string for size input --- .../ui/extrabuildings/ExtraBuildingBottomSheet.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt index b647e7bca5..7674d48cd8 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.verticalScroll import androidx.compose.material3.MaterialTheme import androidx.compose.material3.ModalBottomSheet @@ -98,7 +99,7 @@ internal fun ExtraBuildingBottomSheet( onClick = { if (isInputValid(sizeInput, selectedType)) { val newExtraBuilding = ExtraBuilding( - size = sizeInput?.toInt() ?: 0, + size = sizeInput?.toIntOrNull() ?: 0, type = selectedType ?: ExtraBuildingType.CARPORT, hasWaterConnected = hasWaterConnected, ) From 05680d59cd61a495d6ed55c5963abbf08fb77ef7 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:09:15 +0200 Subject: [PATCH 06/19] Make keyboard easier to use by only showing numbers for number input --- .../ui/extrabuildings/ExtraBuildingBottomSheet.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt index 7674d48cd8..9da39916fd 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt @@ -21,6 +21,7 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import com.hedvig.android.core.designsystem.component.button.HedvigContainedButton @@ -82,6 +83,9 @@ internal fun ExtraBuildingBottomSheet( sizeErrorText = null sizeInput = it }, + keyboardOptions = KeyboardOptions( + keyboardType = KeyboardType.Number, + ), modifier = Modifier .padding(horizontal = 16.dp) .fillMaxWidth(), From 9de4fb4ff9a8bcd77b25faebfdca41bcda5b97dd Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:11:45 +0200 Subject: [PATCH 07/19] Fix bug with using `List.replace` The function was returning a new list with the result instead of mutating the MutableList in-place. Removed the function altogether in favor of doing a simpler approach of removing the item if it's in there since we already got a mutable list to work with. --- .../changeaddress/ChangeAddressViewModel.kt | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt index 52c78daef3..c76ecb78d1 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt @@ -111,12 +111,11 @@ internal class ChangeAddressViewModel( } fun onExpandQuote(moveQuote: MoveQuote) { - _uiState.update { - it.copy( - quotes = it.quotes.replace( - newValue = moveQuote.copy(isExpanded = !moveQuote.isExpanded), - block = { it == moveQuote }, - ), + _uiState.update { uiState: ChangeAddressUiState -> + uiState.copy( + quotes = uiState.quotes.map { quote: MoveQuote -> + if (quote == moveQuote) moveQuote.copy(isExpanded = !moveQuote.isExpanded) else quote + }, ) } } @@ -229,10 +228,12 @@ internal class ChangeAddressViewModel( fun addExtraBuilding(extraBuilding: ExtraBuilding) { _uiState.update { val extraBuildings = it.extraBuildings.toMutableList() - extraBuildings.find { it.id == extraBuilding.id }?.let { - extraBuildings.replace(extraBuilding) { it.id == extraBuilding.id } - } ?: extraBuildings.add(extraBuilding) - it.copy(extraBuildings = extraBuildings) + val existingBuildingWithSameId = extraBuildings.find { it.id == extraBuilding.id } + if (existingBuildingWithSameId != null) { + extraBuildings.remove(existingBuildingWithSameId) + } + extraBuildings.add(extraBuilding) + it.copy(extraBuildings = extraBuildings.toList()) } } } @@ -275,9 +276,3 @@ private fun ChangeAddressUiState.toQuoteInput() = when (housingType.input) { null -> throw IllegalArgumentException("No housing type found when creating input") } - -fun List.replace(newValue: T, block: (T) -> Boolean): List { - return map { - if (block(it)) newValue else it - } -} From fe2fe5d961db36147d6b2678d7d16acd85d84e3c Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:17:26 +0200 Subject: [PATCH 08/19] Make implementation better show that it just clears the error message --- .../android/feature/changeaddress/ChangeAddressViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt index c76ecb78d1..9b371fb860 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt @@ -166,7 +166,7 @@ internal class ChangeAddressViewModel( } fun onHousingTypeErrorDialogDismissed() { - _uiState.update { it.copy(housingType = ValidatedInput(it.housingType.input)) } + _uiState.update { it.copy(housingType = it.housingType.copy(errorMessageRes = null)) } } fun onHousingTypeSubmitted() { From 1bea07a27f0b2e81557e77bd6993803a9d049ee7 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:27:23 +0200 Subject: [PATCH 09/19] Refactor functions to use early returns for readability --- .../changeaddress/ChangeAddressUiState.kt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressUiState.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressUiState.kt index 119fe72f45..4f3b70fe6b 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressUiState.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressUiState.kt @@ -132,24 +132,24 @@ internal data class ChangeAddressUiState( ) } - private fun isSquareMetersWithinBounds(squareMeters: Int?) = if (maxSquareMeters != null) { + private fun isSquareMetersWithinBounds(squareMeters: Int?): Boolean { + if (maxSquareMeters == null) { + return true + } if (squareMeters == null) { - false - } else { - squareMeters <= maxSquareMeters + return false } - } else { - true + return squareMeters <= maxSquareMeters } - private fun isNumberCoInsuredWithinBounds(numberCoInsured: Int?) = if (maxNumberCoInsured != null) { + private fun isNumberCoInsuredWithinBounds(numberCoInsured: Int?): Boolean { + if (maxNumberCoInsured == null) { + return true + } if (numberCoInsured == null) { - false - } else { - numberCoInsured <= maxNumberCoInsured + return false } - } else { - true + return numberCoInsured <= maxNumberCoInsured } } From 0372f5172bed4397af2640b5b59e1b27019655c5 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:28:33 +0200 Subject: [PATCH 10/19] Refactor more functions to use early returns for readability --- .../data/ChangeAddressRepository.kt | 69 ++++++++++--------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ChangeAddressRepository.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ChangeAddressRepository.kt index 3eda02df10..ee559185b6 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ChangeAddressRepository.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ChangeAddressRepository.kt @@ -2,6 +2,7 @@ package com.hedvig.android.feature.changeaddress.data import arrow.core.Either import arrow.core.raise.either +import arrow.core.raise.ensureNotNull import com.apollographql.apollo3.ApolloClient import com.hedvig.android.apollo.safeExecute import com.hedvig.android.apollo.toEither @@ -19,7 +20,7 @@ internal interface ChangeAddressRepository { suspend fun commitMove(id: MoveIntentId): Either } -data object SuccessfulMove +internal data object SuccessfulMove internal class NetworkChangeAddressRepository( private val apolloClient: ApolloClient, @@ -33,14 +34,15 @@ internal class NetworkChangeAddressRepository( .bind() .moveIntentCreate - val moveIntent = result.moveIntent val userError = result.userError - - when { - moveIntent != null -> moveIntent.toMoveIntent() - userError != null -> raise(ErrorMessage(userError.message)) - else -> raise(ErrorMessage("No data found in MoveIntent")) + if (userError != null) { + raise(ErrorMessage(userError.message)) } + val moveIntent = result.moveIntent + ensureNotNull(moveIntent) { + ErrorMessage("No data found in MoveIntent") + } + moveIntent.toMoveIntent() } } @@ -53,14 +55,16 @@ internal class NetworkChangeAddressRepository( .bind() .moveIntentRequest - val moveIntent = result.moveIntent val userError = result.userError + if (userError != null) { + raise(ErrorMessage(userError.message)) + } - when { - userError != null -> raise(ErrorMessage(userError.message)) - moveIntent != null -> moveIntent.toMoveQuotes() - else -> raise(ErrorMessage("No data found in MoveIntent")) + val moveIntent = result.moveIntent + ensureNotNull(moveIntent) { + ErrorMessage("No data found in MoveIntent") } + moveIntent.toMoveQuotes() } } @@ -74,16 +78,15 @@ internal class NetworkChangeAddressRepository( .moveIntentCommit val userError = result.userError - - when { - userError != null -> raise(ErrorMessage(userError.message)) - else -> SuccessfulMove + if (userError != null) { + raise(ErrorMessage(userError.message)) } + SuccessfulMove } } } -private fun MoveIntentCreateMutation.Data.MoveIntentCreate.MoveIntent.toMoveIntent() = MoveIntent( +private fun MoveIntentCreateMutation.Data.MoveIntentCreate.MoveIntent.toMoveIntent(): MoveIntent = MoveIntent( id = MoveIntentId(id), currentHomeAddresses = currentHomeAddresses.map { currentHomeAddress -> Address( @@ -102,19 +105,21 @@ private fun MoveIntentCreateMutation.Data.MoveIntentCreate.MoveIntent.toMoveInte extraBuildingTypes = extraBuildingTypes.map { it.toExtraBuildingType() }, ) -private fun MoveIntentRequestMutation.Data.MoveIntentRequest.MoveIntent.toMoveQuotes() = quotes.map { quote -> - MoveQuote( - id = id, - insuranceName = quote.exposureName ?: quote.productVariant.displayName, - moveIntentId = MoveIntentId(id), - premium = UiMoney( - amount = quote.premium.amount, - currencyCode = quote.premium.currencyCode, - ), - startDate = quote.startDate, - productVariant = quote.productVariant.toProductVariant(), - displayItems = quote.displayItems - .map { it.displayTitle to it.displayValue } - .toImmutableList(), - ) +private fun MoveIntentRequestMutation.Data.MoveIntentRequest.MoveIntent.toMoveQuotes(): List { + return quotes.map { quote -> + MoveQuote( + id = id, + insuranceName = quote.exposureName ?: quote.productVariant.displayName, + moveIntentId = MoveIntentId(id), + premium = UiMoney( + amount = quote.premium.amount, + currencyCode = quote.premium.currencyCode, + ), + startDate = quote.startDate, + productVariant = quote.productVariant.toProductVariant(), + displayItems = quote.displayItems + .map { it.displayTitle to it.displayValue } + .toImmutableList(), + ) + } } From 3a1ad582f775b07720d0179ff8f0d02e2e74190f Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:29:00 +0200 Subject: [PATCH 11/19] Use onPlaced since we don't need onGloballyPositioned here --- .../destination/ChangeAddressOfferDestination.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt index 8604e70edd..3d15f7b680 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt @@ -34,7 +34,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.layout.onPlaced import androidx.compose.ui.layout.positionInParent import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource @@ -171,7 +171,7 @@ private fun ChangeAddressOfferScreen( }, modifier = Modifier .padding(horizontal = 16.dp) - .onGloballyPositioned { layoutCoordinates -> + .onPlaced { layoutCoordinates -> // Find the Y position where this button ends, to scroll right below it on click. whatsIncludedButtonPositionY = layoutCoordinates.positionInParent().y + layoutCoordinates.size.height From 4101b402c9bda67f63219dd91a65c7f950035177 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 13:46:02 +0200 Subject: [PATCH 12/19] Change destination names slightly Remove "Destination" suffix from the offer screen, and remove turn EnterNewVillaAddress into EnterVillaInformation, as it better represents the functionality of that destination --- .../ChangeAddressEnterNewAddressDestination.kt | 8 ++++---- ... ChangeAddressEnterVillaInformationDestination.kt} | 11 +++++------ .../navigation/ChangeAddressDestination.kt | 8 ++++---- .../changeaddress/navigation/ChangeAddressGraph.kt | 6 +++--- 4 files changed, 16 insertions(+), 17 deletions(-) rename app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/{ChangeAddressEnterNewVillaAddressDestination.kt => ChangeAddressEnterVillaInformationDestination.kt} (96%) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewAddressDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewAddressDestination.kt index 89e7e5d6df..d1088b5b52 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewAddressDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewAddressDestination.kt @@ -37,7 +37,7 @@ import hedvig.resources.R import kotlinx.datetime.LocalDate @Composable -internal fun ChangeAddressEnterNewDestination( +internal fun ChangeAddressEnterNewAddressDestination( viewModel: ChangeAddressViewModel, onContinue: () -> Unit, close: () -> Unit, @@ -76,7 +76,7 @@ internal fun ChangeAddressEnterNewDestination( } @Composable -private fun ChangeAddressEnterNewScreen( +private fun ChangeAddressEnterNewAddressScreen( uiState: ChangeAddressUiState, close: () -> Unit, onErrorDialogDismissed: () -> Unit, @@ -195,10 +195,10 @@ private fun ChangeAddressEnterNewScreen( @HedvigPreview @Composable -private fun PreviewChangeAddressEnterNewScreen() { +private fun PreviewChangeAddressEnterNewAddressScreen() { HedvigTheme { Surface(color = MaterialTheme.colorScheme.background) { - ChangeAddressEnterNewScreen( + ChangeAddressEnterNewAddressScreen( ChangeAddressUiState(datePickerUiState = DatePickerUiState(null)), {}, {}, {}, {}, {}, {}, {}, {}, {}, ) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewVillaAddressDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterVillaInformationDestination.kt similarity index 96% rename from app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewVillaAddressDestination.kt rename to app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterVillaInformationDestination.kt index b771986f0b..1a861166a9 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewVillaAddressDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterVillaInformationDestination.kt @@ -38,9 +38,8 @@ import com.hedvig.android.feature.changeaddress.ui.extrabuildings.ExtraBuildingB import com.hedvig.android.feature.changeaddress.ui.extrabuildings.ExtraBuildingContainer import hedvig.resources.R -@ExperimentalMaterial3Api @Composable -internal fun ChangeAddressEnterNewVillaAddressDestination( +internal fun ChangeAddressEnterVillaInformationDestination( viewModel: ChangeAddressViewModel, navigateUp: () -> Unit, onQuotesReceived: () -> Unit, @@ -70,7 +69,7 @@ internal fun ChangeAddressEnterNewVillaAddressDestination( ) } - ChangeAddressEnterNewVillaAddressScreen( + ChangeAddressEnterVillaInformationScreen( uiState = uiState, navigateUp = navigateUp, onErrorDialogDismissed = viewModel::onErrorDialogDismissed, @@ -95,7 +94,7 @@ internal fun ChangeAddressEnterNewVillaAddressDestination( } @Composable -private fun ChangeAddressEnterNewVillaAddressScreen( +private fun ChangeAddressEnterVillaInformationScreen( uiState: ChangeAddressUiState, navigateUp: () -> Unit, onErrorDialogDismissed: () -> Unit, @@ -198,10 +197,10 @@ private fun ChangeAddressEnterNewVillaAddressScreen( @HedvigPreview @Composable -private fun PreviewChangeAddressEnterNewVillaAddressDestination() { +private fun PreviewChangeAddressEnterVillaInformationScreen() { HedvigTheme { Surface(color = MaterialTheme.colorScheme.background) { - ChangeAddressEnterNewVillaAddressScreen( + ChangeAddressEnterVillaInformationScreen( ChangeAddressUiState(), {}, {}, diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressDestination.kt index 6a478d3884..9cb0921020 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressDestination.kt @@ -6,16 +6,16 @@ import kotlinx.serialization.Serializable internal sealed interface ChangeAddressDestination : Destination { @Serializable - data object EnterNewAddress : ChangeAddressDestination + data object SelectHousingType : ChangeAddressDestination @Serializable - data object EnterNewVillaAddress : ChangeAddressDestination + data object EnterNewAddress : ChangeAddressDestination @Serializable - data object OfferDestination : ChangeAddressDestination + data object EnterVillaInformation : ChangeAddressDestination @Serializable - data object SelectHousingType : ChangeAddressDestination + data object Offer : ChangeAddressDestination @Serializable data class AddressResult( diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt index eeaf25c128..94a4b05a8f 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt @@ -57,12 +57,12 @@ fun NavGraphBuilder.changeAddressGraph( ) } - composable { navBackStackEntry -> + composable { navBackStackEntry -> val viewModel: ChangeAddressViewModel = destinationScopedViewModel( navController = navController, backStackEntry = navBackStackEntry, ) - ChangeAddressEnterNewVillaAddressDestination( + ChangeAddressEnterVillaInformationDestination( viewModel = viewModel, navigateUp = navController::navigateUp, onQuotesReceived = { @@ -71,7 +71,7 @@ fun NavGraphBuilder.changeAddressGraph( ) } - composable { backStackEntry -> + composable { backStackEntry -> val viewModel: ChangeAddressViewModel = destinationScopedViewModel( navController = navController, backStackEntry = backStackEntry, From 5dcc826ff6652fd5823db59a565fb4ae021b3c6a Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 15:10:20 +0200 Subject: [PATCH 13/19] Fix moving flow back handling Make back handling move normally through the backstack instead of exiting the entire flow in some scenarios. For this to work, instead of relying on some state being there for the navigation to trigger, instead handle that through event triggers baked in the ui state itself which the UI clears when the navigation event is properly handled. This allows the member to go back and forth to all moving flow destinations without having to exit the entire flow for no reason. Going forward again triggers the same path as before, overriding the old results in case of a new success response from the backend. Remove all BackHandler calls to support this. Keep ChangeAddressDestination.AddressResult outside of the AppDestination.ChangeAddress navigation graph, and make sure that when we do end up there, we do it after popping the entire backstack up to ChangeAddressDestination.AddressResult. --- .../changeaddress/ChangeAddressUiState.kt | 12 +++++++ .../changeaddress/ChangeAddressViewModel.kt | 26 +++++++++++--- ...ChangeAddressEnterNewAddressDestination.kt | 25 +++++++------- ...AddressEnterVillaInformationDestination.kt | 18 ++++------ .../ChangeAddressOfferDestination.kt | 10 +++--- ...angeAddressSelectHousingTypeDestination.kt | 5 +-- .../navigation/ChangeAddressGraph.kt | 34 +++++++------------ 7 files changed, 72 insertions(+), 58 deletions(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressUiState.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressUiState.kt index 4f3b70fe6b..ebee96818f 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressUiState.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressUiState.kt @@ -39,6 +39,18 @@ internal data class ChangeAddressUiState( val moveFromAddressId: AddressId? = null, val quotes: List = emptyList(), val successfulMoveResult: SuccessfulMove? = null, + + /** + * When we receive the moveIntentId, we want to navigate to the next step. We keep this signal here so that we can + * still go back to the previous screen and not introduce an infinite navigation loop + */ + val navigateToFirstStepAfterHavingReceivedMoveIntentId: Boolean = false, + + /** + * When we receive some quotes from submitting all the data, we want to navigate to the offer destination. We keep + * this signal so that we can go back to the previous screen and not introduce an infinite navigation loop. + */ + val navigateToOfferScreenAfterHavingReceivedQuotes: Boolean = false, ) { val isHousingTypeValid: Boolean diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt index 9b371fb860..1a4c080d3a 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ChangeAddressViewModel.kt @@ -65,10 +65,6 @@ internal class ChangeAddressViewModel( _uiState.update { it.copy(isSublet = ValidatedInput(isSublet)) } } - fun onQuotesCleared() { - _uiState.update { it.copy(quotes = emptyList()) } - } - fun validateAddressInput(): Boolean { _uiState.update { it.validateAddressInput() } return _uiState.value.isAddressInputValid @@ -79,6 +75,26 @@ internal class ChangeAddressViewModel( return _uiState.value.isHouseInputValid } + /** + * After we've received the MoveIntentId, `startMovingFlowAfterHavingReceivedMoveIntentId` is used to trigger the + * navigation to the next question. When this function is called, it means the navigation event has been handled. + */ + fun onNavigatedToFirstStepAfterHavingReceivedMoveIntentId() { + _uiState.update { + it.copy(navigateToFirstStepAfterHavingReceivedMoveIntentId = false) + } + } + + /** + * After we've received the offer quotes, `navigateToOfferScreenAfterHavingReceivedQuotes` is used to trigger the + * navigation to the offer page. When this function is called, it means the navigation event has been handled. + */ + fun onNavigatedToOfferScreenAfterHavingReceivedQuotes() { + _uiState.update { + it.copy(navigateToOfferScreenAfterHavingReceivedQuotes = false) + } + } + fun onSubmitNewAddress() { if (uiState.value.moveIntentId == null) { _uiState.update { @@ -102,6 +118,7 @@ internal class ChangeAddressViewModel( _uiState.update { it.copy( isLoading = false, + navigateToOfferScreenAfterHavingReceivedQuotes = true, quotes = quotes, ) } @@ -185,6 +202,7 @@ internal class ChangeAddressViewModel( _uiState.update { it.copy( moveIntentId = moveIntent.id, + navigateToFirstStepAfterHavingReceivedMoveIntentId = true, numberInsured = ValidatedInput(moveIntent.suggestedNumberInsured.toString()), moveFromAddressId = moveIntent.currentHomeAddresses.firstOrNull()?.id, extraBuildingTypes = moveIntent.extraBuildingTypes, diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewAddressDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewAddressDestination.kt index d1088b5b52..b85adb8b2e 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewAddressDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterNewAddressDestination.kt @@ -39,22 +39,23 @@ import kotlinx.datetime.LocalDate @Composable internal fun ChangeAddressEnterNewAddressDestination( viewModel: ChangeAddressViewModel, - onContinue: () -> Unit, - close: () -> Unit, - onQuotesReceived: () -> Unit, + onNavigateToVillaInformationDestination: () -> Unit, + navigateUp: () -> Unit, + onNavigateToOfferDestination: () -> Unit, ) { val uiState: ChangeAddressUiState by viewModel.uiState.collectAsStateWithLifecycle() - val quotes = uiState.quotes - LaunchedEffect(quotes) { - if (quotes.isNotEmpty()) { - onQuotesReceived() + val navigateToOfferScreenAfterHavingReceivedQuotes = uiState.navigateToOfferScreenAfterHavingReceivedQuotes + LaunchedEffect(navigateToOfferScreenAfterHavingReceivedQuotes) { + if (navigateToOfferScreenAfterHavingReceivedQuotes) { + viewModel.onNavigatedToOfferScreenAfterHavingReceivedQuotes() + onNavigateToOfferDestination() } } - ChangeAddressEnterNewScreen( + ChangeAddressEnterNewAddressScreen( uiState = uiState, - close = close, + navigateUp = navigateUp, onErrorDialogDismissed = viewModel::onErrorDialogDismissed, onStreetChanged = viewModel::onStreetChanged, onPostalCodeChanged = viewModel::onPostalCodeChanged, @@ -66,7 +67,7 @@ internal fun ChangeAddressEnterNewAddressDestination( val isInputValid = viewModel.validateAddressInput() if (isInputValid) { if (uiState.housingType.input == HousingType.VILLA) { - onContinue() + onNavigateToVillaInformationDestination() } else { viewModel.onSubmitNewAddress() } @@ -78,7 +79,7 @@ internal fun ChangeAddressEnterNewAddressDestination( @Composable private fun ChangeAddressEnterNewAddressScreen( uiState: ChangeAddressUiState, - close: () -> Unit, + navigateUp: () -> Unit, onErrorDialogDismissed: () -> Unit, onStreetChanged: (String) -> Unit, onPostalCodeChanged: (String) -> Unit, @@ -101,7 +102,7 @@ private fun ChangeAddressEnterNewAddressScreen( } HedvigScaffold( - navigateUp = close, + navigateUp = navigateUp, modifier = Modifier.clearFocusOnTap(), topAppBarActionType = TopAppBarActionType.CLOSE, ) { diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterVillaInformationDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterVillaInformationDestination.kt index 1a861166a9..52e2f0dd4a 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterVillaInformationDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressEnterVillaInformationDestination.kt @@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text @@ -42,14 +41,15 @@ import hedvig.resources.R internal fun ChangeAddressEnterVillaInformationDestination( viewModel: ChangeAddressViewModel, navigateUp: () -> Unit, - onQuotesReceived: () -> Unit, + onNavigateToOfferDestination: () -> Unit, ) { val uiState: ChangeAddressUiState by viewModel.uiState.collectAsStateWithLifecycle() - val quotes = uiState.quotes - LaunchedEffect(quotes) { - if (quotes.isNotEmpty()) { - onQuotesReceived() + val navigateToOfferScreenAfterHavingReceivedQuotes = uiState.navigateToOfferScreenAfterHavingReceivedQuotes + LaunchedEffect(navigateToOfferScreenAfterHavingReceivedQuotes) { + if (navigateToOfferScreenAfterHavingReceivedQuotes) { + viewModel.onNavigatedToOfferScreenAfterHavingReceivedQuotes() + onNavigateToOfferDestination() } } @@ -83,9 +83,6 @@ internal fun ChangeAddressEnterVillaInformationDestination( viewModel.onSubmitNewAddress() } }, - onExtraBuildingClicked = { - showExtraBuildingsBottomSheet = true - }, onAddExtraBuildingClicked = { showExtraBuildingsBottomSheet = true }, @@ -103,7 +100,6 @@ private fun ChangeAddressEnterVillaInformationScreen( onNumberOfBathroomsChanged: (String) -> Unit, onIsSubletSelected: (Boolean) -> Unit, onSaveNewAddress: () -> Unit, - onExtraBuildingClicked: (ExtraBuilding) -> Unit, onAddExtraBuildingClicked: () -> Unit, onRemoveExtraBuildingClicked: (ExtraBuilding) -> Unit, ) { @@ -172,7 +168,6 @@ private fun ChangeAddressEnterVillaInformationScreen( Spacer(modifier = Modifier.height(8.dp)) ExtraBuildingContainer( extraBuildings = uiState.extraBuildings, - onExtraBuildingItemClicked = onExtraBuildingClicked, onAddExtraBuildingClicked = onAddExtraBuildingClicked, onRemoveExtraBuildingClicked = onRemoveExtraBuildingClicked, modifier = Modifier @@ -211,7 +206,6 @@ private fun PreviewChangeAddressEnterVillaInformationScreen() { {}, {}, {}, - {}, ) } } diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt index 3d15f7b680..306243d05e 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt @@ -54,7 +54,6 @@ import com.hedvig.android.core.designsystem.component.card.HedvigInfoCard import com.hedvig.android.core.designsystem.material3.squircleMedium import com.hedvig.android.core.designsystem.theme.HedvigTheme import com.hedvig.android.core.ui.ValidatedInput -import com.hedvig.android.core.ui.appbar.m3.TopAppBarActionType import com.hedvig.android.core.ui.dialog.ErrorDialog import com.hedvig.android.core.ui.infocard.VectorInfoCard import com.hedvig.android.core.ui.scaffold.HedvigScaffold @@ -77,7 +76,7 @@ import kotlinx.datetime.toLocalDateTime internal fun ChangeAddressOfferDestination( viewModel: ChangeAddressViewModel, openChat: () -> Unit, - close: () -> Unit, + navigateUp: () -> Unit, onChangeAddressResult: (LocalDate?) -> Unit, openUrl: (String) -> Unit, ) { @@ -92,7 +91,7 @@ internal fun ChangeAddressOfferDestination( ChangeAddressOfferScreen( uiState = uiState, openChat = openChat, - close = close, + navigateUp = navigateUp, onErrorDialogDismissed = viewModel::onErrorDialogDismissed, onExpandQuote = viewModel::onExpandQuote, onConfirmMove = viewModel::onConfirmMove, @@ -104,7 +103,7 @@ internal fun ChangeAddressOfferDestination( private fun ChangeAddressOfferScreen( uiState: ChangeAddressUiState, openChat: () -> Unit, - close: () -> Unit, + navigateUp: () -> Unit, onErrorDialogDismissed: () -> Unit, onExpandQuote: (MoveQuote) -> Unit, onConfirmMove: (MoveIntentId) -> Unit, @@ -122,9 +121,8 @@ private fun ChangeAddressOfferScreen( val scrollState = rememberScrollState() HedvigScaffold( topAppBarText = stringResource(id = R.string.CHANGE_ADDRESS_SUMMARY_TITLE), - navigateUp = close, + navigateUp = navigateUp, topAppBarScrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(), - topAppBarActionType = TopAppBarActionType.CLOSE, scrollState = scrollState, ) { Spacer(Modifier.height(8.dp)) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressSelectHousingTypeDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressSelectHousingTypeDestination.kt index 21cb2d3760..d190e8fc80 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressSelectHousingTypeDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressSelectHousingTypeDestination.kt @@ -39,8 +39,9 @@ internal fun ChangeAddressSelectHousingTypeDestination( ) { val uiState: ChangeAddressUiState by viewModel.uiState.collectAsStateWithLifecycle() - LaunchedEffect(uiState.moveIntentId) { - if (uiState.moveIntentId != null) { + LaunchedEffect(uiState.navigateToFirstStepAfterHavingReceivedMoveIntentId) { + if (uiState.navigateToFirstStepAfterHavingReceivedMoveIntentId) { + viewModel.onNavigatedToFirstStepAfterHavingReceivedMoveIntentId() navigateToEnterNewAddressDestination() } } diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt index 94a4b05a8f..a09c6d485d 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/navigation/ChangeAddressGraph.kt @@ -1,12 +1,11 @@ package com.hedvig.android.feature.changeaddress.navigation -import androidx.activity.compose.BackHandler import androidx.navigation.NavBackStackEntry import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import com.hedvig.android.feature.changeaddress.ChangeAddressViewModel -import com.hedvig.android.feature.changeaddress.destination.ChangeAddressEnterNewDestination -import com.hedvig.android.feature.changeaddress.destination.ChangeAddressEnterNewVillaAddressDestination +import com.hedvig.android.feature.changeaddress.destination.ChangeAddressEnterNewAddressDestination +import com.hedvig.android.feature.changeaddress.destination.ChangeAddressEnterVillaInformationDestination import com.hedvig.android.feature.changeaddress.destination.ChangeAddressOfferDestination import com.hedvig.android.feature.changeaddress.destination.ChangeAddressResultDestination import com.hedvig.android.feature.changeaddress.destination.ChangeAddressSelectHousingTypeDestination @@ -16,7 +15,6 @@ import com.kiwi.navigationcompose.typed.composable import com.kiwi.navigationcompose.typed.createRoutePattern import com.kiwi.navigationcompose.typed.navigate import com.kiwi.navigationcompose.typed.navigation -import com.kiwi.navigationcompose.typed.popBackStack import com.kiwi.navigationcompose.typed.popUpTo fun NavGraphBuilder.changeAddressGraph( @@ -44,15 +42,14 @@ fun NavGraphBuilder.changeAddressGraph( navController = navController, backStackEntry = navBackStackEntry, ) - BackHandler { - navController.popBackStack(inclusive = true) - } - ChangeAddressEnterNewDestination( + ChangeAddressEnterNewAddressDestination( viewModel = viewModel, - onContinue = { navController.navigate(ChangeAddressDestination.EnterNewVillaAddress) }, - close = { navController.popBackStack(inclusive = true) }, - onQuotesReceived = { - navController.navigate(ChangeAddressDestination.OfferDestination) + onNavigateToVillaInformationDestination = { + navController.navigate(ChangeAddressDestination.EnterVillaInformation) + }, + navigateUp = navController::navigateUp, + onNavigateToOfferDestination = { + navController.navigate(ChangeAddressDestination.Offer) }, ) } @@ -65,8 +62,8 @@ fun NavGraphBuilder.changeAddressGraph( ChangeAddressEnterVillaInformationDestination( viewModel = viewModel, navigateUp = navController::navigateUp, - onQuotesReceived = { - navController.navigate(ChangeAddressDestination.OfferDestination) + onNavigateToOfferDestination = { + navController.navigate(ChangeAddressDestination.Offer) }, ) } @@ -76,17 +73,10 @@ fun NavGraphBuilder.changeAddressGraph( navController = navController, backStackEntry = backStackEntry, ) - BackHandler { - viewModel.onQuotesCleared() - navController.popBackStack(inclusive = true) - } ChangeAddressOfferDestination( viewModel = viewModel, openChat = { openChat(backStackEntry) }, - close = { - viewModel.onQuotesCleared() - navController.popBackStack(inclusive = true) - }, + navigateUp = navController::navigateUp, onChangeAddressResult = { movingDate -> navController.navigate(ChangeAddressDestination.AddressResult(movingDate)) { popUpTo { From 14385bc1765e8c829db0746a8240fe2f9d4034cc Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 17:56:36 +0200 Subject: [PATCH 14/19] Change references to .sp values to tokens from typography --- .../ChangeAddressOfferDestination.kt | 32 ++++++++++++------- .../changeaddress/ui/offer/QuoteCard.kt | 11 +++---- .../claimtriaging/OptionChipsFlowRow.kt | 2 +- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt index 306243d05e..96df12a158 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt @@ -208,7 +208,7 @@ private fun ChangeAddressOfferScreen( Spacer(Modifier.height(64.dp)) Text( text = stringResource(id = R.string.CHANGE_ADDRESS_NO_FIND), - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, textAlign = TextAlign.Center, modifier = Modifier .fillMaxWidth() @@ -225,7 +225,7 @@ private fun ChangeAddressOfferScreen( ) { Text( text = stringResource(R.string.open_chat), - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, ) } Spacer(Modifier.height(16.dp)) @@ -241,14 +241,14 @@ private fun QuotesPriceSum( startSlot = { Text( text = stringResource(id = R.string.CHANGE_ADDRESS_TOTAL), - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, ) }, endSlot = { val summedPrice = quotes.map(MoveQuote::premium).reduce(UiMoney::plus) Text( text = stringResource(R.string.CHANGE_ADDRESS_PRICE_PER_MONTH_LABEL, summedPrice.toString()), - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, textAlign = TextAlign.End, ) }, @@ -266,7 +266,10 @@ private fun QuoteDetailsAndPdfs( HedvigInfoCard( contentPadding = PaddingValues(horizontal = 8.dp, vertical = 4.dp), ) { - Text(quote.productVariant.displayName) + Text( + text = quote.productVariant.displayName, + style = MaterialTheme.typography.bodyMedium, + ) } Spacer(Modifier.height(32.dp)) InsurableLimits(quote) @@ -281,14 +284,20 @@ private fun ColumnScope.InsurableLimits(quote: MoveQuote) { quote.productVariant.insurableLimits.mapIndexed { index, highlight -> HorizontalItemsWithMaximumSpaceTaken( startSlot = { - Text(highlight.label, fontSize = 18.sp) + Text( + text = highlight.label, + style = MaterialTheme.typography.bodyLarge, + ) }, endSlot = { Row( verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.End, ) { - Text(highlight.limit, fontSize = 18.sp) + Text( + text = highlight.limit, + style = MaterialTheme.typography.bodyLarge, + ) } }, spaceBetween = 18.dp, @@ -329,11 +338,12 @@ private fun Documents( append(" PDF") } }, - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, + ) + Text( + text = document.displayName, + style = MaterialTheme.typography.bodyLarge.copy(color = MaterialTheme.colorScheme.onSurfaceVariant), ) - CompositionLocalProvider(LocalContentColor.provides(MaterialTheme.colorScheme.onSurfaceVariant)) { - Text(document.displayName, fontSize = 18.sp) - } } Spacer(Modifier.width(8.dp)) Icon( diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt index 4e49336f5d..1b67d2fe34 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt @@ -89,8 +89,7 @@ private fun PillAndBasicInfo(quote: MoveQuote, movingDate: LocalDate) { Column { Text( text = quote.insuranceName, - style = MaterialTheme.typography.titleMedium, - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, ) CompositionLocalProvider(LocalContentColor.provides(MaterialTheme.colorScheme.onSurfaceVariant)) { Row(verticalAlignment = Alignment.CenterVertically) { @@ -99,7 +98,7 @@ private fun PillAndBasicInfo(quote: MoveQuote, movingDate: LocalDate) { id = R.string.CHANGE_ADDRESS_ACTIVATION_DATE, movingDate.toJavaLocalDate().format(hedvigDateTimeFormatter(getLocale())), ), - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, ) Spacer(modifier = Modifier.width(4.dp)) Icon( @@ -125,8 +124,7 @@ private fun QuoteDetailsAndPrice( Row(verticalAlignment = Alignment.CenterVertically) { Text( text = stringResource(id = R.string.CHANGE_ADDRESS_DETAILS_LABEL), - style = MaterialTheme.typography.titleMedium, - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, ) Spacer(Modifier.width(8.dp)) val angle = animateFloatAsState( @@ -155,8 +153,7 @@ private fun QuoteDetailsAndPrice( id = R.string.CHANGE_ADDRESS_PRICE_PER_MONTH_LABEL, quote.premium.toString(), ), - style = MaterialTheme.typography.titleMedium, - fontSize = 18.sp, + style = MaterialTheme.typography.bodyLarge, textAlign = TextAlign.End, ) }, diff --git a/app/feature/feature-claim-triaging/src/main/kotlin/com/hedvig/android/feature/claimtriaging/OptionChipsFlowRow.kt b/app/feature/feature-claim-triaging/src/main/kotlin/com/hedvig/android/feature/claimtriaging/OptionChipsFlowRow.kt index e69aced1a7..47efbd147c 100644 --- a/app/feature/feature-claim-triaging/src/main/kotlin/com/hedvig/android/feature/claimtriaging/OptionChipsFlowRow.kt +++ b/app/feature/feature-claim-triaging/src/main/kotlin/com/hedvig/android/feature/claimtriaging/OptionChipsFlowRow.kt @@ -30,7 +30,6 @@ import androidx.compose.ui.graphics.compositeOver import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import arrow.core.identity import com.hedvig.android.core.designsystem.material3.motion.MotionTokens import com.hedvig.android.core.designsystem.material3.onTypeContainer @@ -145,6 +144,7 @@ internal fun OptionChipsFlowRow( modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), ) } + style = MaterialTheme.typography.bodyLarge.copy(color = contentColor), } } } From b77bb0aa367a5abd7ffeaab5c1271958d7103c4b Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 17:59:40 +0200 Subject: [PATCH 15/19] Tiny UI fixes for offer Allow HedvigInfoCard take in a new shape if the caller needs it to Make the small info card use the right squircle corner radius For cases where the divider is added on a list on all but the last item, prefer adding it in the first line by doing a much simpler `index > 0` check instead. Remove some non lokalised content description. Use the right icon for the info icon Use the right tint for the arrow showing that there is more info in the quote details card Remove the odd color for the ExpandablePlusCard which made it look different from the cards above, especially in dark mode. New colors match Figma instead. --- .../component/card/HedvigInfoCard.kt | 6 ++++-- .../android/core/ui/card/ExpandablePlusCard.kt | 6 ------ .../ChangeAddressOfferDestination.kt | 10 +++++----- .../feature/changeaddress/ui/offer/QuoteCard.kt | 14 +++++++------- .../feature/claimtriaging/OptionChipsFlowRow.kt | 17 +++++------------ 5 files changed, 21 insertions(+), 32 deletions(-) diff --git a/app/core/core-design-system/src/main/kotlin/com/hedvig/android/core/designsystem/component/card/HedvigInfoCard.kt b/app/core/core-design-system/src/main/kotlin/com/hedvig/android/core/designsystem/component/card/HedvigInfoCard.kt index a42a3c3fb5..7a4720fba6 100644 --- a/app/core/core-design-system/src/main/kotlin/com/hedvig/android/core/designsystem/component/card/HedvigInfoCard.kt +++ b/app/core/core-design-system/src/main/kotlin/com/hedvig/android/core/designsystem/component/card/HedvigInfoCard.kt @@ -9,6 +9,7 @@ import androidx.compose.material3.CardDefaults import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Shape import androidx.compose.ui.unit.dp import com.hedvig.android.core.designsystem.material3.infoContainer import com.hedvig.android.core.designsystem.material3.onInfoContainer @@ -22,10 +23,11 @@ fun HedvigInfoCard( containerColor = MaterialTheme.colorScheme.infoContainer, contentColor = MaterialTheme.colorScheme.onInfoContainer, ), - content: @Composable RowScope.() -> Unit, + shape: Shape = MaterialTheme.shapes.squircleMedium, + content: @Composable() (RowScope.() -> Unit), ) { HedvigCard( - shape = MaterialTheme.shapes.squircleMedium, + shape = shape, colors = colors, modifier = modifier, ) { diff --git a/app/core/core-ui/src/main/kotlin/com/hedvig/android/core/ui/card/ExpandablePlusCard.kt b/app/core/core-ui/src/main/kotlin/com/hedvig/android/core/ui/card/ExpandablePlusCard.kt index 79f2a2b3ba..121e19fdc9 100644 --- a/app/core/core-ui/src/main/kotlin/com/hedvig/android/core/ui/card/ExpandablePlusCard.kt +++ b/app/core/core-ui/src/main/kotlin/com/hedvig/android/core/ui/card/ExpandablePlusCard.kt @@ -18,9 +18,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.material.icons.Icons -import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon -import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment @@ -44,10 +42,6 @@ fun ExpandablePlusCard( ) { HedvigCard( onClick = onClick, - colors = CardDefaults.outlinedCardColors( - containerColor = MaterialTheme.colorScheme.surfaceVariant, - contentColor = MaterialTheme.colorScheme.onSurface, - ), modifier = modifier, ) { Column { diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt index 96df12a158..b7ae865db3 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressOfferDestination.kt @@ -19,13 +19,11 @@ import androidx.compose.foundation.rememberScrollState import androidx.compose.material3.Button import androidx.compose.material3.Divider import androidx.compose.material3.Icon -import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableFloatStateOf @@ -51,6 +49,7 @@ import com.hedvig.android.core.designsystem.component.button.HedvigContainedButt import com.hedvig.android.core.designsystem.component.button.HedvigTextButton import com.hedvig.android.core.designsystem.component.card.HedvigCard import com.hedvig.android.core.designsystem.component.card.HedvigInfoCard +import com.hedvig.android.core.designsystem.material3.squircleExtraSmall import com.hedvig.android.core.designsystem.material3.squircleMedium import com.hedvig.android.core.designsystem.theme.HedvigTheme import com.hedvig.android.core.ui.ValidatedInput @@ -265,6 +264,7 @@ private fun QuoteDetailsAndPdfs( Column(modifier) { HedvigInfoCard( contentPadding = PaddingValues(horizontal = 8.dp, vertical = 4.dp), + shape = MaterialTheme.shapes.squircleExtraSmall, ) { Text( text = quote.productVariant.displayName, @@ -316,6 +316,9 @@ private fun Documents( openUrl: (String) -> Unit, ) { quote.productVariant.documents.mapIndexed { index, document -> + if (index > 0) { + Spacer(Modifier.height(8.dp)) + } HedvigCard( onClick = { openUrl(document.url) }, ) { @@ -353,9 +356,6 @@ private fun Documents( ) } } - if (index != quote.productVariant.documents.lastIndex) { - Spacer(Modifier.height(8.dp)) - } } } diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt index 1b67d2fe34..e42ba22f69 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt @@ -14,6 +14,7 @@ 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.material.icons.Icons import androidx.compose.material3.Divider import androidx.compose.material3.Icon import androidx.compose.material3.LocalContentColor @@ -29,10 +30,11 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp import com.hedvig.android.core.designsystem.component.card.HedvigCard import com.hedvig.android.core.designsystem.preview.HedvigPreview import com.hedvig.android.core.designsystem.theme.HedvigTheme +import com.hedvig.android.core.icons.Hedvig +import com.hedvig.android.core.icons.hedvig.normal.InfoFilled import com.hedvig.android.core.ui.getLocale import com.hedvig.android.core.ui.hedvigDateTimeFormatter import com.hedvig.android.core.ui.insurance.toPillow @@ -82,7 +84,7 @@ private fun PillAndBasicInfo(quote: MoveQuote, movingDate: LocalDate) { Row(verticalAlignment = Alignment.CenterVertically) { Image( painter = painterResource(id = quote.productVariant.contractType.toPillow()), - contentDescription = "pillow", + contentDescription = null, modifier = Modifier.size(48.dp), ) Spacer(modifier = Modifier.width(16.dp)) @@ -102,11 +104,9 @@ private fun PillAndBasicInfo(quote: MoveQuote, movingDate: LocalDate) { ) Spacer(modifier = Modifier.width(4.dp)) Icon( - painter = painterResource(id = com.hedvig.android.core.design.system.R.drawable.ic_info), + imageVector = Icons.Hedvig.InfoFilled, contentDescription = null, - modifier = Modifier - .size(16.dp) - .padding(1.dp), + modifier = Modifier.size(16.dp), ) } } @@ -138,7 +138,7 @@ private fun QuoteDetailsAndPrice( Icon( painter = painterResource(com.hedvig.android.core.design.system.R.drawable.ic_drop_down_indicator), contentDescription = null, - tint = MaterialTheme.colorScheme.outlineVariant, + tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier .size(16.dp) .graphicsLayer { diff --git a/app/feature/feature-claim-triaging/src/main/kotlin/com/hedvig/android/feature/claimtriaging/OptionChipsFlowRow.kt b/app/feature/feature-claim-triaging/src/main/kotlin/com/hedvig/android/feature/claimtriaging/OptionChipsFlowRow.kt index 47efbd147c..26e1749bc6 100644 --- a/app/feature/feature-claim-triaging/src/main/kotlin/com/hedvig/android/feature/claimtriaging/OptionChipsFlowRow.kt +++ b/app/feature/feature-claim-triaging/src/main/kotlin/com/hedvig/android/feature/claimtriaging/OptionChipsFlowRow.kt @@ -14,12 +14,10 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.padding -import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.key @@ -134,17 +132,12 @@ internal fun OptionChipsFlowRow( onClick = { onItemClick(item) }, ), ) - CompositionLocalProvider(LocalContentColor provides contentColor) { - Text( - text = itemDisplayName(item), - style = MaterialTheme.typography.bodyLarge.copy( - fontSize = 18.sp, - ), - maxLines = 1, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), - ) - } + Text( + text = itemDisplayName(item), style = MaterialTheme.typography.bodyLarge.copy(color = contentColor), + maxLines = 1, + modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp), + ) } } } From 5af7a22e001c7842f1d81e7d23f47168c3e4d5c1 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 18:16:42 +0200 Subject: [PATCH 16/19] Fix documents to use default hedvig card colors --- .../insurances/insurancedetail/documents/DocumentsTab.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/feature/feature-insurances/src/main/kotlin/com/hedvig/android/feature/insurances/insurancedetail/documents/DocumentsTab.kt b/app/feature/feature-insurances/src/main/kotlin/com/hedvig/android/feature/insurances/insurancedetail/documents/DocumentsTab.kt index 0feba26447..f78da5cb00 100644 --- a/app/feature/feature-insurances/src/main/kotlin/com/hedvig/android/feature/insurances/insurancedetail/documents/DocumentsTab.kt +++ b/app/feature/feature-insurances/src/main/kotlin/com/hedvig/android/feature/insurances/insurancedetail/documents/DocumentsTab.kt @@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.material.icons.Icons -import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -70,10 +69,6 @@ private fun DocumentCard( ) { HedvigCard( onClick = onClick, - colors = CardDefaults.outlinedCardColors( - containerColor = MaterialTheme.colorScheme.surfaceVariant, - contentColor = MaterialTheme.colorScheme.onSurface, - ), modifier = Modifier .padding(horizontal = 16.dp) .heightIn(min = 72.dp), From a1f88f7ccbf9cf30c2897d18f244cc2f0d71b5f9 Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Wed, 18 Oct 2023 18:28:13 +0200 Subject: [PATCH 17/19] Fix visibility modifiers in all feature-changeaddress More or less nothing of those had to be public and available to the :app module or anywhere else. --- .../android/feature/changeaddress/data/Address.kt | 4 ++-- .../changeaddress/data/ChangeAddressRepository.kt | 4 ++++ .../feature/changeaddress/data/ExtraBuilding.kt | 10 +++++----- .../feature/changeaddress/data/MoveIntent.kt | 6 ++---- .../feature/changeaddress/data/MoveQuote.kt | 2 +- .../feature/changeaddress/data/QuoteInput.kt | 10 +++++----- .../destination/ChangeAddressResultDestination.kt | 2 +- .../feature/changeaddress/ui/InputTextField.kt | 2 +- .../android/feature/changeaddress/ui/Switch.kt | 2 +- .../ui/extrabuildings/ExtraBuildingBottomSheet.kt | 2 +- .../extrabuildings/ExtraBuildingTypeContainer.kt | 2 +- ...tTermsOverView.kt => ContractTermsOverview.kt} | 15 ++++++++------- .../feature/changeaddress/ui/offer/QuoteCard.kt | 2 +- 13 files changed, 33 insertions(+), 30 deletions(-) rename app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/{ContractTermsOverView.kt => ContractTermsOverview.kt} (96%) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/Address.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/Address.kt index 92bffe8b51..49b60a8fc7 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/Address.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/Address.kt @@ -4,10 +4,10 @@ import kotlinx.serialization.Serializable @JvmInline @Serializable -value class AddressId(val id: String) +internal value class AddressId(val id: String) @Serializable -data class Address( +internal data class Address( val id: AddressId, val apartmentNumber: String? = null, val bbrId: String? = null, diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ChangeAddressRepository.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ChangeAddressRepository.kt index ee559185b6..06c4755239 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ChangeAddressRepository.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ChangeAddressRepository.kt @@ -9,6 +9,7 @@ import com.hedvig.android.apollo.toEither import com.hedvig.android.core.common.ErrorMessage import com.hedvig.android.core.ui.insurance.toProductVariant import com.hedvig.android.core.uidata.UiMoney +import com.hedvig.android.logger.logcat import kotlinx.collections.immutable.toImmutableList import octopus.MoveIntentCommitMutation import octopus.MoveIntentCreateMutation @@ -26,6 +27,7 @@ internal class NetworkChangeAddressRepository( private val apolloClient: ApolloClient, ) : ChangeAddressRepository { override suspend fun createMoveIntent(): Either { + logcat { "Moving Flow: createMoveIntent" } return either { val result = apolloClient .mutation(MoveIntentCreateMutation()) @@ -47,6 +49,7 @@ internal class NetworkChangeAddressRepository( } override suspend fun createQuotes(input: QuoteInput): Either> { + logcat { "Moving Flow: createQuotes with input:$input" } return either { val result = apolloClient .mutation(input.toMoveIntentRequestMutation()) @@ -69,6 +72,7 @@ internal class NetworkChangeAddressRepository( } override suspend fun commitMove(id: MoveIntentId): Either { + logcat { "Moving Flow: commitMove with id:$id" } return either { val result = apolloClient .mutation(MoveIntentCommitMutation(id.id)) diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ExtraBuilding.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ExtraBuilding.kt index 1e533eb0da..4808722c86 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ExtraBuilding.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/ExtraBuilding.kt @@ -3,14 +3,14 @@ package com.hedvig.android.feature.changeaddress.data import octopus.type.MoveExtraBuildingType import java.util.UUID -data class ExtraBuilding( +internal data class ExtraBuilding( val id: String = UUID.randomUUID().toString(), val size: Int, val type: ExtraBuildingType, val hasWaterConnected: Boolean, ) -enum class ExtraBuildingType { +internal enum class ExtraBuildingType { GARAGE, CARPORT, SHED, @@ -28,7 +28,7 @@ enum class ExtraBuildingType { UNKNOWN, } -fun ExtraBuildingType.stringRes(): Int = when (this) { +internal fun ExtraBuildingType.stringRes(): Int = when (this) { ExtraBuildingType.GARAGE -> hedvig.resources.R.string.FIELD_EXTRA_BUIDLINGS_GARAGE_LABEL ExtraBuildingType.CARPORT -> hedvig.resources.R.string.FIELD_EXTRA_BUIDLINGS_CARPORT_LABEL ExtraBuildingType.SHED -> hedvig.resources.R.string.FIELD_EXTRA_BUIDLINGS_SHED_LABEL @@ -46,7 +46,7 @@ fun ExtraBuildingType.stringRes(): Int = when (this) { ExtraBuildingType.UNKNOWN -> hedvig.resources.R.string.FIELD_EXTRA_BUIDLINGS_OTHER_LABEL } -fun ExtraBuildingType.toMoveExtraBuildingType() = when (this) { +internal fun ExtraBuildingType.toMoveExtraBuildingType() = when (this) { ExtraBuildingType.GARAGE -> MoveExtraBuildingType.GARAGE ExtraBuildingType.CARPORT -> MoveExtraBuildingType.CARPORT ExtraBuildingType.SHED -> MoveExtraBuildingType.SHED @@ -64,7 +64,7 @@ fun ExtraBuildingType.toMoveExtraBuildingType() = when (this) { ExtraBuildingType.UNKNOWN -> MoveExtraBuildingType.UNKNOWN__ } -fun MoveExtraBuildingType.toExtraBuildingType() = when (this) { +internal fun MoveExtraBuildingType.toExtraBuildingType() = when (this) { MoveExtraBuildingType.GARAGE -> ExtraBuildingType.GARAGE MoveExtraBuildingType.CARPORT -> ExtraBuildingType.CARPORT MoveExtraBuildingType.SHED -> ExtraBuildingType.SHED diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/MoveIntent.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/MoveIntent.kt index 850b75210d..8b2046ff2c 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/MoveIntent.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/MoveIntent.kt @@ -1,13 +1,11 @@ package com.hedvig.android.feature.changeaddress.data import kotlinx.datetime.LocalDate -import kotlinx.serialization.Serializable @JvmInline -@Serializable -value class MoveIntentId(val id: String) +internal value class MoveIntentId(val id: String) -data class MoveIntent( +internal data class MoveIntent( val id: MoveIntentId, val currentHomeAddresses: List
, val movingDateRange: ClosedRange, diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/MoveQuote.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/MoveQuote.kt index 87e2f505b2..ccbbf2633f 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/MoveQuote.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/MoveQuote.kt @@ -9,7 +9,7 @@ import kotlinx.collections.immutable.persistentListOf import kotlinx.datetime.LocalDate import octopus.type.CurrencyCode -data class MoveQuote( +internal data class MoveQuote( val id: String, val insuranceName: String, val moveIntentId: MoveIntentId, diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/QuoteInput.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/QuoteInput.kt index f8bcefe31d..1267eb1c10 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/QuoteInput.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/data/QuoteInput.kt @@ -10,17 +10,17 @@ import octopus.type.MoveToAddressInput import octopus.type.MoveToApartmentInput import octopus.type.MoveToHouseInput -enum class HousingType { +internal enum class HousingType { APARTMENT_RENT, APARTMENT_OWN, VILLA } -fun HousingType.displayNameResource() = when (this) { +internal fun HousingType.displayNameResource() = when (this) { HousingType.APARTMENT_RENT -> hedvig.resources.R.string.CHANGE_ADDRESS_APARTMENT_RENT_LABEL HousingType.APARTMENT_OWN -> hedvig.resources.R.string.CHANGE_ADDRESS_APARTMENT_OWN_LABEL HousingType.VILLA -> hedvig.resources.R.string.CHANGE_ADDRESS_VILLA_LABEL } -sealed interface QuoteInput { +internal sealed interface QuoteInput { fun toMoveIntentRequestMutation(): MoveIntentRequestMutation data class ApartmentInput( @@ -33,7 +33,7 @@ sealed interface QuoteInput { val apartmentOwnerType: HousingType, val isStudent: Boolean, ) : QuoteInput { - override fun toMoveIntentRequestMutation() = MoveIntentRequestMutation( + override fun toMoveIntentRequestMutation(): MoveIntentRequestMutation = MoveIntentRequestMutation( intentId = moveIntentId.id, input = MoveIntentRequestInput( moveToAddress = MoveToAddressInput( @@ -74,7 +74,7 @@ sealed interface QuoteInput { val extraBuildings: List, val isStudent: Boolean, ) : QuoteInput { - override fun toMoveIntentRequestMutation() = MoveIntentRequestMutation( + override fun toMoveIntentRequestMutation(): MoveIntentRequestMutation = MoveIntentRequestMutation( intentId = moveIntentId.id, input = MoveIntentRequestInput( moveToAddress = MoveToAddressInput( diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressResultDestination.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressResultDestination.kt index 4fb4fdf9ea..d2c35f8944 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressResultDestination.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/destination/ChangeAddressResultDestination.kt @@ -46,7 +46,7 @@ internal fun ChangeAddressResultDestination( @HedvigPreview @Composable -internal fun PreviewChangeAddressResultDestination() { +private fun PreviewChangeAddressResultDestination() { HedvigTheme { Surface { ChangeAddressResultDestination(movingDate = LocalDate.fromEpochDays(3000)) {} diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/InputTextField.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/InputTextField.kt index 474a8f4276..4a94b20b81 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/InputTextField.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/InputTextField.kt @@ -9,7 +9,7 @@ import androidx.compose.ui.res.stringResource import com.hedvig.android.core.designsystem.component.textfield.HedvigTextField @Composable -fun InputTextField( +internal fun InputTextField( value: String?, errorMessageRes: Int?, onValueChange: (String) -> Unit, diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/Switch.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/Switch.kt index 6e080c8404..fdf0b05200 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/Switch.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/Switch.kt @@ -17,7 +17,7 @@ import com.hedvig.android.core.designsystem.component.card.HedvigCard import com.hedvig.android.core.designsystem.material3.squircleMedium @Composable -fun ChangeAddressSwitch( +internal fun ChangeAddressSwitch( label: String, checked: Boolean, onClick: () -> Unit, diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt index 9da39916fd..9bf1f38551 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingBottomSheet.kt @@ -132,7 +132,7 @@ private fun isInputValid(sizeInput: String?, selectedType: ExtraBuildingType?): @HedvigPreview @Composable -internal fun PreviewExtraBuildingBottomSheet() { +private fun PreviewExtraBuildingBottomSheet() { HedvigTheme { Surface { ExtraBuildingBottomSheet( diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingTypeContainer.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingTypeContainer.kt index fb07f19f11..436c5f8686 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingTypeContainer.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/extrabuildings/ExtraBuildingTypeContainer.kt @@ -65,7 +65,7 @@ internal fun ExtraBuildingTypeContainer( @HedvigPreview @Composable -fun PreviewExtraBuildingTypeContainer() { +private fun PreviewExtraBuildingTypeContainer() { HedvigTheme { Surface { ExtraBuildingTypeContainer( diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/ContractTermsOverView.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/ContractTermsOverview.kt similarity index 96% rename from app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/ContractTermsOverView.kt rename to app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/ContractTermsOverview.kt index 5e12444621..5b1a53a3d7 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/ContractTermsOverView.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/ContractTermsOverview.kt @@ -1,3 +1,4 @@ + package com.hedvig.android.feature.changeaddress.ui.offer import androidx.compose.foundation.background @@ -26,7 +27,7 @@ import com.hedvig.android.core.designsystem.material3.squircleMedium import com.hedvig.android.core.designsystem.theme.HedvigTheme @Composable -internal fun ContractTermsOverView( +private fun ContractTermsOverview( contractDisplayName: String, contractTerms: ContractTerms, ) { @@ -141,26 +142,26 @@ internal fun ContractTermsOverView( } } -data class ContractTerms( +private data class ContractTerms( val insurableLimits: List, val perils: List, val documents: List, ) -data class InsurableLimit( +private data class InsurableLimit( val label: String, val description: String, val limit: String, ) -data class Peril( +private data class Peril( val title: String, val description: String, val iconUrl: String, val isExpanded: Boolean = false, ) -data class Document( +private data class Document( val title: String, val description: String, val documentUrl: String, @@ -168,10 +169,10 @@ data class Document( @Preview @Composable -fun PreviewContractTermsOverView() { +private fun PreviewContractTermsOverview() { HedvigTheme { Surface { - ContractTermsOverView( + ContractTermsOverview( contractDisplayName = "Hemförsäkring", contractTerms = ContractTerms( insurableLimits = listOf( diff --git a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt index e42ba22f69..ec20214859 100644 --- a/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt +++ b/app/feature/feature-changeaddress/src/main/kotlin/com/hedvig/android/feature/changeaddress/ui/offer/QuoteCard.kt @@ -177,7 +177,7 @@ private fun ExpandedInformation( @HedvigPreview @Composable -fun PreviewQuoteCard() { +private fun PreviewQuoteCard() { HedvigTheme { Surface(color = MaterialTheme.colorScheme.background) { QuoteCard( From daf6a58d9060da97c1fc1cb5b62de37a24a71dab Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Thu, 19 Oct 2023 15:11:24 +0200 Subject: [PATCH 18/19] Fix ktlint error --- .../android/core/designsystem/component/card/HedvigInfoCard.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/core-design-system/src/main/kotlin/com/hedvig/android/core/designsystem/component/card/HedvigInfoCard.kt b/app/core/core-design-system/src/main/kotlin/com/hedvig/android/core/designsystem/component/card/HedvigInfoCard.kt index 7a4720fba6..9ec69d9452 100644 --- a/app/core/core-design-system/src/main/kotlin/com/hedvig/android/core/designsystem/component/card/HedvigInfoCard.kt +++ b/app/core/core-design-system/src/main/kotlin/com/hedvig/android/core/designsystem/component/card/HedvigInfoCard.kt @@ -24,7 +24,7 @@ fun HedvigInfoCard( contentColor = MaterialTheme.colorScheme.onInfoContainer, ), shape: Shape = MaterialTheme.shapes.squircleMedium, - content: @Composable() (RowScope.() -> Unit), + content: @Composable RowScope.() -> Unit, ) { HedvigCard( shape = shape, From 14a8191c566d5e37052a5d5caa4c354bf9efb3ad Mon Sep 17 00:00:00 2001 From: stylianosgakis Date: Thu, 19 Oct 2023 18:11:34 +0200 Subject: [PATCH 19/19] Fix breaking GQL schema change --- .../com/hedvig/app/feature/chat/data/ChatRepositoryNew.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/app/src/main/kotlin/com/hedvig/app/feature/chat/data/ChatRepositoryNew.kt b/app/app/src/main/kotlin/com/hedvig/app/feature/chat/data/ChatRepositoryNew.kt index 480a2ed5f5..7e22ff9eed 100644 --- a/app/app/src/main/kotlin/com/hedvig/app/feature/chat/data/ChatRepositoryNew.kt +++ b/app/app/src/main/kotlin/com/hedvig/app/feature/chat/data/ChatRepositoryNew.kt @@ -51,7 +51,8 @@ class ChatRepositoryNewImpl( contentType: String, ) = either { val fileUpload = file.toUpload(contentType) - val input = ChatMessageFileInput(fileUpload) +// val input = ChatMessageFileInput(fileUpload) // todo here upload file directly through HTTP instead + val input = ChatMessageFileInput("") val mutation = ChatSendFileMutation(input) val result = apolloClientOctopus.mutation(mutation)