Skip to content

Commit

Permalink
feat: Event observing 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
SeongHoonC committed Sep 11, 2023
1 parent 2c09605 commit 738f96e
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,17 @@ class StudentVerificationActivity : AppCompatActivity() {
private fun initObserve() {
repeatOnStarted {
vm.uiState.collect { uiState ->
updateUiState(uiState)
handleUiState(uiState)
}
}
repeatOnStarted {
vm.event.collect { event ->
handleEvent(event)
}
}
}

private fun updateUiState(uiState: StudentVerificationUiState) {
private fun handleUiState(uiState: StudentVerificationUiState) {
binding.uiState = uiState
when (uiState) {
is StudentVerificationUiState.Success -> handleSuccess(uiState)
Expand All @@ -73,6 +78,14 @@ class StudentVerificationActivity : AppCompatActivity() {
binding.btnVerificationConfirm.isEnabled = uiState.isValidateCode
}

private fun handleEvent(event: StudentVerificationEvent) {
when (event) {
is StudentVerificationEvent.VerificationSuccess -> Unit
is StudentVerificationEvent.VerificationFailure -> Unit
is StudentVerificationEvent.CodeTimeOut -> Unit
}
}

companion object {

private const val KEY_SCHOOL_ID = "KEY_SCHOOL_ID"
Expand Down

0 comments on commit 738f96e

Please sign in to comment.