Skip to content

Commit

Permalink
Merge branch 'develop' into bloc-app-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Decoder07 authored Jun 1, 2024
2 parents ab034bc + 051812a commit 0020015
Show file tree
Hide file tree
Showing 19 changed files with 284 additions and 112 deletions.
9 changes: 4 additions & 5 deletions packages/hms_room_kit/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,10 @@ packages:
hmssdk_flutter:
dependency: transitive
description:
name: hmssdk_flutter
sha256: b3f1438c5146afe0399935d78820357bf548b0e3ea36f9355878670ccc2aca6e
url: "https://pub.dev"
source: hosted
version: "1.10.2"
path: "../../hmssdk_flutter"
relative: true
source: path
version: "1.10.3"
http:
dependency: transitive
description:
Expand Down
3 changes: 3 additions & 0 deletions packages/hms_room_kit/lib/src/assets/icons/add_peer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 26 additions & 24 deletions packages/hms_room_kit/lib/src/hls_viewer/hls_hand_raise_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,33 @@ class HLSHandRaiseMenu extends StatelessWidget {
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Selector<MeetingStore, bool>(
selector: (_, meetingStore) => meetingStore.isRaisedHand,
builder: (_, isRaisedHand, __) {
return HMSEmbeddedButton(
onTap: () => {
context.read<MeetingStore>().toggleLocalPeerHandRaise(),
},
enabledBorderColor: HMSThemeColors.surfaceBrighter,
offColor: HMSThemeColors.surfaceDefault,
disabledBorderColor: HMSThemeColors.surfaceDefault,
onColor: HMSThemeColors.surfaceBrighter,
isActive: isRaisedHand,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: SvgPicture.asset(
isRaisedHand
? "packages/hms_room_kit/lib/src/assets/icons/hand_off.svg"
: "packages/hms_room_kit/lib/src/assets/icons/hand_outline.svg",
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
semanticsLabel: "hand_raise_button",
if (HMSRoomLayout.isHandRaiseEnabled)
Selector<MeetingStore, bool>(
selector: (_, meetingStore) => meetingStore.isRaisedHand,
builder: (_, isRaisedHand, __) {
return HMSEmbeddedButton(
onTap: () => {
context.read<MeetingStore>().toggleLocalPeerHandRaise(),
},
enabledBorderColor: HMSThemeColors.surfaceBrighter,
offColor: HMSThemeColors.surfaceDefault,
disabledBorderColor: HMSThemeColors.surfaceDefault,
onColor: HMSThemeColors.surfaceBrighter,
isActive: isRaisedHand,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: SvgPicture.asset(
isRaisedHand
? "packages/hms_room_kit/lib/src/assets/icons/hand_off.svg"
: "packages/hms_room_kit/lib/src/assets/icons/hand_outline.svg",
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis,
BlendMode.srcIn),
semanticsLabel: "hand_raise_button",
),
),
),
);
}),
);
}),
const SizedBox(
width: 8,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class Elements {
Map<String, dynamic>? emojiReactions;
OnStageExp? onStageExp;
Map<String, dynamic>? brb;
Map<String, dynamic>? handRaise;

Elements(
{this.header,
Expand All @@ -117,7 +118,8 @@ class Elements {
this.videoTileLayout,
this.emojiReactions,
this.onStageExp,
this.brb});
this.brb,
this.handRaise});

Elements.fromJson(Map<String, dynamic>? json) {
if (json == null) {
Expand All @@ -128,6 +130,7 @@ class Elements {
emojiReactions = null;
onStageExp = null;
brb = null;
handRaise = null;
return;
}

Expand All @@ -146,6 +149,7 @@ class Elements {
? OnStageExp.fromJson(json['on_stage_exp'])
: null;
brb = json.containsKey("brb") ? json["brb"] : null;
handRaise = json.containsKey("hand_raise") ? json["hand_raise"] : null;
}

Map<String, dynamic> toJson() {
Expand Down
7 changes: 7 additions & 0 deletions packages/hms_room_kit/lib/src/layout_api/hms_room_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ class HMSRoomLayout {
static Chat? chatData;
static bool isParticipantsListEnabled = true;
static bool isBRBEnabled = true;
static bool isHandRaiseEnabled = true;
static List<String>? offStageRoles = [];
static bool skipPreviewForRole = false;
static bool skipPreview = false;
Expand Down Expand Up @@ -265,6 +266,9 @@ class HMSRoomLayout {
isBRBEnabled =
roleLayoutData?.screens?.conferencing?.defaultConf?.elements?.brb !=
null;
isHandRaiseEnabled = roleLayoutData
?.screens?.conferencing?.defaultConf?.elements?.handRaise !=
null;
offStageRoles = roleLayoutData?.screens?.conferencing?.defaultConf
?.elements?.onStageExp?.offStageRoles;
skipPreviewForRole = roleLayoutData?.screens?.conferencing?.defaultConf
Expand All @@ -279,6 +283,9 @@ class HMSRoomLayout {
isBRBEnabled = roleLayoutData
?.screens?.conferencing?.hlsLiveStreaming?.elements?.brb !=
null;
isHandRaiseEnabled = roleLayoutData
?.screens?.conferencing?.hlsLiveStreaming?.elements?.handRaise !=
null;
offStageRoles = roleLayoutData?.screens?.conferencing?.hlsLiveStreaming
?.elements?.onStageExp?.offStageRoles;
skipPreviewForRole = roleLayoutData
Expand Down
48 changes: 48 additions & 0 deletions packages/hms_room_kit/lib/src/meeting/empty_room_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
library;

///Package imports
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hms_room_kit/hms_room_kit.dart';

///[EmptyRoomScreen] is a widget that is used to render the empty room screen
///This screen is shown when there is only single publisher
class EmptyRoomScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircleAvatar(
backgroundColor: HMSThemeColors.surfaceDefault,
radius: 40,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/add_peer.svg",
height: 37,
width: 37,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
),
),
const SizedBox(
height: 24,
),
HMSTitleText(
text: "You’re the first to join",
textColor: HMSThemeColors.onSurfaceHighEmphasis,
fontSize: 24,
lineHeight: 32,
),
const SizedBox(
height: 8,
),
HMSTitleText(
text: "Sit back and relax till others join",
textColor: HMSThemeColors.onSurfaceMediumEmphasis,
fontWeight: FontWeight.w400,
maxLines: 3,
)
],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'dart:io';

///Package imports
import 'package:flutter/material.dart';
import 'package:hms_room_kit/src/meeting/waiting_room_screen.dart';
import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:provider/provider.dart';
import 'package:tuple/tuple.dart';
Expand Down Expand Up @@ -43,6 +44,7 @@ class MeetingGridComponent extends StatelessWidget {
color: Colors.transparent,
height: double.infinity,
width: double.infinity,
child: WaitingRoomScreen(),
));
}
return Selector<MeetingStore, Tuple2<MeetingMode, HMSPeer?>>(
Expand Down
100 changes: 100 additions & 0 deletions packages/hms_room_kit/lib/src/meeting/waiting_room_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
library;

///Package imports
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';

///Project imports
import 'package:hms_room_kit/hms_room_kit.dart';
import 'package:hms_room_kit/src/meeting/meeting_store.dart';

///[WaitingRoomScreen] is a widget that is used to render the waiting room screen
///This is rendered when the user is waiting for the host to join
///or when the user has only screenshare option
class WaitingRoomScreen extends StatelessWidget {
///[showScreenshareOption] is a function that returns true if the user has only screenshare option
bool showScreenshareOption(MeetingStore meetingStore) {
return (!(meetingStore.localPeer?.role.publishSettings?.allowed
.contains("video") ??
true) &&
(meetingStore.localPeer?.role.publishSettings?.allowed
.contains("screen") ??
false) &&
!(meetingStore.localPeer?.role.publishSettings?.allowed
.contains("audio") ??
true));
}

@override
Widget build(BuildContext context) {
var meetingStore = context.watch<MeetingStore>();

return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: showScreenshareOption(meetingStore)
? [
CircleAvatar(
backgroundColor: HMSThemeColors.surfaceDefault,
radius: 40,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/screen_share.svg",
height: 37,
width: 37,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
),
),
const SizedBox(
height: 24,
),
HMSTitleText(
text: "Ready to present",
textColor: HMSThemeColors.onSurfaceHighEmphasis,
fontSize: 24,
lineHeight: 32,
),
const SizedBox(
height: 8,
),
HMSTitleText(
text:
"Select the screenshare button \nfrom the menu to start presenting.",
textColor: HMSThemeColors.onSurfaceMediumEmphasis,
fontWeight: FontWeight.w400,
maxLines: 3,
)
]
: [
CircleAvatar(
backgroundColor: HMSThemeColors.surfaceDefault,
radius: 40,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/add_peer.svg",
height: 37,
width: 37,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
),
),
const SizedBox(
height: 24,
),
HMSTitleText(
text: "Waiting for Host to join",
textColor: HMSThemeColors.onSurfaceHighEmphasis,
fontSize: 24,
lineHeight: 32,
),
const SizedBox(
height: 8,
),
HMSTitleText(
text: "Sit back and relax",
textColor: HMSThemeColors.onSurfaceMediumEmphasis,
fontWeight: FontWeight.w400,
)
],
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,24 +213,24 @@ class _AppUtilitiesBottomSheetState extends State<AppUtilitiesBottomSheet> {
meetingStore.isBRB ? "I'm Back" : "Be Right Back"),

///This renders the raise hand option
MoreOptionItem(
onTap: () async {
context.read<MeetingStore>().toggleLocalPeerHandRaise();
Navigator.pop(context);
},
isActive: meetingStore.isRaisedHand,
optionIcon: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/hand_outline.svg",
height: 20,
width: 20,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis,
BlendMode.srcIn),
),
optionText: meetingStore.isRaisedHand
? "Lower Hand"
: "Raise Hand"),
if (HMSRoomLayout.isHandRaiseEnabled)
MoreOptionItem(
onTap: () async {
context.read<MeetingStore>().toggleLocalPeerHandRaise();
Navigator.pop(context);
},
isActive: meetingStore.isRaisedHand,
optionIcon: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/hand_outline.svg",
height: 20,
width: 20,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis,
BlendMode.srcIn),
),
optionText: meetingStore.isRaisedHand
? "Lower Hand"
: "Raise Hand"),

///This renders the polls and quizzes option
if ((meetingStore.localPeer?.role.permissions.pollRead ??
Expand Down Expand Up @@ -380,6 +380,7 @@ class _AppUtilitiesBottomSheetState extends State<AppUtilitiesBottomSheet> {
: "Record",
),
if (meetingStore.isNoiseCancellationAvailable &&
meetingStore.localPeer?.audioTrack != null &&
meetingStore.isMicOn)
MoreOptionItem(
onTap: () async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ class _ChatTextUtilityState extends State<ChatTextUtility>
void didChangeMetrics() {
final bool isKeyboardOpen =
(MediaQuery.of(context).viewInsets.bottom).toInt() > 0;
if (Platform.isAndroid) {
showMenu = isKeyboardOpen;
} else {
showMenu = !isKeyboardOpen;
}
showMenu = !isKeyboardOpen;
setState(() {});
}

Expand Down
Loading

0 comments on commit 0020015

Please sign in to comment.