kopia lustrzana https://github.com/ryukoposting/Signal-Android
Remove dead code referencing the old way directory lookup was performed.
rodzic
0edfb0bd68
commit
dccfafa9e8
|
@ -416,44 +416,6 @@ public class SignalServiceAccountManager {
|
|||
return pushServiceSocket.isIdentifierRegistered(identifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a contact is currently registered with the server.
|
||||
*
|
||||
* @param e164number The contact to check.
|
||||
* @return An optional ContactTokenDetails, present if registered, absent if not.
|
||||
* @throws IOException
|
||||
*/
|
||||
public Optional<ContactTokenDetails> getContact(String e164number) throws IOException {
|
||||
String contactToken = createDirectoryServerToken(e164number, true);
|
||||
ContactTokenDetails contactTokenDetails = this.pushServiceSocket.getContactTokenDetails(contactToken);
|
||||
|
||||
if (contactTokenDetails != null) {
|
||||
contactTokenDetails.setNumber(e164number);
|
||||
}
|
||||
|
||||
return Optional.fromNullable(contactTokenDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks which contacts in a set are registered with the server.
|
||||
*
|
||||
* @param e164numbers The contacts to check.
|
||||
* @return A list of ContactTokenDetails for the registered users.
|
||||
* @throws IOException
|
||||
*/
|
||||
public List<ContactTokenDetails> getContacts(Set<String> e164numbers)
|
||||
throws IOException
|
||||
{
|
||||
Map<String, String> contactTokensMap = createDirectoryServerTokenMap(e164numbers);
|
||||
List<ContactTokenDetails> activeTokens = this.pushServiceSocket.retrieveDirectory(contactTokensMap.keySet());
|
||||
|
||||
for (ContactTokenDetails activeToken : activeTokens) {
|
||||
activeToken.setNumber(contactTokensMap.get(activeToken.getToken()));
|
||||
}
|
||||
|
||||
return activeTokens;
|
||||
}
|
||||
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
public Map<String, ACI> getRegisteredUsers(KeyStore iasKeyStore, Set<String> e164numbers, String mrenclave)
|
||||
throws IOException, Quote.InvalidQuoteFormatException, UnauthenticatedQuoteException, SignatureException, UnauthenticatedResponseException, InvalidKeyException
|
||||
|
|
|
@ -203,10 +203,7 @@ public class PushServiceSocket {
|
|||
private static final String PROVISIONING_MESSAGE_PATH = "/v1/provisioning/%s";
|
||||
private static final String DEVICE_PATH = "/v1/devices/%s";
|
||||
|
||||
private static final String DIRECTORY_TOKENS_PATH = "/v1/directory/tokens";
|
||||
private static final String DIRECTORY_VERIFY_PATH = "/v1/directory/%s";
|
||||
private static final String DIRECTORY_AUTH_PATH = "/v1/directory/auth";
|
||||
private static final String DIRECTORY_FEEDBACK_PATH = "/v1/directory/feedback-v3/%s";
|
||||
private static final String MESSAGE_PATH = "/v1/messages/%s";
|
||||
private static final String GROUP_MESSAGE_PATH = "/v1/messages/multi_recipient?ts=%s&online=%s";
|
||||
private static final String SENDER_ACK_MESSAGE_PATH = "/v1/messages/%s/%d";
|
||||
|
@ -979,30 +976,6 @@ public class PushServiceSocket {
|
|||
}
|
||||
}
|
||||
|
||||
public List<ContactTokenDetails> retrieveDirectory(Set<String> contactTokens)
|
||||
throws NonSuccessfulResponseCodeException, PushNetworkException, MalformedResponseException
|
||||
{
|
||||
try {
|
||||
ContactTokenList contactTokenList = new ContactTokenList(new LinkedList<>(contactTokens));
|
||||
String response = makeServiceRequest(DIRECTORY_TOKENS_PATH, "PUT", JsonUtil.toJson(contactTokenList));
|
||||
ContactTokenDetailsList activeTokens = JsonUtil.fromJson(response, ContactTokenDetailsList.class);
|
||||
|
||||
return activeTokens.getContacts();
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
throw new MalformedResponseException("Unable to parse entity", e);
|
||||
}
|
||||
}
|
||||
|
||||
public ContactTokenDetails getContactTokenDetails(String contactToken) throws IOException {
|
||||
try {
|
||||
String response = makeServiceRequest(String.format(DIRECTORY_VERIFY_PATH, contactToken), "GET", null);
|
||||
return JsonUtil.fromJson(response, ContactTokenDetails.class);
|
||||
} catch (NotFoundException nfe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private AuthCredentials getAuthCredentials(String authPath) throws IOException {
|
||||
String response = makeServiceRequest(authPath, "GET", null, NO_HEADERS);
|
||||
AuthCredentials token = JsonUtil.fromJson(response, AuthCredentials.class);
|
||||
|
|
Ładowanie…
Reference in New Issue