String screen_onboarding_welcome_message now needs the application name.
This commit is contained in:
committed by
Benoit Marty
parent
4916baadd8
commit
97e1c5e674
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user