use of org.signal.storageservice.protos.groups.local.DecryptedModifyMemberRole in project Signal-Android by WhisperSystems.
the class DecryptedGroupUtil method applyModifyMemberRoleActions.
private static void applyModifyMemberRoleActions(DecryptedGroup.Builder builder, List<DecryptedModifyMemberRole> modifyMemberRolesList) throws NotAbleToApplyGroupV2ChangeException {
for (DecryptedModifyMemberRole modifyMemberRole : modifyMemberRolesList) {
int index = indexOfUuid(builder.getMembersList(), modifyMemberRole.getUuid());
if (index == -1) {
throw new NotAbleToApplyGroupV2ChangeException();
}
Member.Role role = modifyMemberRole.getRole();
ensureKnownRole(role);
builder.setMembers(index, DecryptedMember.newBuilder(builder.getMembers(index)).setRole(role));
}
}
use of org.signal.storageservice.protos.groups.local.DecryptedModifyMemberRole in project Signal-Android by WhisperSystems.
the class GroupChangeUtil method resolveField5ModifyMemberRoles.
private static void resolveField5ModifyMemberRoles(DecryptedGroupChange conflictingChange, ChangeSetModifier result, HashMap<ByteString, DecryptedMember> fullMembersByUuid) {
List<DecryptedModifyMemberRole> modifyRolesList = conflictingChange.getModifyMemberRolesList();
for (int i = modifyRolesList.size() - 1; i >= 0; i--) {
DecryptedModifyMemberRole modifyRoleAction = modifyRolesList.get(i);
DecryptedMember memberInGroup = fullMembersByUuid.get(modifyRoleAction.getUuid());
if (memberInGroup == null || memberInGroup.getRole() == modifyRoleAction.getRole()) {
result.removeModifyMemberRoles(i);
}
}
}
Aggregations