From 3b39dd61b6069c42d7d1b743ef758f877517e5e5 Mon Sep 17 00:00:00 2001 From: wjchoi96 Date: Sun, 5 Jan 2025 17:05:02 +0900 Subject: [PATCH] =?UTF-8?q?fix:TOP-109=20DailyTopic=EC=84=A0=ED=83=9D=20?= =?UTF-8?q?=EC=9D=B4=ED=9B=84=20=EB=8B=A4=EC=9D=8C=20UserCard=EB=A1=9C=20?= =?UTF-8?q?=EB=84=98=EC=96=B4=EA=B0=80=EC=A7=80=20=EC=95=8A=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/tohot/tohot/viewmodel/ToHotViewModel.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/feature/tohot/src/main/java/tht/feature/tohot/tohot/viewmodel/ToHotViewModel.kt b/feature/tohot/src/main/java/tht/feature/tohot/tohot/viewmodel/ToHotViewModel.kt index 1fc9a866..558173cd 100644 --- a/feature/tohot/src/main/java/tht/feature/tohot/tohot/viewmodel/ToHotViewModel.kt +++ b/feature/tohot/src/main/java/tht/feature/tohot/tohot/viewmodel/ToHotViewModel.kt @@ -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 @@ -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 { @@ -341,10 +346,9 @@ 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) { @@ -352,7 +356,7 @@ class ToHotViewModel @Inject constructor( reduce { state -> state.copy( topic = state.topic.copy( - selectTopicIdx = -1, + selectTopicIdx = selectTopic.idx, currentTopic = selectTopic ), loading = ToHotLoading.None,