Prefer ServiceIds over SignalServiceAddresses.

This commit is contained in:
Greyson Parrelli
2022-07-08 09:09:27 -04:00
committed by Alex Hart
parent 6d4dadea48
commit 3beb730edb
18 changed files with 107 additions and 121 deletions

View File

@@ -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