Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bugs #1687

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,22 @@ class _OverlayChatComponentState extends State<OverlayChatComponent> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ReceipientSelectorChip(
currentlySelectedValue: currentlySelectedValue,
updateSelectedValue: _updateValueChoose,
chipColor:
HMSThemeColors.backgroundDim.withAlpha(64),
),
if ((HMSRoomLayout
.chatData?.isPrivateChatEnabled ??
false) ||
(HMSRoomLayout
.chatData?.isPublicChatEnabled ??
false) ||
(HMSRoomLayout.chatData?.rolesWhitelist
.isNotEmpty ??
false))
ReceipientSelectorChip(
currentlySelectedValue:
currentlySelectedValue,
updateSelectedValue: _updateValueChoose,
chipColor: HMSThemeColors.backgroundDim
.withAlpha(64),
),
const SizedBox(),
if (HMSRoomLayout.chatData?.realTimeControls
?.canDisableChat ??
Expand Down
10 changes: 4 additions & 6 deletions packages/hms_room_kit/lib/src/meeting/meeting_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2017,12 +2017,10 @@ class MeetingStore extends ChangeNotifier
recipientSelectorValue = "Everyone";
return;
} else if (HMSRoomLayout.chatData?.rolesWhitelist.isNotEmpty ?? false) {
if (localPeer != null) {
recipientSelectorValue = HMSRoomLayout.chatData?.rolesWhitelist
.firstWhere((role) => role != localPeer?.role.name) ??
localPeer!.role.name;
return;
}
recipientSelectorValue = HMSRoomLayout.chatData?.rolesWhitelist
.firstWhere(
(role) => role != HMSRoomLayout.roleLayoutData?.role) ??
"Choose a Recipient";
} else if (HMSRoomLayout.chatData?.isPrivateChatEnabled ?? false) {
if (peers.length > 1) {
recipientSelectorValue = peers[1];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//Package imports
import 'package:flutter/material.dart';
import 'package:hms_room_kit/src/layout_api/hms_room_layout.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
Expand Down Expand Up @@ -168,9 +169,13 @@ class _ChatBottomSheetState extends State<ChatBottomSheet> {
),

/// This draws the chip to select the roles or peers to send message to
ReceipientSelectorChip(
currentlySelectedValue: currentlySelectedValue,
updateSelectedValue: _updateValueChoose),
if ((HMSRoomLayout.chatData?.isPrivateChatEnabled ?? false) ||
(HMSRoomLayout.chatData?.isPublicChatEnabled ?? false) ||
(HMSRoomLayout.chatData?.rolesWhitelist.isNotEmpty ??
false))
ReceipientSelectorChip(
currentlySelectedValue: currentlySelectedValue,
updateSelectedValue: _updateValueChoose),

///Text Field
ChatTextField(sendMessage: sendMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:provider/provider.dart';
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hms_room_kit/src/meeting/meeting_store.dart';
import 'package:hms_room_kit/src/widgets/chat_widgets/recipient_selector_widget.dart';
import 'package:hms_room_kit/src/layout_api/hms_room_layout.dart';

///[ReceipientSelectorChip] is a widget that is used to render the receipient selector chip
class ReceipientSelectorChip extends StatefulWidget {
Expand Down Expand Up @@ -48,16 +49,25 @@ class _ReceipientSelectorChipState extends State<ReceipientSelectorChip> {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
context: context,
builder: (ctx) => ChangeNotifierProvider.value(
value: context.read<MeetingStore>(),
child: RecipientSelectorWidget(
updateUI: _updateValueChoose,
selectedValue: currentlySelectedValue,
))),
onTap: () => {
if (!(HMSRoomLayout.chatData?.isPrivateChatEnabled ?? true) &&
(HMSRoomLayout.chatData?.isPublicChatEnabled ?? false) ||
(HMSRoomLayout.chatData?.rolesWhitelist.isEmpty ?? false))
{() {}}
else
{
showModalBottomSheet(
isScrollControlled: true,
backgroundColor: Colors.transparent,
context: context,
builder: (ctx) => ChangeNotifierProvider.value(
value: context.read<MeetingStore>(),
child: RecipientSelectorWidget(
updateUI: _updateValueChoose,
selectedValue: currentlySelectedValue,
)))
}
},
child: Padding(
padding: const EdgeInsets.only(bottom: 8.0, top: 16),
child: Row(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@ class _RecipientSelectorWidgetState extends State<RecipientSelectorWidget> {
),
),

Padding(
padding: const EdgeInsets.symmetric(vertical: 6.0),
child: Divider(
height: 1,
color: HMSThemeColors.borderBright,
if (HMSRoomLayout.chatData?.isPublicChatEnabled ??
false)
Padding(
padding: const EdgeInsets.symmetric(vertical: 6.0),
child: Divider(
height: 1,
color: HMSThemeColors.borderBright,
),
),
),

///Group based selection
if (HMSRoomLayout.chatData?.rolesWhitelist.isNotEmpty ??
Expand Down Expand Up @@ -277,7 +279,24 @@ class _RecipientSelectorWidgetState extends State<RecipientSelectorWidget> {
meetingStore.peers.length),
builder: (_, data, __) {
return data.item2 <= 1
? const SizedBox()
? ((HMSRoomLayout.chatData
?.isPrivateChatEnabled ??
false) &&
!(HMSRoomLayout.chatData
?.isPublicChatEnabled ??
true) &&
(HMSRoomLayout.chatData
?.rolesWhitelist.isEmpty ??
false))
? HMSTitleText(
text: "No recipients yet",
textColor: HMSThemeColors
.onSurfaceMediumEmphasis,
fontSize: 14,
letterSpacing: 0.1,
lineHeight: 20,
)
: const SizedBox()
: Padding(
padding: const EdgeInsets.only(
left: 10.0, right: 10),
Expand Down
Loading