Add AppInitializeListener to migrate Home Work points

This commit is contained in:
Dima-1 2020-02-24 13:47:51 +02:00
parent 70d52b4dcc
commit 91e7a1686a

View file

@ -203,6 +203,18 @@ public class AppInitializer implements IProgress {
if (prevAppVersion < VERSION_3_5 || Version.getAppVersion(app).equals("3.5.3") if (prevAppVersion < VERSION_3_5 || Version.getAppVersion(app).equals("3.5.3")
|| Version.getAppVersion(app).equals("3.5.4")) { || Version.getAppVersion(app).equals("3.5.4")) {
app.getSettings().migratePreferences(); app.getSettings().migratePreferences();
app.getAppInitializer().addListener(new AppInitializer.AppInitializeListener() {
@Override
public void onProgress(AppInitializer init, AppInitializer.InitEvents event) {
if (event.equals(InitEvents.FAVORITES_INITIALIZED)) {
app.getSettings().migrateHomeWorkParkingToFavorites();
}
}
@Override
public void onFinish(AppInitializer init) {
}
});
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_5).commit(); startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_5).commit();
} }
if (prevAppVersion < VERSION_3_6) { if (prevAppVersion < VERSION_3_6) {
@ -217,13 +229,6 @@ public class AppInitializer implements IProgress {
initSettings = true; initSettings = true;
} }
void migrateHomeWorkFromSettings() {
if (prevAppVersion < VERSION_3_5 || Version.getAppVersion(app).equals("3.5.3")) {
app.getSettings().migrateHomeWorkParkingToFavorites();
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_5).commit();
}
}
public int getNumberOfStarts() { public int getNumberOfStarts() {
if(startPrefs == null) { if(startPrefs == null) {
return 0; return 0;