mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Prefer ServiceIds over SignalServiceAddresses.
This commit is contained in:
committed by
Alex Hart
parent
6d4dadea48
commit
3beb730edb
@@ -27,6 +27,7 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.mms.OutgoingExpirationUpdateMessage;
|
||||
import org.thoughtcrime.securesms.sms.MessageSender;
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NotFoundException;
|
||||
|
||||
@@ -39,6 +40,16 @@ public class RecipientUtil {
|
||||
|
||||
private static final String TAG = Log.tag(RecipientUtil.class);
|
||||
|
||||
/**
|
||||
* This method will do it's best to get a {@link ServiceId} for the provided recipient. This includes performing
|
||||
* a possible network request if no ServiceId is available. If the request to get a ServiceId fails or the user is
|
||||
* not registered, an IOException is thrown.
|
||||
*/
|
||||
@WorkerThread
|
||||
public static @NonNull ServiceId getOrFetchServiceId(@NonNull Context context, @NonNull Recipient recipient) throws IOException {
|
||||
return toSignalServiceAddress(context, recipient).getServiceId();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will do it's best to craft a fully-populated {@link SignalServiceAddress} based on
|
||||
* the provided recipient. This includes performing a possible network request if no UUID is
|
||||
|
||||
Reference in New Issue
Block a user