Utilize RecipientIdCache during message processing.

This commit is contained in:
Greyson Parrelli
2021-05-11 12:19:07 -04:00
committed by GitHub
parent 1fb3290038
commit 260575d139
3 changed files with 31 additions and 16 deletions

View File

@@ -15,6 +15,7 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.util.DelimiterUtil;
import org.thoughtcrime.securesms.util.Util;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.util.UuidUtil;
import java.util.ArrayList;
import java.util.Collection;
@@ -56,6 +57,20 @@ public class RecipientId implements Parcelable, Comparable<RecipientId> {
return from(address.getUuid().orNull(), address.getNumber().orNull(), false);
}
/**
* Used for when you have a string that could be either a UUID or an e164. This was primarily
* created for interacting with protocol stores.
* @param identifier A UUID or e164
*/
@AnyThread
public static @NonNull RecipientId fromExternalPush(@NonNull String identifier) {
if (UuidUtil.isUuid(identifier)) {
return from(UuidUtil.parseOrThrow(identifier), null);
} else {
return from(null, identifier);
}
}
/**
* Indicates that the pairing is from a high-trust source.
* See {@link Recipient#externalHighTrustPush(Context, SignalServiceAddress)}