diff --git a/app/src/main/java/org/thoughtcrime/securesms/AppCapabilities.java b/app/src/main/java/org/thoughtcrime/securesms/AppCapabilities.java index 6bb9f9de3..e6cec6301 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/AppCapabilities.java +++ b/app/src/main/java/org/thoughtcrime/securesms/AppCapabilities.java @@ -1,5 +1,6 @@ package org.thoughtcrime.securesms; +import org.thoughtcrime.securesms.util.FeatureFlags; import org.whispersystems.signalservice.api.account.AccountAttributes; public final class AppCapabilities { @@ -10,13 +11,12 @@ public final class AppCapabilities { private static final boolean UUID_CAPABLE = false; private static final boolean GV2_CAPABLE = true; private static final boolean GV1_MIGRATION = true; - private static final boolean SENDER_KEY = 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, GV1_MIGRATION, SENDER_KEY); + return new AccountAttributes.Capabilities(UUID_CAPABLE, GV2_CAPABLE, storageCapable, GV1_MIGRATION, FeatureFlags.senderKey()); } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/migrations/ApplicationMigrations.java b/app/src/main/java/org/thoughtcrime/securesms/migrations/ApplicationMigrations.java index 98b3caa2e..60434eb32 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/migrations/ApplicationMigrations.java +++ b/app/src/main/java/org/thoughtcrime/securesms/migrations/ApplicationMigrations.java @@ -40,7 +40,7 @@ public class ApplicationMigrations { private static final int LEGACY_CANONICAL_VERSION = 455; - public static final int CURRENT_VERSION = 35; + public static final int CURRENT_VERSION = 36; private static final class Version { static final int LEGACY = 1; @@ -77,6 +77,7 @@ public class ApplicationMigrations { static final int SMS_STORAGE_SYNC = 33; static final int APPLY_UNIVERSAL_EXPIRE = 34; static final int SENDER_KEY = 35; + static final int SENDER_KEY_2 = 36; } /** @@ -327,6 +328,10 @@ public class ApplicationMigrations { jobs.put(Version.SENDER_KEY, new AttributesMigrationJob()); } + if (lastSeenVersion < Version.SENDER_KEY_2) { + jobs.put(Version.SENDER_KEY_2, new AttributesMigrationJob()); + } + return jobs; } diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/FeatureFlags.java b/app/src/main/java/org/thoughtcrime/securesms/util/FeatureFlags.java index 5a852f1ed..9d9e74564 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/FeatureFlags.java +++ b/app/src/main/java/org/thoughtcrime/securesms/util/FeatureFlags.java @@ -14,6 +14,7 @@ import org.signal.core.util.logging.Log; import org.thoughtcrime.securesms.BuildConfig; import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; import org.thoughtcrime.securesms.groups.SelectionLimits; +import org.thoughtcrime.securesms.jobs.RefreshAttributesJob; import org.thoughtcrime.securesms.jobs.RemoteConfigRefreshJob; import org.thoughtcrime.securesms.keyvalue.SignalStore; import org.thoughtcrime.securesms.messageprocessingalarm.MessageProcessReceiver; @@ -179,6 +180,7 @@ public final class FeatureFlags { */ private static final Map FLAG_CHANGE_LISTENERS = new HashMap() {{ put(MESSAGE_PROCESSOR_ALARM_INTERVAL, change -> MessageProcessReceiver.startOrUpdateAlarm(ApplicationDependencies.getApplication())); + put(SENDER_KEY, change -> ApplicationDependencies.getJobManager().add(new RefreshAttributesJob())); }}; private static final Map REMOTE_VALUES = new TreeMap<>();