Remove the unused mark duplicate as read preference. (#1448)
* Remove the unused mark duplicate as read preference. * Migrate the old preference to new preference
This commit is contained in:
@@ -46,4 +46,5 @@ val migrations: List<Migration>
|
||||
MoveEncryptionSettingsToAppStateMigration(),
|
||||
TrustExtensionRepositoryMigration(),
|
||||
CategoryPreferencesCleanupMigration(),
|
||||
RemoveDuplicateReaderPreferenceMigration(),
|
||||
)
|
||||
|
||||
+26
@@ -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 = 74f
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user