Skip to content

Commit

Permalink
Merge branch 'develop' into feat/music-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ygit authored Aug 29, 2024
2 parents c00d746 + e08c00a commit dcc394e
Show file tree
Hide file tree
Showing 15 changed files with 371 additions and 37 deletions.
33 changes: 33 additions & 0 deletions packages/hms_room_kit/lib/src/meeting/meeting_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -666,16 +666,45 @@ class MeetingStore extends ChangeNotifier
void toggleLocalPeerHandRaise() {
if (isRaisedHand) {
_hmsSDKInteractor.lowerLocalPeerHand(hmsActionResultListener: this);
resetTimestampWhenHandDown();
} else {
_hmsSDKInteractor.raiseLocalPeerHand(hmsActionResultListener: this);
setTimestampWhenHandRaise();
}
}

void setTimestampWhenHandRaise() {
int currentTime = DateTime.now().millisecondsSinceEpoch;
log("Vkohli Setting timestamp for hand raise $currentTime");
_hmsSDKInteractor.changeMetadata(
metadata:
"{\"isBRBOn\":false,\"prevRole\":\"$previousRole\",\"handRaisedAt\":${currentTime}}",
hmsActionResultListener: this);
}

void resetTimestampWhenHandDown() {
_hmsSDKInteractor.changeMetadata(
metadata: "{\"isBRBOn\":false,\"prevRole\":\"$previousRole\"}",
hmsActionResultListener: this);
}

void lowerRemotePeerHand(HMSPeer forPeer) {
_hmsSDKInteractor.lowerRemotePeerHand(
forPeer: forPeer, hmsActionResultListener: this);
}

int _getTimestampFromPeerMetadata(String? metadata) {
if (metadata == null) {
return 0;
}
try {
Map<String, dynamic> metadataMap = jsonDecode(metadata);
return metadataMap["handRaisedAt"];
} catch (e) {
return 0;
}
}

bool isBRB = false;

