mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-22 10:46:50 +00:00
Revert "Prevent changes to conversations while device is unregistered."
This reverts commit ed8edb5aee.
This commit is contained in:
@@ -70,10 +70,6 @@ public class PipeConnectivityListener implements ConnectivityListener {
|
||||
Log.w(TAG, "Encountered an error while we had a proxy set! Terminating the connection to prevent retry spam.");
|
||||
ApplicationDependencies.closeConnections();
|
||||
return false;
|
||||
} else if (TextSecurePreferences.isUnauthorizedRecieved(ApplicationDependencies.getApplication())) {
|
||||
Log.w(TAG, "Encountered an error while unregistered! Terminating the connection to prevent retry spam.");
|
||||
ApplicationDependencies.closeConnections();
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package org.thoughtcrime.securesms.net;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.signalservice.internal.push.PushServiceSocket;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Protocol;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
/**
|
||||
* Blocks network access when device is unregistered.
|
||||
*/
|
||||
public final class UnregisteredBlockingInterceptor implements Interceptor {
|
||||
|
||||
private static final String TAG = Log.tag(UnregisteredBlockingInterceptor.class);
|
||||
|
||||
@Override
|
||||
public @NonNull Response intercept(@NonNull Chain chain) throws IOException {
|
||||
if (TextSecurePreferences.isUnauthorizedRecieved(ApplicationDependencies.getApplication()) &&
|
||||
PushServiceSocket.isNotRegistrationPath(chain.request().url().encodedPath()))
|
||||
{
|
||||
Log.w(TAG, "Preventing request because device is unregistered.");
|
||||
return new Response.Builder().request(chain.request())
|
||||
.protocol(Protocol.HTTP_1_1)
|
||||
.receivedResponseAtMillis(System.currentTimeMillis())
|
||||
.message("")
|
||||
.body(ResponseBody.create(null, ""))
|
||||
.code(508)
|
||||
.build();
|
||||
}
|
||||
|
||||
return chain.proceed(chain.request());
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ package org.thoughtcrime.securesms.push;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
@@ -16,7 +16,6 @@ import org.thoughtcrime.securesms.net.DeviceTransferBlockingInterceptor;
|
||||
import org.thoughtcrime.securesms.net.RemoteDeprecationDetectorInterceptor;
|
||||
import org.thoughtcrime.securesms.net.SequentialDns;
|
||||
import org.thoughtcrime.securesms.net.StandardUserAgentInterceptor;
|
||||
import org.thoughtcrime.securesms.net.UnregisteredBlockingInterceptor;
|
||||
import org.thoughtcrime.securesms.util.Base64;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
@@ -35,6 +34,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import okhttp3.CipherSuite;
|
||||
import okhttp3.ConnectionSpec;
|
||||
import okhttp3.Dns;
|
||||
@@ -184,7 +185,6 @@ public class SignalServiceNetworkAccess {
|
||||
final List<Interceptor> interceptors = Arrays.asList(new StandardUserAgentInterceptor(),
|
||||
new RemoteDeprecationDetectorInterceptor(),
|
||||
new DeprecatedClientPreventionInterceptor(),
|
||||
new UnregisteredBlockingInterceptor(),
|
||||
DeviceTransferBlockingInterceptor.getInstance());
|
||||
final Optional<Dns> dns = Optional.of(DNS);
|
||||
|
||||
|
||||
@@ -466,12 +466,6 @@ public class TextSecurePreferences {
|
||||
}
|
||||
|
||||
public static void setUnauthorizedReceived(Context context, boolean value) {
|
||||
if (value) {
|
||||
ApplicationDependencies.closeConnections();
|
||||
} else {
|
||||
ApplicationDependencies.getIncomingMessageObserver();
|
||||
}
|
||||
|
||||
setBooleanPreference(context, UNAUTHORIZED_RECEIVED, value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user