mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +01:00
Convert SignalService, Database, Group, Payment, and other remaining protos to wire.
This commit is contained in:
committed by
Alex Hart
parent
a6b7d0bcc5
commit
efbd5cab85
@@ -2,14 +2,12 @@ package org.thoughtcrime.securesms.sms;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
|
||||
import org.signal.storageservice.protos.groups.local.DecryptedGroupChange;
|
||||
import org.thoughtcrime.securesms.mms.MessageGroupContext;
|
||||
import org.whispersystems.signalservice.api.groupsv2.DecryptedGroupUtil;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.ACI;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -38,13 +36,13 @@ public final class GroupV2UpdateMessageUtil {
|
||||
}
|
||||
|
||||
private static boolean changeEditorOnlyWasRemoved(@NonNull DecryptedGroupChange decryptedGroupChange) {
|
||||
return decryptedGroupChange.getDeleteMembersCount() == 1 &&
|
||||
decryptedGroupChange.getDeleteMembers(0).equals(decryptedGroupChange.getEditorServiceIdBytes());
|
||||
return decryptedGroupChange.deleteMembers.size() == 1 &&
|
||||
decryptedGroupChange.deleteMembers.get(0).equals(decryptedGroupChange.editorServiceIdBytes);
|
||||
}
|
||||
|
||||
private static boolean noChangesOtherThanDeletes(@NonNull DecryptedGroupChange decryptedGroupChange) {
|
||||
DecryptedGroupChange withoutDeletedMembers = decryptedGroupChange.toBuilder()
|
||||
.clearDeleteMembers()
|
||||
DecryptedGroupChange withoutDeletedMembers = decryptedGroupChange.newBuilder()
|
||||
.deleteMembers(Collections.emptyList())
|
||||
.build();
|
||||
return DecryptedGroupUtil.changeIsEmpty(withoutDeletedMembers);
|
||||
}
|
||||
@@ -54,7 +52,7 @@ public final class GroupV2UpdateMessageUtil {
|
||||
DecryptedGroupChange decryptedGroupChange = groupContext.requireGroupV2Properties()
|
||||
.getChange();
|
||||
|
||||
return decryptedGroupChange.getDeleteRequestingMembersCount() > 0;
|
||||
return decryptedGroupChange.deleteRequestingMembers.size() > 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -62,14 +60,14 @@ public final class GroupV2UpdateMessageUtil {
|
||||
|
||||
public static int getChangeRevision(@NonNull MessageGroupContext groupContext) {
|
||||
if (isGroupV2(groupContext) && isUpdate(groupContext)) {
|
||||
return groupContext.requireGroupV2Properties().getChange().getRevision();
|
||||
return groupContext.requireGroupV2Properties().getChange().revision;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static Optional<ServiceId> getChangeEditor(MessageGroupContext groupContext) {
|
||||
if (isGroupV2(groupContext) && isUpdate(groupContext)) {
|
||||
return Optional.ofNullable(groupContext.requireGroupV2Properties().getChange().getEditorServiceIdBytes()).map(ServiceId::parseOrNull);
|
||||
return Optional.ofNullable(groupContext.requireGroupV2Properties().getChange().editorServiceIdBytes).map(ServiceId::parseOrNull);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
package org.thoughtcrime.securesms.sms;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.DecryptedGroupV2Context;
|
||||
import org.thoughtcrime.securesms.mms.MessageGroupContext;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId;
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.ACI;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.whispersystems.signalservice.internal.push.SignalServiceProtos.GroupContext;
|
||||
|
||||
public final class IncomingGroupUpdateMessage extends IncomingTextMessage {
|
||||
|
||||
private final MessageGroupContext groupContext;
|
||||
|
||||
Reference in New Issue
Block a user