org.whispersystems.signalservice.api.util.SleepTimer Java Examples

The following examples show how to use org.whispersystems.signalservice.api.util.SleepTimer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SignalServiceMessageReceiver.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Construct a SignalServiceMessageReceiver.
 *
 * @param urls The URL of the Signal Service.
 * @param credentials The Signal Service user's credentials.
 */
public SignalServiceMessageReceiver(SignalServiceConfiguration urls,
                                    CredentialsProvider credentials,
                                    String signalAgent,
                                    ConnectivityListener listener,
                                    SleepTimer timer,
                                    ClientZkProfileOperations clientZkProfileOperations)
{
  this.urls                      = urls;
  this.credentialsProvider       = credentials;
  this.socket                    = new PushServiceSocket(urls, credentials, signalAgent, clientZkProfileOperations);
  this.signalAgent               = signalAgent;
  this.connectivityListener      = listener;
  this.sleepTimer                = timer;
  this.clientZkProfileOperations = clientZkProfileOperations;
}
 
Example #2
Source File: WebSocketConnection.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
public WebSocketConnection(String httpUri,
                           TrustStore trustStore,
                           Optional<CredentialsProvider> credentialsProvider,
                           String signalAgent,
                           ConnectivityListener listener,
                           SleepTimer timer,
                           List<Interceptor> interceptors,
                           Optional<Dns> dns)
{
  this.trustStore          = trustStore;
  this.credentialsProvider = credentialsProvider;
  this.signalAgent         = signalAgent;
  this.listener            = listener;
  this.sleepTimer          = timer;
  this.interceptors        = interceptors;
  this.dns                 = dns;
  this.attempts            = 0;
  this.connected           = false;

  String uri = httpUri.replace("https://", "wss://").replace("http://", "ws://");

  if (credentialsProvider.isPresent()) this.wsUri = uri + "/v1/websocket/?login=%s&password=%s";
  else                                 this.wsUri = uri + "/v1/websocket/";
}
 
Example #3
Source File: WebSocketConnection.java    From libsignal-service-java with GNU General Public License v3.0 6 votes vote down vote up
public WebSocketConnection(String httpUri,
                           TrustStore trustStore,
                           Optional<CredentialsProvider> credentialsProvider,
                           String userAgent,
                           ConnectivityListener listener,
                           SleepTimer timer)
{
  this.trustStore          = trustStore;
  this.credentialsProvider = credentialsProvider;
  this.userAgent           = userAgent;
  this.listener            = listener;
  this.sleepTimer          = timer;
  this.attempts            = 0;
  this.connected           = false;

  String uri = httpUri.replace("https://", "wss://").replace("http://", "ws://");

  if (credentialsProvider.isPresent()) this.wsUri = uri + "/v1/websocket/?login=%s&password=%s";
  else                                 this.wsUri = uri + "/v1/websocket/";
}
 
Example #4
Source File: SignalServiceMessageReceiver.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Construct a SignalServiceMessageReceiver.
 *
 * @param urls The URL of the Signal Service.
 * @param uuid The Signal Service UUID.
 * @param e164 The Signal Service phone number.
 * @param password The Signal Service user password.
 * @param signalingKey The 52 byte signaling key assigned to this user at registration.
 */
public SignalServiceMessageReceiver(SignalServiceConfiguration urls,
                                    UUID uuid, String e164, String password,
                                    String signalingKey, String signalAgent,
                                    ConnectivityListener listener,
                                    SleepTimer timer,
                                    ClientZkProfileOperations clientZkProfileOperations)
{
  this(urls, new StaticCredentialsProvider(uuid, e164, password, signalingKey), signalAgent, listener, timer, clientZkProfileOperations);
}
 
Example #5
Source File: ApplicationDependencyProvider.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public @NonNull SignalServiceMessageReceiver provideSignalServiceMessageReceiver() {
  SleepTimer sleepTimer = TextSecurePreferences.isFcmDisabled(context) ? new AlarmSleepTimer(context)
                                                                       : new UptimeSleepTimer();
  return new SignalServiceMessageReceiver(networkAccess.getConfiguration(context),
                                          new DynamicCredentialsProvider(context),
                                          BuildConfig.SIGNAL_AGENT,
                                          new PipeConnectivityListener(),
                                          sleepTimer,
                                          provideClientZkOperations().getProfileOperations());
}
 
Example #6
Source File: SignalServiceMessageReceiver.java    From libsignal-service-java with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Construct a SignalServiceMessageReceiver.
 *
 * @param urls The URL of the Signal Service.
 * @param credentials The Signal Service user's credentials.
 */
public SignalServiceMessageReceiver(SignalServiceConfiguration urls,
                                    CredentialsProvider credentials,
                                    String userAgent,
                                    ConnectivityListener listener,
                                    SleepTimer timer)
{
  this.urls                 = urls;
  this.credentialsProvider  = credentials;
  this.socket               = new PushServiceSocket(urls, credentials, userAgent);
  this.userAgent            = userAgent;
  this.connectivityListener = listener;
  this.sleepTimer           = timer;
}
 
Example #7
Source File: ProvisioningManager.java    From signal-cli with GNU General Public License v3.0 5 votes vote down vote up
public ProvisioningManager(String settingsPath, SignalServiceConfiguration serviceConfiguration, String userAgent) {
    this.pathConfig = PathConfig.createDefault(settingsPath);
    this.serviceConfiguration = serviceConfiguration;
    this.userAgent = userAgent;

    identityKey = KeyHelper.generateIdentityKeyPair();
    registrationId = KeyHelper.generateRegistrationId(false);
    password = KeyUtils.createPassword();
    final SleepTimer timer = new UptimeSleepTimer();
    accountManager = new SignalServiceAccountManager(serviceConfiguration, null, null, password, SignalServiceAddress.DEFAULT_DEVICE_ID, userAgent, timer);
}
 
Example #8
Source File: SignalServiceMessageReceiver.java    From libsignal-service-java with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Construct a SignalServiceMessageReceiver.
 *
 * @param urls The URL of the Signal Service.
 * @param uuid The Signal Service UUID.
 * @param e164 The Signal Service phone number.
 * @param password The Signal Service user password.
 * @param signalingKey The 52 byte signaling key assigned to this user at registration.
 */
public SignalServiceMessageReceiver(SignalServiceConfiguration urls,
                                    UUID uuid, String e164, String password,
                                    String signalingKey, String userAgent,
                                    ConnectivityListener listener,
                                    SleepTimer timer)
{
  this(urls, new StaticCredentialsProvider(uuid, e164, password, signalingKey), userAgent, listener, timer);
}