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:
parent
4fd24accac
commit
71470b9e02
@ -227,13 +227,6 @@ object SettingsReaderScreen : SearchableSettings {
|
||||
preference = readerPreferences.skipDupe(),
|
||||
title = stringResource(MR.strings.pref_skip_dupe_chapters),
|
||||
),
|
||||
// SY -->
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
preference = readerPreferences.markReadDupe(),
|
||||
title = stringResource(SYMR.strings.pref_mark_read_dupe_chapters),
|
||||
subtitle = stringResource(SYMR.strings.pref_mark_read_dupe_chapters_summary),
|
||||
),
|
||||
// SY <--
|
||||
Preference.PreferenceItem.SwitchPreference(
|
||||
preference = readerPreferences.alwaysShowChapterTransition(),
|
||||
title = stringResource(MR.strings.pref_always_show_chapter_transition),
|
||||
|
@ -184,8 +184,6 @@ class ReaderPreferences(
|
||||
fun centerMarginType() = preferenceStore.getInt("center_margin_type", PagerConfig.CenterMarginType.NONE)
|
||||
|
||||
fun archiveReaderMode() = preferenceStore.getInt("archive_reader_mode", ArchiveReaderMode.LOAD_FROM_FILE)
|
||||
|
||||
fun markReadDupe() = preferenceStore.getBoolean("mark_read_dupe", false)
|
||||
// SY <--
|
||||
|
||||
enum class FlashColor {
|
||||
|
@ -46,4 +46,5 @@ val migrations: List<Migration>
|
||||
MoveEncryptionSettingsToAppStateMigration(),
|
||||
TrustExtensionRepositoryMigration(),
|
||||
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 = 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
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user