mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Generalize preventing WebSocket from connecting in various app states.
This commit is contained in:
committed by
Michelle Tang
parent
ecb040ce98
commit
fcc6032ee0
@@ -47,6 +47,7 @@ import org.thoughtcrime.securesms.jobs.TypingSendJob;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.megaphone.MegaphoneRepository;
|
||||
import org.thoughtcrime.securesms.messages.IncomingMessageObserver;
|
||||
import org.thoughtcrime.securesms.net.DeviceTransferBlockingInterceptor;
|
||||
import org.thoughtcrime.securesms.net.SignalWebSocketHealthMonitor;
|
||||
import org.thoughtcrime.securesms.net.StandardUserAgentInterceptor;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
@@ -339,7 +340,10 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
}
|
||||
};
|
||||
|
||||
SignalWebSocket.AuthenticatedWebSocket webSocket = new SignalWebSocket.AuthenticatedWebSocket(authFactory, sleepTimer, TimeUnit.SECONDS.toMillis(10));
|
||||
SignalWebSocket.AuthenticatedWebSocket webSocket = new SignalWebSocket.AuthenticatedWebSocket(authFactory,
|
||||
() -> !SignalStore.misc().isClientDeprecated() && !DeviceTransferBlockingInterceptor.getInstance().isBlockingNetwork(),
|
||||
sleepTimer,
|
||||
TimeUnit.SECONDS.toMillis(10));
|
||||
if (AppForegroundObserver.isForegrounded()) {
|
||||
webSocket.registerKeepAliveToken(SignalWebSocket.FOREGROUND_KEEPALIVE);
|
||||
}
|
||||
@@ -372,7 +376,10 @@ public class ApplicationDependencyProvider implements AppDependencies.Provider {
|
||||
}
|
||||
};
|
||||
|
||||
SignalWebSocket.UnauthenticatedWebSocket webSocket = new SignalWebSocket.UnauthenticatedWebSocket(unauthFactory, sleepTimer, TimeUnit.SECONDS.toMillis(10));
|
||||
SignalWebSocket.UnauthenticatedWebSocket webSocket = new SignalWebSocket.UnauthenticatedWebSocket(unauthFactory,
|
||||
() -> !SignalStore.misc().isClientDeprecated() && !DeviceTransferBlockingInterceptor.getInstance().isBlockingNetwork(),
|
||||
sleepTimer,
|
||||
TimeUnit.SECONDS.toMillis(10));
|
||||
if (AppForegroundObserver.isForegrounded()) {
|
||||
webSocket.registerKeepAliveToken(SignalWebSocket.FOREGROUND_KEEPALIVE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user