mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-04 07:25:25 +01:00
Introduce new add member labels permission.
This commit is contained in:
@@ -299,6 +299,17 @@ public final class GroupManager {
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static void applyMemberLabelRightsChange(@NonNull Context context,
|
||||
@NonNull GroupId.V2 groupId,
|
||||
@NonNull GroupAccessControl newRights)
|
||||
throws GroupChangeFailedException, GroupInsufficientRightsException, IOException, GroupNotAMemberException, GroupChangeBusyException
|
||||
{
|
||||
try (GroupManagerV2.GroupEditor editor = new GroupManagerV2(context).edit(groupId.requireV2())) {
|
||||
editor.updateMemberLabelRights(newRights);
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
public static void applyAnnouncementGroupChange(@NonNull Context context,
|
||||
@NonNull GroupId.V2 groupId,
|
||||
|
||||
@@ -321,6 +321,14 @@ final class GroupManagerV2 {
|
||||
return commitChangeWithConflictResolution(selfAci, groupOperations.createChangeMembershipRights(rightsToAccessControl(newRights)));
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@NonNull GroupManager.GroupActionResult updateMemberLabelRights(@NonNull GroupAccessControl newRights)
|
||||
throws GroupChangeFailedException, GroupInsufficientRightsException, IOException, GroupNotAMemberException
|
||||
{
|
||||
AccessControl.AccessRequired accessRequired = rightsToAccessControl(newRights);
|
||||
return commitChangeWithConflictResolution(selfAci, groupOperations.createChangeMemberLabelRights(accessRequired));
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
@NonNull GroupManager.GroupActionResult updateAnnouncementGroup(boolean isAnnouncementGroup)
|
||||
throws GroupChangeFailedException, GroupInsufficientRightsException, IOException, GroupNotAMemberException
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.lifecycle.Transformations;
|
||||
import com.annimon.stream.ComparatorCompat;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.models.ServiceId;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.storageservice.storage.protos.groups.AccessControl;
|
||||
import org.signal.storageservice.storage.protos.groups.local.DecryptedGroup;
|
||||
@@ -28,7 +29,6 @@ import org.thoughtcrime.securesms.recipients.LiveRecipient;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.util.livedata.LiveDataUtil;
|
||||
import org.signal.core.models.ServiceId;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.Collections;
|
||||
@@ -182,6 +182,11 @@ public final class LiveGroup {
|
||||
return Transformations.map(groupRecord, GroupRecord::getAttributesAccessControl);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public LiveData<GroupAccessControl> getMemberLabelAccessControl() {
|
||||
return Transformations.map(groupRecord, GroupRecord::getMemberLabelAccessControl);
|
||||
}
|
||||
|
||||
public LiveData<List<GroupMemberEntry.FullMember>> getNonAdminFullMembers() {
|
||||
return Transformations.map(fullMembers,
|
||||
members -> Stream.of(members)
|
||||
|
||||
Reference in New Issue
Block a user