Put send viewed receipts behind a feature flag.

This commit is contained in:
Cody Henthorne 2020-12-02 20:15:26 -05:00
parent cf7fb7e1a2
commit 25bffa6d56
2 changed files with 10 additions and 2 deletions

View file

@ -14,6 +14,7 @@ import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.recipients.RecipientUtil;
import org.thoughtcrime.securesms.util.FeatureFlags;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
@ -89,7 +90,7 @@ public class SendViewedReceiptJob extends BaseJob {
@Override
public void onRun() throws IOException, UntrustedIdentityException {
if (!TextSecurePreferences.isReadReceiptsEnabled(context) || syncTimestamps.isEmpty()) return;
if (!TextSecurePreferences.isReadReceiptsEnabled(context) || syncTimestamps.isEmpty() || !FeatureFlags.sendViewedReceipts()) return;
if (!RecipientUtil.isMessageRequestAccepted(context, threadId)) {
Log.w(TAG, "Refusing to send receipts to untrusted recipient");

View file

@ -63,6 +63,7 @@ public final class FeatureFlags {
private static final String GV1_AUTO_MIGRATE = "android.groupsV1Migration.auto.3";
private static final String GV1_MANUAL_MIGRATE = "android.groupsV1Migration.manual";
private static final String GV1_FORCED_MIGRATE = "android.groupsV1Migration.forced";
private static final String SEND_VIEWED_RECEIPTS = "android.sendViewedReceipts";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@ -81,7 +82,8 @@ public final class FeatureFlags {
GV1_AUTO_MIGRATE,
GV1_MANUAL_MIGRATE,
GV1_FORCED_MIGRATE,
GROUP_CALLING
GROUP_CALLING,
SEND_VIEWED_RECEIPTS
);
/**
@ -244,6 +246,11 @@ public final class FeatureFlags {
return getBoolean(GV1_FORCED_MIGRATE, false) && groupsV1ManualMigration() && groupsV1AutoMigration();
}
/** Whether or not to send viewed receipts. */
public static boolean sendViewedReceipts() {
return getBoolean(SEND_VIEWED_RECEIPTS, false);
}
/** Only for rendering debug info. */
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
return new TreeMap<>(REMOTE_VALUES);