void changeMetadataBRB() {
Expand Down Expand Up @@ -1604,6 +1633,10 @@ class MeetingStore extends ChangeNotifier
(handDownPeer) => handDownPeer.peer.peerId == peer.peerId);
participantsInMeetingMap[peer.role.name]?[index].updatePeer(peer);
}
participantsInMeetingMap["Hand Raised"]?.sort((a, b) {
return _getTimestampFromPeerMetadata(a.peer.metadata)
.compareTo(_getTimestampFromPeerMetadata(b.peer.metadata));
});
notifyListeners();
} else if (peerUpdate == HMSPeerUpdate.metadataChanged) {
participantsInMeetingMap[peer.role.name]?[index].updatePeer(peer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ library;
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hms_room_kit/src/widgets/common_widgets/hms_cross_button.dart';
import 'package:hmssdk_flutter/hmssdk_flutter.dart';
import 'package:provider/provider.dart';

///Project imports
Expand Down Expand Up @@ -51,7 +52,10 @@ class _LocalPeerBottomSheetState extends State<LocalPeerBottomSheet> {
@override
Widget build(BuildContext context) {
return FractionallySizedBox(
heightFactor: widget.isInsetTile ? 0.26 : 0.2,
heightFactor:
(AppDebugConfig.isDebugMode && widget.meetingStore.isVideoOn)
? (widget.isInsetTile ? 0.46 : 0.4)
: (widget.isInsetTile ? 0.26 : 0.2),
child: Padding(
padding: const EdgeInsets.only(top: 16.0, left: 24, right: 24),
child: Column(
Expand Down Expand Up @@ -228,6 +232,53 @@ class _LocalPeerBottomSheetState extends State<LocalPeerBottomSheet> {
widget.meetingStore.peerTracks.length > 1
? HMSThemeColors.onSurfaceHighEmphasis
: HMSThemeColors.onSurfaceLowEmphasis)),
if (AppDebugConfig.isDebugMode &&
widget.meetingStore.isVideoOn)
ListTile(
horizontalTitleGap: 2,
onTap: () async {
Navigator.pop(context);
bool isZoomSupported =
await HMSCameraControls.isZoomSupported();
if (isZoomSupported) {
HMSCameraControls.setZoom(zoomValue: 2);
}
},
contentPadding: EdgeInsets.zero,
leading: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/maximize.svg",
semanticsLabel: "fl_local_pin_tile",
height: 20,
width: 20,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis,
BlendMode.srcIn),
),
title: HMSSubheadingText(
text: "Zoom In (2x)",
textColor: HMSThemeColors.onSurfaceHighEmphasis)),

if (AppDebugConfig.isDebugMode &&
widget.meetingStore.isVideoOn)
ListTile(
horizontalTitleGap: 2,
onTap: () async {
Navigator.pop(context);
HMSCameraControls.resetZoom();
},
contentPadding: EdgeInsets.zero,
leading: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/minimize.svg",
semanticsLabel: "fl_local_pin_tile",
height: 20,
width: 20,
colorFilter: ColorFilter.mode(
HMSThemeColors.onSurfaceHighEmphasis,
BlendMode.srcIn),
),
title: HMSSubheadingText(
text: "Reset zoom",
textColor: HMSThemeColors.onSurfaceHighEmphasis)),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
);
}

bool isHandRaisedRow(String role) {
return role == "Hand Raised";
}

Widget _kebabMenu(HMSPeer peer) {
final meetingStore = context.read<MeetingStore>();
PeerTrackNode? peerTrackNode;
Expand Down Expand Up @@ -410,12 +414,13 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
.keys
.elementAt(index);
return Selector<MeetingStore,
Tuple2<int, List<ParticipantsStore>?>>(
selector: (_, meetingStore) => Tuple2(
Tuple3<int, List<ParticipantsStore>?, String>>(
selector: (_, meetingStore) => Tuple3(
meetingStore
.participantsInMeetingMap[role]?.length ??
0,
meetingStore.participantsInMeetingMap[role]),
meetingStore.participantsInMeetingMap[role],
role),
builder: (_, participantsPerRole, __) {
return (participantsPerRole.item2?.isNotEmpty ??
false)
Expand Down Expand Up @@ -458,7 +463,9 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
null
? 0
: (participantsPerRole.item1) *
54,
(isHandRaisedRow(role)
? 60
: 54),
child: Center(
child: ListView.builder(
physics:
Expand Down Expand Up @@ -538,15 +545,18 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
isSIPPeer,
__) {
return isSIPPeer
? CircleAvatar(
radius: 16,
backgroundColor: HMSThemeColors.surfaceBright,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/sip_call.svg",
height: 12,
width: 12,
colorFilter: ColorFilter.mode(HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
))
? Padding(
padding: const EdgeInsets.only(right: 4.0),
child: CircleAvatar(
radius: 12,
backgroundColor: HMSThemeColors.surfaceDefault,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/sip_call.svg",
height: 12,
width: 12,
colorFilter: ColorFilter.mode(HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
)),
)
: const SizedBox();
},
selector: (_, participantsStore) =>
Expand All @@ -562,14 +572,14 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
builder: (_, participantData, __) {
return participantData.item1 != -1 && participantData.item1 < 3 && participantData.item2
? Padding(
padding: const EdgeInsets.only(right: 16.0),
padding: const EdgeInsets.only(right: 4.0),
child: CircleAvatar(
radius: 16,
radius: 12,
backgroundColor: HMSThemeColors.surfaceDefault,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/network_${participantData.item1}.svg",
height: 16,
width: 16,
height: 12,
width: 12,
),
),
)
Expand All @@ -588,12 +598,12 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
? Padding(
padding: const EdgeInsets.only(right: 16.0),
child: CircleAvatar(
radius: 16,
radius: 12,
backgroundColor: HMSThemeColors.surfaceDefault,
child: SvgPicture.asset(
"packages/hms_room_kit/lib/src/assets/icons/hand_outline.svg",
height: 16,
width: 16,
height: 12,
width: 12,
colorFilter: ColorFilter.mode(HMSThemeColors.onSurfaceHighEmphasis, BlendMode.srcIn),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class HmssdkFlutterPlugin :
"capture_snapshot" -> {
captureSnapshot(call, result)
}
"is_tap_to_focus_supported", "capture_image_at_max_supported_resolution", "is_zoom_supported", "is_flash_supported", "toggle_flash" -> {
"is_tap_to_focus_supported", "capture_image_at_max_supported_resolution", "is_zoom_supported", "is_flash_supported", "toggle_flash", "set_zoom", "reset_zoom", "get_max_zoom", "get_min_zoom" -> {
HMSCameraControlsAction.cameraControlsAction(call, result, hmssdk!!, activity.applicationContext)
}
"get_session_metadata_for_key", "set_session_metadata_for_key" -> {
Expand Down
Loading

0 comments on commit dcc394e

Please sign in to comment.