From 4a2feb3721907ac112dcae617b3f345e4e3fd781 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 28 Aug 2019 20:22:10 +0200 Subject: [PATCH] Fixed upgrading preferences Needs to use the original storage location that `UpdateManager` used, which was removed in e2cf363cc442b5032111f256eb432fffbf954c86 --- .../antennapod/preferences/PreferenceUpgrader.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java index e56703598..4d6fbcb7b 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java @@ -8,22 +8,23 @@ import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.gui.NotificationUtils; public class PreferenceUpgrader { - private static final String PREF_CONFIGURED_VERSION = "configuredVersion"; - private static final String PREF_NAME = "PreferenceUpgrader"; + private static final String PREF_CONFIGURED_VERSION = "version_code"; + private static final String PREF_NAME = "app_version"; private static SharedPreferences prefs; public static void checkUpgrades(Context context) { prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences upgraderPrefs = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); - int oldVersion = upgraderPrefs.getInt(PREF_CONFIGURED_VERSION, 1070200); + int oldVersion = upgraderPrefs.getInt(PREF_CONFIGURED_VERSION, -1); int newVersion = BuildConfig.VERSION_CODE; if (oldVersion != newVersion) { NotificationUtils.createChannels(context); + UserPreferences.restartUpdateAlarm(); - upgraderPrefs.edit().putInt(PREF_CONFIGURED_VERSION, newVersion).apply(); upgrade(oldVersion); + upgraderPrefs.edit().putInt(PREF_CONFIGURED_VERSION, newVersion).apply(); } } @@ -41,8 +42,6 @@ public class PreferenceUpgrader { } } if (oldVersion < 1070300) { - UserPreferences.restartUpdateAlarm(); - if (UserPreferences.getMediaPlayer().equals("builtin")) { prefs.edit().putString(UserPreferences.PREF_MEDIA_PLAYER, UserPreferences.PREF_MEDIA_PLAYER_EXOPLAYER).apply();