mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Remove E164s most places and prefer ServiceId more places.\
This commit is contained in:
committed by
Alex Hart
parent
d6b6884c69
commit
935dd7de45
@@ -48,7 +48,6 @@ import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.wallpaper.ChatWallpaper;
|
||||
import org.whispersystems.libsignal.util.guava.Optional;
|
||||
import org.whispersystems.libsignal.util.guava.Preconditions;
|
||||
import org.whispersystems.signalservice.api.push.ACI;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.PNI;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
@@ -317,8 +316,8 @@ public class Recipient {
|
||||
RecipientId id = null;
|
||||
|
||||
if (UuidUtil.isUuid(identifier)) {
|
||||
ACI uuid = ACI.parseOrThrow(identifier);
|
||||
id = db.getOrInsertFromServiceId(uuid);
|
||||
ServiceId serviceId = ServiceId.parseOrThrow(identifier);
|
||||
id = db.getOrInsertFromServiceId(serviceId);
|
||||
} else if (GroupId.isEncodedGroup(identifier)) {
|
||||
id = db.getOrInsertFromGroupId(GroupId.parseOrThrow(identifier));
|
||||
} else if (NumberUtil.isValidEmail(identifier)) {
|
||||
|
||||
@@ -11,10 +11,8 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.util.DelimiterUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.whispersystems.signalservice.api.push.ACI;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
@@ -66,7 +64,7 @@ public class RecipientId implements Parcelable, Comparable<RecipientId> {
|
||||
@AnyThread
|
||||
public static @NonNull RecipientId fromExternalPush(@NonNull String identifier) {
|
||||
if (UuidUtil.isUuid(identifier)) {
|
||||
return from(ACI.parseOrThrow(identifier), null);
|
||||
return from(ServiceId.parseOrThrow(identifier), null);
|
||||
} else {
|
||||
return from(null, identifier);
|
||||
}
|
||||
@@ -86,17 +84,17 @@ public class RecipientId implements Parcelable, Comparable<RecipientId> {
|
||||
*/
|
||||
@AnyThread
|
||||
@SuppressLint("WrongThread")
|
||||
public static @NonNull RecipientId from(@Nullable ServiceId aci, @Nullable String e164) {
|
||||
return from(aci, e164, false);
|
||||
public static @NonNull RecipientId from(@Nullable ServiceId serviceId, @Nullable String e164) {
|
||||
return from(serviceId, e164, false);
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
@SuppressLint("WrongThread")
|
||||
private static @NonNull RecipientId from(@Nullable ServiceId aci, @Nullable String e164, boolean highTrust) {
|
||||
RecipientId recipientId = RecipientIdCache.INSTANCE.get(aci, e164);
|
||||
private static @NonNull RecipientId from(@Nullable ServiceId serviceId, @Nullable String e164, boolean highTrust) {
|
||||
RecipientId recipientId = RecipientIdCache.INSTANCE.get(serviceId, e164);
|
||||
|
||||
if (recipientId == null) {
|
||||
Recipient recipient = Recipient.externalPush(aci, e164, highTrust);
|
||||
Recipient recipient = Recipient.externalPush(serviceId, e164, highTrust);
|
||||
RecipientIdCache.INSTANCE.put(recipient);
|
||||
recipientId = recipient.getId();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user