Fix some missed cases for blocking unregistered sends.

This commit is contained in:
Greyson Parrelli 2021-05-26 12:02:19 -04:00
parent 98f432d23c
commit 65020dde1a
8 changed files with 15 additions and 2 deletions

View file

@ -1751,7 +1751,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
} }
Log.i(TAG, "Resolved registered state: " + registeredState); Log.i(TAG, "Resolved registered state: " + registeredState);
boolean signalEnabled = TextSecurePreferences.isPushRegistered(context); boolean signalEnabled = Recipient.self().isRegistered();
if (registeredState == RegisteredState.UNKNOWN) { if (registeredState == RegisteredState.UNKNOWN) {
try { try {

View file

@ -118,6 +118,7 @@ public final class PaymentNotificationSendJob extends BaseJob {
@Override @Override
protected boolean onShouldRetry(@NonNull Exception e) { protected boolean onShouldRetry(@NonNull Exception e) {
if (e instanceof ServerRejectedException) return false; if (e instanceof ServerRejectedException) return false;
if (e instanceof NotPushRegisteredException) return false;
return e instanceof IOException || return e instanceof IOException ||
e instanceof RetryLaterException; e instanceof RetryLaterException;
} }

View file

@ -123,6 +123,7 @@ public class ProfileKeySendJob extends BaseJob {
@Override @Override
protected boolean onShouldRetry(@NonNull Exception e) { protected boolean onShouldRetry(@NonNull Exception e) {
if (e instanceof ServerRejectedException) return false; if (e instanceof ServerRejectedException) return false;
if (e instanceof NotPushRegisteredException) return false;
return e instanceof IOException || return e instanceof IOException ||
e instanceof RetryLaterException; e instanceof RetryLaterException;
} }

View file

@ -151,6 +151,7 @@ public final class PushGroupSilentUpdateSendJob extends BaseJob {
@Override @Override
protected boolean onShouldRetry(@NonNull Exception e) { protected boolean onShouldRetry(@NonNull Exception e) {
if (e instanceof ServerRejectedException) return false; if (e instanceof ServerRejectedException) return false;
if (e instanceof NotPushRegisteredException) return false;
return e instanceof IOException || return e instanceof IOException ||
e instanceof RetryLaterException; e instanceof RetryLaterException;
} }

View file

@ -145,6 +145,10 @@ public abstract class PushSendJob extends SendJob {
return false; return false;
} }
if (exception instanceof NotPushRegisteredException) {
return false;
}
return exception instanceof IOException || return exception instanceof IOException ||
exception instanceof RetryLaterException || exception instanceof RetryLaterException ||
exception instanceof ProofRequiredException; exception instanceof ProofRequiredException;

View file

@ -186,6 +186,7 @@ public class ReactionSendJob extends BaseJob {
@Override @Override
protected boolean onShouldRetry(@NonNull Exception e) { protected boolean onShouldRetry(@NonNull Exception e) {
if (e instanceof ServerRejectedException) return false; if (e instanceof ServerRejectedException) return false;
if (e instanceof NotPushRegisteredException) return false;
return e instanceof IOException || return e instanceof IOException ||
e instanceof RetryLaterException; e instanceof RetryLaterException;
} }

View file

@ -159,6 +159,7 @@ public class RemoteDeleteSendJob extends BaseJob {
@Override @Override
protected boolean onShouldRetry(@NonNull Exception e) { protected boolean onShouldRetry(@NonNull Exception e) {
if (e instanceof ServerRejectedException) return false; if (e instanceof ServerRejectedException) return false;
if (e instanceof NotPushRegisteredException) return false;
return e instanceof IOException || return e instanceof IOException ||
e instanceof RetryLaterException; e instanceof RetryLaterException;
} }

View file

@ -5,6 +5,7 @@ import android.content.Context;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.thoughtcrime.securesms.keyvalue.SignalStore; import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.Util;
@ -24,6 +25,9 @@ final class LogSectionKeyPreferences implements LogSection {
.append("Default SMS : ").append(Util.isDefaultSmsProvider(context)).append("\n") .append("Default SMS : ").append(Util.isDefaultSmsProvider(context)).append("\n")
.append("Prefer Contact Photos: ").append(SignalStore.settings().isPreferSystemContactPhotos()).append("\n") .append("Prefer Contact Photos: ").append(SignalStore.settings().isPreferSystemContactPhotos()).append("\n")
.append("Call Bandwidth Mode : ").append(SignalStore.settings().getCallBandwidthMode()).append("\n") .append("Call Bandwidth Mode : ").append(SignalStore.settings().getCallBandwidthMode()).append("\n")
.append("Client Deprecated : ").append(SignalStore.misc().isClientDeprecated()).append("\n"); .append("Client Deprecated : ").append(SignalStore.misc().isClientDeprecated()).append("\n")
.append("Push Registered : ").append(TextSecurePreferences.isPushRegistered(context)).append("\n")
.append("Unauthorized Received: ").append(TextSecurePreferences.isUnauthorizedRecieved(context)).append("\n")
.append("self.isRegistered() : ").append(Recipient.self().isRegistered()).append("\n");
} }
} }