|
|
@ -68,6 +68,7 @@ import eu.kanade.tachiyomi.util.view.setNavigationBarTransparentCompat
|
|
|
|
import kotlinx.coroutines.delay
|
|
|
|
import kotlinx.coroutines.delay
|
|
|
|
import kotlinx.coroutines.flow.drop
|
|
|
|
import kotlinx.coroutines.flow.drop
|
|
|
|
import kotlinx.coroutines.flow.launchIn
|
|
|
|
import kotlinx.coroutines.flow.launchIn
|
|
|
|
|
|
|
|
import kotlinx.coroutines.flow.merge
|
|
|
|
import kotlinx.coroutines.flow.onEach
|
|
|
|
import kotlinx.coroutines.flow.onEach
|
|
|
|
import logcat.LogPriority
|
|
|
|
import logcat.LogPriority
|
|
|
|
|
|
|
|
|
|
|
@ -227,6 +228,10 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
merge(preferences.libraryUpdateShowTabBadge().asFlow(), preferences.libraryUnreadUpdatesCount().asFlow())
|
|
|
|
|
|
|
|
.onEach { setUnreadUpdatesBadge() }
|
|
|
|
|
|
|
|
.launchIn(lifecycleScope)
|
|
|
|
|
|
|
|
|
|
|
|
preferences.extensionUpdatesCount()
|
|
|
|
preferences.extensionUpdatesCount()
|
|
|
|
.asImmediateFlow { setExtensionsBadge() }
|
|
|
|
.asImmediateFlow { setExtensionsBadge() }
|
|
|
|
.launchIn(lifecycleScope)
|
|
|
|
.launchIn(lifecycleScope)
|
|
|
@ -349,6 +354,15 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun setUnreadUpdatesBadge() {
|
|
|
|
|
|
|
|
val updates = if (preferences.libraryUpdateShowTabBadge().get()) preferences.libraryUnreadUpdatesCount().get() else 0
|
|
|
|
|
|
|
|
if (updates > 0) {
|
|
|
|
|
|
|
|
nav.getOrCreateBadge(R.id.nav_updates).number = updates
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
nav.removeBadge(R.id.nav_updates)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private fun setExtensionsBadge() {
|
|
|
|
private fun setExtensionsBadge() {
|
|
|
|
val updates = preferences.extensionUpdatesCount().get()
|
|
|
|
val updates = preferences.extensionUpdatesCount().get()
|
|
|
|
if (updates > 0) {
|
|
|
|
if (updates > 0) {
|
|
|
|