Fix crash on "About you" page

Number EditText preferences must still be persisted as strings.
This commit is contained in:
José Rebelo
2025-09-01 22:57:34 +01:00
parent 6cc910af5a
commit 243ef19606
@@ -142,7 +142,7 @@ public class GBApplication extends Application {
private static SharedPreferences sharedPrefs;
private static final String PREFS_VERSION = "shared_preferences_version";
//if preferences have to be migrated, increment the following and add the migration logic in migratePrefs below; see http://stackoverflow.com/questions/16397848/how-can-i-migrate-android-preferences-with-a-new-version
private static final int CURRENT_PREFS_VERSION = 51;
private static final int CURRENT_PREFS_VERSION = 52;
private static final LimitedQueue<Integer, String> mIDSenderLookup = new LimitedQueue<>(16);
private static GBPrefs prefs;
@@ -2145,6 +2145,14 @@ public class GBApplication extends Application {
}
}
if (oldVersion < 52) {
if (prefs.contains("activity_user_sleep_duration_minutes")) {
final int minutes = prefs.getInt("activity_user_sleep_duration_minutes", 7 * 60);
editor.remove("activity_user_sleep_duration_minutes");
editor.putString("activity_user_sleep_duration_minutes", String.valueOf(minutes));
}
}
editor.putString(PREFS_VERSION, Integer.toString(CURRENT_PREFS_VERSION));
editor.apply();
}