mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Changing extensionUpdatesCount to flowpref
This commit is contained in:
parent
6415387c16
commit
495d2316ed
4 changed files with 8 additions and 9 deletions
|
@ -352,7 +352,7 @@ class PreferencesHelper(val context: Context) {
|
|||
|
||||
fun updateOnRefresh() = rxPrefs.getInteger(Keys.updateOnRefresh, -1)
|
||||
|
||||
fun extensionUpdatesCount() = rxPrefs.getInteger("ext_updates_count", 0)
|
||||
fun extensionUpdatesCount() = flowPrefs.getInt("ext_updates_count", 0)
|
||||
|
||||
fun recentsViewType() = flowPrefs.getInt("recents_view_type", 0)
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import androidx.work.NetworkType
|
|||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.extension.ExtensionManager.ExtensionInfo
|
||||
import eu.kanade.tachiyomi.extension.model.Extension
|
||||
import eu.kanade.tachiyomi.extension.model.InstallStep
|
||||
|
@ -105,7 +104,7 @@ class ExtensionInstallService(
|
|||
installedExtensions.add(extension)
|
||||
installed++
|
||||
val prefCount =
|
||||
preferences.extensionUpdatesCount().getOrDefault()
|
||||
preferences.extensionUpdatesCount().get()
|
||||
preferences.extensionUpdatesCount().set(max(prefCount - 1, 0))
|
||||
}
|
||||
notifier.showProgressNotification(installed, list.size)
|
||||
|
|
|
@ -6,7 +6,6 @@ import eu.kanade.tachiyomi.R
|
|||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.extension.ExtensionInstallService
|
||||
import eu.kanade.tachiyomi.extension.ExtensionManager
|
||||
import eu.kanade.tachiyomi.extension.ExtensionsChangedListener
|
||||
|
@ -293,7 +292,7 @@ class ExtensionBottomPresenter(
|
|||
}
|
||||
}
|
||||
|
||||
fun getExtensionUpdateCount(): Int = preferences.extensionUpdatesCount().getOrDefault()
|
||||
fun getExtensionUpdateCount(): Int = preferences.extensionUpdatesCount().get()
|
||||
|
||||
@Synchronized
|
||||
private fun updateInstallStep(
|
||||
|
|
|
@ -384,10 +384,11 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||
}
|
||||
}
|
||||
}
|
||||
preferences.extensionUpdatesCount().asObservable().subscribe {
|
||||
|
||||
preferences.extensionUpdatesCount()
|
||||
.asImmediateFlowIn(lifecycleScope) {
|
||||
setExtensionsBadge()
|
||||
}
|
||||
|
||||
preferences.incognitoMode()
|
||||
.asImmediateFlowIn(lifecycleScope) {
|
||||
binding.toolbar.setIncognitoMode(it)
|
||||
|
@ -496,7 +497,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||
}
|
||||
|
||||
private fun setExtensionsBadge() {
|
||||
val updates = preferences.extensionUpdatesCount().getOrDefault()
|
||||
val updates = preferences.extensionUpdatesCount().get()
|
||||
if (updates > 0) {
|
||||
val badge = nav.getOrCreateBadge(R.id.nav_browse)
|
||||
badge.number = updates
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue