Search in sources :

Example 1 with UptimeSleepTimer

use of org.whispersystems.signalservice.api.util.UptimeSleepTimer in project Signal-Android by WhisperSystems.

the class ApplicationDependencyProvider method provideSignalWebSocket.

@Override
@NonNull
public SignalWebSocket provideSignalWebSocket() {
    SleepTimer sleepTimer = SignalStore.account().isFcmEnabled() ? new UptimeSleepTimer() : new AlarmSleepTimer(context);
    SignalWebSocketHealthMonitor healthMonitor = new SignalWebSocketHealthMonitor(context, sleepTimer);
    SignalWebSocket signalWebSocket = new SignalWebSocket(provideWebSocketFactory(healthMonitor));
    healthMonitor.monitor(signalWebSocket);
    return signalWebSocket;
}
Also used : SleepTimer(org.whispersystems.signalservice.api.util.SleepTimer) UptimeSleepTimer(org.whispersystems.signalservice.api.util.UptimeSleepTimer) AlarmSleepTimer(org.thoughtcrime.securesms.util.AlarmSleepTimer) UptimeSleepTimer(org.whispersystems.signalservice.api.util.UptimeSleepTimer) SignalWebSocketHealthMonitor(org.thoughtcrime.securesms.net.SignalWebSocketHealthMonitor) SignalWebSocket(org.whispersystems.signalservice.api.SignalWebSocket) AlarmSleepTimer(org.thoughtcrime.securesms.util.AlarmSleepTimer) NonNull(androidx.annotation.NonNull)

Example 2 with UptimeSleepTimer

use of org.whispersystems.signalservice.api.util.UptimeSleepTimer in project Signal-Android by signalapp.

the class ApplicationDependencyProvider method provideSignalWebSocket.

@Override
@NonNull
public SignalWebSocket provideSignalWebSocket() {
    SleepTimer sleepTimer = SignalStore.account().isFcmEnabled() ? new UptimeSleepTimer() : new AlarmSleepTimer(context);
    SignalWebSocketHealthMonitor healthMonitor = new SignalWebSocketHealthMonitor(context, sleepTimer);
    SignalWebSocket signalWebSocket = new SignalWebSocket(provideWebSocketFactory(healthMonitor));
    healthMonitor.monitor(signalWebSocket);
    return signalWebSocket;
}
Also used : SleepTimer(org.whispersystems.signalservice.api.util.SleepTimer) UptimeSleepTimer(org.whispersystems.signalservice.api.util.UptimeSleepTimer) AlarmSleepTimer(org.thoughtcrime.securesms.util.AlarmSleepTimer) UptimeSleepTimer(org.whispersystems.signalservice.api.util.UptimeSleepTimer) SignalWebSocketHealthMonitor(org.thoughtcrime.securesms.net.SignalWebSocketHealthMonitor) SignalWebSocket(org.whispersystems.signalservice.api.SignalWebSocket) AlarmSleepTimer(org.thoughtcrime.securesms.util.AlarmSleepTimer) NonNull(androidx.annotation.NonNull)

Example 3 with UptimeSleepTimer

use of org.whispersystems.signalservice.api.util.UptimeSleepTimer in project mollyim-android by mollyim.

the class ApplicationDependencyProvider method provideSignalWebSocket.

@Override
@NonNull
public SignalWebSocket provideSignalWebSocket() {
    SleepTimer sleepTimer = SignalStore.account().isFcmEnabled() ? new UptimeSleepTimer() : new AlarmSleepTimer(context);
    SignalWebSocketHealthMonitor healthMonitor = new SignalWebSocketHealthMonitor(context, sleepTimer);
    SignalWebSocket signalWebSocket = new SignalWebSocket(provideWebSocketFactory(healthMonitor));
    healthMonitor.monitor(signalWebSocket);
    return signalWebSocket;
}
Also used : SleepTimer(org.whispersystems.signalservice.api.util.SleepTimer) UptimeSleepTimer(org.whispersystems.signalservice.api.util.UptimeSleepTimer) AlarmSleepTimer(org.thoughtcrime.securesms.util.AlarmSleepTimer) UptimeSleepTimer(org.whispersystems.signalservice.api.util.UptimeSleepTimer) SignalWebSocketHealthMonitor(org.thoughtcrime.securesms.net.SignalWebSocketHealthMonitor) SignalWebSocket(org.whispersystems.signalservice.api.SignalWebSocket) AlarmSleepTimer(org.thoughtcrime.securesms.util.AlarmSleepTimer) NonNull(androidx.annotation.NonNull)

Example 4 with UptimeSleepTimer

use of org.whispersystems.signalservice.api.util.UptimeSleepTimer in project signal-cli by AsamK.

the class SignalDependencies method getSignalWebSocket.

public SignalWebSocket getSignalWebSocket() {
    return getOrCreate(() -> signalWebSocket, () -> {
        final var timer = new UptimeSleepTimer();
        final var healthMonitor = new SignalWebSocketHealthMonitor(timer);
        final var webSocketFactory = new WebSocketFactory() {

            @Override
            public WebSocketConnection createWebSocket() {
                return new WebSocketConnection("normal", serviceEnvironmentConfig.getSignalServiceConfiguration(), Optional.of(credentialsProvider), userAgent, healthMonitor);
            }

            @Override
            public WebSocketConnection createUnidentifiedWebSocket() {
                return new WebSocketConnection("unidentified", serviceEnvironmentConfig.getSignalServiceConfiguration(), Optional.empty(), userAgent, healthMonitor);
            }
        };
        signalWebSocket = new SignalWebSocket(webSocketFactory);
        healthMonitor.monitor(signalWebSocket);
    });
}
Also used : UptimeSleepTimer(org.whispersystems.signalservice.api.util.UptimeSleepTimer) WebSocketConnection(org.whispersystems.signalservice.internal.websocket.WebSocketConnection) WebSocketFactory(org.whispersystems.signalservice.api.websocket.WebSocketFactory) SignalWebSocket(org.whispersystems.signalservice.api.SignalWebSocket)

Aggregations

SignalWebSocket (org.whispersystems.signalservice.api.SignalWebSocket)4 UptimeSleepTimer (org.whispersystems.signalservice.api.util.UptimeSleepTimer)4 NonNull (androidx.annotation.NonNull)3 SignalWebSocketHealthMonitor (org.thoughtcrime.securesms.net.SignalWebSocketHealthMonitor)3 AlarmSleepTimer (org.thoughtcrime.securesms.util.AlarmSleepTimer)3 SleepTimer (org.whispersystems.signalservice.api.util.SleepTimer)3 WebSocketFactory (org.whispersystems.signalservice.api.websocket.WebSocketFactory)1 WebSocketConnection (org.whispersystems.signalservice.internal.websocket.WebSocketConnection)1