mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Remove E164s most places and prefer ServiceId more places.\
This commit is contained in:
committed by
Alex Hart
parent
d6b6884c69
commit
935dd7de45
@@ -62,6 +62,7 @@ import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
|
||||
import org.whispersystems.signalservice.api.groupsv2.InvalidGroupStateException;
|
||||
import org.whispersystems.signalservice.api.groupsv2.NotAbleToApplyGroupV2ChangeException;
|
||||
import org.whispersystems.signalservice.api.push.ACI;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.AuthorizationFailedException;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.ConflictException;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
@@ -1193,7 +1194,7 @@ final class GroupManagerV2 {
|
||||
|
||||
private static @NonNull List<RecipientId> getPendingMemberRecipientIds(@NonNull List<DecryptedPendingMember> newPendingMembersList) {
|
||||
return Stream.of(DecryptedGroupUtil.pendingToUuidList(newPendingMembersList))
|
||||
.map(uuid -> RecipientId.from(ACI.from(uuid), null))
|
||||
.map(uuid -> RecipientId.from(ServiceId.from(uuid), null))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public final class GroupProtoUtil {
|
||||
|
||||
@WorkerThread
|
||||
public static Recipient uuidByteStringToRecipient(@NonNull Context context, @NonNull ByteString uuidByteString) {
|
||||
ServiceId serviceId = ACI.fromByteString(uuidByteString);
|
||||
ServiceId serviceId = ServiceId.fromByteString(uuidByteString);
|
||||
|
||||
if (serviceId.isUnknown()) {
|
||||
return Recipient.UNKNOWN;
|
||||
@@ -97,7 +97,7 @@ public final class GroupProtoUtil {
|
||||
|
||||
@WorkerThread
|
||||
public static @NonNull RecipientId uuidByteStringToRecipientId(@NonNull ByteString uuidByteString) {
|
||||
ServiceId serviceId = ACI.fromByteString(uuidByteString);
|
||||
ServiceId serviceId = ServiceId.fromByteString(uuidByteString);
|
||||
|
||||
if (serviceId.isUnknown()) {
|
||||
return RecipientId.UNKNOWN;
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.thoughtcrime.securesms.groups.GroupChangeException;
|
||||
import org.thoughtcrime.securesms.groups.GroupId;
|
||||
import org.thoughtcrime.securesms.groups.GroupManager;
|
||||
import org.thoughtcrime.securesms.groups.GroupProtoUtil;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -54,7 +55,7 @@ final class PendingMemberInvitesRepository {
|
||||
List<DecryptedPendingMember> pendingMembersList = decryptedGroup.getPendingMembersList();
|
||||
List<SinglePendingMemberInvitedByYou> byMe = new ArrayList<>(pendingMembersList.size());
|
||||
List<MultiplePendingMembersInvitedByAnother> byOthers = new ArrayList<>(pendingMembersList.size());
|
||||
ByteString self = Recipient.self().requireServiceId().toByteString();
|
||||
ByteString self = SignalStore.account().requireAci().toByteString();
|
||||
boolean selfIsAdmin = v2GroupProperties.isAdmin(Recipient.self());
|
||||
|
||||
Stream.of(pendingMembersList)
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.signal.storageservice.protos.groups.local.DecryptedRequestingMember;
|
||||
import org.signal.zkgroup.InvalidInputException;
|
||||
import org.signal.zkgroup.profiles.ProfileKey;
|
||||
import org.whispersystems.signalservice.api.push.ACI;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -31,8 +32,8 @@ public final class ProfileKeySet {
|
||||
|
||||
private static final String TAG = Log.tag(ProfileKeySet.class);
|
||||
|
||||
private final Map<ACI, ProfileKey> profileKeys = new LinkedHashMap<>();
|
||||
private final Map<ACI, ProfileKey> authoritativeProfileKeys = new LinkedHashMap<>();
|
||||
private final Map<ServiceId, ProfileKey> profileKeys = new LinkedHashMap<>();
|
||||
private final Map<ServiceId, ProfileKey> authoritativeProfileKeys = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* Add new profile keys from a group change.
|
||||
@@ -97,20 +98,20 @@ public final class ProfileKeySet {
|
||||
}
|
||||
|
||||
if (memberUuid.equals(changeSource)) {
|
||||
authoritativeProfileKeys.put(ACI.from(memberUuid), profileKey);
|
||||
profileKeys.remove(ACI.from(memberUuid));
|
||||
authoritativeProfileKeys.put(ServiceId.from(memberUuid), profileKey);
|
||||
profileKeys.remove(ServiceId.from(memberUuid));
|
||||
} else {
|
||||
if (!authoritativeProfileKeys.containsKey(ACI.from(memberUuid))) {
|
||||
profileKeys.put(ACI.from(memberUuid), profileKey);
|
||||
if (!authoritativeProfileKeys.containsKey(ServiceId.from(memberUuid))) {
|
||||
profileKeys.put(ServiceId.from(memberUuid), profileKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Map<ACI, ProfileKey> getProfileKeys() {
|
||||
public Map<ServiceId, ProfileKey> getProfileKeys() {
|
||||
return profileKeys;
|
||||
}
|
||||
|
||||
public Map<ACI, ProfileKey> getAuthoritativeProfileKeys() {
|
||||
public Map<ServiceId, ProfileKey> getAuthoritativeProfileKeys() {
|
||||
return authoritativeProfileKeys;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ import org.whispersystems.signalservice.api.groupsv2.InvalidGroupStateException;
|
||||
import org.whispersystems.signalservice.api.groupsv2.NotAbleToApplyGroupV2ChangeException;
|
||||
import org.whispersystems.signalservice.api.groupsv2.PartialDecryptedGroup;
|
||||
import org.whispersystems.signalservice.api.push.ACI;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil;
|
||||
import org.whispersystems.signalservice.internal.push.exceptions.GroupNotFoundException;
|
||||
import org.whispersystems.signalservice.internal.push.exceptions.NotInGroupException;
|
||||
@@ -579,7 +580,7 @@ public final class GroupsV2StateProcessor {
|
||||
.filter(c -> c != null && c.getRevision() == revisionJoinedAt)
|
||||
.findFirst()
|
||||
.map(c -> Optional.fromNullable(UuidUtil.fromByteStringOrNull(c.getEditor()))
|
||||
.transform(a -> Recipient.externalPush(ACI.fromByteStringOrNull(c.getEditor()), null, false)))
|
||||
.transform(a -> Recipient.externalPush(ServiceId.fromByteStringOrNull(c.getEditor()), null, false)))
|
||||
.orElse(Optional.absent());
|
||||
|
||||
if (addedByOptional.isPresent()) {
|
||||
@@ -650,7 +651,7 @@ public final class GroupsV2StateProcessor {
|
||||
}
|
||||
|
||||
void storeMessage(@NonNull DecryptedGroupV2Context decryptedGroupV2Context, long timestamp) {
|
||||
Optional<ACI> editor = getEditor(decryptedGroupV2Context).transform(ACI::from);
|
||||
Optional<ServiceId> editor = getEditor(decryptedGroupV2Context).transform(ServiceId::from);
|
||||
|
||||
boolean outgoing = !editor.isPresent() || selfAci.equals(editor.get());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user