feat: removed auto sync

This commit is contained in:
2026-09-03 20:46:11 +03:00
parent 72e63addb2
commit 32d0cec8ce
@@ -56,13 +56,21 @@ class ScheduleViewModel(
} }
launch { launch {
_uiState.value = _uiState.value.copy(isSyncing = true) syncIfMissingToday(groupId)
scheduleRepository.sync(groupId)
_uiState.value = _uiState.value.copy(isSyncing = false)
} }
} }
} }
private suspend fun syncIfMissingToday(groupId: String) {
val schedule = scheduleRepository.getSchedule(groupId)
val today = ScheduleDates.moscowToday()
val hasTodayPeriod = schedule?.periodOf(today) != null
if (hasTodayPeriod) return
_uiState.value = _uiState.value.copy(isSyncing = true)
scheduleRepository.sync(groupId)
_uiState.value = _uiState.value.copy(isSyncing = false)
}
fun switchGroup() { fun switchGroup() {
viewModelScope.launch { viewModelScope.launch {
currentGroupId = null currentGroupId = null