Rename classes (not a State)

This commit is contained in:
Benoit Marty 2023-02-09 18:21:25 +01:00
parent ce0ed5226d
commit e03ef8c338
3 changed files with 12 additions and 12 deletions

View file

@ -59,8 +59,8 @@ fun OnBoardingScreen(
onSignUp: () -> Unit = {}, onSignUp: () -> Unit = {},
onSignIn: () -> Unit = {}, onSignIn: () -> Unit = {},
) { ) {
val carrouselState = remember { SplashCarouselStateFactory().create() } val carrouselData = remember { SplashCarouselDataFactory().create() }
val nbOfPages = carrouselState.items.size val nbOfPages = carrouselData.items.size
var key by remember { mutableStateOf(false) } var key by remember { mutableStateOf(false) }
Box( Box(
modifier = modifier modifier = modifier
@ -92,7 +92,7 @@ fun OnBoardingScreen(
state = pagerState, state = pagerState,
) { page -> ) { page ->
// Our page content // Our page content
OnBoardingPage(carrouselState.items[page]) OnBoardingPage(carrouselData.items[page])
} }
HorizontalPagerIndicator( HorizontalPagerIndicator(
pagerState = pagerState, pagerState = pagerState,
@ -118,7 +118,7 @@ fun OnBoardingScreen(
@Composable @Composable
fun OnBoardingPage( fun OnBoardingPage(
item: SplashCarouselState.Item, item: SplashCarouselData.Item,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
) { ) {
Box( Box(

View file

@ -19,7 +19,7 @@ package io.element.android.features.onboarding
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import androidx.annotation.StringRes import androidx.annotation.StringRes
data class SplashCarouselState( data class SplashCarouselData(
val items: List<Item> val items: List<Item>
) { ) {
data class Item( data class Item(

View file

@ -19,8 +19,8 @@ package io.element.android.features.onboarding
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import io.element.android.libraries.ui.strings.R as StringR import io.element.android.libraries.ui.strings.R as StringR
class SplashCarouselStateFactory { class SplashCarouselDataFactory {
fun create(): SplashCarouselState { fun create(): SplashCarouselData {
val lightTheme = true val lightTheme = true
fun background(@DrawableRes lightDrawable: Int) = fun background(@DrawableRes lightDrawable: Int) =
@ -29,9 +29,9 @@ class SplashCarouselStateFactory {
fun hero(@DrawableRes lightDrawable: Int, @DrawableRes darkDrawable: Int) = fun hero(@DrawableRes lightDrawable: Int, @DrawableRes darkDrawable: Int) =
if (lightTheme) lightDrawable else darkDrawable if (lightTheme) lightDrawable else darkDrawable
return SplashCarouselState( return SplashCarouselData(
listOf( listOf(
SplashCarouselState.Item( SplashCarouselData.Item(
StringR.string.ftue_auth_carousel_secure_title, StringR.string.ftue_auth_carousel_secure_title,
StringR.string.ftue_auth_carousel_secure_body, StringR.string.ftue_auth_carousel_secure_body,
hero( hero(
@ -40,19 +40,19 @@ class SplashCarouselStateFactory {
), ),
background(R.drawable.bg_carousel_page_1) background(R.drawable.bg_carousel_page_1)
), ),
SplashCarouselState.Item( SplashCarouselData.Item(
StringR.string.ftue_auth_carousel_control_title, StringR.string.ftue_auth_carousel_control_title,
StringR.string.ftue_auth_carousel_control_body, StringR.string.ftue_auth_carousel_control_body,
hero(R.drawable.ic_splash_control, R.drawable.ic_splash_control_dark), hero(R.drawable.ic_splash_control, R.drawable.ic_splash_control_dark),
background(R.drawable.bg_carousel_page_2) background(R.drawable.bg_carousel_page_2)
), ),
SplashCarouselState.Item( SplashCarouselData.Item(
StringR.string.ftue_auth_carousel_encrypted_title, StringR.string.ftue_auth_carousel_encrypted_title,
StringR.string.ftue_auth_carousel_encrypted_body, StringR.string.ftue_auth_carousel_encrypted_body,
hero(R.drawable.ic_splash_secure, R.drawable.ic_splash_secure_dark), hero(R.drawable.ic_splash_secure, R.drawable.ic_splash_secure_dark),
background(R.drawable.bg_carousel_page_3) background(R.drawable.bg_carousel_page_3)
), ),
SplashCarouselState.Item( SplashCarouselData.Item(
collaborationTitle(), collaborationTitle(),
StringR.string.ftue_auth_carousel_workplace_body, StringR.string.ftue_auth_carousel_workplace_body,
hero( hero(