Having calling code specify push URL to library.

This commit is contained in:
Moxie Marlinspike
2013-11-20 00:45:51 -08:00
parent f8dda5afd6
commit dc73bc2a5c
11 changed files with 42 additions and 32 deletions

View File

@@ -1,6 +1,5 @@
package org.thoughtcrime.securesms.service;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
@@ -8,8 +7,10 @@ import android.os.IBinder;
import android.os.PowerManager;
import android.util.Log;
import org.thoughtcrime.securesms.Release;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.TextSecurePushCredentials;
import org.whispersystems.textsecure.directory.Directory;
import org.whispersystems.textsecure.push.ContactTokenDetails;
import org.whispersystems.textsecure.push.PushServiceSocket;
@@ -59,7 +60,7 @@ public class DirectoryRefreshService extends Service {
try {
Log.w("DirectoryRefreshService", "Refreshing directory...");
Directory directory = Directory.getInstance(context);
PushServiceSocket socket = new PushServiceSocket(context, TextSecurePushCredentials.getInstance());
PushServiceSocket socket = new PushServiceSocket(context, Release.PUSH_URL, TextSecurePushCredentials.getInstance());
Set<String> eligibleContactTokens = directory.getPushEligibleContactTokens(TextSecurePreferences.getLocalNumber(context));
List<ContactTokenDetails> activeTokens = socket.retrieveDirectory(eligibleContactTokens);

View File

@@ -6,10 +6,10 @@ import android.content.Intent;
import android.util.Log;
import android.util.Pair;
import org.thoughtcrime.securesms.Release;
import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.EncryptingPartDatabase;
import org.thoughtcrime.securesms.database.PartDatabase;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.TextSecurePushCredentials;
import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.textsecure.crypto.AttachmentCipherInputStream;
@@ -111,7 +111,7 @@ public class PushDownloader {
}
private File downloadAttachment(String relay, long contentLocation) throws IOException {
PushServiceSocket socket = new PushServiceSocket(context, TextSecurePushCredentials.getInstance());
PushServiceSocket socket = new PushServiceSocket(context, Release.PUSH_URL, TextSecurePushCredentials.getInstance());
return socket.retrieveAttachment(relay, contentLocation);
}

View File

@@ -11,7 +11,9 @@ import android.os.IBinder;
import android.util.Log;
import com.google.android.gcm.GCMRegistrar;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.Release;
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
import org.thoughtcrime.securesms.gcm.GcmIntentService;
import org.thoughtcrime.securesms.gcm.GcmRegistrationTimeoutException;
@@ -20,7 +22,6 @@ import org.whispersystems.textsecure.crypto.IdentityKey;
import org.whispersystems.textsecure.crypto.MasterSecret;
import org.whispersystems.textsecure.crypto.PreKeyUtil;
import org.whispersystems.textsecure.crypto.ecc.Curve;
import org.whispersystems.textsecure.crypto.ecc.ECPublicKey;
import org.whispersystems.textsecure.directory.Directory;
import org.whispersystems.textsecure.push.ContactTokenDetails;
import org.whispersystems.textsecure.push.PushServiceSocket;
@@ -197,7 +198,7 @@ public class RegistrationService extends Service {
initializeGcmRegistrationListener();
initializePreKeyGenerator(masterSecret);
PushServiceSocket socket = new PushServiceSocket(this, number, password);
PushServiceSocket socket = new PushServiceSocket(this, Release.PUSH_URL, number, password);
handleCommonRegistration(masterSecret, socket, number);
@@ -237,7 +238,7 @@ public class RegistrationService extends Service {
initializePreKeyGenerator(masterSecret);
setState(new RegistrationState(RegistrationState.STATE_CONNECTING, number));
PushServiceSocket socket = new PushServiceSocket(this, number, password);
PushServiceSocket socket = new PushServiceSocket(this, Release.PUSH_URL, number, password);
socket.createAccount(false);
setState(new RegistrationState(RegistrationState.STATE_VERIFYING, number));