String screen_onboarding_welcome_message now needs the application name.

This commit is contained in:
Benoit Marty
2024-04-10 12:25:43 +02:00
committed by Benoit Marty
parent 4916baadd8
commit 97e1c5e674
5 changed files with 8 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ class OnBoardingPresenter @Inject constructor(
override fun present(): OnBoardingState {
return OnBoardingState(
isDebugBuild = buildMeta.buildType != BuildType.RELEASE,
applicationName = buildMeta.applicationName,
canLoginWithQrCode = OnBoardingConfig.CAN_LOGIN_WITH_QR_CODE,
canCreateAccount = OnBoardingConfig.CAN_CREATE_ACCOUNT,
)

View File

@@ -18,6 +18,7 @@ package io.element.android.features.onboarding.impl
data class OnBoardingState(
val isDebugBuild: Boolean,
val applicationName: String,
val canLoginWithQrCode: Boolean,
val canCreateAccount: Boolean,
)

View File

@@ -31,10 +31,12 @@ open class OnBoardingStateProvider : PreviewParameterProvider<OnBoardingState> {
fun anOnBoardingState(
isDebugBuild: Boolean = false,
applicationName: String = "Element",
canLoginWithQrCode: Boolean = false,
canCreateAccount: Boolean = false
) = OnBoardingState(
isDebugBuild = isDebugBuild,
applicationName = applicationName,
canLoginWithQrCode = canLoginWithQrCode,
canCreateAccount = canCreateAccount
)

View File

@@ -129,7 +129,7 @@ private fun OnBoardingContent(
)
Spacer(modifier = Modifier.height(8.dp))
Text(
text = stringResource(id = R.string.screen_onboarding_welcome_message),
text = stringResource(id = R.string.screen_onboarding_welcome_message, state.applicationName),
color = ElementTheme.materialColors.secondary,
style = ElementTheme.typography.fontBodyLgRegular.copy(fontSize = 17.sp),
textAlign = TextAlign.Center

View File

@@ -33,12 +33,14 @@ class OnBoardingPresenterTest {
@Test
fun `present - initial state`() = runTest {
val presenter = OnBoardingPresenter(aBuildMeta())
val appName = "Name"
val presenter = OnBoardingPresenter(aBuildMeta(applicationName = appName))
moleculeFlow(RecompositionMode.Immediate) {
presenter.present()
}.test {
val initialState = awaitItem()
assertThat(initialState.isDebugBuild).isTrue()
assertThat(initialState.applicationName).isEqualTo(appName)
assertThat(initialState.canLoginWithQrCode).isFalse()
assertThat(initialState.canCreateAccount).isFalse()
}