mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 09:02:19 +00:00
Move directory refresh from a service over to a job.
// FREEBIE
This commit is contained in:
@@ -22,6 +22,8 @@ import org.whispersystems.libaxolotl.state.SignedPreKeyRecord;
|
||||
import org.whispersystems.libaxolotl.util.guava.Optional;
|
||||
import org.whispersystems.textsecure.api.push.ContactTokenDetails;
|
||||
import org.whispersystems.textsecure.api.push.TrustStore;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.NonSuccessfulResponseCodeException;
|
||||
import org.whispersystems.textsecure.api.push.exceptions.PushNetworkException;
|
||||
import org.whispersystems.textsecure.internal.push.PushServiceSocket;
|
||||
import org.whispersystems.textsecure.api.push.SignedPreKeyEntity;
|
||||
|
||||
@@ -86,7 +88,9 @@ public class TextSecureAccountManager {
|
||||
return Optional.fromNullable(this.pushServiceSocket.getContactTokenDetails(contactToken));
|
||||
}
|
||||
|
||||
public List<ContactTokenDetails> getContacts(Set<String> contactTokens) {
|
||||
public List<ContactTokenDetails> getContacts(Set<String> contactTokens)
|
||||
throws IOException
|
||||
{
|
||||
return this.pushServiceSocket.retrieveDirectory(contactTokens);
|
||||
}
|
||||
|
||||
|
||||
@@ -321,17 +321,14 @@ public class PushServiceSocket {
|
||||
downloadExternalFile(descriptor.getLocation(), destination);
|
||||
}
|
||||
|
||||
public List<ContactTokenDetails> retrieveDirectory(Set<String> contactTokens) {
|
||||
try {
|
||||
ContactTokenList contactTokenList = new ContactTokenList(new LinkedList<String>(contactTokens));
|
||||
String response = makeRequest(DIRECTORY_TOKENS_PATH, "PUT", new Gson().toJson(contactTokenList));
|
||||
ContactTokenDetailsList activeTokens = new Gson().fromJson(response, ContactTokenDetailsList.class);
|
||||
public List<ContactTokenDetails> retrieveDirectory(Set<String> contactTokens)
|
||||
throws NonSuccessfulResponseCodeException, PushNetworkException
|
||||
{
|
||||
ContactTokenList contactTokenList = new ContactTokenList(new LinkedList<>(contactTokens));
|
||||
String response = makeRequest(DIRECTORY_TOKENS_PATH, "PUT", new Gson().toJson(contactTokenList));
|
||||
ContactTokenDetailsList activeTokens = new Gson().fromJson(response, ContactTokenDetailsList.class);
|
||||
|
||||
return activeTokens.getContacts();
|
||||
} catch (IOException ioe) {
|
||||
Log.w("PushServiceSocket", ioe);
|
||||
return null;
|
||||
}
|
||||
return activeTokens.getContacts();
|
||||
}
|
||||
|
||||
public ContactTokenDetails getContactTokenDetails(String contactToken) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user