Коммит d0591192 создал по автору Radch-enko's avatar Radch-enko
Просмотр файлов

Improve date reset logic and fix room index selection

- Added a timer to reset the selected date every minute in `MainComponent`.
- Fixed `RoomsResult` logic to use the correct room index from the current state.
владелец e6835c07
......@@ -48,6 +48,7 @@ import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
import kotlin.math.abs
import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
import kotlin.time.ExperimentalTime
......@@ -148,6 +149,14 @@ class MainComponent(
}
}
}
// reset select date
currentTimeTimer.start(1.minutes) {
withContext(Dispatchers.Main) {
mutableState.update { it.copy(selectedDate = currentLocalDateTime,) }
slotComponent.sendIntent(SlotIntent.UpdateDate(currentLocalDateTime))
}
}
}
/**
......@@ -429,7 +438,7 @@ class MainComponent(
is Either.Success<List<RoomInfo>> -> RoomsResult(
isSuccess = true,
roomList = result.data,
indexSelectRoom = getRoomIndexUseCase(state.value.roomList),
indexSelectRoom = state.value.indexSelectRoom,
)
else -> RoomsResult(
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать