Remove the unused mark duplicate as read preference. (jobobby04/tachiyomiSY#1448)
* Remove the unused mark duplicate as read preference. * Migrate the old preference to new preference (cherry picked from commit 71470b9e02bc5e3e7607d7de57f90a882810bb49)
This commit is contained in:
parent
b7c60d0750
commit
06ce765952
2 changed files with 27 additions and 0 deletions
|
|
@ -51,4 +51,5 @@ val migrations: List<Migration>
|
||||||
// KMK <--
|
// KMK <--
|
||||||
TrustExtensionRepositoryMigration(),
|
TrustExtensionRepositoryMigration(),
|
||||||
CategoryPreferencesCleanupMigration(),
|
CategoryPreferencesCleanupMigration(),
|
||||||
|
RemoveDuplicateReaderPreferenceMigration(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package mihon.core.migration.migrations
|
||||||
|
|
||||||
|
import android.content.SharedPreferences
|
||||||
|
import androidx.core.content.edit
|
||||||
|
import mihon.core.migration.Migration
|
||||||
|
import mihon.core.migration.MigrationContext
|
||||||
|
import tachiyomi.core.common.util.lang.withIOContext
|
||||||
|
|
||||||
|
class RemoveDuplicateReaderPreferenceMigration : Migration {
|
||||||
|
override val version: Float = 75f
|
||||||
|
|
||||||
|
override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext {
|
||||||
|
val prefs = migrationContext.get<SharedPreferences>() ?: return@withIOContext false
|
||||||
|
|
||||||
|
if (prefs.getBoolean("mark_read_dupe", false)) {
|
||||||
|
val readPrefSet = prefs.getStringSet("mark_duplicate_read_chapter_read", emptySet())?.toMutableSet()
|
||||||
|
readPrefSet?.add("existing")
|
||||||
|
prefs.edit {
|
||||||
|
putStringSet("mark_duplicate_read_chapter_read", readPrefSet)
|
||||||
|
remove("mark_read_dupe")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return@withIOContext true
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue