mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Replace switch with if
This commit is contained in:
parent
d4321971e3
commit
1adfd3d6cd
1 changed files with 44 additions and 46 deletions
|
@ -209,54 +209,52 @@ public class GroupHelper {
|
||||||
var group = getGroupForUpdating(groupId);
|
var group = getGroupForUpdating(groupId);
|
||||||
final var avatarBytes = readAvatarBytes(avatarFile);
|
final var avatarBytes = readAvatarBytes(avatarFile);
|
||||||
|
|
||||||
switch (group) {
|
if(group instanceof GroupInfoV2) {
|
||||||
case GroupInfoV2 gv2 -> {
|
GroupInfoV2 gv2 = (GroupInfoV2) group;
|
||||||
try {
|
try {
|
||||||
return updateGroupV2(gv2,
|
return updateGroupV2(gv2,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
members,
|
members,
|
||||||
removeMembers,
|
removeMembers,
|
||||||
admins,
|
admins,
|
||||||
removeAdmins,
|
removeAdmins,
|
||||||
banMembers,
|
banMembers,
|
||||||
unbanMembers,
|
unbanMembers,
|
||||||
resetGroupLink,
|
resetGroupLink,
|
||||||
groupLinkState,
|
groupLinkState,
|
||||||
addMemberPermission,
|
addMemberPermission,
|
||||||
editDetailsPermission,
|
editDetailsPermission,
|
||||||
avatarBytes,
|
avatarBytes,
|
||||||
expirationTimer,
|
expirationTimer,
|
||||||
isAnnouncementGroup);
|
isAnnouncementGroup);
|
||||||
} catch (ConflictException e) {
|
} catch (ConflictException e) {
|
||||||
// Detected conflicting update, refreshing group and trying again
|
// Detected conflicting update, refreshing group and trying again
|
||||||
group = getGroup(groupId, true);
|
group = getGroup(groupId, true);
|
||||||
return updateGroupV2((GroupInfoV2) group,
|
return updateGroupV2((GroupInfoV2) group,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
members,
|
members,
|
||||||
removeMembers,
|
removeMembers,
|
||||||
admins,
|
admins,
|
||||||
removeAdmins,
|
removeAdmins,
|
||||||
banMembers,
|
banMembers,
|
||||||
unbanMembers,
|
unbanMembers,
|
||||||
resetGroupLink,
|
resetGroupLink,
|
||||||
groupLinkState,
|
groupLinkState,
|
||||||
addMemberPermission,
|
addMemberPermission,
|
||||||
editDetailsPermission,
|
editDetailsPermission,
|
||||||
avatarBytes,
|
avatarBytes,
|
||||||
expirationTimer,
|
expirationTimer,
|
||||||
isAnnouncementGroup);
|
isAnnouncementGroup);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else if (group instanceof GroupInfoV1) {
|
||||||
case GroupInfoV1 gv1 -> {
|
GroupInfoV1 gv1 = (GroupInfoV1) group;
|
||||||
final var result = updateGroupV1(gv1, name, members, avatarBytes);
|
final var result = updateGroupV1(gv1, name, members, avatarBytes);
|
||||||
if (expirationTimer != null) {
|
if (expirationTimer != null) {
|
||||||
setExpirationTimer(gv1, expirationTimer);
|
setExpirationTimer(gv1, expirationTimer);
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue