more migrations for player prefs

This commit is contained in:
jmir1 2022-11-10 11:45:03 +01:00
parent efee413ecb
commit 505a6f5639
2 changed files with 22 additions and 1 deletions

View file

@ -28,7 +28,7 @@ android {
applicationId = "xyz.jmir.tachiyomi.mi"
minSdk = AndroidConfig.minSdk
targetSdk = AndroidConfig.targetSdk
versionCode = 92
versionCode = 93
versionName = "0.14.2.0"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")

View file

@ -380,6 +380,27 @@ object Migrations {
}
}
}
if (oldVersion < 93) {
listOf(
playerPreferences.defaultPlayerOrientationType(),
playerPreferences.defaultPlayerOrientationLandscape(),
playerPreferences.defaultPlayerOrientationPortrait(),
playerPreferences.skipLengthPreference(),
).forEach { pref ->
if (pref.isSet()) {
prefs.edit {
val oldString = try {
prefs.getString(pref.key(), null)
} catch (e: ClassCastException) {
null
} ?: return@edit
val newInt = oldString.toIntOrNull() ?: return@edit
putInt(pref.key(), newInt)
}
}
}
}
return true
}