Handle the sender key capability better.

fork-5.53.8
Greyson Parrelli 2021-06-09 09:56:21 -04:00
rodzic 335ff61011
commit 7833d7c99a
3 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -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());
}
}

Wyświetl plik

@ -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;
}

Wyświetl plik

@ -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<String, OnFlagChange> FLAG_CHANGE_LISTENERS = new HashMap<String, OnFlagChange>() {{
put(MESSAGE_PROCESSOR_ALARM_INTERVAL, change -> MessageProcessReceiver.startOrUpdateAlarm(ApplicationDependencies.getApplication()));
put(SENDER_KEY, change -> ApplicationDependencies.getJobManager().add(new RefreshAttributesJob()));
}};
private static final Map<String, Object> REMOTE_VALUES = new TreeMap<>();