mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-20 10:43:22 +00:00
Having calling code specify push URL to library.
This commit is contained in:
@@ -314,7 +314,8 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredSherlockPr
|
||||
protected Integer doInBackground(Void... params) {
|
||||
try {
|
||||
Context context = ApplicationPreferencesActivity.this;
|
||||
PushServiceSocket socket = new PushServiceSocket(context, TextSecurePushCredentials.getInstance());
|
||||
PushServiceSocket socket = new PushServiceSocket(context, Release.PUSH_URL,
|
||||
TextSecurePushCredentials.getInstance());
|
||||
|
||||
socket.unregisterGcmId();
|
||||
GCMRegistrar.unregister(context);
|
||||
|
@@ -29,8 +29,9 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.actionbarsherlock.app.SherlockActivity;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
|
||||
import org.thoughtcrime.securesms.service.RegistrationService;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.whispersystems.textsecure.push.PushServiceSocket;
|
||||
import org.whispersystems.textsecure.push.RateLimitException;
|
||||
import org.whispersystems.textsecure.util.PhoneNumberFormatter;
|
||||
@@ -497,7 +498,7 @@ public class RegistrationProgressActivity extends SherlockActivity {
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
try {
|
||||
PushServiceSocket socket = new PushServiceSocket(context, e164number, password);
|
||||
PushServiceSocket socket = new PushServiceSocket(context, Release.PUSH_URL, e164number, password);
|
||||
socket.verifyAccount(code, signalingKey);
|
||||
return SUCCESS;
|
||||
} catch (RateLimitException e) {
|
||||
@@ -584,7 +585,7 @@ public class RegistrationProgressActivity extends SherlockActivity {
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
try {
|
||||
PushServiceSocket socket = new PushServiceSocket(context, e164number, password);
|
||||
PushServiceSocket socket = new PushServiceSocket(context, Release.PUSH_URL, e164number, password);
|
||||
socket.createAccount(true);
|
||||
|
||||
return SUCCESS;
|
||||
|
8
src/org/thoughtcrime/securesms/Release.java
Normal file
8
src/org/thoughtcrime/securesms/Release.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
public class Release {
|
||||
|
||||
public static final String PUSH_URL = "https://textsecure-service.whispersystems.org";
|
||||
// public static final String PUSH_SERVICE_URL = "http://192.168.1.135:8080";
|
||||
|
||||
}
|
@@ -5,6 +5,8 @@ import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gcm.GCMBaseIntentService;
|
||||
|
||||
import org.thoughtcrime.securesms.Release;
|
||||
import org.thoughtcrime.securesms.service.RegistrationService;
|
||||
import org.thoughtcrime.securesms.service.SendReceiveService;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
@@ -32,7 +34,7 @@ public class GcmIntentService extends GCMBaseIntentService {
|
||||
sendBroadcast(intent);
|
||||
} else {
|
||||
try {
|
||||
PushServiceSocket pushSocket = new PushServiceSocket(context, TextSecurePushCredentials.getInstance());
|
||||
PushServiceSocket pushSocket = new PushServiceSocket(context, Release.PUSH_URL, TextSecurePushCredentials.getInstance());
|
||||
pushSocket.registerGcmId(registrationId);
|
||||
} catch (IOException e) {
|
||||
Log.w("GcmIntentService", e);
|
||||
@@ -43,7 +45,7 @@ public class GcmIntentService extends GCMBaseIntentService {
|
||||
@Override
|
||||
protected void onUnregistered(Context context, String registrationId) {
|
||||
try {
|
||||
PushServiceSocket pushSocket = new PushServiceSocket(context, TextSecurePushCredentials.getInstance());
|
||||
PushServiceSocket pushSocket = new PushServiceSocket(context, Release.PUSH_URL, TextSecurePushCredentials.getInstance());
|
||||
pushSocket.unregisterGcmId();
|
||||
} catch (IOException ioe) {
|
||||
Log.w("GcmIntentService", ioe);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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));
|
||||
|
@@ -22,6 +22,7 @@ import android.util.Log;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
|
||||
import org.thoughtcrime.securesms.Release;
|
||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||
import org.thoughtcrime.securesms.crypto.KeyExchangeProcessor;
|
||||
import org.thoughtcrime.securesms.database.model.SmsMessageRecord;
|
||||
@@ -74,7 +75,7 @@ public class PushTransport extends BaseTransport {
|
||||
TextSecurePushCredentials credentials = TextSecurePushCredentials.getInstance();
|
||||
Recipient recipient = message.getIndividualRecipient();
|
||||
long threadId = message.getThreadId();
|
||||
PushServiceSocket socket = new PushServiceSocket(context, credentials);
|
||||
PushServiceSocket socket = new PushServiceSocket(context, Release.PUSH_URL, credentials);
|
||||
PushDestination destination = PushDestination.create(context, credentials,
|
||||
recipient.getNumber());
|
||||
|
||||
@@ -96,7 +97,7 @@ public class PushTransport extends BaseTransport {
|
||||
{
|
||||
try {
|
||||
TextSecurePushCredentials credentials = TextSecurePushCredentials.getInstance();
|
||||
PushServiceSocket socket = new PushServiceSocket(context, credentials);
|
||||
PushServiceSocket socket = new PushServiceSocket(context, Release.PUSH_URL, credentials);
|
||||
String messageBody = PartParser.getMessageText(message.getBody());
|
||||
List<PushBody> pushBodies = new LinkedList<PushBody>();
|
||||
|
||||
|
@@ -18,8 +18,8 @@ package org.thoughtcrime.securesms.transport;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
import org.thoughtcrime.securesms.Release;
|
||||
import org.thoughtcrime.securesms.database.model.SmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.mms.MmsSendResult;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
@@ -133,7 +133,7 @@ public class UniversalTransport {
|
||||
return directory.isActiveNumber(destination);
|
||||
} catch (NotInDirectoryException e) {
|
||||
try {
|
||||
PushServiceSocket socket = new PushServiceSocket(context, TextSecurePushCredentials.getInstance());
|
||||
PushServiceSocket socket = new PushServiceSocket(context, Release.PUSH_URL, TextSecurePushCredentials.getInstance());
|
||||
String contactToken = directory.getToken(destination);
|
||||
ContactTokenDetails registeredUser = socket.getContactTokenDetails(contactToken);
|
||||
|
||||
|
Reference in New Issue
Block a user