String screen_onboarding_welcome_message now needs the application name.
This commit is contained in:
parent
4916baadd8
commit
97e1c5e674
5 changed files with 8 additions and 2 deletions
|
|
@ -33,6 +33,7 @@ class OnBoardingPresenter @Inject constructor(
|
||||||
override fun present(): OnBoardingState {
|
override fun present(): OnBoardingState {
|
||||||
return OnBoardingState(
|
return OnBoardingState(
|
||||||
isDebugBuild = buildMeta.buildType != BuildType.RELEASE,
|
isDebugBuild = buildMeta.buildType != BuildType.RELEASE,
|
||||||
|
applicationName = buildMeta.applicationName,
|
||||||
canLoginWithQrCode = OnBoardingConfig.CAN_LOGIN_WITH_QR_CODE,
|
canLoginWithQrCode = OnBoardingConfig.CAN_LOGIN_WITH_QR_CODE,
|
||||||
canCreateAccount = OnBoardingConfig.CAN_CREATE_ACCOUNT,
|
canCreateAccount = OnBoardingConfig.CAN_CREATE_ACCOUNT,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package io.element.android.features.onboarding.impl
|
||||||
|
|
||||||
data class OnBoardingState(
|
data class OnBoardingState(
|
||||||
val isDebugBuild: Boolean,
|
val isDebugBuild: Boolean,
|
||||||
|
val applicationName: String,
|
||||||
val canLoginWithQrCode: Boolean,
|
val canLoginWithQrCode: Boolean,
|
||||||
val canCreateAccount: Boolean,
|
val canCreateAccount: Boolean,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,12 @@ open class OnBoardingStateProvider : PreviewParameterProvider<OnBoardingState> {
|
||||||
|
|
||||||
fun anOnBoardingState(
|
fun anOnBoardingState(
|
||||||
isDebugBuild: Boolean = false,
|
isDebugBuild: Boolean = false,
|
||||||
|
applicationName: String = "Element",
|
||||||
canLoginWithQrCode: Boolean = false,
|
canLoginWithQrCode: Boolean = false,
|
||||||
canCreateAccount: Boolean = false
|
canCreateAccount: Boolean = false
|
||||||
) = OnBoardingState(
|
) = OnBoardingState(
|
||||||
isDebugBuild = isDebugBuild,
|
isDebugBuild = isDebugBuild,
|
||||||
|
applicationName = applicationName,
|
||||||
canLoginWithQrCode = canLoginWithQrCode,
|
canLoginWithQrCode = canLoginWithQrCode,
|
||||||
canCreateAccount = canCreateAccount
|
canCreateAccount = canCreateAccount
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ private fun OnBoardingContent(
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
Text(
|
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,
|
color = ElementTheme.materialColors.secondary,
|
||||||
style = ElementTheme.typography.fontBodyLgRegular.copy(fontSize = 17.sp),
|
style = ElementTheme.typography.fontBodyLgRegular.copy(fontSize = 17.sp),
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,14 @@ class OnBoardingPresenterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial state`() = runTest {
|
fun `present - initial state`() = runTest {
|
||||||
val presenter = OnBoardingPresenter(aBuildMeta())
|
val appName = "Name"
|
||||||
|
val presenter = OnBoardingPresenter(aBuildMeta(applicationName = appName))
|
||||||
moleculeFlow(RecompositionMode.Immediate) {
|
moleculeFlow(RecompositionMode.Immediate) {
|
||||||
presenter.present()
|
presenter.present()
|
||||||
}.test {
|
}.test {
|
||||||
val initialState = awaitItem()
|
val initialState = awaitItem()
|
||||||
assertThat(initialState.isDebugBuild).isTrue()
|
assertThat(initialState.isDebugBuild).isTrue()
|
||||||
|
assertThat(initialState.applicationName).isEqualTo(appName)
|
||||||
assertThat(initialState.canLoginWithQrCode).isFalse()
|
assertThat(initialState.canLoginWithQrCode).isFalse()
|
||||||
assertThat(initialState.canCreateAccount).isFalse()
|
assertThat(initialState.canCreateAccount).isFalse()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue