Skip to content

Commit

Permalink
[MERGE] #417 -> develop
Browse files Browse the repository at this point in the history
[FIX/#417] 구독 정보 조회 실패 시 발생하는 토스트 제거
  • Loading branch information
Marchbreeze authored Feb 28, 2024
2 parents d452ac1 + 1e2f5f0 commit 1d48a33
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
}
}

is Failure -> {
yelloSnackbar(binding.root, getString(R.string.internet_connection_error_msg))
}
is Failure -> return@onEach
}
}.launchIn(lifecycleScope)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class MainViewModel @Inject constructor(
}
.onFailure { t ->
if (t is HttpException) {
Timber.d("GET_USER_SUBS_INFO_FAILURE : $t")
_getUserSubsState.value = UiState.Failure(t.code().toString())
_getUserSubsState.value = UiState.Loading
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.example.domain.repository.VoteRepository
import com.example.ui.state.UiState
import com.example.ui.state.UiState.Empty
import com.example.ui.state.UiState.Failure
import com.example.ui.state.UiState.Loading
import com.example.ui.state.UiState.Success
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.delay
Expand Down Expand Up @@ -46,7 +47,7 @@ class YelloViewModel @Inject constructor(
get() = _isDecreasing.value

private val _getPurchaseInfoState =
MutableStateFlow<UiState<PayInfoModel>>(UiState.Loading)
MutableStateFlow<UiState<PayInfoModel>>(Loading)
val getPurchaseInfoState: StateFlow<UiState<PayInfoModel>> =
_getPurchaseInfoState.asStateFlow()

Expand All @@ -71,6 +72,7 @@ class YelloViewModel @Inject constructor(
.onSuccess { voteState ->
if (voteState == null) {
_yelloState.value = Empty
_yelloState.value = Loading
return@launch
}

Expand All @@ -83,22 +85,29 @@ class YelloViewModel @Inject constructor(
}
_yelloState.value =
Success(Valid(voteState.point, voteState.hasFourFriends))
_yelloState.value = Loading
return@launch
}

_yelloState.value = Success(Wait(voteState.leftTime))
_yelloState.value = Loading
_leftTime.value = voteState.leftTime
decreaseTime()
}
.onFailure { t ->
if (t is HttpException) {
Timber.e("GET VOTE STATE FAILURE : $t")
when (t.code()) {
CODE_NO_FRIEND -> _yelloState.value = Success(Lock)
CODE_NO_FRIEND -> {
_yelloState.value = Success(Lock)
_yelloState.value = Loading
}

else -> {
authRepository.clearLocalPref()
delay(500)
_yelloState.value = Failure(t.code().toString())
_yelloState.value = Loading
}
}
}
Expand All @@ -113,13 +122,19 @@ class YelloViewModel @Inject constructor(
.onSuccess { purchaseInfo ->
if (purchaseInfo == null) {
_getPurchaseInfoState.value = Empty
_getPurchaseInfoState.value = Loading
return@onSuccess
}

Timber.d("GET_PURCHASE_INFO_SUCCESS : $purchaseInfo")

_getPurchaseInfoState.value = Success(purchaseInfo)
_getPurchaseInfoState.value = Loading
}
.onFailure { t ->
if (t is HttpException) {
_getPurchaseInfoState.value = Failure(t.code().toString())
_getPurchaseInfoState.value = Loading
}
}
}
Expand Down

0 comments on commit 1d48a33

Please sign in to comment.