kopia lustrzana https://github.com/ryukoposting/Signal-Android
Inline GV1 auto-migration flag.
rodzic
372744178e
commit
f3ce582fa5
|
@ -8,14 +8,15 @@ public final class AppCapabilities {
|
|||
private AppCapabilities() {
|
||||
}
|
||||
|
||||
private static final boolean UUID_CAPABLE = false;
|
||||
private static final boolean GV2_CAPABLE = true;
|
||||
private static final boolean UUID_CAPABLE = false;
|
||||
private static final boolean GV2_CAPABLE = true;
|
||||
private static final boolean GV1_MIGRATION = true;
|
||||
|
||||
/**
|
||||
* @param storageCapable Whether or not the user can use storage service. This is another way of
|
||||
* asking if the user has set a Signal PIN or not.
|
||||
*/
|
||||
public static AccountAttributes.Capabilities getCapabilities(boolean storageCapable) {
|
||||
return new AccountAttributes.Capabilities(UUID_CAPABLE, GV2_CAPABLE, storageCapable, FeatureFlags.groupsV1AutoMigration());
|
||||
return new AccountAttributes.Capabilities(UUID_CAPABLE, GV2_CAPABLE, storageCapable, GV1_MIGRATION);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,11 +86,6 @@ public final class GroupsV1MigrationUtil {
|
|||
throw new InvalidMigrationStateException();
|
||||
}
|
||||
|
||||
if (!forced && !FeatureFlags.groupsV1AutoMigration()) {
|
||||
Log.w(TAG, "Auto migration is not enabled! Skipping.");
|
||||
throw new InvalidMigrationStateException();
|
||||
}
|
||||
|
||||
if (forced && !FeatureFlags.groupsV1ManualMigration()) {
|
||||
Log.w(TAG, "Manual migration is not enabled! Skipping.");
|
||||
throw new InvalidMigrationStateException();
|
||||
|
|
|
@ -87,11 +87,6 @@ public class GroupV1MigrationJob extends BaseJob {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!FeatureFlags.groupsV1AutoMigration()) {
|
||||
Log.i(TAG, "Auto-migration disabled. Not proactively searching for groups.");
|
||||
return;
|
||||
}
|
||||
|
||||
long timeSinceRefresh = System.currentTimeMillis() - SignalStore.misc().getLastGv1RoutineMigrationTime();
|
||||
|
||||
if (timeSinceRefresh < REFRESH_INTERVAL) {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class ApplicationMigrations {
|
|||
|
||||
private static final int LEGACY_CANONICAL_VERSION = 455;
|
||||
|
||||
public static final int CURRENT_VERSION = 23;
|
||||
public static final int CURRENT_VERSION = 24;
|
||||
|
||||
private static final class Version {
|
||||
static final int LEGACY = 1;
|
||||
|
@ -66,6 +66,7 @@ public class ApplicationMigrations {
|
|||
static final int GV2_2 = 21;
|
||||
static final int CDS = 22;
|
||||
static final int BACKUP_NOTIFICATION = 23;
|
||||
static final int GV1_MIGRATION = 24;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,6 +277,10 @@ public class ApplicationMigrations {
|
|||
jobs.put(Version.BACKUP_NOTIFICATION, new BackupNotificationMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.GV1_MIGRATION) {
|
||||
jobs.put(Version.GV1_MIGRATION, new AttributesMigrationJob());
|
||||
}
|
||||
|
||||
return jobs;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ public final class FeatureFlags {
|
|||
public static final String DONATE_MEGAPHONE = "android.donate";
|
||||
private static final String VIEWED_RECEIPTS = "android.viewed.receipts";
|
||||
private static final String GROUP_CALLING = "android.groupsv2.calling.2";
|
||||
private static final String GV1_AUTO_MIGRATE = "android.groupsV1Migration.auto.4";
|
||||
private static final String GV1_MANUAL_MIGRATE = "android.groupsV1Migration.manual";
|
||||
private static final String GV1_FORCED_MIGRATE = "android.groupsV1Migration.forced";
|
||||
private static final String GV1_MIGRATION_JOB = "android.groupsV1Migration.job";
|
||||
|
@ -81,7 +80,6 @@ public final class FeatureFlags {
|
|||
RESEARCH_MEGAPHONE_1,
|
||||
DONATE_MEGAPHONE,
|
||||
VIEWED_RECEIPTS,
|
||||
GV1_AUTO_MIGRATE,
|
||||
GV1_MIGRATION_JOB,
|
||||
GV1_MANUAL_MIGRATE,
|
||||
GV1_FORCED_MIGRATE,
|
||||
|
@ -132,7 +130,6 @@ public final class FeatureFlags {
|
|||
* desired test state.
|
||||
*/
|
||||
private static final Map<String, OnFlagChange> FLAG_CHANGE_LISTENERS = new HashMap<String, OnFlagChange>() {{
|
||||
put(GV1_AUTO_MIGRATE, change -> ApplicationDependencies.getJobManager().add(new RefreshAttributesJob()));
|
||||
}};
|
||||
|
||||
private static final Map<String, Object> REMOTE_VALUES = new TreeMap<>();
|
||||
|
@ -236,11 +233,6 @@ public final class FeatureFlags {
|
|||
return Build.VERSION.SDK_INT > 19 && getBoolean(GROUP_CALLING, false);
|
||||
}
|
||||
|
||||
/** Whether or not auto-migration from GV1->GV2 is enabled. */
|
||||
public static boolean groupsV1AutoMigration() {
|
||||
return getBoolean(GV1_AUTO_MIGRATE, false);
|
||||
}
|
||||
|
||||
/** Whether or not we should run the job to proactively migrate groups. */
|
||||
public static boolean groupsV1MigrationJob() {
|
||||
return getBoolean(GV1_MIGRATION_JOB, false);
|
||||
|
@ -248,12 +240,12 @@ public final class FeatureFlags {
|
|||
|
||||
/** Whether or not manual migration from GV1->GV2 is enabled. */
|
||||
public static boolean groupsV1ManualMigration() {
|
||||
return getBoolean(GV1_MANUAL_MIGRATE, false) && groupsV1AutoMigration();
|
||||
return getBoolean(GV1_MANUAL_MIGRATE, false);
|
||||
}
|
||||
|
||||
/** Whether or not forced migration from GV1->GV2 is enabled. */
|
||||
public static boolean groupsV1ForcedMigration() {
|
||||
return getBoolean(GV1_FORCED_MIGRATE, false) && groupsV1ManualMigration() && groupsV1AutoMigration();
|
||||
return getBoolean(GV1_FORCED_MIGRATE, false) && groupsV1ManualMigration();
|
||||
}
|
||||
|
||||
/** Whether or not to send viewed receipts. */
|
||||
|
|
Ładowanie…
Reference in New Issue