11package com.nextroom.nextroom.presentation.ui.hint
22
3- import com.nextroom.nextroom.domain.model.SubscribeStatus
43import com.nextroom.nextroom.domain.repository.DataStoreRepository
54import com.nextroom.nextroom.domain.repository.TimerRepository
65import com.nextroom.nextroom.presentation.base.NewBaseViewModel
7- import com.nextroom.nextroom.presentation.model.Hint
86import com.nextroom.nextroom.presentation.ui.main.GameSharedViewModel
97import dagger.assisted.Assisted
108import dagger.assisted.AssistedFactory
@@ -29,8 +27,10 @@ class HintViewModel @AssistedInject constructor(
2927 gameSharedViewModel.state
3028 ) { state, gameSharedState ->
3129 state.copy(
32- isHintOpened = state.hint.id in gameSharedState.openedHintIds,
33- isAnswerOpened = state.hint.id in gameSharedState.openedAnswerIds,
30+ hint = gameSharedState.currentHint ? : state.hint,
31+ userSubscribeStatus = gameSharedState.subscribeStatus,
32+ isHintOpened = (gameSharedState.currentHint?.id ? : state.hint.id) in gameSharedState.openedHintIds,
33+ isAnswerOpened = (gameSharedState.currentHint?.id ? : state.hint.id) in gameSharedState.openedAnswerIds,
3434 totalHintCount = gameSharedState.totalHintCount
3535 )
3636 }.stateIn(
@@ -58,16 +58,6 @@ class HintViewModel @AssistedInject constructor(
5858 _uiState .value = _uiState .value.copy(networkDisconnectedCount = count)
5959 }
6060
61- fun setHint (hint : Hint ) {
62- _uiState .value = _uiState .value.copy(
63- hint = hint
64- )
65- }
66-
67- fun setSubscribeStatus (subscribeStatus : SubscribeStatus ) {
68- _uiState .value = _uiState .value.copy(userSubscribeStatus = subscribeStatus)
69- }
70-
7161 fun tryOpenHint (hintId : Int ) {
7262 val openedCount = gameSharedViewModel.getOpenedHintCount()
7363 val openableHintCount = uiState.value.totalHintCount
0 commit comments