Skip to content

Commit

Permalink
FLUT-162: Skip Preview for Role Change (#1674)
Browse files Browse the repository at this point in the history
* updated packages

* added key for skipping preview for role change

* performing force role change based on skip preview option

* updated conditions

* Updated skip preview implementation

* 🤖 Automated Format and Fix

* Added metadata change update

* 🤖 Automated Format and Fix

---------

Co-authored-by: Decoder07 <[email protected]>
Co-authored-by: Decoder07 <[email protected]>
  • Loading branch information
3 people authored Dec 21, 2023
1 parent 7d4c8ca commit 1523cb0
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 13 deletions.
11 changes: 10 additions & 1 deletion .github/styles/Vocab/HMSVocab/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ iOS
authToken
issue_tracker
publish_to
bool
prominentRoles
isOverlay
roleName
forceChange
previousRole
peerMetadata
toRole
forPeer
Enum
rolesWhitelist
messagePlaceholder
Expand All @@ -184,4 +193,4 @@ bool
permission_handler
intl
chatState
pinnedMessages
pinnedMessages
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,14 @@ class OnStageExp {
String? removeFromStageLabel;
String? onStageRole;
List<String>? offStageRoles;
bool? skipPreviewForRoleChange;

OnStageExp({
this.bringToStageLabel,
this.removeFromStageLabel,
this.onStageRole,
this.offStageRoles,
this.skipPreviewForRoleChange,
});

OnStageExp.fromJson(Map<String, dynamic>? json) {
Expand All @@ -154,6 +156,7 @@ class OnStageExp {
removeFromStageLabel = null;
onStageRole = null;
offStageRoles = null;
skipPreviewForRoleChange = null;
return;
}
bringToStageLabel = json['bring_to_stage_label'];
Expand All @@ -163,6 +166,9 @@ class OnStageExp {
json.containsKey('off_stage_roles') && json['off_stage_roles'] is List
? List<String>.from(json['off_stage_roles'])
: null;
skipPreviewForRoleChange = json.containsKey('skip_preview_for_role_change')
? json['skip_preview_for_role_change']
: null;
}

Map<String, dynamic> toJson() {
Expand All @@ -173,6 +179,7 @@ class OnStageExp {
if (offStageRoles != null && offStageRoles!.isNotEmpty) {
data['off_stage_roles'] = offStageRoles;
}
data['skip_preview_for_role_change'] = skipPreviewForRoleChange;
return data;
}
}
Expand Down
12 changes: 12 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 bool isParticipantsListEnabled = true;
static bool isBRBEnabled = true;
static List<String>? offStageRoles = [];
static bool skipPreviewForRole = false;

static Future<void> getRoomLayout(
{required HMSSDKInteractor hmsSDKInteractor,
Expand Down Expand Up @@ -263,6 +264,9 @@ class HMSRoomLayout {
null;
offStageRoles = roleLayoutData?.screens?.conferencing?.defaultConf
?.elements?.onStageExp?.offStageRoles;
skipPreviewForRole = roleLayoutData?.screens?.conferencing?.defaultConf
?.elements?.onStageExp?.skipPreviewForRoleChange ??
false;
} else {
chatData = roleLayoutData
?.screens?.conferencing?.hlsLiveStreaming?.elements?.chat;
Expand All @@ -274,6 +278,14 @@ class HMSRoomLayout {
null;
offStageRoles = roleLayoutData?.screens?.conferencing?.hlsLiveStreaming
?.elements?.onStageExp?.offStageRoles;
skipPreviewForRole = roleLayoutData
?.screens
?.conferencing
?.hlsLiveStreaming
?.elements
?.onStageExp
?.skipPreviewForRoleChange ??
false;
}
}

Expand Down
10 changes: 10 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 @@ -476,6 +476,14 @@ class MeetingStore extends ChangeNotifier
hmsActionResultListener: this);
}

void setPreviousRole(String oldRole) {
if (HMSRoomLayout.skipPreviewForRole) {
_hmsSDKInteractor.changeMetadata(
metadata: "{\"isBRBOn\":false,\"prevRole\":\"$oldRole\"}",
hmsActionResultListener: this);
}
}

Future<List<HMSRole>> getRoles() async {
return await _hmsSDKInteractor.getRoles();
}
Expand Down Expand Up @@ -1403,6 +1411,8 @@ class MeetingStore extends ChangeNotifier
participantsInMeetingMap[peer.role.name]?[index].updatePeer(peer);
}
notifyListeners();
} else if (peerUpdate == HMSPeerUpdate.metadataChanged) {
participantsInMeetingMap[peer.role.name]?[index].updatePeer(peer);
}
} else {
if (peerUpdate == HMSPeerUpdate.roleUpdated) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ class _ParticipantsBottomSheetState extends State<ParticipantsBottomSheet> {
HMSRole? onStageRole = meetingStore.getOnStageRole();
if (onStageRole != null) {
meetingStore.changeRoleOfPeer(
peer: peer, roleName: onStageRole, forceChange: false);
peer: peer,
roleName: onStageRole,
forceChange: HMSRoomLayout.skipPreviewForRole);
meetingStore.setPreviousRole(peer.role.name);
meetingStore.removeToast(HMSToastsType.roleChangeToast,
data: peer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ class _ParticipantsViewAllBottomSheetState
HMSRole? onStageRole = meetingStore.getOnStageRole();
if (onStageRole != null) {
meetingStore.changeRoleOfPeer(
peer: peer, roleName: onStageRole, forceChange: false);
peer: peer,
roleName: onStageRole,
forceChange: HMSRoomLayout.skipPreviewForRole);
meetingStore.setPreviousRole(peer.role.name);
meetingStore.removeToast(HMSToastsType.roleChangeToast,
data: peer);
}
Expand Down
10 changes: 5 additions & 5 deletions packages/hmssdk_flutter/example/android/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.867.0)
aws-partitions (1.869.0)
aws-sdk-core (3.190.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.74.0)
aws-sdk-kms (1.75.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.141.0)
Expand All @@ -41,7 +41,7 @@ GEM
domain_name (0.6.20231109)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.106.0)
excon (0.108.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -114,7 +114,7 @@ GEM
fastlane-plugin-firebase_app_distribution (0.7.4)
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.53.0)
google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.2)
addressable (~> 2.5, >= 2.5.1)
Expand Down Expand Up @@ -198,7 +198,7 @@ GEM
unicode-display_width (>= 1.1.1, < 3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
tty-screen (0.8.2)
tty-spinner (0.9.3)
tty-cursor (~> 0.7)
tzinfo (2.0.6)
Expand Down
10 changes: 5 additions & 5 deletions packages/hmssdk_flutter/example/ios/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.3.0)
aws-partitions (1.867.0)
aws-partitions (1.869.0)
aws-sdk-core (3.190.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.74.0)
aws-sdk-kms (1.75.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.141.0)
Expand All @@ -41,7 +41,7 @@ GEM
domain_name (0.6.20231109)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.106.0)
excon (0.108.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -115,7 +115,7 @@ GEM
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
fastlane-plugin-versioning (0.5.2)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.53.0)
google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.2)
addressable (~> 2.5, >= 2.5.1)
Expand Down Expand Up @@ -199,7 +199,7 @@ GEM
unicode-display_width (>= 1.1.1, < 3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
tty-screen (0.8.2)
tty-spinner (0.9.3)
tty-cursor (~> 0.7)
tzinfo (2.0.6)
Expand Down

0 comments on commit 1523cb0

Please sign in to comment.