File tree Expand file tree Collapse file tree
app/src/main/java/com/github/libretube/helpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,16 +35,11 @@ object PreferenceHelper {
3535 */
3636 private const val USER_ID_CHARS = " ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
3737
38-
39- /* *
40- * Current version of the preferences.
41- */
42- private const val PREFERENCE_VERSION = 1
43-
4438 /* *
45- * Migrations required to migrate the application to a newer [PREFERENCE_VERSION].
39+ * Migrations required to migrate the application to a newer preference version.
40+ * The version is automatically determined from the number of migrations available.
4641 */
47- private val MIGRATIONS = listOf (
42+ private val MIGRATIONS = arrayOf (
4843 PreferenceMigration (0 , 1 ) {
4944 LibreTubeApp .instance.resources
5045 .getStringArray(R .array.sponsorBlockSegments)
@@ -68,13 +63,11 @@ object PreferenceHelper {
6863
6964 /* *
7065 * Migrate preference to a new version.
71- *
72- * Migrations are run up to [PREFERENCE_VERSION].
7366 */
7467 fun migrate () {
7568 var currentPrefVersion = getInt(PreferenceKeys .PREFERENCE_VERSION , 0 )
7669
77- while (currentPrefVersion < PREFERENCE_VERSION ) {
70+ while (currentPrefVersion < MIGRATIONS .count() ) {
7871 val next = currentPrefVersion + 1
7972
8073 val migration =
You can’t perform that action at this time.
0 commit comments