mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Remove android.libsignalWebSocketEnabled flag and always use LibSignalChatConnection.
This commit is contained in:
@@ -121,7 +121,6 @@ import org.whispersystems.signalservice.internal.configuration.SignalServiceConf
|
||||
import org.whispersystems.signalservice.internal.push.PushServiceSocket;
|
||||
import org.whispersystems.signalservice.internal.websocket.LibSignalChatConnection;
|
||||
import org.whispersystems.signalservice.internal.websocket.LibSignalNetworkExtensions;
|
||||
import org.whispersystems.signalservice.internal.websocket.OkHttpWebSocketConnection;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -327,23 +326,6 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
return new PendingRetryReceiptCache();
|
||||
}
|
||||
|
||||
private boolean shouldUseLibsignalForWebsocket(@NonNull SignalServiceConfiguration signalServiceConfiguration) {
|
||||
if (RemoteConfig.libSignalWebSocketEnabled()) {
|
||||
if (RemoteConfig.libSignalWebSocketEnabledForProxies()) {
|
||||
return true;
|
||||
} else {
|
||||
// libsignalWebSocketEnabled = true but libsignalWebSocketEnabledForProxies = false
|
||||
if (signalServiceConfiguration.getCensored() ||
|
||||
signalServiceConfiguration.getSignalProxy().isPresent()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public @NonNull SignalWebSocket.AuthenticatedWebSocket provideAuthWebSocket(@NonNull Supplier<SignalServiceConfiguration> signalServiceConfigurationSupplier, @NonNull Supplier<Network> libSignalNetworkSupplier) {
|
||||
SleepTimer sleepTimer = !SignalStore.account().isFcmEnabled() || SignalStore.internal().isWebsocketModeForced() ? new AlarmSleepTimer(context) : new UptimeSleepTimer();
|
||||
@@ -356,21 +338,12 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
throw new WebSocketUnavailableException("Invalid auth credentials");
|
||||
}
|
||||
|
||||
if (shouldUseLibsignalForWebsocket(signalServiceConfigurationSupplier.get())) {
|
||||
Network network = libSignalNetworkSupplier.get();
|
||||
return new LibSignalChatConnection("libsignal-auth",
|
||||
network,
|
||||
credentialsProvider,
|
||||
Stories.isFeatureEnabled(),
|
||||
healthMonitor);
|
||||
} else {
|
||||
return new OkHttpWebSocketConnection("auth",
|
||||
signalServiceConfigurationSupplier.get(),
|
||||
Optional.of(credentialsProvider),
|
||||
BuildConfig.SIGNAL_AGENT,
|
||||
healthMonitor,
|
||||
Stories.isFeatureEnabled());
|
||||
}
|
||||
Network network = libSignalNetworkSupplier.get();
|
||||
return new LibSignalChatConnection("libsignal-auth",
|
||||
network,
|
||||
credentialsProvider,
|
||||
Stories.isFeatureEnabled(),
|
||||
healthMonitor);
|
||||
};
|
||||
|
||||
SignalWebSocket.AuthenticatedWebSocket webSocket = new SignalWebSocket.AuthenticatedWebSocket(authFactory,
|
||||
@@ -392,21 +365,12 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
SignalWebSocketHealthMonitor healthMonitor = new SignalWebSocketHealthMonitor(sleepTimer);
|
||||
|
||||
WebSocketFactory unauthFactory = () -> {
|
||||
if (shouldUseLibsignalForWebsocket(signalServiceConfigurationSupplier.get())) {
|
||||
Network network = libSignalNetworkSupplier.get();
|
||||
return new LibSignalChatConnection("libsignal-unauth",
|
||||
network,
|
||||
null,
|
||||
Stories.isFeatureEnabled(),
|
||||
healthMonitor);
|
||||
} else {
|
||||
return new OkHttpWebSocketConnection("unauth",
|
||||
signalServiceConfigurationSupplier.get(),
|
||||
Optional.empty(),
|
||||
BuildConfig.SIGNAL_AGENT,
|
||||
healthMonitor,
|
||||
Stories.isFeatureEnabled());
|
||||
}
|
||||
Network network = libSignalNetworkSupplier.get();
|
||||
return new LibSignalChatConnection("libsignal-unauth",
|
||||
network,
|
||||
null,
|
||||
Stories.isFeatureEnabled(),
|
||||
healthMonitor);
|
||||
};
|
||||
|
||||
SignalWebSocket.UnauthenticatedWebSocket webSocket = new SignalWebSocket.UnauthenticatedWebSocket(unauthFactory,
|
||||
|
||||
@@ -1054,28 +1054,6 @@ object RemoteConfig {
|
||||
value.asLong(8.kibiBytes.inWholeBytes).bytes
|
||||
}
|
||||
|
||||
/** Whether the chat web socket is backed by libsignal for direct connections */
|
||||
@JvmStatic
|
||||
@get:JvmName("libSignalWebSocketEnabled")
|
||||
val libSignalWebSocketEnabled: Boolean by remoteValue(
|
||||
key = "android.libsignalWebSocketEnabled.8",
|
||||
hotSwappable = false
|
||||
) { value ->
|
||||
value.asBoolean(false) || Environment.IS_NIGHTLY
|
||||
}
|
||||
|
||||
/** Whether the chat web socket is backed by libsignal for all connections, including proxied connections.
|
||||
* Note, this does *not* gate HTTP proxies, which are treated as direct connections.
|
||||
* This only has an effect if libSignalWebSocketEnabled is also enabled. */
|
||||
@JvmStatic
|
||||
@get:JvmName("libSignalWebSocketEnabledForProxies")
|
||||
val libSignalWebSocketEnabledForProxies: Boolean by remoteValue(
|
||||
key = "android.libSignalWebSocketEnabledForProxies.8",
|
||||
hotSwappable = false
|
||||
) { value ->
|
||||
value.asBoolean(false) || Environment.IS_NIGHTLY
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@get:JvmName("libsignalEnforceMinTlsVersion")
|
||||
val libsignalEnforceMinTlsVersion by remoteBoolean(
|
||||
|
||||
Reference in New Issue
Block a user