diff options
author | ByteHamster <info@bytehamster.com> | 2019-08-28 20:22:10 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2019-08-28 20:22:13 +0200 |
commit | 4a2feb3721907ac112dcae617b3f345e4e3fd781 (patch) | |
tree | 7af7c3d2d60d670de872f655d139f8d655a310e3 /app/src/main/java/de/danoeh/antennapod | |
parent | 2a24fa849ee9aeea7596258ed4efb59f0235d3d6 (diff) | |
download | AntennaPod-4a2feb3721907ac112dcae617b3f345e4e3fd781.zip |
Fixed upgrading preferences
Needs to use the original storage location that `UpdateManager` used,
which was removed in e2cf363cc442b5032111f256eb432fffbf954c86
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/preferences/PreferenceUpgrader.java | 11 |
1 files 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(); |