Skip to content

Commit

Permalink
fix:TOP-109 DailyTopic선택 이후 다음 UserCard로 넘어가지 않는 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
cwj-c committed Jan 5, 2025
1 parent 1bc0db4 commit 3b39dd6
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import com.example.compose_ui.common.viewmodel.Store
import com.example.compose_ui.common.viewmodel.intent
import com.example.compose_ui.common.viewmodel.store
import com.tht.tht.domain.tohot.FetchToHotStateUseCase
import com.tht.tht.domain.tohot.SelectTopicUseCase
import com.tht.tht.domain.tohot.ToHotStateModel
import com.tht.tht.domain.token.model.NeedLogoutException
import com.tht.tht.domain.tohot.SelectTopicUseCase
import com.tht.tht.domain.user.BlockUserUseCase
import com.tht.tht.domain.user.ReportUserUseCase
import com.tht.tht.domain.user.SendDislikeUseCase
Expand Down Expand Up @@ -115,6 +115,11 @@ class ToHotViewModel @Inject constructor(
reduce {
toHotState.toUiState(it, autoRunToHot)
}
if (autoRunToHot) {
tryScrollToNext(
currentIdx = store.state.value.enableTimerIdx
)
}
}.onFailure { e ->
e.printStackTrace()
reduce {
Expand Down Expand Up @@ -341,18 +346,17 @@ class ToHotViewModel @Inject constructor(
selectTopicIdx = store.state.value.topic.selectTopicIdx
)
if (selectTopic == null || selectTopic.idx < 0) return

intent {
reduce { it.copy(loading = ToHotLoading.TopicSelect) }
selectTopicUseCase(topicIdx = selectTopic.idx)
selectTopicUseCase.invoke(topicIdx = selectTopic.idx)
.unWrapTokenException()
.onSuccess {
when (it) {
true -> {
reduce { state ->
state.copy(
topic = state.topic.copy(
selectTopicIdx = -1,
selectTopicIdx = selectTopic.idx,
currentTopic = selectTopic
),
loading = ToHotLoading.None,
Expand Down

0 comments on commit 3b39dd6

Please sign in to comment.