Skip to content

Commit

Permalink
Added remove peer functionality from message menu (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 authored Jan 12, 2024
1 parent 85c313c commit 0bab3b8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ class _ChatUtilitiesBottomSheetState extends State<ChatUtilitiesBottomSheet> {
fontWeight: FontWeight.w600,
textColor: HMSThemeColors.onSurfaceHighEmphasis)),

if (HMSRoomLayout.chatData?.realTimeControls?.canBlockUser ?? false)
if ((HMSRoomLayout.chatData?.realTimeControls?.canBlockUser ??
false) &&
!(widget.message.sender?.isLocal ?? true))
ListTile(
horizontalTitleGap: 2,
onTap: () async {
Expand All @@ -171,6 +173,39 @@ class _ChatUtilitiesBottomSheetState extends State<ChatUtilitiesBottomSheet> {
letterSpacing: 0.1,
fontWeight: FontWeight.w600,
textColor: HMSThemeColors.alertErrorDefault)),

if ((context
.read<MeetingStore>()
.localPeer
?.role
.permissions
.removeOthers ??
false) &&
!(widget.message.sender?.isLocal ?? true))
ListTile(
horizontalTitleGap: 2,
onTap: () async {
Navigator.pop(context);
if (widget.message.sender != null) {
context
.read<MeetingStore>()
.removePeerFromRoom(widget.message.sender!);
}
},
contentPadding: EdgeInsets.zero,
leading: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/peer_remove.svg",
semanticsLabel: "fl_remove_peer",
height: 20,
width: 20,
colorFilter: ColorFilter.mode(
HMSThemeColors.alertErrorDefault, BlendMode.srcIn),
),
title: HMSSubheadingText(
text: "Remove Participant",
letterSpacing: 0.1,
fontWeight: FontWeight.w600,
textColor: HMSThemeColors.alertErrorDefault)),
]),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class _ReceipientSelectorChipState extends State<ReceipientSelectorChip> {
return GestureDetector(
onTap: () => {
if (!(HMSRoomLayout.chatData?.isPrivateChatEnabled ?? true) &&
(HMSRoomLayout.chatData?.isPublicChatEnabled ?? false) ||
(HMSRoomLayout.chatData?.isPublicChatEnabled ?? false) &&
(HMSRoomLayout.chatData?.rolesWhitelist.isEmpty ?? false))
{() {}}
else
Expand Down

0 comments on commit 0bab3b8

Please sign in to comment.