mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 19:00:26 +01:00
Inline GV2 feature flag.
This commit is contained in:
committed by
Greyson Parrelli
parent
a2c2ab428a
commit
45915bed90
@@ -39,7 +39,7 @@ public class ApplicationMigrations {
|
||||
|
||||
private static final int LEGACY_CANONICAL_VERSION = 455;
|
||||
|
||||
public static final int CURRENT_VERSION = 19;
|
||||
public static final int CURRENT_VERSION = 20;
|
||||
|
||||
private static final class Version {
|
||||
static final int LEGACY = 1;
|
||||
@@ -61,6 +61,7 @@ public class ApplicationMigrations {
|
||||
static final int PIN_OPT_OUT = 17;
|
||||
static final int TRIM_SETTINGS = 18;
|
||||
static final int THUMBNAIL_CLEANUP = 19;
|
||||
static final int GV2 = 20;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,6 +253,10 @@ public class ApplicationMigrations {
|
||||
jobs.put(Version.THUMBNAIL_CLEANUP, new DatabaseMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.GV2) {
|
||||
jobs.put(Version.GV2, new AttributesMigrationJob());
|
||||
}
|
||||
|
||||
return jobs;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package org.thoughtcrime.securesms.migrations;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.jobs.ProfileUploadJob;
|
||||
import org.thoughtcrime.securesms.jobs.RefreshAttributesJob;
|
||||
import org.thoughtcrime.securesms.jobs.RefreshOwnProfileJob;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
/**
|
||||
* Schedules a re-upload of the users attributes followed by a download of their profile.
|
||||
*/
|
||||
public final class AttributesMigrationJob extends MigrationJob {
|
||||
|
||||
private static final String TAG = Log.tag(AttributesMigrationJob.class);
|
||||
|
||||
public static final String KEY = "AttributesMigrationJob";
|
||||
|
||||
AttributesMigrationJob() {
|
||||
this(new Parameters.Builder().build());
|
||||
}
|
||||
|
||||
private AttributesMigrationJob(@NonNull Parameters parameters) {
|
||||
super(parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUiBlocking() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull String getFactoryKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performMigration() {
|
||||
Log.i(TAG, "Scheduling attributes upload and profile refresh job chain");
|
||||
ApplicationDependencies.getJobManager().startChain(new RefreshAttributesJob())
|
||||
.then(new RefreshOwnProfileJob())
|
||||
.enqueue();
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean shouldRetry(@NonNull Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class Factory implements Job.Factory<AttributesMigrationJob> {
|
||||
@Override
|
||||
public @NonNull AttributesMigrationJob create(@NonNull Parameters parameters, @NonNull Data data) {
|
||||
return new AttributesMigrationJob(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user