Skip to content

Commit 792b447

Browse files
committed
chore(login): delay 2s to show checkmark; add additional padding above IME in register
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 723ac36 commit 792b447

4 files changed

Lines changed: 24 additions & 15 deletions

File tree

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/login/LoginHome.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ import com.getcode.ui.theme.ButtonState
3737
import com.getcode.ui.theme.CodeButton
3838
import com.getcode.ui.utils.noRippleClickable
3939
import xyz.flipchat.app.R
40+
import xyz.flipchat.app.features.chat.lookup.confirm.LoadingSuccessState
4041
import xyz.flipchat.app.util.ChromeTabsUtils
4142

4243
@Composable
4344
fun LoginHome(
4445
isSpectatorJoinEnabled: Boolean = false,
45-
isCreatingAccount: Boolean = false,
46+
isCreatingAccount: LoadingSuccessState = LoadingSuccessState(),
4647
betaFlagsVisible: Boolean = false,
4748
onLogoTapped: () -> Unit,
4849
openBetaFlags: () -> Unit,
@@ -87,7 +88,8 @@ fun LoginHome(
8788
.fillMaxWidth()
8889
.padding(horizontal = CodeTheme.dimens.inset),
8990
onClick = createAccount,
90-
isLoading = isCreatingAccount,
91+
isLoading = isCreatingAccount.loading,
92+
isSuccess = isCreatingAccount.success,
9193
text = if (isSpectatorJoinEnabled) {
9294
stringResource(R.string.action_getStarted)
9395
} else {

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/login/LoginScreen.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ import cafe.adriel.voyager.core.screen.uniqueScreenKey
1212
import cafe.adriel.voyager.hilt.getViewModel
1313
import com.getcode.navigation.NavScreenProvider
1414
import com.getcode.navigation.core.LocalCodeNavigator
15+
import kotlinx.coroutines.delay
1516
import kotlinx.coroutines.flow.filterIsInstance
1617
import kotlinx.coroutines.flow.launchIn
1718
import kotlinx.coroutines.flow.onEach
1819
import kotlinx.parcelize.IgnoredOnParcel
1920
import kotlinx.parcelize.Parcelize
21+
import kotlin.time.Duration.Companion.seconds
2022

2123
@Parcelize
2224
data class LoginScreen(val seed: String? = null) : Screen, Parcelable {
@@ -32,6 +34,7 @@ data class LoginScreen(val seed: String? = null) : Screen, Parcelable {
3234
LaunchedEffect(vm) {
3335
vm.eventFlow
3436
.filterIsInstance<LoginViewModel.Event.OnAccountCreated>()
37+
.onEach { delay(2.seconds) }
3538
.onEach { navigator.replaceAll(ScreenRegistry.get(NavScreenProvider.AppHomeScreen())) }
3639
.launchIn(this)
3740
}

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/login/LoginViewModel.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import kotlinx.coroutines.flow.onEach
1414
import xyz.flipchat.app.auth.AuthManager
1515
import xyz.flipchat.app.beta.BetaFlag
1616
import xyz.flipchat.app.beta.BetaFlags
17+
import xyz.flipchat.app.features.chat.lookup.confirm.LoadingSuccessState
1718
import xyz.flipchat.app.features.login.register.onResult
1819
import javax.inject.Inject
1920
import kotlin.time.Duration.Companion.seconds
@@ -28,7 +29,7 @@ class LoginViewModel @Inject constructor(
2829
) {
2930
data class State(
3031
val followerModeEnabled: Boolean = false,
31-
val creatingAccount: Boolean = false,
32+
val creatingAccount: LoadingSuccessState = LoadingSuccessState(),
3233
val logoTapCount: Int = 0,
3334
val betaOptionsVisible: Boolean = false,
3435
)
@@ -78,9 +79,9 @@ class LoginViewModel @Inject constructor(
7879
private const val TAP_THRESHOLD = 6
7980
val updateStateForEvent: (Event) -> ((State) -> State) = { event ->
8081
when (event) {
81-
Event.CreateAccount -> { state -> state.copy(creatingAccount = true) }
82-
Event.OnAccountCreated -> { state -> state.copy(creatingAccount = false) }
83-
Event.CreateFailed -> { state -> state.copy(creatingAccount = false) }
82+
Event.CreateAccount -> { state -> state.copy(creatingAccount = LoadingSuccessState(loading = true)) }
83+
Event.OnAccountCreated -> { state -> state.copy(creatingAccount = LoadingSuccessState(loading = false, success = true)) }
84+
Event.CreateFailed -> { state -> state.copy(creatingAccount = LoadingSuccessState(loading = false)) }
8485
is Event.OnFollowerModeEnabled -> { state -> state.copy(followerModeEnabled = event.enabled) }
8586
is Event.BetaOptionsUnlocked -> { state -> state.copy(betaOptionsVisible = true) }
8687
is Event.OnLogoTapped -> { state ->

flipchatApp/src/main/kotlin/xyz/flipchat/app/features/login/register/RegisterScreen.kt

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,17 @@ internal fun RegisterDisplayNameScreenContent(
104104
.fillMaxSize()
105105
.imePadding(),
106106
bottomBar = {
107-
Box(modifier = Modifier
108-
.fillMaxWidth()
109-
.navigationBarsPadding()) {
107+
Box(
108+
modifier = Modifier
109+
.fillMaxWidth()
110+
.navigationBarsPadding()
111+
.padding(bottom = CodeTheme.dimens.grid.x3),
112+
) {
110113
CodeButton(
111114
enabled = state.canAdvance,
112115
modifier = Modifier
113116
.fillMaxWidth()
114-
.padding(horizontal = CodeTheme.dimens.inset)
115-
.padding(bottom = CodeTheme.dimens.grid.x2),
117+
.padding(horizontal = CodeTheme.dimens.inset),
116118
buttonState = ButtonState.Filled,
117119
text = stringResource(R.string.action_next),
118120
isLoading = isChecking,
@@ -129,10 +131,11 @@ internal fun RegisterDisplayNameScreenContent(
129131
.fillMaxSize()
130132
.padding(padding)
131133
) {
132-
Column(modifier = Modifier
133-
.fillMaxWidth()
134-
.align(Alignment.CenterStart)
135-
.padding(horizontal = CodeTheme.dimens.inset),
134+
Column(
135+
modifier = Modifier
136+
.fillMaxWidth()
137+
.align(Alignment.CenterStart)
138+
.padding(horizontal = CodeTheme.dimens.inset),
136139
verticalArrangement = Arrangement.spacedBy(CodeTheme.dimens.inset)
137140
) {
138141
TextInput(

0 commit comments

Comments
 (0)