Simply PushServiceSocket constructor.

This commit is contained in:
Moxie Marlinspike
2013-10-19 11:15:45 -07:00
parent 5b2caa0074
commit ca3c82f581
8 changed files with 52 additions and 30 deletions

View File

@@ -9,6 +9,7 @@ import android.os.PowerManager;
import android.util.Log;
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;
@@ -57,12 +58,10 @@ public class DirectoryRefreshService extends Service {
public void run() {
try {
Log.w("DirectoryRefreshService", "Refreshing directory...");
Directory directory = Directory.getInstance(context);
String localNumber = TextSecurePreferences.getLocalNumber(context);
String password = TextSecurePreferences.getPushServerPassword(context);
PushServiceSocket socket = new PushServiceSocket(context, localNumber, password);
Directory directory = Directory.getInstance(context);
PushServiceSocket socket = new PushServiceSocket(context, TextSecurePushCredentials.getInstance());
Set<String> eligibleContactTokens = directory.getPushEligibleContactTokens(localNumber);
Set<String> eligibleContactTokens = directory.getPushEligibleContactTokens(TextSecurePreferences.getLocalNumber(context));
List<ContactTokenDetails> activeTokens = socket.retrieveDirectory(eligibleContactTokens);
if (activeTokens != null) {

View File

@@ -10,6 +10,7 @@ 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;
import org.whispersystems.textsecure.crypto.InvalidMessageException;
@@ -97,10 +98,7 @@ public class PushDownloader {
}
private File downloadAttachment(long contentLocation) throws IOException {
String localNumber = TextSecurePreferences.getLocalNumber(context);
String password = TextSecurePreferences.getPushServerPassword(context);
PushServiceSocket socket = new PushServiceSocket(context, localNumber, password);
PushServiceSocket socket = new PushServiceSocket(context, TextSecurePushCredentials.getInstance());
return socket.retrieveAttachment(contentLocation);
}