kopia lustrzana https://github.com/ryukoposting/Signal-Android
Put send viewed receipts behind a feature flag.
rodzic
cf7fb7e1a2
commit
25bffa6d56
|
@ -14,6 +14,7 @@ import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
import org.thoughtcrime.securesms.recipients.RecipientUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.FeatureFlags;
|
||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||||
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
|
||||||
|
@ -89,7 +90,7 @@ public class SendViewedReceiptJob extends BaseJob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRun() throws IOException, UntrustedIdentityException {
|
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)) {
|
if (!RecipientUtil.isMessageRequestAccepted(context, threadId)) {
|
||||||
Log.w(TAG, "Refusing to send receipts to untrusted recipient");
|
Log.w(TAG, "Refusing to send receipts to untrusted recipient");
|
||||||
|
|
|
@ -63,6 +63,7 @@ public final class FeatureFlags {
|
||||||
private static final String GV1_AUTO_MIGRATE = "android.groupsV1Migration.auto.3";
|
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_MANUAL_MIGRATE = "android.groupsV1Migration.manual";
|
||||||
private static final String GV1_FORCED_MIGRATE = "android.groupsV1Migration.forced";
|
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
|
* 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_AUTO_MIGRATE,
|
||||||
GV1_MANUAL_MIGRATE,
|
GV1_MANUAL_MIGRATE,
|
||||||
GV1_FORCED_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();
|
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. */
|
/** Only for rendering debug info. */
|
||||||
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
||||||
return new TreeMap<>(REMOTE_VALUES);
|
return new TreeMap<>(REMOTE_VALUES);
|
||||||
|
|
Ładowanie…
Reference in New Issue