11package com.getcode.view.login
22
3- import androidx.compose.animation.AnimatedVisibility
4- import androidx.compose.animation.core.tween
5- import androidx.compose.animation.fadeIn
6- import androidx.compose.animation.fadeOut
73import androidx.compose.foundation.Image
8- import androidx.compose.foundation.background
94import androidx.compose.foundation.layout.Box
105import androidx.compose.foundation.layout.WindowInsets
116import androidx.compose.foundation.layout.fillMaxHeight
@@ -16,14 +11,11 @@ import androidx.compose.foundation.layout.padding
1611import androidx.compose.foundation.layout.windowInsetsPadding
1712import androidx.compose.foundation.text.ClickableText
1813import androidx.compose.runtime.Composable
19- import androidx.compose.runtime.DisposableEffect
2014import androidx.compose.runtime.LaunchedEffect
21- import androidx.compose.runtime.getValue
22- import androidx.compose.runtime.mutableStateOf
23- import androidx.compose.runtime.remember
24- import androidx.compose.runtime.rememberCoroutineScope
25- import androidx.compose.runtime.setValue
2615import androidx.compose.ui.Modifier
16+ import androidx.compose.ui.graphics.Color
17+ import androidx.compose.ui.graphics.ColorFilter
18+ import androidx.compose.ui.graphics.painter.ColorPainter
2719import androidx.compose.ui.layout.ContentScale
2820import androidx.compose.ui.platform.LocalContext
2921import androidx.compose.ui.platform.LocalFocusManager
@@ -36,20 +28,18 @@ import androidx.compose.ui.text.style.TextDecoration
3628import androidx.compose.ui.text.withStyle
3729import androidx.compose.ui.tooling.preview.Preview
3830import androidx.constraintlayout.compose.ConstraintLayout
39- import androidx.hilt.navigation.compose.hiltViewModel
4031import com.getcode.LocalAnalytics
4132import com.getcode.R
4233import com.getcode.navigation.core.LocalCodeNavigator
4334import com.getcode.navigation.screens.AccessKeyLoginScreen
4435import com.getcode.navigation.screens.LoginPhoneVerificationScreen
36+ import com.getcode.theme.Brand
4537import com.getcode.theme.BrandLight
4638import com.getcode.theme.CodeTheme
47- import com.getcode.util.AnimationUtils
4839import com.getcode.util.ChromeTabsUtils
4940import com.getcode.view.components.ButtonState
5041import com.getcode.view.components.CodeButton
51- import kotlinx.coroutines.delay
52- import kotlinx.coroutines.launch
42+ import com.getcode.view.components.ImageWithBackground
5343
5444
5545@Preview
@@ -58,45 +48,25 @@ fun LoginHome() {
5848 val context = LocalContext .current
5949 val navigator = LocalCodeNavigator .current
6050
61- var show by remember {
62- mutableStateOf(false )
63- }
6451 Box {
65-
66- AnimatedVisibility (
67- modifier = Modifier .fillMaxSize(),
68- visible = show,
69- enter = fadeIn(
70- animationSpec = tween(AnimationUtils .animationTime)
71- ),
72- exit = fadeOut(tween(AnimationUtils .animationTime))
73- ) {
74- Box (
75- Modifier
76- .fillMaxSize()
77- .background(CodeTheme .colors.background)
78- )
79- }
80-
8152 ConstraintLayout (
8253 modifier = Modifier
8354 .fillMaxSize()
8455 .windowInsetsPadding(WindowInsets .navigationBars),
8556 ) {
8657 val (bgImage, logo, buttonCreate, buttonLogin, toc) = createRefs()
8758
88- Image (
89- painterResource(R .drawable.ic_code_splash_bg),
90- " " ,
59+ ImageWithBackground (
9160 modifier = Modifier
9261 .constrainAs(bgImage) {
9362 start.linkTo(parent.start)
9463 end.linkTo(parent.end)
9564 top.linkTo(parent.top)
96- bottom.linkTo(parent.bottom)
9765 }
9866 .fillMaxSize(),
99- contentScale = ContentScale .Crop ,
67+ painter = ColorPainter (Brand ),
68+ backgroundDrawableResId = R .drawable.ic_code_splash_bg,
69+ contentDescription = null
10070 )
10171
10272 Image (
@@ -191,17 +161,9 @@ fun LoginHome() {
191161
192162 val focusManager = LocalFocusManager .current
193163 val analytics = LocalAnalytics .current
194- val scope = rememberCoroutineScope()
195- DisposableEffect (Unit ) {
164+ LaunchedEffect (Unit ) {
196165 focusManager.clearFocus()
197166 analytics.onAppStarted()
198- scope.launch {
199- delay(750 )
200- show = false
201- }
202167
203- onDispose { show = true }
204168 }
205-
206-
207169}
0 commit comments