From 8360e156177a653099eaba27a4ddc172cfab2e54 Mon Sep 17 00:00:00 2001 From: jeongjaino Date: Sat, 5 Oct 2024 17:46:40 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]#184=20:=20=ED=83=80=EC=9D=B4=EB=A8=B8=20?= =?UTF-8?q?=EC=8B=9C=EC=9E=91=EC=8B=9C,=20=EC=AA=BD=EC=A7=80=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=20=EB=B6=88=EB=9F=AC=EC=98=A4=EB=8A=94=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/viewmodel/MessageViewModel.kt | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/feature/message/src/main/kotlin/com/bff/wespot/message/viewmodel/MessageViewModel.kt b/feature/message/src/main/kotlin/com/bff/wespot/message/viewmodel/MessageViewModel.kt index 42558a82..13f4a39d 100644 --- a/feature/message/src/main/kotlin/com/bff/wespot/message/viewmodel/MessageViewModel.kt +++ b/feature/message/src/main/kotlin/com/bff/wespot/message/viewmodel/MessageViewModel.kt @@ -101,6 +101,7 @@ class MessageViewModel @Inject constructor( private fun startTimer() = intent { if (!timerJob.isActive) { + setTimer() timerJob.start() } } @@ -130,22 +131,20 @@ class MessageViewModel @Inject constructor( } } - /** - * TimePeriod Default 값은 DAWN_TO_EVENING으로 - * DAWN_TO_EVENING 상태에서 다른 행동을 수행하지 않기 때문에, TimePeriod가 변경되었을 때만 행동을 수행한다. - */ private fun updateTimePeriod(currentTimePeriod: TimePeriod) = intent { if (state.timePeriod != currentTimePeriod) { - getMessageStatus() - - // 메세지 전송 가능한 시간이 경우, 타이머 시각을 설정한다. - if (currentTimePeriod == TimePeriod.EVENING_TO_NIGHT) { - _remainingTimeMillis.value = getRemainingTimeMillis() - } - reduce { state.copy(timePeriod = currentTimePeriod) } + setTimer() + } + } + + private fun setTimer() = intent { + getMessageStatus() + + if (state.timePeriod == TimePeriod.EVENING_TO_NIGHT) { + _remainingTimeMillis.value = getRemainingTimeMillis() } }