mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-07 13:55:56 +01:00
Add more checks to avoid unnecessary websocket connects.
This commit is contained in:
+1
-1
@@ -399,7 +399,7 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
};
|
||||
|
||||
SignalWebSocket.AuthenticatedWebSocket webSocket = new SignalWebSocket.AuthenticatedWebSocket(authFactory,
|
||||
() -> !SignalStore.misc().isClientDeprecated() && !DeviceTransferBlockingInterceptor.getInstance().isBlockingNetwork() && !Environment.IS_INSTRUMENTATION,
|
||||
() -> !SignalStore.misc().isClientDeprecated() && SignalStore.account().isRegistered() && !TextSecurePreferences.isUnauthorizedReceived(context) && !DeviceTransferBlockingInterceptor.getInstance().isBlockingNetwork() && !Environment.IS_INSTRUMENTATION,
|
||||
sleepTimer,
|
||||
TimeUnit.SECONDS.toMillis(30));
|
||||
if (AppForegroundObserver.isForegrounded()) {
|
||||
|
||||
@@ -271,7 +271,7 @@ class IncomingMessageObserver(
|
||||
}
|
||||
|
||||
private fun isConnectionAvailable(): Boolean {
|
||||
return SignalStore.account.isRegistered && (authWebSocket.stateSnapshot == WebSocketConnectionState.CONNECTED || (authWebSocket.shouldSendKeepAlives() && NetworkConstraint.isMet(context)))
|
||||
return !TextSecurePreferences.isUnauthorizedReceived(context) && SignalStore.account.isRegistered && (authWebSocket.stateSnapshot == WebSocketConnectionState.CONNECTED || (authWebSocket.shouldSendKeepAlives() && NetworkConstraint.isMet(context)))
|
||||
}
|
||||
|
||||
private fun waitForConnectionNecessary() {
|
||||
|
||||
Reference in New Issue
Block a user