|
|
@ -78,32 +78,25 @@ public class Upgrader {
|
|
|
|
|
|
|
|
|
|
|
|
public void upgrade(int from, int to) {
|
|
|
|
public void upgrade(int from, int to) {
|
|
|
|
if (from > 0) {
|
|
|
|
if (from > 0) {
|
|
|
|
if (from < V4_8_0) {
|
|
|
|
run(from, V4_8_0, this::performMarshmallowMigration);
|
|
|
|
performMarshmallowMigration();
|
|
|
|
run(from, V4_9_5, this::removeDuplicateTags);
|
|
|
|
}
|
|
|
|
run(from, V5_3_0, this::migrateFilters);
|
|
|
|
if (from < V4_9_5) {
|
|
|
|
run(from, V6_0_beta_1, this::migrateDefaultSyncList);
|
|
|
|
removeDuplicateTags();
|
|
|
|
run(from, V6_0_beta_2, this::migrateGoogleTaskAccount);
|
|
|
|
}
|
|
|
|
run(from, V6_4, this::migrateUris);
|
|
|
|
if (from < V5_3_0) {
|
|
|
|
run(from, V6_7, this::migrateGoogleTaskFilters);
|
|
|
|
migrateFilters();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (from < V6_0_beta_1) {
|
|
|
|
|
|
|
|
migrateDefaultSyncList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (from < V6_0_beta_2) {
|
|
|
|
|
|
|
|
migrateGoogleTaskAccount();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (from < V6_4) {
|
|
|
|
|
|
|
|
migrateUris();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (from < V6_7) {
|
|
|
|
|
|
|
|
migrateGoogleTaskFilters();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tracker.reportEvent(Tracking.Events.UPGRADE, Integer.toString(from));
|
|
|
|
tracker.reportEvent(Tracking.Events.UPGRADE, Integer.toString(from));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
preferences.setCurrentVersion(to);
|
|
|
|
preferences.setCurrentVersion(to);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void run(int from, int version, Runnable runnable) {
|
|
|
|
|
|
|
|
if (from < version) {
|
|
|
|
|
|
|
|
runnable.run();
|
|
|
|
|
|
|
|
preferences.setCurrentVersion(version);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void performMarshmallowMigration() {
|
|
|
|
private void performMarshmallowMigration() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// preserve pre-marshmallow default backup location
|
|
|
|
// preserve pre-marshmallow default backup location
|
|
|
|