Change Updates icon badge to show new updates count (#8659)

* Change Updates icon badge to show new updates count

* Fix reference

* review changes

* Lint
This commit is contained in:
AntsyLich
2022-12-04 01:44:30 +06:00
committed by GitHub
parent 7be9b49143
commit 373463e995
9 changed files with 20 additions and 29 deletions
@@ -40,7 +40,6 @@ import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.components.NavigationBar
import eu.kanade.presentation.components.NavigationRail
import eu.kanade.presentation.components.Scaffold
import eu.kanade.presentation.util.Tab
import eu.kanade.presentation.util.Transition
import eu.kanade.presentation.util.isTabletUi
import eu.kanade.tachiyomi.R
@@ -52,7 +51,6 @@ import eu.kanade.tachiyomi.ui.more.MoreTab
import eu.kanade.tachiyomi.ui.updates.UpdatesTab
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.launch
import uy.kohesive.injekt.Injekt
@@ -219,11 +217,8 @@ object HomeScreen : Screen {
when {
tab is UpdatesTab -> {
val count by produceState(initialValue = 0) {
val pref = Injekt.get<LibraryPreferences>()
combine(
pref.showUpdatesNavBadge().changes(),
pref.unreadUpdatesCount().changes(),
) { show, count -> if (show) count else 0 }
Injekt.get<LibraryPreferences>()
.newUpdatesCount().changes()
.collectLatest { value = it }
}
if (count > 0) {