Skip to content

Commit 5363cba

Browse files
committed
fix: fix followed user sync
1 parent 940253b commit 5363cba

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

shared/src/commonMain/kotlin/fr/outadoc/justchatting/feature/timeline/presentation/LiveTimelineViewModel.kt

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,23 @@ internal class LiveTimelineViewModel(
4545
return
4646
}
4747

48-
periodicSyncJob =
49-
viewModelScope.launch(DispatchersProvider.default) {
50-
launch {
51-
val tz = _state.value.timeZone
52-
val today = clock.now().toLocalDateTime(tz).date
48+
viewModelScope.launch {
49+
val tz = _state.value.timeZone
50+
val today = clock.now().toLocalDateTime(tz).date
5351

54-
twitchRepository
55-
.getFollowedChannelsSchedule(
56-
today = today,
57-
timeZone = tz,
58-
).collect { schedule ->
59-
_state.update { state ->
60-
state.copy(live = schedule.live)
61-
}
62-
}
52+
twitchRepository
53+
.getFollowedChannelsSchedule(
54+
today = today,
55+
timeZone = tz,
56+
).collect { schedule ->
57+
_state.update { state ->
58+
state.copy(live = schedule.live)
59+
}
6360
}
61+
}
6462

63+
periodicSyncJob =
64+
viewModelScope.launch {
6565
while (isActive) {
6666
doSync()
6767
delay(1.minutes)
@@ -82,9 +82,8 @@ internal class LiveTimelineViewModel(
8282

8383
val appUser = authRepository.currentUser.first()
8484

85-
twitchRepository.syncFollowedStreams(
86-
appUser = appUser,
87-
)
85+
twitchRepository.syncFollowedChannels(appUser)
86+
twitchRepository.syncFollowedStreams(appUser)
8887

8988
_state.update { state ->
9089
state.copy(isLoading = false)

0 commit comments

Comments
 (0)