From 7500a17b7971b2577bf896aebe42f6defb8020f8 Mon Sep 17 00:00:00 2001 From: Syer10 Date: Wed, 16 Mar 2022 21:22:27 -0400 Subject: [PATCH] Cleanup updates menu --- .../kotlin/ca/gosyer/ui/updates/UpdatesScreenViewModel.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/presentation/src/jvmMain/kotlin/ca/gosyer/ui/updates/UpdatesScreenViewModel.kt b/presentation/src/jvmMain/kotlin/ca/gosyer/ui/updates/UpdatesScreenViewModel.kt index 0bd457b6..8202f712 100644 --- a/presentation/src/jvmMain/kotlin/ca/gosyer/ui/updates/UpdatesScreenViewModel.kt +++ b/presentation/src/jvmMain/kotlin/ca/gosyer/ui/updates/UpdatesScreenViewModel.kt @@ -34,8 +34,6 @@ class UpdatesScreenViewModel @Inject constructor( private val _isLoading = MutableStateFlow(true) val isLoading = _isLoading.asStateFlow() - private var mangaIds: Set = emptySet() - private val _updates = MutableStateFlow>(emptyList()) val updates = _updates.asStateFlow() @@ -63,8 +61,6 @@ class UpdatesScreenViewModel @Inject constructor( private suspend fun getUpdates() { updatesHandler.getRecentUpdates(currentPage.value) .onEach { updates -> - mangaIds = updates.page.map { it.manga.id }.toSet() - _updates.value += updates.page.map { ChapterDownloadItem( it.manga, @@ -72,7 +68,7 @@ class UpdatesScreenViewModel @Inject constructor( ) } downloadServiceJob?.cancel() - downloadServiceJob = DownloadService.registerWatches(mangaIds) + downloadServiceJob = DownloadService.registerWatches(updates.page.map { it.manga.id }.toSet()) .onEach { chapters -> _updates.value .forEach {