mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-26 19:17:51 +02:00
Migrate to flow
This commit is contained in:
@ -12,7 +12,6 @@ import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.databinding.PreMigrationControllerBinding
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
@ -98,7 +97,7 @@ class PreMigrationController(bundle: Bundle? = null) :
|
||||
val listOfSources = adapter?.items?.filter {
|
||||
it.sourceEnabled
|
||||
}?.joinToString("/") { it.source.id.toString() }
|
||||
prefs.migrationSources().set(listOfSources)
|
||||
prefs.migrationSources().set(listOfSources!!)
|
||||
|
||||
router.replaceTopController(
|
||||
MigrationListController.create(
|
||||
@ -136,7 +135,7 @@ class PreMigrationController(bundle: Bundle? = null) :
|
||||
*/
|
||||
private fun getEnabledSources(): List<HttpSource> {
|
||||
val languages = prefs.enabledLanguages().get()
|
||||
val sourcesSaved = prefs.migrationSources().getOrDefault().split("/")
|
||||
val sourcesSaved = prefs.migrationSources().get().split("/")
|
||||
var sources = sourceManager.getVisibleCatalogueSources()
|
||||
.filterIsInstance<HttpSource>()
|
||||
.filter { it.lang in languages }
|
||||
@ -154,7 +153,7 @@ class PreMigrationController(bundle: Bundle? = null) :
|
||||
}
|
||||
|
||||
fun isEnabled(id: String): Boolean {
|
||||
val sourcesSaved = prefs.migrationSources().getOrDefault()
|
||||
val sourcesSaved = prefs.migrationSources().get()
|
||||
val hiddenCatalogues = prefs.hiddenCatalogues().get()
|
||||
return if (sourcesSaved.isEmpty()) id !in hiddenCatalogues
|
||||
else sourcesSaved.split("/").contains(id)
|
||||
|
@ -128,7 +128,7 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
val useSourceWithMost = preferences.useSourceWithMost().getOrDefault()
|
||||
val useSmartSearch = preferences.smartMigration().getOrDefault()
|
||||
|
||||
val sources = preferences.migrationSources().getOrDefault().split("/").mapNotNull {
|
||||
val sources = preferences.migrationSources().get().split("/").mapNotNull {
|
||||
val value = it.toLongOrNull() ?: return
|
||||
sourceManager.get(value) as? CatalogueSource
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ class SettingsLibraryController : SettingsController() {
|
||||
}
|
||||
}
|
||||
if (preferences.skipPreMigration().get() || preferences.migrationSources()
|
||||
.getOrDefault().isNotEmpty()
|
||||
.get().isNotEmpty()
|
||||
) {
|
||||
switchPreference {
|
||||
key = Keys.skipPreMigration
|
||||
|
Reference in New Issue
Block a user