mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Make GroupV2Helper package-private
This commit is contained in:
parent
ffcda46c31
commit
332780b1a6
1 changed files with 20 additions and 20 deletions
|
@ -52,7 +52,7 @@ import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class GroupV2Helper {
|
class GroupV2Helper {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(GroupV2Helper.class);
|
private final static Logger logger = LoggerFactory.getLogger(GroupV2Helper.class);
|
||||||
|
|
||||||
|
@ -61,12 +61,12 @@ public class GroupV2Helper {
|
||||||
|
|
||||||
private HashMap<Integer, AuthCredentialResponse> groupApiCredentials;
|
private HashMap<Integer, AuthCredentialResponse> groupApiCredentials;
|
||||||
|
|
||||||
public GroupV2Helper(final Context context) {
|
GroupV2Helper(final Context context) {
|
||||||
this.dependencies = context.getDependencies();
|
this.dependencies = context.getDependencies();
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DecryptedGroup getDecryptedGroup(final GroupSecretParams groupSecretParams) throws NotAGroupMemberException {
|
DecryptedGroup getDecryptedGroup(final GroupSecretParams groupSecretParams) throws NotAGroupMemberException {
|
||||||
try {
|
try {
|
||||||
final var groupsV2AuthorizationString = getGroupAuthForToday(groupSecretParams);
|
final var groupsV2AuthorizationString = getGroupAuthForToday(groupSecretParams);
|
||||||
return dependencies.getGroupsV2Api().getGroup(groupSecretParams, groupsV2AuthorizationString);
|
return dependencies.getGroupsV2Api().getGroup(groupSecretParams, groupsV2AuthorizationString);
|
||||||
|
@ -82,7 +82,7 @@ public class GroupV2Helper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DecryptedGroupJoinInfo getDecryptedGroupJoinInfo(
|
DecryptedGroupJoinInfo getDecryptedGroupJoinInfo(
|
||||||
GroupMasterKey groupMasterKey, GroupLinkPassword password
|
GroupMasterKey groupMasterKey, GroupLinkPassword password
|
||||||
) throws IOException, GroupLinkNotActiveException {
|
) throws IOException, GroupLinkNotActiveException {
|
||||||
var groupSecretParams = GroupSecretParams.deriveFromMasterKey(groupMasterKey);
|
var groupSecretParams = GroupSecretParams.deriveFromMasterKey(groupMasterKey);
|
||||||
|
@ -93,7 +93,7 @@ public class GroupV2Helper {
|
||||||
getGroupAuthForToday(groupSecretParams));
|
getGroupAuthForToday(groupSecretParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<GroupInfoV2, DecryptedGroup> createGroup(
|
Pair<GroupInfoV2, DecryptedGroup> createGroup(
|
||||||
String name, Set<RecipientId> members, File avatarFile
|
String name, Set<RecipientId> members, File avatarFile
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final var avatarBytes = readAvatarBytes(avatarFile);
|
final var avatarBytes = readAvatarBytes(avatarFile);
|
||||||
|
@ -182,7 +182,7 @@ public class GroupV2Helper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> updateGroup(
|
Pair<DecryptedGroup, GroupChange> updateGroup(
|
||||||
GroupInfoV2 groupInfoV2, String name, String description, File avatarFile
|
GroupInfoV2 groupInfoV2, String name, String description, File avatarFile
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final var groupSecretParams = GroupSecretParams.deriveFromMasterKey(groupInfoV2.getMasterKey());
|
final var groupSecretParams = GroupSecretParams.deriveFromMasterKey(groupInfoV2.getMasterKey());
|
||||||
|
@ -206,7 +206,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> addMembers(
|
Pair<DecryptedGroup, GroupChange> addMembers(
|
||||||
GroupInfoV2 groupInfoV2, Set<RecipientId> newMembers
|
GroupInfoV2 groupInfoV2, Set<RecipientId> newMembers
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
@ -232,7 +232,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> leaveGroup(
|
Pair<DecryptedGroup, GroupChange> leaveGroup(
|
||||||
GroupInfoV2 groupInfoV2, Set<RecipientId> membersToMakeAdmin
|
GroupInfoV2 groupInfoV2, Set<RecipientId> membersToMakeAdmin
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
var pendingMembersList = groupInfoV2.getGroup().getPendingMembersList();
|
var pendingMembersList = groupInfoV2.getGroup().getPendingMembersList();
|
||||||
|
@ -253,7 +253,7 @@ public class GroupV2Helper {
|
||||||
groupOperations.createLeaveAndPromoteMembersToAdmin(selfAci.uuid(), adminUuids));
|
groupOperations.createLeaveAndPromoteMembersToAdmin(selfAci.uuid(), adminUuids));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> removeMembers(
|
Pair<DecryptedGroup, GroupChange> removeMembers(
|
||||||
GroupInfoV2 groupInfoV2, Set<RecipientId> members
|
GroupInfoV2 groupInfoV2, Set<RecipientId> members
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final var memberUuids = members.stream()
|
final var memberUuids = members.stream()
|
||||||
|
@ -264,7 +264,7 @@ public class GroupV2Helper {
|
||||||
return ejectMembers(groupInfoV2, memberUuids);
|
return ejectMembers(groupInfoV2, memberUuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> revokeInvitedMembers(
|
Pair<DecryptedGroup, GroupChange> revokeInvitedMembers(
|
||||||
GroupInfoV2 groupInfoV2, Set<RecipientId> members
|
GroupInfoV2 groupInfoV2, Set<RecipientId> members
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
var pendingMembersList = groupInfoV2.getGroup().getPendingMembersList();
|
var pendingMembersList = groupInfoV2.getGroup().getPendingMembersList();
|
||||||
|
@ -279,14 +279,14 @@ public class GroupV2Helper {
|
||||||
return revokeInvites(groupInfoV2, memberUuids);
|
return revokeInvites(groupInfoV2, memberUuids);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> resetGroupLinkPassword(GroupInfoV2 groupInfoV2) throws IOException {
|
Pair<DecryptedGroup, GroupChange> resetGroupLinkPassword(GroupInfoV2 groupInfoV2) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
final var newGroupLinkPassword = GroupLinkPassword.createNew().serialize();
|
final var newGroupLinkPassword = GroupLinkPassword.createNew().serialize();
|
||||||
final var change = groupOperations.createModifyGroupLinkPasswordChange(newGroupLinkPassword);
|
final var change = groupOperations.createModifyGroupLinkPasswordChange(newGroupLinkPassword);
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> setGroupLinkState(
|
Pair<DecryptedGroup, GroupChange> setGroupLinkState(
|
||||||
GroupInfoV2 groupInfoV2, GroupLinkState state
|
GroupInfoV2 groupInfoV2, GroupLinkState state
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
@ -302,7 +302,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> setEditDetailsPermission(
|
Pair<DecryptedGroup, GroupChange> setEditDetailsPermission(
|
||||||
GroupInfoV2 groupInfoV2, GroupPermission permission
|
GroupInfoV2 groupInfoV2, GroupPermission permission
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
@ -312,7 +312,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> setAddMemberPermission(
|
Pair<DecryptedGroup, GroupChange> setAddMemberPermission(
|
||||||
GroupInfoV2 groupInfoV2, GroupPermission permission
|
GroupInfoV2 groupInfoV2, GroupPermission permission
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
@ -322,7 +322,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupChange joinGroup(
|
GroupChange joinGroup(
|
||||||
GroupMasterKey groupMasterKey,
|
GroupMasterKey groupMasterKey,
|
||||||
GroupLinkPassword groupLinkPassword,
|
GroupLinkPassword groupLinkPassword,
|
||||||
DecryptedGroupJoinInfo decryptedGroupJoinInfo
|
DecryptedGroupJoinInfo decryptedGroupJoinInfo
|
||||||
|
@ -349,7 +349,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupSecretParams, decryptedGroupJoinInfo.getRevision(), change, groupLinkPassword);
|
return commitChange(groupSecretParams, decryptedGroupJoinInfo.getRevision(), change, groupLinkPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> acceptInvite(GroupInfoV2 groupInfoV2) throws IOException {
|
Pair<DecryptedGroup, GroupChange> acceptInvite(GroupInfoV2 groupInfoV2) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
|
||||||
final var selfRecipientId = context.getAccount().getSelfRecipientId();
|
final var selfRecipientId = context.getAccount().getSelfRecipientId();
|
||||||
|
@ -366,7 +366,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> setMemberAdmin(
|
Pair<DecryptedGroup, GroupChange> setMemberAdmin(
|
||||||
GroupInfoV2 groupInfoV2, RecipientId recipientId, boolean admin
|
GroupInfoV2 groupInfoV2, RecipientId recipientId, boolean admin
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
@ -376,7 +376,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> setMessageExpirationTimer(
|
Pair<DecryptedGroup, GroupChange> setMessageExpirationTimer(
|
||||||
GroupInfoV2 groupInfoV2, int messageExpirationTimer
|
GroupInfoV2 groupInfoV2, int messageExpirationTimer
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
@ -384,7 +384,7 @@ public class GroupV2Helper {
|
||||||
return commitChange(groupInfoV2, change);
|
return commitChange(groupInfoV2, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<DecryptedGroup, GroupChange> setIsAnnouncementGroup(
|
Pair<DecryptedGroup, GroupChange> setIsAnnouncementGroup(
|
||||||
GroupInfoV2 groupInfoV2, boolean isAnnouncementGroup
|
GroupInfoV2 groupInfoV2, boolean isAnnouncementGroup
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||||
|
@ -472,7 +472,7 @@ public class GroupV2Helper {
|
||||||
Optional.fromNullable(password).transform(GroupLinkPassword::serialize));
|
Optional.fromNullable(password).transform(GroupLinkPassword::serialize));
|
||||||
}
|
}
|
||||||
|
|
||||||
public DecryptedGroup getUpdatedDecryptedGroup(
|
DecryptedGroup getUpdatedDecryptedGroup(
|
||||||
DecryptedGroup group, byte[] signedGroupChange, GroupMasterKey groupMasterKey
|
DecryptedGroup group, byte[] signedGroupChange, GroupMasterKey groupMasterKey
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue