Skip to content

Commit

Permalink
πŸ”— :: (#690) νšŒμ›κ°€μž… 인풋 μžλ™μœΌλ‘œ λ„˜κΈ°κΈ°
Browse files Browse the repository at this point in the history
πŸ”— :: (#690) νšŒμ›κ°€μž… 인풋 μžλ™μœΌλ‘œ λ„˜κΈ°κΈ°
  • Loading branch information
parkuiery authored Jun 8, 2024
2 parents 422320e + 37a66b8 commit 6d0b9e2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
Expand All @@ -19,9 +20,10 @@ import androidx.compose.ui.res.stringResource
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.ramcosta.composedestinations.annotation.Destination
import team.aliens.dms.android.core.designsystem.ContainedButton
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.DmsIcon
import team.aliens.dms.android.core.designsystem.DmsTopAppBar
import team.aliens.dms.android.core.designsystem.LocalToast
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.VerificationCodeInput
import team.aliens.dms.android.core.designsystem.VerificationCodeInputDefaults
import team.aliens.dms.android.core.ui.Banner
Expand All @@ -46,6 +48,12 @@ internal fun EnterSchoolVerificationCodeScreen(
val toast = LocalToast.current
val context = LocalContext.current

LaunchedEffect(uiState.schoolVerificationCode) {
if (uiState.schoolVerificationCode.length == SignUpViewModel.SCHOOL_VERIFICATION_CODE_LENGTH) {
viewModel.postIntent(SignUpIntent.ExamineSchoolVerificationCode)
}
}

viewModel.sideEffectFlow.collectInLaunchedEffectWithLifecycle { sideEffect ->
when (sideEffect) {
SignUpSideEffect.SchoolVerificationCodeExamined -> navigator.openEnterSchoolVerificationQuestion()
Expand All @@ -66,7 +74,7 @@ internal fun EnterSchoolVerificationCodeScreen(
navigationIcon = {
IconButton(onClick = navigator::navigateUp) {
Icon(
painter = painterResource(id = R.drawable.ic_baseline_arrow_back_24),
painter = painterResource(id = DmsIcon.Back),
contentDescription = stringResource(id = R.string.top_bar_back_button),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.ramcosta.composedestinations.annotation.Destination
import team.aliens.dms.android.core.designsystem.ButtonDefaults
import team.aliens.dms.android.core.designsystem.ContainedButton
import team.aliens.dms.android.core.designsystem.DmsIcon
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.DmsTheme
import team.aliens.dms.android.core.designsystem.DmsTopAppBar
Expand Down Expand Up @@ -79,6 +80,12 @@ internal fun SignUpEnterEmailVerificationCodeScreen(
}
}

LaunchedEffect(uiState.emailVerificationCode) {
if (uiState.emailVerificationCode.length == SignUpViewModel.EMAIL_VERIFICATION_CODE_LENGTH) {
viewModel.postIntent(SignUpIntent.CheckEmailVerificationCode)
}
}

LaunchedEffect(uiState.sessionId) {
timer.start()
}
Expand Down Expand Up @@ -122,7 +129,7 @@ internal fun SignUpEnterEmailVerificationCodeScreen(
navigationIcon = {
IconButton(onClick = navigator::popUpToEnterEmail) {
Icon(
painter = painterResource(id = R.drawable.ic_baseline_arrow_back_24),
painter = painterResource(id = DmsIcon.Back),
contentDescription = stringResource(id = R.string.top_bar_back_button),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
Expand Down Expand Up @@ -77,6 +79,9 @@ internal fun SetIdScreen(
val toast = LocalToast.current
val context = LocalContext.current

val classFocusRequest = remember { FocusRequester() }
val numberFocusRequest = remember { FocusRequester() }

val (studentConfirmed, onStudentConfirmedChange) = remember { mutableStateOf(false) }

val (gradeClassNumberError, setGradeClassNumberError) = remember { mutableStateOf(false) }
Expand Down Expand Up @@ -165,10 +170,14 @@ internal fun SetIdScreen(
horizontalArrangement = Arrangement.spacedBy(DefaultHorizontalSpace),
) {
TextField(
modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f),
value = uiState.grade,
hint = { Text(text = stringResource(id = R.string.sign_up_set_id_hint_grade)) },
onValueChange = { viewModel.postIntent(SignUpIntent.UpdateGrade(value = it)) },
onValueChange = { grade ->
viewModel.postIntent(SignUpIntent.UpdateGrade(value = grade))
if (grade.isNotEmpty()) classFocusRequest.requestFocus()
},
supportingText = {},
isError = gradeClassNumberError,
enabled = !studentConfirmed,
Expand All @@ -178,10 +187,15 @@ internal fun SetIdScreen(
),
)
TextField(
modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f)
.focusRequester(classFocusRequest),
value = uiState.classroom,
hint = { Text(text = stringResource(id = R.string.sign_up_set_id_hint_class)) },
onValueChange = { viewModel.postIntent(SignUpIntent.UpdateClass(value = it)) },
onValueChange = { classRoom ->
viewModel.postIntent(SignUpIntent.UpdateClass(value = classRoom))
if (classRoom.isNotEmpty()) numberFocusRequest.requestFocus()
},
supportingText = {},
isError = gradeClassNumberError,
enabled = !studentConfirmed,
Expand All @@ -191,7 +205,9 @@ internal fun SetIdScreen(
),
)
TextField(
modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f)
.focusRequester(numberFocusRequest),
value = uiState.number,
hint = { Text(text = stringResource(id = R.string.sign_up_set_id_hint_number)) },
onValueChange = { viewModel.postIntent(SignUpIntent.UpdateNumber(value = it)) },
Expand Down

0 comments on commit 6d0b9e2

Please sign in to comment.