From 69f140a56ad870dda5a956963605008081b6309c Mon Sep 17 00:00:00 2001 From: mariiapanasetskaia Date: Thu, 16 Apr 2026 10:42:29 +0200 Subject: [PATCH] move legal info to about app --- .../androidMain/res/values-sv-rSE/strings.xml | 3 +- .../src/androidMain/res/values/strings.xml | 3 +- .../values-sv-rSE/strings.xml | 3 +- .../composeResources/values/strings.xml | 3 +- ...stination.kt => InformationDestination.kt} | 205 ++++++++++++++++-- .../profile/legal/LegalInfoDestination.kt | 146 ------------- .../profile/navigation/ProfileDestinations.kt | 4 +- .../feature/profile/tab/ProfileDestination.kt | 21 +- .../feature/profile/tab/ProfileGraph.kt | 25 +-- 9 files changed, 209 insertions(+), 204 deletions(-) rename app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/aboutapp/{AboutAppDestination.kt => InformationDestination.kt} (62%) delete mode 100644 app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/legal/LegalInfoDestination.kt diff --git a/app/core/core-resources/src/androidMain/res/values-sv-rSE/strings.xml b/app/core/core-resources/src/androidMain/res/values-sv-rSE/strings.xml index a11c26e276..7cea7bbfd9 100644 --- a/app/core/core-resources/src/androidMain/res/values-sv-rSE/strings.xml +++ b/app/core/core-resources/src/androidMain/res/values-sv-rSE/strings.xml @@ -513,7 +513,7 @@ Invalid National Identity Number Vi försöker reparera i första hand, men om din %1$s skulle behöva ersättas helt (ex. om den blivit stulen) ersätts du med **%2$d\u0025** av inköpspriset **%3$d kr**, alltså **%4$d kr**. Värdering - Du kan inte ändra betalmetod just nu. Kontakta oss för hjälp. + Vill du betala din försäkring via autogiro och möjliggöra snabba utbetalningar vid skador? Fakturan skickas till din Kivra-inkorg 14 dagar före förfallodatumet varje månad. Tillgänglighet Juridisk information @@ -641,6 +641,7 @@ Vi kan inte radera ditt konto just nu För att vi ska kunna radera ditt konto måste alla öppna skadeärenden vara stängda och inte finnas några aktiva försäkringar. Var vänlig skriv till oss i appen. Hedvig Forever + Information Är du säker på att du vill logga ut? Epost Inkorrekt epostadress diff --git a/app/core/core-resources/src/androidMain/res/values/strings.xml b/app/core/core-resources/src/androidMain/res/values/strings.xml index c32f2e330f..335c64edc2 100644 --- a/app/core/core-resources/src/androidMain/res/values/strings.xml +++ b/app/core/core-resources/src/androidMain/res/values/strings.xml @@ -513,7 +513,7 @@ Invalid National Identity Number We first try to repair your %1$s, but if it needs to be replaced (e.g. if it was stolen) you will be compensated **%2$d\u0025** of the purchase price **%3$d SEK**, i.e **%4$d SEK**. Valuation - You can’t change the payment method right now. Contact us for help. + Do you want to pay your insurance via direct debit and enable quick payouts in the event of claims? The invoice is sent to your Kivra inbox 14 days before the due date each month. Accessibility Legal @@ -641,6 +641,7 @@ We can\'t delete your account right now In order to delete your account you need to have your open claims settled and not have any active insurances. Please reach out to our service team via message in the app. Hedvig Forever + Information Are you sure you want to log out? Email Invalid email diff --git a/app/core/core-resources/src/commonMain/composeResources/values-sv-rSE/strings.xml b/app/core/core-resources/src/commonMain/composeResources/values-sv-rSE/strings.xml index 47fe4f86fc..416af9b0a8 100644 --- a/app/core/core-resources/src/commonMain/composeResources/values-sv-rSE/strings.xml +++ b/app/core/core-resources/src/commonMain/composeResources/values-sv-rSE/strings.xml @@ -513,7 +513,7 @@ Invalid National Identity Number Vi försöker reparera i första hand, men om din %1$s skulle behöva ersättas helt (ex. om den blivit stulen) ersätts du med **%2$d\u0025** av inköpspriset **%3$d kr**, alltså **%4$d kr**. Värdering - Du kan inte ändra betalmetod just nu. Kontakta oss för hjälp. + Vill du betala din försäkring via autogiro och möjliggöra snabba utbetalningar vid skador? Fakturan skickas till din Kivra-inkorg 14 dagar före förfallodatumet varje månad. Tillgänglighet Juridisk information @@ -641,6 +641,7 @@ Vi kan inte radera ditt konto just nu För att vi ska kunna radera ditt konto måste alla öppna skadeärenden vara stängda och inte finnas några aktiva försäkringar. Var vänlig skriv till oss i appen. Hedvig Forever + Information Är du säker på att du vill logga ut? Epost Inkorrekt epostadress diff --git a/app/core/core-resources/src/commonMain/composeResources/values/strings.xml b/app/core/core-resources/src/commonMain/composeResources/values/strings.xml index e14022ed2f..f684d45a2e 100644 --- a/app/core/core-resources/src/commonMain/composeResources/values/strings.xml +++ b/app/core/core-resources/src/commonMain/composeResources/values/strings.xml @@ -513,7 +513,7 @@ Invalid National Identity Number We first try to repair your %1$s, but if it needs to be replaced (e.g. if it was stolen) you will be compensated **%2$d\u0025** of the purchase price **%3$d SEK**, i.e **%4$d SEK**. Valuation - You can’t change the payment method right now. Contact us for help. + Do you want to pay your insurance via direct debit and enable quick payouts in the event of claims? The invoice is sent to your Kivra inbox 14 days before the due date each month. Accessibility Legal @@ -641,6 +641,7 @@ We can't delete your account right now In order to delete your account you need to have your open claims settled and not have any active insurances. Please reach out to our service team via message in the app. Hedvig Forever + Information Are you sure you want to log out? Email Invalid email diff --git a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/aboutapp/AboutAppDestination.kt b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/aboutapp/InformationDestination.kt similarity index 62% rename from app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/aboutapp/AboutAppDestination.kt rename to app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/aboutapp/InformationDestination.kt index aa5bf508aa..b7376e25dc 100644 --- a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/aboutapp/AboutAppDestination.kt +++ b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/aboutapp/InformationDestination.kt @@ -5,12 +5,15 @@ import android.content.Intent import android.os.Build import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer 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.foundation.layout.wrapContentHeight import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -20,13 +23,19 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.core.net.toUri import androidx.lifecycle.compose.collectAsStateWithLifecycle +import com.hedvig.android.compose.ui.EmptyContentDescription import com.hedvig.android.core.buildconstants.HedvigBuildConstants +import com.hedvig.android.core.icons.HedvigIcons +import com.hedvig.android.core.icons.hedvig.small.hedvig.ArrowNorthEast +import com.hedvig.android.core.locale.CommonLocale import com.hedvig.android.design.system.hedvig.ButtonDefaults.ButtonStyle.Secondary +import com.hedvig.android.design.system.hedvig.DividerPosition import com.hedvig.android.design.system.hedvig.HedvigAlertDialog import com.hedvig.android.design.system.hedvig.HedvigButton import com.hedvig.android.design.system.hedvig.HedvigFullScreenCenterAlignedProgressDebounced @@ -34,15 +43,25 @@ import com.hedvig.android.design.system.hedvig.HedvigPreview 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.HighlightLabel +import com.hedvig.android.design.system.hedvig.HighlightLabelDefaults import com.hedvig.android.design.system.hedvig.HorizontalItemsWithMaximumSpaceTaken +import com.hedvig.android.design.system.hedvig.Icon import com.hedvig.android.design.system.hedvig.Surface import com.hedvig.android.design.system.hedvig.clearFocusOnTap +import com.hedvig.android.design.system.hedvig.horizontalDivider import com.hedvig.android.design.system.hedvig.withHedvigLink +import com.hedvig.android.language.Language +import com.hedvig.android.language.LanguageService import hedvig.resources.HC_CHAT_BUTTON +import hedvig.resources.LEGAL_A11Y +import hedvig.resources.LEGAL_INFORMATION +import hedvig.resources.LEGAL_PRIVACY_POLICY import hedvig.resources.PROFILE_ABOUT_APP_LICENSE_ATTRIBUTIONS import hedvig.resources.PROFILE_ABOUT_APP_MEMBER_ID import hedvig.resources.PROFILE_ABOUT_APP_TITLE import hedvig.resources.PROFILE_ABOUT_APP_VERSION +import hedvig.resources.PROFILE_INFO_LABEL import hedvig.resources.Res import hedvig.resources.app_info_submit_bug_button import hedvig.resources.app_info_submit_bug_continue @@ -55,15 +74,17 @@ import hedvig.resources.app_info_submit_bug_warning_with_chat_link_3 import org.jetbrains.compose.resources.stringResource @Composable -internal fun AboutAppDestination( +internal fun InformationDestination( viewModel: AboutAppViewModel, onBackPressed: () -> Unit, showOpenSourceLicenses: () -> Unit, navigateToNewConversation: () -> Unit, hedvigBuildConstants: HedvigBuildConstants, + languageService: LanguageService, + openUrl: (String) -> Unit, ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() - AboutAppScreen( + InformationScreen( uiState = uiState, onBackPressed = onBackPressed, showOpenSourceLicenses = showOpenSourceLicenses, @@ -71,11 +92,13 @@ internal fun AboutAppDestination( appVersionName = hedvigBuildConstants.appVersionName, appVersionCode = hedvigBuildConstants.appVersionCode, navigateToNewConversation = navigateToNewConversation, + openUrl = openUrl, + languageService = languageService, ) } @Composable -private fun AboutAppScreen( +private fun InformationScreen( uiState: AboutAppUiState, isProduction: Boolean, appVersionName: String, @@ -83,9 +106,11 @@ private fun AboutAppScreen( onBackPressed: () -> Unit, showOpenSourceLicenses: () -> Unit, navigateToNewConversation: () -> Unit, + openUrl: (String) -> Unit, + languageService: LanguageService, ) { HedvigScaffold( - topAppBarText = stringResource(Res.string.PROFILE_ABOUT_APP_TITLE), + topAppBarText = stringResource(Res.string.PROFILE_INFO_LABEL), navigateUp = onBackPressed, modifier = Modifier.clearFocusOnTap(), ) { @@ -99,7 +124,7 @@ private fun AboutAppScreen( } is AboutAppUiState.Content -> { - AboutAppContent( + InformationContent( memberId = uiState.memberId, deviceId = uiState.deviceId, showOpenSourceLicenses = showOpenSourceLicenses, @@ -107,6 +132,8 @@ private fun AboutAppScreen( appVersionName = appVersionName, appVersionCode = appVersionCode, navigateToNewConversation = navigateToNewConversation, + openUrl = openUrl, + languageService = languageService, ) } } @@ -114,7 +141,7 @@ private fun AboutAppScreen( } @Composable -private fun ColumnScope.AboutAppContent( +private fun ColumnScope.InformationContent( memberId: String?, deviceId: String?, showOpenSourceLicenses: () -> Unit, @@ -122,7 +149,15 @@ private fun ColumnScope.AboutAppContent( appVersionName: String, appVersionCode: String, navigateToNewConversation: () -> Unit, + openUrl: (String) -> Unit, + languageService: LanguageService, ) { + Spacer(Modifier.height(16.dp)) + LegalInfoSection( + openUrl = openUrl, + languageService = languageService, + ) + Spacer(Modifier.height(24.dp)) var showSubmitBugWarning by remember { mutableStateOf(false) } if (showSubmitBugWarning) { SubmitBugWarningDialog( @@ -135,13 +170,22 @@ private fun ColumnScope.AboutAppContent( }, ) } - Spacer(Modifier.height(16.dp)) + HighlightLabel( + stringResource(Res.string.PROFILE_ABOUT_APP_TITLE), + size = HighlightLabelDefaults.HighLightSize.Medium, + color = HighlightLabelDefaults.HighlightColor.Blue( + HighlightLabelDefaults.HighlightShade.LIGHT, + ), + modifier = Modifier.padding(horizontal = 16.dp), + ) if (memberId != null) { HorizontalItemsWithMaximumSpaceTaken( spaceBetween = 8.dp, - modifier = Modifier - .fillMaxWidth() - .padding(16.dp), + modifier = horizontalDividerModifier.then( + Modifier + .fillMaxWidth() + .padding(16.dp), + ), startSlot = { HedvigText(stringResource(Res.string.PROFILE_ABOUT_APP_MEMBER_ID)) }, @@ -155,9 +199,11 @@ private fun ColumnScope.AboutAppContent( ) } HorizontalItemsWithMaximumSpaceTaken( - modifier = Modifier - .fillMaxWidth() - .padding(16.dp), + modifier = horizontalDividerModifier.then( + Modifier + .fillMaxWidth() + .padding(16.dp), + ), startSlot = { HedvigText(stringResource(Res.string.PROFILE_ABOUT_APP_VERSION)) }, @@ -268,12 +314,126 @@ private fun openEmailClientWithPrefilledData( ) } +private val horizontalDividerModifier = Modifier.horizontalDivider( + DividerPosition.Bottom, horizontalPadding = 16.dp, +) + +@Composable +internal fun LegalInfoSection( + openUrl: (String) -> Unit, + languageService: LanguageService, + modifier: Modifier = Modifier, +) { + Column(modifier) { + val linkContainer = LinkContainer(languageService) + + LinkRow( + modifier = horizontalDividerModifier, + text = stringResource(Res.string.LEGAL_PRIVACY_POLICY), + link = linkContainer.getPrivacyPolicyLink(), + onLinkClick = openUrl, + ) + LinkRow( + modifier = horizontalDividerModifier, + text = stringResource(Res.string.LEGAL_INFORMATION), + link = linkContainer.getLegalInfoLink(), + onLinkClick = openUrl, + ) + LinkRow( + text = stringResource(Res.string.LEGAL_A11Y), + link = linkContainer.getA11yLink(), + onLinkClick = openUrl, + ) + } +} + +private class LinkContainer( + val languageService: LanguageService, +) { + private val privacyPolicyLinkEn = "https://www.hedvig.com/se-en/hedvig/privacy-policy" + private val privacyPolicyLinkSe = "https://www.hedvig.com/se/hedvig/personuppgifter" + fun getPrivacyPolicyLink(): String { + return when (languageService.getLanguage()) { + Language.SV_SE -> privacyPolicyLinkSe + Language.EN_SE -> privacyPolicyLinkEn + } + } + + private val legalInfoLinkEn = "https://www.hedvig.com/se-en/hedvig/legal" + private val legalInfoLinkSe = "https://www.hedvig.com/se/hedvig/legal" + fun getLegalInfoLink(): String { + return when (languageService.getLanguage()) { + Language.SV_SE -> legalInfoLinkSe + Language.EN_SE -> legalInfoLinkEn + } + } + + private val a11yLinkEn = "https://www.hedvig.com/se-en/help/accessibility" + private val a11yLinkSe = "https://www.hedvig.com/se/hjalp/tillganglighet" + fun getA11yLink(): String { + return when (languageService.getLanguage()) { + Language.SV_SE -> a11yLinkSe + Language.EN_SE -> a11yLinkEn + } + } +} + + +@Composable +private fun LinkRow( + link: String, + text: String, + onLinkClick: (String) -> Unit, + modifier: Modifier = Modifier, +) { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = modifier + .fillMaxWidth() + .clickable( + onClick = { + onLinkClick(link) + }, + enabled = true, + ) + .padding(16.dp) + .semantics(mergeDescendants = true) {}, + ) { + HedvigText( + text = text, + ) + Spacer(Modifier.weight(1f)) + Spacer(Modifier.width(8.dp)) + Icon( + imageVector = HedvigIcons.ArrowNorthEast, + contentDescription = EmptyContentDescription, + modifier = Modifier + .size(16.dp), + ) + } +} + + +@HedvigPreview +@Composable +private fun PreviewLinkRow() { + HedvigTheme { + Surface(color = HedvigTheme.colorScheme.backgroundPrimary) { + LinkRow( + link = "", + text = "Legal information", + onLinkClick = {}, + ) + } + } +} + @HedvigPreview @Composable -private fun PreviewAboutAppScreen() { +private fun PreviewInformationScreen() { HedvigTheme { Surface(color = HedvigTheme.colorScheme.backgroundPrimary) { - AboutAppScreen( + InformationScreen( uiState = AboutAppUiState.Content(memberId = "123", deviceId = "123456"), onBackPressed = {}, showOpenSourceLicenses = {}, @@ -281,7 +441,22 @@ private fun PreviewAboutAppScreen() { appVersionName = "11.3.2", appVersionCode = "43", navigateToNewConversation = {}, + openUrl = {}, + languageService = previewLanguageService, ) } } } + +private val previewLanguageService = object : LanguageService { + override fun setLanguage(language: Language) {} + override fun getSelectedLanguage(): Language { + return Language.EN_SE + } + override fun getLanguage(): Language { + return Language.EN_SE + } + override fun getLocale(): CommonLocale { + return CommonLocale.getDefault() + } +} diff --git a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/legal/LegalInfoDestination.kt b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/legal/LegalInfoDestination.kt deleted file mode 100644 index 68144bf393..0000000000 --- a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/legal/LegalInfoDestination.kt +++ /dev/null @@ -1,146 +0,0 @@ -package com.hedvig.android.feature.profile.legal - -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -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.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.semantics.semantics -import androidx.compose.ui.unit.dp -import com.hedvig.android.compose.ui.EmptyContentDescription -import com.hedvig.android.core.icons.HedvigIcons -import com.hedvig.android.core.icons.hedvig.small.hedvig.ArrowNorthEast -import com.hedvig.android.design.system.hedvig.DividerPosition -import com.hedvig.android.design.system.hedvig.HedvigPreview -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.Icon -import com.hedvig.android.design.system.hedvig.Surface -import com.hedvig.android.design.system.hedvig.horizontalDivider -import com.hedvig.android.language.Language -import com.hedvig.android.language.LanguageService -import hedvig.resources.LEGAL_A11Y -import hedvig.resources.LEGAL_CATEGORY_LABEL -import hedvig.resources.LEGAL_INFORMATION -import hedvig.resources.LEGAL_PRIVACY_POLICY -import hedvig.resources.Res -import org.jetbrains.compose.resources.stringResource - -@Composable -internal fun LegalInfoDestination( - openUrl: (String) -> Unit, - navigateUp: () -> Unit, - languageService: LanguageService, -) { - HedvigScaffold( - navigateUp = navigateUp, - topAppBarText = stringResource(Res.string.LEGAL_CATEGORY_LABEL), - ) { - val linkContainer = LinkContainer(languageService) - val horizontalDividerModifier = Modifier.horizontalDivider(DividerPosition.Bottom, horizontalPadding = 16.dp) - LinkRow( - modifier = horizontalDividerModifier, - text = stringResource(Res.string.LEGAL_PRIVACY_POLICY), - link = linkContainer.getPrivacyPolicyLink(), - onLinkClick = openUrl, - ) - LinkRow( - modifier = horizontalDividerModifier, - text = stringResource(Res.string.LEGAL_INFORMATION), - link = linkContainer.getLegalInfoLink(), - onLinkClick = openUrl, - ) - LinkRow( - text = stringResource(Res.string.LEGAL_A11Y), - link = linkContainer.getA11yLink(), - onLinkClick = openUrl, - ) - } -} - -private class LinkContainer( - val languageService: LanguageService, -) { - private val privacyPolicyLinkEn = "https://www.hedvig.com/se-en/hedvig/privacy-policy" - private val privacyPolicyLinkSe = "https://www.hedvig.com/se/hedvig/personuppgifter" - fun getPrivacyPolicyLink(): String { - return when (languageService.getLanguage()) { - Language.SV_SE -> privacyPolicyLinkSe - Language.EN_SE -> privacyPolicyLinkEn - } - } - - private val legalInfoLinkEn = "https://www.hedvig.com/se-en/hedvig/legal" - private val legalInfoLinkSe = "https://www.hedvig.com/se/hedvig/legal" - fun getLegalInfoLink(): String { - return when (languageService.getLanguage()) { - Language.SV_SE -> legalInfoLinkSe - Language.EN_SE -> legalInfoLinkEn - } - } - - private val a11yLinkEn = "https://www.hedvig.com/se-en/help/accessibility" - private val a11yLinkSe = "https://www.hedvig.com/se/hjalp/tillganglighet" - fun getA11yLink(): String { - return when (languageService.getLanguage()) { - Language.SV_SE -> a11yLinkSe - Language.EN_SE -> a11yLinkEn - } - } -} - - -@Composable -private fun LinkRow( - link: String, - text: String, - onLinkClick: (String) -> Unit, - modifier: Modifier = Modifier, -) { - Row( - verticalAlignment = Alignment.CenterVertically, - modifier = modifier - .fillMaxWidth() - .clickable( - onClick = { - onLinkClick(link) - }, - enabled = true, - ) - .padding(16.dp) - .semantics(mergeDescendants = true) {}, - ) { - HedvigText( - text = text, - ) - Spacer(Modifier.weight(1f)) - Spacer(Modifier.width(8.dp)) - Icon( - imageVector = HedvigIcons.ArrowNorthEast, - contentDescription = EmptyContentDescription, - modifier = Modifier - .size(16.dp), - ) - } -} - - -@HedvigPreview -@Composable -private fun PreviewLinkRow() { - HedvigTheme { - Surface(color = HedvigTheme.colorScheme.backgroundPrimary) { - LinkRow( - link = "", - text = "Legal information", - onLinkClick = {}, - ) - } - } -} diff --git a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/navigation/ProfileDestinations.kt b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/navigation/ProfileDestinations.kt index f52864bac1..a14c4dcef2 100644 --- a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/navigation/ProfileDestinations.kt +++ b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/navigation/ProfileDestinations.kt @@ -23,7 +23,7 @@ internal sealed interface ProfileDestinations { data object Certificates : ProfileDestinations, Destination @Serializable - data object AboutApp : ProfileDestinations, Destination + data object Information : ProfileDestinations, Destination @Serializable data object Licenses : ProfileDestinations, Destination @@ -31,8 +31,6 @@ internal sealed interface ProfileDestinations { @Serializable data object SettingsGraph : ProfileDestinations, Destination - @Serializable - data object Legal: ProfileDestinations, Destination } internal sealed interface SettingsDestinations { diff --git a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/tab/ProfileDestination.kt b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/tab/ProfileDestination.kt index 9ff6ffb028..4367ae1a24 100644 --- a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/tab/ProfileDestination.kt +++ b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/tab/ProfileDestination.kt @@ -62,7 +62,6 @@ import com.hedvig.android.design.system.hedvig.HedvigTheme import com.hedvig.android.design.system.hedvig.Icon import com.hedvig.android.design.system.hedvig.Surface import com.hedvig.android.design.system.hedvig.horizontalDivider -import com.hedvig.android.design.system.hedvig.icon.Bookmark import com.hedvig.android.design.system.hedvig.icon.Clock import com.hedvig.android.design.system.hedvig.icon.Eurobonus import com.hedvig.android.design.system.hedvig.icon.HedvigIcons @@ -82,9 +81,9 @@ import com.hedvig.android.pullrefresh.PullRefreshIndicator import com.hedvig.android.pullrefresh.pullRefresh import com.hedvig.android.pullrefresh.rememberPullRefreshState import hedvig.resources.GENERAL_YES -import hedvig.resources.LEGAL_CATEGORY_LABEL import hedvig.resources.LOGOUT_BUTTON import hedvig.resources.PROFILE_ABOUT_ROW +import hedvig.resources.PROFILE_INFO_LABEL import hedvig.resources.PROFILE_LOGOUT_DIALOG_MESSAGE import hedvig.resources.PROFILE_MY_INFO_ROW_TITLE import hedvig.resources.PROFILE_TITLE @@ -111,7 +110,6 @@ internal fun ProfileDestination( onNavigateToNewConversation: () -> Unit, viewModel: ProfileViewModel, navigateToChipId: () -> Unit, - navigateToLegalInfo: () -> Unit, ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() @@ -132,7 +130,6 @@ internal fun ProfileDestination( onLogout = { viewModel.emit(ProfileUiEvent.Logout) }, onNavigateToNewConversation = onNavigateToNewConversation, navigateToChipId = navigateToChipId, - navigateToLegalInfo = navigateToLegalInfo ) } @@ -155,7 +152,6 @@ private fun ProfileScreen( snoozeNotificationPermission: () -> Unit, onLogout: () -> Unit, navigateToChipId: () -> Unit, - navigateToLegalInfo: () -> Unit, ) { val systemBarInsetTopDp = with(LocalDensity.current) { WindowInsets.systemBars.getTop(this).toDp() @@ -209,7 +205,6 @@ private fun ProfileScreen( navigateToEurobonus = navigateToEurobonus, navigateToClaimHistory = navigateToClaimHistory, navigateToCertificates = navigateToCertificates, - navigateToLegalInfo = navigateToLegalInfo ) Spacer(Modifier.height(16.dp)) Spacer(Modifier.weight(1f)) @@ -272,7 +267,6 @@ private fun ProfileRows( navigateToEurobonus: () -> Unit, navigateToClaimHistory: () -> Unit, navigateToCertificates: () -> Unit, - navigateToLegalInfo: () -> Unit, ) { AnimatedContent( targetState = profileUiState, @@ -293,7 +287,6 @@ private fun ProfileRows( navigateToEurobonus = navigateToEurobonus, navigateToClaimHistory = navigateToClaimHistory, navigateToCertificates = navigateToCertificates, - navigateToLegalInfo = navigateToLegalInfo ) } } @@ -340,7 +333,6 @@ private fun ColumnScope.ProfileItemRows( navigateToEurobonus: () -> Unit, navigateToClaimHistory: () -> Unit, navigateToCertificates: () -> Unit, - navigateToLegalInfo: () -> Unit, ) { val horizontalDividerModifier = Modifier.horizontalDivider(DividerPosition.Bottom, horizontalPadding = 16.dp) ProfileRow( @@ -378,19 +370,12 @@ private fun ColumnScope.ProfileItemRows( ) } ProfileRow( - title = stringResource(Res.string.PROFILE_ABOUT_ROW), + title = stringResource(Res.string.PROFILE_INFO_LABEL), icon = HedvigIcons.InfoOutline, onClick = navigateToAboutApp, isLoading = false, modifier = horizontalDividerModifier, ) - ProfileRow( - title = stringResource(Res.string.LEGAL_CATEGORY_LABEL), - icon = HedvigIcons.Bookmark, - onClick = navigateToLegalInfo, - isLoading = false, - modifier = horizontalDividerModifier, - ) ProfileRow( title = stringResource(Res.string.profile_appSettingsSection_row_headline), icon = HedvigIcons.Settings, @@ -453,7 +438,6 @@ private fun PreviewProfileRows( {}, {}, {}, - {} ) } } @@ -497,7 +481,6 @@ private fun PreviewAnimatedProfileItemRows() { {}, {}, {}, - {} ) } } diff --git a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/tab/ProfileGraph.kt b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/tab/ProfileGraph.kt index 492f02c922..d477f1ee4e 100644 --- a/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/tab/ProfileGraph.kt +++ b/app/feature/feature-profile/src/main/kotlin/com/hedvig/android/feature/profile/tab/ProfileGraph.kt @@ -8,7 +8,7 @@ import com.hedvig.android.core.buildconstants.HedvigBuildConstants import com.hedvig.android.data.coinsured.CoInsuredFlowType import com.hedvig.android.design.system.hedvig.GlobalSnackBarState import com.hedvig.android.design.system.hedvig.motion.MotionDefaults -import com.hedvig.android.feature.profile.aboutapp.AboutAppDestination +import com.hedvig.android.feature.profile.aboutapp.InformationDestination import com.hedvig.android.feature.profile.aboutapp.AboutAppViewModel import com.hedvig.android.feature.profile.aboutapp.LicensesDestination import com.hedvig.android.feature.profile.certificates.CertificatesDestination @@ -17,7 +17,7 @@ import com.hedvig.android.feature.profile.contactinfo.ContactInfoDestination import com.hedvig.android.feature.profile.contactinfo.ContactInfoViewModel import com.hedvig.android.feature.profile.eurobonus.EurobonusDestination import com.hedvig.android.feature.profile.eurobonus.EurobonusViewModel -import com.hedvig.android.feature.profile.legal.LegalInfoDestination + import com.hedvig.android.feature.profile.navigation.ProfileDestination import com.hedvig.android.feature.profile.navigation.ProfileDestinations import com.hedvig.android.feature.profile.navigation.ProfileDestinations.Certificates @@ -49,7 +49,7 @@ fun NavGraphBuilder.profileGraph( onNavigateToInsuranceEvidence: () -> Unit, openUrl: (String) -> Unit, navigateToChipId: () -> Unit, - languageService: LanguageService + languageService: LanguageService, ) { navgraph( startDestination = ProfileDestination.Profile::class, @@ -69,7 +69,7 @@ fun NavGraphBuilder.profileGraph( navController.navigate(ProfileDestination.ContactInfo) }, navigateToAboutApp = dropUnlessResumed { - navController.navigate(ProfileDestinations.AboutApp) + navController.navigate(ProfileDestinations.Information) }, navigateToSettings = dropUnlessResumed { navController.navigate(ProfileDestinations.SettingsGraph) @@ -88,17 +88,6 @@ fun NavGraphBuilder.profileGraph( onNavigateToNewConversation() }, navigateToChipId = navigateToChipId, - navigateToLegalInfo = dropUnlessResumed { - navController.navigate(ProfileDestinations.Legal) - }, - ) - } - - navdestination { - LegalInfoDestination( - openUrl = openUrl, - navigateUp = navController::navigateUp, - languageService = languageService ) } @@ -122,9 +111,9 @@ fun NavGraphBuilder.profileGraph( popBackStack = popBackStackOrFinish, ) } - navdestination { + navdestination { val viewModel: AboutAppViewModel = koinViewModel() - AboutAppDestination( + InformationDestination( viewModel = viewModel, onBackPressed = navController::navigateUp, showOpenSourceLicenses = dropUnlessResumed { @@ -132,6 +121,8 @@ fun NavGraphBuilder.profileGraph( }, navigateToNewConversation = dropUnlessResumed { onNavigateToNewConversation() }, hedvigBuildConstants = hedvigBuildConstants, + languageService = languageService, + openUrl = openUrl, ) } navdestination {