- // TODO check if revision is only 1 behind and a signedGroupChange is available
- try {
- final GroupsV2AuthorizationString groupsV2AuthorizationString = getGroupAuthForToday(
- groupSecretParams);
- final DecryptedGroup group = groupsV2Api.getGroup(groupSecretParams,
- groupsV2AuthorizationString);
- groupInfoV2.setGroup(group);
- for (DecryptedMember member : group.getMembersList()) {
- final SignalServiceAddress address = resolveSignalServiceAddress(new SignalServiceAddress(
- UuidUtil.parseOrThrow(member.getUuid().toByteArray()),
- null));
- try {
- account.getProfileStore()
- .storeProfileKey(address,
- new ProfileKey(member.getProfileKey().toByteArray()));
- } catch (InvalidInputException ignored) {
- }
- }
- } catch (IOException | VerificationFailedException | InvalidGroupStateException e) {
- System.err.println("Failed to retrieve Group V2 info, ignoring ...");
+ DecryptedGroup group = null;
+ if (groupContext.hasSignedGroupChange()
+ && groupInfoV2.getGroup() != null
+ && groupInfoV2.getGroup().getRevision() + 1 == groupContext.getRevision()) {
+ group = groupHelper.getUpdatedDecryptedGroup(groupInfoV2.getGroup(),
+ groupContext.getSignedGroupChange(),
+ groupMasterKey);