diff --git a/app/app/build.gradle.kts b/app/app/build.gradle.kts index 98983cf972..754ab6914e 100644 --- a/app/app/build.gradle.kts +++ b/app/app/build.gradle.kts @@ -192,7 +192,8 @@ dependencies { implementation(projects.featureEditCoinsured) implementation(projects.featureFlagsPublic) implementation(projects.featureForever) - implementation(projects.featureHelpCenter) + implementation(projects.featureHelpCenterData) + implementation(projects.featureHelpCenterUi) implementation(projects.featureHome) implementation(projects.featureInsurances) implementation(projects.featureLogin) diff --git a/app/app/src/main/kotlin/com/hedvig/app/ApplicationModule.kt b/app/app/src/main/kotlin/com/hedvig/app/ApplicationModule.kt index 3b28644437..9c5b67500e 100644 --- a/app/app/src/main/kotlin/com/hedvig/app/ApplicationModule.kt +++ b/app/app/src/main/kotlin/com/hedvig/app/ApplicationModule.kt @@ -7,7 +7,6 @@ import android.content.Context import android.content.Context.MODE_PRIVATE import android.content.SharedPreferences import android.os.Build -import androidx.core.content.ContextCompat.startActivity import androidx.work.WorkerParameters import coil.ImageLoader import coil.decode.GifDecoder @@ -58,7 +57,8 @@ import com.hedvig.android.feature.connect.payment.trustly.di.connectPaymentTrust import com.hedvig.android.feature.deleteaccount.di.deleteAccountModule import com.hedvig.android.feature.editcoinsured.di.editCoInsuredModule import com.hedvig.android.feature.forever.di.foreverModule -import com.hedvig.android.feature.help.center.di.helpCenterModule +import com.hedvig.android.feature.help.center.di.helpCenterDataModule +import com.hedvig.android.feature.help.center.di.helpCenterUiModule import com.hedvig.android.feature.home.di.homeModule import com.hedvig.android.feature.insurances.di.insurancesModule import com.hedvig.android.feature.login.di.loginModule @@ -355,7 +355,8 @@ val applicationModule = module { fileUploadModule, firebaseNotificationModule, foreverModule, - helpCenterModule, + helpCenterDataModule, + helpCenterUiModule, homeModule, insurancesModule, languageAuthListenersModule, diff --git a/app/data/data-claim-flow/src/main/kotlin/com/hedvig/android/data/claimflow/ClaimFlowRepository.kt b/app/data/data-claim-flow/src/main/kotlin/com/hedvig/android/data/claimflow/ClaimFlowRepository.kt index 233a5a7c6b..f1979ad7bc 100644 --- a/app/data/data-claim-flow/src/main/kotlin/com/hedvig/android/data/claimflow/ClaimFlowRepository.kt +++ b/app/data/data-claim-flow/src/main/kotlin/com/hedvig/android/data/claimflow/ClaimFlowRepository.kt @@ -338,7 +338,7 @@ internal class ClaimFlowRepositoryImpl( // Same name for both due to this: https://hedviginsurance.slack.com/archives/C03RP2M458V/p1680004365854429 name = file.name, filename = file.name, - body = file.asRequestBody("audio/aac".toMediaType()), + body = file.asRequestBody("audio/mp4".toMediaType()), ), ) .onLeft { diff --git a/app/feature/feature-edit-coinsured/src/main/kotlin/com/hedvig/android/feature/editcoinsured/ui/AddCoInsuredBottomSheetContent.kt b/app/feature/feature-edit-coinsured/src/main/kotlin/com/hedvig/android/feature/editcoinsured/ui/AddCoInsuredBottomSheetContent.kt index 89d38cf406..61c886bb53 100644 --- a/app/feature/feature-edit-coinsured/src/main/kotlin/com/hedvig/android/feature/editcoinsured/ui/AddCoInsuredBottomSheetContent.kt +++ b/app/feature/feature-edit-coinsured/src/main/kotlin/com/hedvig/android/feature/editcoinsured/ui/AddCoInsuredBottomSheetContent.kt @@ -28,10 +28,17 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.text.input.OffsetMapping +import androidx.compose.ui.text.input.TransformedText +import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.withStyle import androidx.compose.ui.unit.dp import com.hedvig.android.core.designsystem.component.button.HedvigContainedButton import com.hedvig.android.core.designsystem.component.button.HedvigTextButton @@ -186,7 +193,8 @@ private fun FetchFromSsnFields( onContinue: () -> Unit, ) { var ssnInput by remember { mutableStateOf("") } - + val mask = stringResource(id = R.string.edit_coinsured_ssn_placeholder) + val maskColor = MaterialTheme.colorScheme.onSurfaceVariant Column { HedvigTextField( value = ssnInput, @@ -194,10 +202,13 @@ private fun FetchFromSsnFields( Text(stringResource(id = R.string.CONTRACT_PERSONAL_IDENTITY)) }, onValueChange = { - onSsnChanged(it) - ssnInput = it + if (it.length <= 12) { + onSsnChanged(it) + ssnInput = it + } }, errorText = errorMessage, + visualTransformation = PersonalNumberVisualTransformation(mask, maskColor), keyboardOptions = KeyboardOptions( keyboardType = KeyboardType.Number, imeAction = ImeAction.Done, @@ -226,6 +237,45 @@ private fun FetchFromSsnFields( } } +private class PersonalNumberVisualTransformation( + private val mask: String, + private val maskColor: Color, +) : VisualTransformation { + override fun filter(text: AnnotatedString): TransformedText { + val trimmed = if (text.text.length >= 12) text.text.substring(0..11) else text.text + + val annotatedString = buildAnnotatedString { + for (i in trimmed.indices) { + append(trimmed[i]) + if (i == 7) { + append("-") + } + } + withStyle(SpanStyle(color = maskColor)) { + append(mask.takeLast(mask.length - length)) + } + } + + val personalNumberOffsetTranslator = object : OffsetMapping { + override fun originalToTransformed(offset: Int): Int { + return when { + offset < 8 -> offset + offset <= 12 -> offset + 1 + else -> 13 + } + } + + override fun transformedToOriginal(offset: Int): Int { + return when { + offset <= 8 -> offset + else -> offset - 1 + }.coerceAtMost(text.length) + } + } + return TransformedText(annotatedString, personalNumberOffsetTranslator) + } +} + @Composable private fun ManualInputFields( birthDate: LocalDate?, diff --git a/app/feature/feature-edit-coinsured/src/main/kotlin/com/hedvig/android/feature/editcoinsured/ui/EditCoInsuredPresenter.kt b/app/feature/feature-edit-coinsured/src/main/kotlin/com/hedvig/android/feature/editcoinsured/ui/EditCoInsuredPresenter.kt index e927c5f8d6..7921344fe1 100644 --- a/app/feature/feature-edit-coinsured/src/main/kotlin/com/hedvig/android/feature/editcoinsured/ui/EditCoInsuredPresenter.kt +++ b/app/feature/feature-edit-coinsured/src/main/kotlin/com/hedvig/android/feature/editcoinsured/ui/EditCoInsuredPresenter.kt @@ -117,12 +117,14 @@ internal class EditCoInsuredPresenter( } is EditCoInsuredEvent.OnSsnChanged -> - addBottomSheetState = addBottomSheetState.copy( - ssn = event.ssn, - errorMessage = null, - firstName = null, - lastName = null, - ) + if (event.ssn.length <= 12) { + addBottomSheetState = addBottomSheetState.copy( + ssn = event.ssn, + errorMessage = null, + firstName = null, + lastName = null, + ) + } is EditCoInsuredEvent.OnBirthDateChanged -> addBottomSheetState = @@ -406,7 +408,7 @@ internal sealed interface EditCoInsuredState { fun canPickExistingCoInsured() = !selectableCoInsured.isNullOrEmpty() fun canContinue() = (showManualInput && firstName != null && lastName != null && birthDate != null) || - (!showManualInput && ssn != null) || + (!showManualInput && ssn?.length == 12) || (selectedCoInsured != null) fun shouldFetchInfo() = !showManualInput && ssn != null && firstName == null && lastName == null diff --git a/app/feature/feature-help-center/feature-help-center-data/build.gradle.kts b/app/feature/feature-help-center/feature-help-center-data/build.gradle.kts new file mode 100644 index 0000000000..243da5cd0c --- /dev/null +++ b/app/feature/feature-help-center/feature-help-center-data/build.gradle.kts @@ -0,0 +1,37 @@ +plugins { + id("hedvig.android.ktlint") + id("hedvig.android.library") + alias(libs.plugins.apollo) + alias(libs.plugins.serialization) + alias(libs.plugins.squareSortDependencies) +} + +dependencies { + apolloMetadata(projects.apolloOctopusPublic) + + implementation(libs.androidx.annotation) + implementation(libs.apollo.normalizedCache) + implementation(libs.apollo.runtime) + implementation(libs.arrow.core) + implementation(libs.coroutines.core) + implementation(libs.koin.core) + implementation(libs.kotlinx.immutable.collections) + implementation(libs.kotlinx.serialization.core) + implementation(projects.apolloCore) + implementation(projects.apolloOctopusPublic) + implementation(projects.coreCommonPublic) + implementation(projects.coreResources) + implementation(projects.featureFlagsPublic) + implementation(projects.moleculePublic) + implementation(projects.uiEmergency) + implementation(projects.dataTravelCertificatePublic) + implementation(projects.dataTermination) +} + +apollo { + service("octopus") { + packageName.set("octopus") + generateDataBuilders.set(true) + } +} + diff --git a/app/feature/feature-help-center/src/main/AndroidManifest.xml b/app/feature/feature-help-center/feature-help-center-data/src/main/AndroidManifest.xml similarity index 100% rename from app/feature/feature-help-center/src/main/AndroidManifest.xml rename to app/feature/feature-help-center/feature-help-center-data/src/main/AndroidManifest.xml diff --git a/app/feature/feature-help-center/src/main/graphql/QueryAvailableSelfServiceOnContracts.graphql b/app/feature/feature-help-center/feature-help-center-data/src/main/graphql/QueryAvailableSelfServiceOnContracts.graphql similarity index 100% rename from app/feature/feature-help-center/src/main/graphql/QueryAvailableSelfServiceOnContracts.graphql rename to app/feature/feature-help-center/feature-help-center-data/src/main/graphql/QueryAvailableSelfServiceOnContracts.graphql diff --git a/app/feature/feature-help-center/src/main/graphql/QueryCommonClaims.graphql b/app/feature/feature-help-center/feature-help-center-data/src/main/graphql/QueryCommonClaims.graphql similarity index 100% rename from app/feature/feature-help-center/src/main/graphql/QueryCommonClaims.graphql rename to app/feature/feature-help-center/feature-help-center-data/src/main/graphql/QueryCommonClaims.graphql diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterPresenter.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterPresenter.kt similarity index 96% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterPresenter.kt rename to app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterPresenter.kt index 9919e5afb6..01f2d25ce2 100644 --- a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterPresenter.kt +++ b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterPresenter.kt @@ -19,13 +19,13 @@ import com.hedvig.android.molecule.public.MoleculePresenterScope import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf -internal sealed interface HelpCenterEvent { +sealed interface HelpCenterEvent { data class OnQuickActionSelected(val quickAction: QuickAction) : HelpCenterEvent data object OnDismissQuickActionDialog : HelpCenterEvent } -internal data class HelpCenterUiState( +data class HelpCenterUiState( val topics: ImmutableList, val questions: ImmutableList, val quickLinks: ImmutableList, @@ -38,7 +38,7 @@ internal data class HelpCenterUiState( } } -internal class HelpCenterPresenter( +class HelpCenterPresenter( private val getCommonClaimsUseCase: GetCommonClaimsUseCase, private val getQuickLinksUseCase: GetQuickLinksUseCase, ) : MoleculePresenter { diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimsData.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimsData.kt similarity index 98% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimsData.kt rename to app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimsData.kt index 2f4d287d05..4dac420204 100644 --- a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimsData.kt +++ b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimsData.kt @@ -4,7 +4,7 @@ import hedvig.resources.R import kotlinx.serialization.Serializable import octopus.CommonClaimsQuery -internal sealed interface CommonClaim { +sealed interface CommonClaim { val title: String val hintTextRes: Int? diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetCommonClaimsUseCase.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetCommonClaimsUseCase.kt similarity index 98% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetCommonClaimsUseCase.kt rename to app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetCommonClaimsUseCase.kt index 946c561391..2f1ac3c8ca 100644 --- a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetCommonClaimsUseCase.kt +++ b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetCommonClaimsUseCase.kt @@ -16,7 +16,7 @@ import octopus.CommonClaimsQuery import octopus.CommonClaimsQuery.Data.CurrentMember.ActiveContract.CurrentAgreement.ProductVariant.CommonClaimDescription.Layout.Companion.asCommonClaimLayoutEmergency import octopus.CommonClaimsQuery.Data.CurrentMember.ActiveContract.CurrentAgreement.ProductVariant.CommonClaimDescription.Layout.Companion.asCommonClaimLayoutTitleAndBulletPoints -internal class GetCommonClaimsUseCase( +class GetCommonClaimsUseCase( private val apolloClient: ApolloClient, ) { suspend fun invoke(): Either> = either { diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetQuickLinksUseCase.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetQuickLinksUseCase.kt similarity index 99% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetQuickLinksUseCase.kt rename to app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetQuickLinksUseCase.kt index ea6d1bb3b5..38dfb81bc2 100644 --- a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetQuickLinksUseCase.kt +++ b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/data/GetQuickLinksUseCase.kt @@ -19,7 +19,7 @@ import kotlinx.collections.immutable.toPersistentList import kotlinx.coroutines.flow.first import octopus.AvailableSelfServiceOnContractsQuery -internal class GetQuickLinksUseCase( +class GetQuickLinksUseCase( private val apolloClient: ApolloClient, private val featureManager: FeatureManager, private val checkTravelCertificateDestinationAvailabilityUseCase: diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterModule.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterModule.kt similarity index 68% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterModule.kt rename to app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterModule.kt index 14436e59b5..8b9f0701a8 100644 --- a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterModule.kt +++ b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterModule.kt @@ -2,13 +2,11 @@ package com.hedvig.android.feature.help.center.di import com.hedvig.android.data.termination.data.GetTerminatableContractsUseCase import com.hedvig.android.data.travelcertificate.CheckTravelCertificateDestinationAvailabilityUseCase -import com.hedvig.android.feature.help.center.HelpCenterViewModel import com.hedvig.android.feature.help.center.data.GetCommonClaimsUseCase import com.hedvig.android.feature.help.center.data.GetQuickLinksUseCase -import org.koin.androidx.viewmodel.dsl.viewModel import org.koin.dsl.module -val helpCenterModule = module { +val helpCenterDataModule = module { single { GetCommonClaimsUseCase(get()) } @@ -20,10 +18,4 @@ val helpCenterModule = module { get(), ) } - viewModel { - HelpCenterViewModel( - getCommonClaimsUseCase = get(), - getQuickLinksUseCase = get(), - ) - } } diff --git a/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/HelpCenterContext.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/HelpCenterContext.kt new file mode 100644 index 0000000000..06dbacf695 --- /dev/null +++ b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/HelpCenterContext.kt @@ -0,0 +1,9 @@ +package com.hedvig.android.feature.help.center.model + +enum class HelpCenterContext { + PAYMENT, + CLAIMS, + COVERAGE, + INSURANCE, + OTHER, +} diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/model/Question.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/Question.kt similarity index 71% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/model/Question.kt rename to app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/Question.kt index a53263ce39..a2c95ef9db 100644 --- a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/model/Question.kt +++ b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/Question.kt @@ -1,15 +1,14 @@ package com.hedvig.android.feature.help.center.model import androidx.annotation.StringRes -import com.hedvig.android.navigation.core.AppDestination import hedvig.resources.R import kotlinx.collections.immutable.persistentListOf -internal enum class Question( +enum class Question( @StringRes val titleRes: Int, @StringRes val questionRes: Int, @StringRes val answerRes: Int, - val chatContext: AppDestination.Chat.ChatContext, + val helpCenterContext: HelpCenterContext, val relatedQuestionIds: List = persistentListOf(), ) { // CLAIMS @@ -17,73 +16,73 @@ internal enum class Question( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_01, R.string.HC_CLAIMS_A_01, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q2( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_02, R.string.HC_CLAIMS_A_02, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q3( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_03, R.string.HC_CLAIMS_A_03, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q4( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_04, R.string.HC_CLAIMS_A_04, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q5( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_05, R.string.HC_CLAIMS_A_05, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q6( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_06, R.string.HC_CLAIMS_A_06, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q7( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_07, R.string.HC_CLAIMS_A_07, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q8( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_08, R.string.HC_CLAIMS_A_08, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q9( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_09, R.string.HC_CLAIMS_A_09, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q10( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_10, R.string.HC_CLAIMS_A_10, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q11( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_11, R.string.HC_CLAIMS_A_11, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), CLAIMS_Q12( R.string.HC_CLAIMS_TITLE, R.string.HC_CLAIMS_Q_12, R.string.HC_CLAIMS_A_12, - AppDestination.Chat.ChatContext.CLAIMS, + HelpCenterContext.CLAIMS, ), // COVERAGE @@ -91,127 +90,127 @@ internal enum class Question( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_01, R.string.HC_COVERAGE_A_01, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q2( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_02, R.string.HC_COVERAGE_A_02, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q3( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_03, R.string.HC_COVERAGE_A_03, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q4( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_04, R.string.HC_COVERAGE_A_04, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q5( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_05, R.string.HC_COVERAGE_A_05, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q6( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_06, R.string.HC_COVERAGE_A_06, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q7( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_07, R.string.HC_COVERAGE_A_07, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q8( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_08, R.string.HC_COVERAGE_A_08, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q9( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_09, R.string.HC_COVERAGE_A_09, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q10( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_10, R.string.HC_COVERAGE_A_10, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q11( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_11, R.string.HC_COVERAGE_A_11, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q12( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_12, R.string.HC_COVERAGE_A_12, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q13( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_13, R.string.HC_COVERAGE_A_13, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q14( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_14, R.string.HC_COVERAGE_A_14, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q15( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_15, R.string.HC_COVERAGE_A_15, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q17( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_17, R.string.HC_COVERAGE_A_17, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q18( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_18, R.string.HC_COVERAGE_A_18, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q19( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_19, R.string.HC_COVERAGE_A_19, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q20( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_20, R.string.HC_COVERAGE_A_20, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q21( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_21, R.string.HC_COVERAGE_A_21, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), COVERAGE_Q22( R.string.HC_COVERAGE_TITLE, R.string.HC_COVERAGE_Q_22, R.string.HC_COVERAGE_A_22, - AppDestination.Chat.ChatContext.COVERAGE, + HelpCenterContext.COVERAGE, ), // INSURANCE @@ -219,61 +218,61 @@ internal enum class Question( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_01, R.string.HC_INSURANCE_A_01, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q2( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_02, R.string.HC_INSURANCE_A_02, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q3( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_03, R.string.HC_INSURANCE_A_03, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q4( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_04, R.string.HC_INSURANCE_A_04, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q5( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_05, R.string.HC_INSURANCE_A_05, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q6( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_06, R.string.HC_INSURANCE_A_06, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q7( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_07, R.string.HC_INSURANCE_A_07, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q8( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_08, R.string.HC_INSURANCE_A_08, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q9( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_09, R.string.HC_INSURANCE_A_09, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), INSURANCE_Q10( R.string.HC_INSURANCES_TITLE, R.string.HC_INSURANCE_Q_10, R.string.HC_INSURANCE_A_10, - AppDestination.Chat.ChatContext.INSURANCE, + HelpCenterContext.INSURANCE, ), // OTHER @@ -281,25 +280,25 @@ internal enum class Question( R.string.HC_INSURANCES_TITLE, R.string.HC_OTHER_Q_01, R.string.HC_OTHER_A_01, - AppDestination.Chat.ChatContext.OTHER, + HelpCenterContext.OTHER, ), OTHER_Q2( R.string.HC_INSURANCES_TITLE, R.string.HC_OTHER_Q_02, R.string.HC_OTHER_A_02, - AppDestination.Chat.ChatContext.OTHER, + HelpCenterContext.OTHER, ), OTHER_Q3( R.string.HC_INSURANCES_TITLE, R.string.HC_OTHER_Q_03, R.string.HC_OTHER_A_03, - AppDestination.Chat.ChatContext.OTHER, + HelpCenterContext.OTHER, ), OTHER_Q4( R.string.HC_INSURANCES_TITLE, R.string.HC_OTHER_Q_04, R.string.HC_OTHER_A_04, - AppDestination.Chat.ChatContext.OTHER, + HelpCenterContext.OTHER, ), // PAYMENTS @@ -307,89 +306,89 @@ internal enum class Question( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_01, R.string.HC_PAYMENTS_A_01, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q2( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_02, R.string.HC_PAYMENTS_A_02, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q3( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_03, R.string.HC_PAYMENTS_A_03, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q4( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_04, R.string.HC_PAYMENTS_A_04, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q5( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_05, R.string.HC_PAYMENTS_A_05, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q6( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_06, R.string.HC_PAYMENTS_A_06, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q7( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_07, R.string.HC_PAYMENTS_A_07, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q8( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_08, R.string.HC_PAYMENTS_A_08, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q9( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_09, R.string.HC_PAYMENTS_A_09, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q10( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_10, R.string.HC_PAYMENTS_A_10, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q11( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_11, R.string.HC_PAYMENTS_A_11, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q12( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_12, R.string.HC_PAYMENTS_A_12, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q13( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_13, R.string.HC_PAYMENTS_A_13, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), PAYMENTS_Q14( R.string.HC_PAYMENTS_TITLE, R.string.HC_PAYMENTS_Q_14, R.string.HC_PAYMENTS_A_14, - AppDestination.Chat.ChatContext.PAYMENT, + HelpCenterContext.PAYMENT, ), } -internal val commonQuestions = persistentListOf( +val commonQuestions = persistentListOf( Question.CLAIMS_Q1, Question.INSURANCE_Q5, Question.PAYMENTS_Q1, diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/model/QuickLink.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/QuickLink.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/model/QuickLink.kt rename to app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/QuickLink.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/model/Topic.kt b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/Topic.kt similarity index 85% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/model/Topic.kt rename to app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/Topic.kt index a01afa31f3..0ce869901d 100644 --- a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/model/Topic.kt +++ b/app/feature/feature-help-center/feature-help-center-data/src/main/kotlin/com/hedvig/android/feature/help/center/model/Topic.kt @@ -1,15 +1,14 @@ package com.hedvig.android.feature.help.center.model import androidx.annotation.StringRes -import com.hedvig.android.navigation.core.AppDestination import hedvig.resources.R import kotlinx.collections.immutable.persistentListOf -internal enum class Topic( +enum class Topic( @StringRes val titleRes: Int, val commonQuestionIds: List, val allQuestionIds: List, - val chatContext: AppDestination.Chat.ChatContext, + val helpCenterContext: HelpCenterContext, ) { PAYMENTS( titleRes = R.string.HC_PAYMENTS_TITLE, @@ -30,7 +29,7 @@ internal enum class Topic( Question.PAYMENTS_Q13, Question.PAYMENTS_Q14, ), - chatContext = AppDestination.Chat.ChatContext.PAYMENT, + helpCenterContext = HelpCenterContext.PAYMENT, ), CLAIMS( titleRes = R.string.HC_CLAIMS_TITLE, @@ -49,7 +48,7 @@ internal enum class Topic( Question.CLAIMS_Q11, Question.CLAIMS_Q12, ), - chatContext = AppDestination.Chat.ChatContext.CLAIMS, + helpCenterContext = HelpCenterContext.CLAIMS, ), INSURANCE( titleRes = R.string.HC_INSURANCES_TITLE, @@ -66,7 +65,7 @@ internal enum class Topic( Question.INSURANCE_Q9, Question.INSURANCE_Q10, ), - chatContext = AppDestination.Chat.ChatContext.INSURANCE, + helpCenterContext = HelpCenterContext.INSURANCE, ), COVERAGE( titleRes = R.string.HC_COVERAGE_TITLE, @@ -94,7 +93,7 @@ internal enum class Topic( Question.COVERAGE_Q21, Question.COVERAGE_Q22, ), - chatContext = AppDestination.Chat.ChatContext.COVERAGE, + helpCenterContext = HelpCenterContext.COVERAGE, ), OTHER( titleRes = R.string.HC_ALL_QUESTION_TITLE, @@ -105,11 +104,11 @@ internal enum class Topic( Question.OTHER_Q3, Question.OTHER_Q4, ), - chatContext = AppDestination.Chat.ChatContext.OTHER, + helpCenterContext = HelpCenterContext.OTHER, ), } -internal val commonTopics = persistentListOf( +val commonTopics = persistentListOf( Topic.PAYMENTS, Topic.CLAIMS, Topic.INSURANCE, diff --git a/app/feature/feature-help-center/build.gradle.kts b/app/feature/feature-help-center/feature-help-center-ui/build.gradle.kts similarity index 66% rename from app/feature/feature-help-center/build.gradle.kts rename to app/feature/feature-help-center/feature-help-center-ui/build.gradle.kts index 50709b296e..57a28625ac 100644 --- a/app/feature/feature-help-center/build.gradle.kts +++ b/app/feature/feature-help-center/feature-help-center-ui/build.gradle.kts @@ -3,52 +3,34 @@ plugins { id("hedvig.android.ktlint") id("hedvig.android.library") id("hedvig.android.library.compose") - alias(libs.plugins.apollo) alias(libs.plugins.serialization) alias(libs.plugins.squareSortDependencies) } dependencies { - apolloMetadata(projects.apolloOctopusPublic) - implementation(libs.androidx.compose.material3) implementation(libs.androidx.lifecycle.compose) - implementation(libs.apollo.normalizedCache) - implementation(libs.apollo.runtime) - implementation(libs.arrow.core) - implementation(libs.coil.coil) - implementation(libs.coil.compose) + implementation(libs.androidx.lifecycle.viewmodelCompose) implementation(libs.compose.richtext) implementation(libs.compose.richtextUi) implementation(libs.coroutines.android) implementation(libs.coroutines.core) + implementation(libs.koin.android) implementation(libs.koin.compose) implementation(libs.koin.core) implementation(libs.kotlinx.immutable.collections) implementation(libs.kotlinx.serialization.core) implementation(projects.apolloCore) implementation(projects.apolloOctopusPublic) - implementation(projects.coreBuildConstants) - implementation(projects.coreCommonPublic) implementation(projects.coreDesignSystem) implementation(projects.coreIcons) implementation(projects.coreResources) implementation(projects.coreUi) - implementation(projects.dataContractPublic) - implementation(projects.featureFlagsPublic) + implementation(projects.featureHelpCenterData) implementation(projects.moleculeAndroid) implementation(projects.moleculePublic) implementation(projects.navigationComposeTyped) implementation(projects.navigationCore) implementation(projects.uiEmergency) implementation(projects.dataTravelCertificatePublic) - implementation(projects.dataTermination) -} - -apollo { - service("octopus") { - packageName.set("octopus") - generateDataBuilders.set(true) - } } - diff --git a/app/feature/feature-help-center/feature-help-center-ui/src/main/AndroidManifest.xml b/app/feature/feature-help-center/feature-help-center-ui/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..568741e54f --- /dev/null +++ b/app/feature/feature-help-center/feature-help-center-ui/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterGraph.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterGraph.kt similarity index 87% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterGraph.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterGraph.kt index ac3674fb15..284d8b160a 100644 --- a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterGraph.kt +++ b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterGraph.kt @@ -10,6 +10,7 @@ import com.hedvig.android.feature.help.center.commonclaim.CommonClaimDestination import com.hedvig.android.feature.help.center.commonclaim.emergency.EmergencyDestination import com.hedvig.android.feature.help.center.data.QuickLinkDestination import com.hedvig.android.feature.help.center.home.HelpCenterHomeDestination +import com.hedvig.android.feature.help.center.model.HelpCenterContext import com.hedvig.android.feature.help.center.model.Question import com.hedvig.android.feature.help.center.model.Topic import com.hedvig.android.feature.help.center.navigation.HelpCenterDestination @@ -78,7 +79,7 @@ fun NavGraphBuilder.helpCenterGraph( onNavigateUp = navigator::navigateUp, onNavigateBack = navigator::popBackStack, openChat = { - openChat(backStackEntry, topic.chatContext) + openChat(backStackEntry, topic.helpCenterContext.toChatContext()) }, ) } @@ -92,7 +93,7 @@ fun NavGraphBuilder.helpCenterGraph( onNavigateUp = navigator::navigateUp, onNavigateBack = navigator::popBackStack, openChat = { - openChat(backStackEntry, question.chatContext) + openChat(backStackEntry, question.helpCenterContext.toChatContext()) }, ) } @@ -112,6 +113,17 @@ fun NavGraphBuilder.helpCenterGraph( } } +private fun HelpCenterContext?.toChatContext(): AppDestination.Chat.ChatContext? { + return when(this) { + HelpCenterContext.PAYMENT -> AppDestination.Chat.ChatContext.PAYMENT + HelpCenterContext.CLAIMS -> AppDestination.Chat.ChatContext.CLAIMS + HelpCenterContext.COVERAGE -> AppDestination.Chat.ChatContext.COVERAGE + HelpCenterContext.INSURANCE -> AppDestination.Chat.ChatContext.INSURANCE + HelpCenterContext.OTHER -> AppDestination.Chat.ChatContext.OTHER + null -> null + } +} + private fun navigateToTopic( resources: Resources, topic: Topic, diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterViewModel.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterViewModel.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterViewModel.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/HelpCenterViewModel.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimDestination.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimDestination.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimDestination.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/CommonClaimDestination.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/emergency/EmergencyDestination.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/emergency/EmergencyDestination.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/emergency/EmergencyDestination.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/commonclaim/emergency/EmergencyDestination.kt diff --git a/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterUiModule.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterUiModule.kt new file mode 100644 index 0000000000..8ac1ff3be1 --- /dev/null +++ b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/di/HelpCenterUiModule.kt @@ -0,0 +1,16 @@ +package com.hedvig.android.feature.help.center.di + +import com.hedvig.android.feature.help.center.HelpCenterViewModel +import com.hedvig.android.feature.help.center.data.GetCommonClaimsUseCase +import com.hedvig.android.feature.help.center.data.GetQuickLinksUseCase +import org.koin.androidx.viewmodel.dsl.viewModel +import org.koin.dsl.module + +val helpCenterUiModule = module { + viewModel { + HelpCenterViewModel( + getCommonClaimsUseCase = get(), + getQuickLinksUseCase = get(), + ) + } +} diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/home/HelpCenterHomeDestination.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/home/HelpCenterHomeDestination.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/home/HelpCenterHomeDestination.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/home/HelpCenterHomeDestination.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/navigation/HelpCenterDestination.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/navigation/HelpCenterDestination.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/navigation/HelpCenterDestination.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/navigation/HelpCenterDestination.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/question/HelpCenterQuestionDestination.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/question/HelpCenterQuestionDestination.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/question/HelpCenterQuestionDestination.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/question/HelpCenterQuestionDestination.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/topic/HelpCenterTopicDestination.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/topic/HelpCenterTopicDestination.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/topic/HelpCenterTopicDestination.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/topic/HelpCenterTopicDestination.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/ui/HelpCenterSection.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/ui/HelpCenterSection.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/ui/HelpCenterSection.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/ui/HelpCenterSection.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/ui/HelpCenterSectionWithClickableRows.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/ui/HelpCenterSectionWithClickableRows.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/ui/HelpCenterSectionWithClickableRows.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/ui/HelpCenterSectionWithClickableRows.kt diff --git a/app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/ui/StillNeedHelpSection.kt b/app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/ui/StillNeedHelpSection.kt similarity index 100% rename from app/feature/feature-help-center/src/main/kotlin/com/hedvig/android/feature/help/center/ui/StillNeedHelpSection.kt rename to app/feature/feature-help-center/feature-help-center-ui/src/main/kotlin/com/hedvig/android/feature/help/center/ui/StillNeedHelpSection.kt diff --git a/app/feature/feature-odyssey/src/main/kotlin/com/hedvig/android/feature/odyssey/step/audiorecording/AudioRecordingViewModel.kt b/app/feature/feature-odyssey/src/main/kotlin/com/hedvig/android/feature/odyssey/step/audiorecording/AudioRecordingViewModel.kt index 132a935e43..c72055ba19 100644 --- a/app/feature/feature-odyssey/src/main/kotlin/com/hedvig/android/feature/odyssey/step/audiorecording/AudioRecordingViewModel.kt +++ b/app/feature/feature-odyssey/src/main/kotlin/com/hedvig/android/feature/odyssey/step/audiorecording/AudioRecordingViewModel.kt @@ -103,12 +103,12 @@ internal class AudioRecordingViewModel( if (recorder == null) { recorder = MediaRecorder().apply { setAudioSource(MediaRecorder.AudioSource.VOICE_RECOGNITION) - setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS) + setOutputFormat(MediaRecorder.OutputFormat.MPEG_4) setAudioSamplingRate(96_000) setAudioEncodingBitRate(128_000) val filePath = File.createTempFile( "claim_android_recording_${UUID.randomUUID()}", - ".aac", + ".mp4", ).absolutePath setOutputFile(filePath) setAudioEncoder(MediaRecorder.AudioEncoder.AAC) diff --git a/build-logic/convention/src/main/kotlin/FeatureConventionPlugin.kt b/build-logic/convention/src/main/kotlin/FeatureConventionPlugin.kt index 396f15efe6..d72c824487 100644 --- a/build-logic/convention/src/main/kotlin/FeatureConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/FeatureConventionPlugin.kt @@ -19,8 +19,20 @@ private fun Project.ensureNotDependingOnOtherFeatureModule() { eachDependency { if (requested.group != "hedvigandroid") return@eachDependency // Only check for our own modules if (requested.name == thisModuleName) return@eachDependency // Only check deps to other modules + // feature-foo-ui is allowed to depend on feature-foo-data + if (thisModuleName.withoutUiOrDataSuffix() == requested.name.withoutUiOrDataSuffix()) { + // Only allow -ui module to depend on the -data module, not vice versa + require(thisModuleName.endsWith("-ui")) { + "Hedvig build error on FeatureConventionPlugin." + + "\nDo not depend on a -ui feature module from a -data feature module." + "\nIn particular, ${thisModuleName} is trying to depend on ${requested.name}." + + "\nDid you mean to have the -ui module depend on the -data module instead?" + } + return@eachDependency + } val requestedModuleIsAFeatureModule = - requested.name.startsWith("feature-") && !requested.name.startsWith("feature-flags") + requested.name.startsWith("feature-") && + !requested.name.startsWith("feature-flags") require(!requestedModuleIsAFeatureModule) { "Hedvig build error on FeatureConventionPlugin." + "\nYou are trying to depend on another feature module from a feature module." + @@ -32,3 +44,5 @@ private fun Project.ensureNotDependingOnOtherFeatureModule() { } } } + +private fun String.withoutUiOrDataSuffix(): String = this.removeSuffix("-ui").removeSuffix("-data") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1c64e4fe3d..511a246260 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -62,7 +62,7 @@ kotlinxDatetime = "0.5.0" kotlinxImmutableCollections = "0.3.7" leakCanary = "2.13" moneta = "1.4.4" -navigationRecentsUrlSharing = "0.0.1" +navigationRecentsUrlSharing = "0.0.2" okhttp = "4.12.0" okio = "3.9.0" playReview = "2.0.1" diff --git a/hedvig-lint/lint-baseline/lint-baseline-feature-help-center-data.xml b/hedvig-lint/lint-baseline/lint-baseline-feature-help-center-data.xml new file mode 100644 index 0000000000..fb7b14703c --- /dev/null +++ b/hedvig-lint/lint-baseline/lint-baseline-feature-help-center-data.xml @@ -0,0 +1,4 @@ + + + + diff --git a/hedvig-lint/lint-baseline/lint-baseline-feature-help-center-ui.xml b/hedvig-lint/lint-baseline/lint-baseline-feature-help-center-ui.xml new file mode 100644 index 0000000000..fb7b14703c --- /dev/null +++ b/hedvig-lint/lint-baseline/lint-baseline-feature-help-center-ui.xml @@ -0,0 +1,4 @@ + + + + diff --git a/hedvig-lint/lint-baseline/lint-baseline-feature-help-center.xml b/hedvig-lint/lint-baseline/lint-baseline-feature-help-center.xml deleted file mode 100644 index ddc2d3f41c..0000000000 --- a/hedvig-lint/lint-baseline/lint-baseline-feature-help-center.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/misc/images/modularization-graph.png b/misc/images/modularization-graph.png index 8c9b57e1ec..73f9d6e6cc 100644 Binary files a/misc/images/modularization-graph.png and b/misc/images/modularization-graph.png differ