Skip to content

Commit

Permalink
[IDLE-000] CenterPending 화면에서 CenterStatus를 2초마다 Polling 하도록 변경 및 Han…
Browse files Browse the repository at this point in the history
…dlerHelper -> Helper 네이밍 변경
  • Loading branch information
tgyuuAn committed Nov 21, 2024
1 parent ecd3e3b commit 0527dd4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
namespace = "com.idle.care"

defaultConfig {
versionCode = 17
versionName = "1.2.2"
versionCode = 18
versionName = "1.2.3"
targetSdk = 34

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import androidx.lifecycle.viewModelScope
import com.idle.binding.EventHelper
import com.idle.binding.MainEvent
import com.idle.binding.ToastType.SUCCESS
import com.idle.center.pending.R
import com.idle.domain.model.error.ErrorHelper
import com.idle.domain.model.profile.CenterManagerAccountStatus
import com.idle.domain.usecase.auth.LogoutCenterUseCase
import com.idle.domain.usecase.auth.SendCenterVerificationRequestUseCase
import com.idle.domain.usecase.profile.GetCenterStatusUseCase
import com.idle.navigation.DeepLinkDestination
import com.idle.navigation.NavigationEvent
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
Expand All @@ -32,7 +35,7 @@ class CenterPendingViewModel @Inject constructor(

private var pollingJob = MutableStateFlow(false)

init{
init {
subscribeCenterStatus()
}

Expand All @@ -43,7 +46,7 @@ class CenterPendingViewModel @Inject constructor(
internal fun logout() = viewModelScope.launch {
logoutCenterUseCase().onSuccess {
navigationHelper.navigateTo(
com.idle.navigation.NavigationEvent.NavigateToAuthWithClearBackStack(
NavigationEvent.NavigateToAuthWithClearBackStack(
toastMsg = "로그아웃이 완료되었습니다.",
toastType = "SUCCESS"
)
Expand Down Expand Up @@ -73,7 +76,14 @@ class CenterPendingViewModel @Inject constructor(
when (it.centerManagerAccountStatus) {
CenterManagerAccountStatus.APPROVED -> {
pollingJob.emit(false)
navigationHelper.navigateTo(
NavigationEvent.NavigateTo(
destination = DeepLinkDestination.CenterHome,
popUpTo = R.id.centerPendingFragment,
)
)

eventHelper.sendEvent(MainEvent.ShowToast("센터 인증이 완료되었습니다.", SUCCESS))
}

else -> Unit
Expand Down

0 comments on commit 0527dd4

Please sign in to comment.