diff --git a/packages/hms_room_kit/lib/src/assets/icons/sip_call.svg b/packages/hms_room_kit/lib/src/assets/icons/sip_call.svg new file mode 100644 index 000000000..635ee3b49 --- /dev/null +++ b/packages/hms_room_kit/lib/src/assets/icons/sip_call.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart index 7ff427234..08879449e 100644 --- a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart +++ b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/participants_bottom_sheet.dart @@ -13,14 +13,13 @@ import 'package:tuple/tuple.dart'; import 'package:hmssdk_flutter/hmssdk_flutter.dart'; ///Project imports +import 'package:hms_room_kit/hms_room_kit.dart'; import 'package:hms_room_kit/src/widgets/toasts/hms_toasts_type.dart'; import 'package:hms_room_kit/src/layout_api/hms_room_layout.dart'; -import 'package:hms_room_kit/src/layout_api/hms_theme_colors.dart'; import 'package:hms_room_kit/src/model/participant_store.dart'; import 'package:hms_room_kit/src/widgets/common_widgets/hms_subheading_text.dart'; import 'package:hms_room_kit/src/widgets/bottom_sheets/participants_view_all_bottom_sheet.dart'; import 'package:hms_room_kit/src/model/peer_track_node.dart'; -import 'package:hms_room_kit/src/widgets/common_widgets/hms_title_text.dart'; import 'package:hms_room_kit/src/meeting/meeting_store.dart'; ///[ParticipantsBottomSheet] is the bottom sheet that is shown when the user @@ -483,26 +482,47 @@ class _ParticipantsBottomSheetState extends State { children: [ Selector< ParticipantsStore, - int>( - selector: (_, participantsStore) => (participantsStore.peer.networkQuality?.quality ?? - -1), + bool>( builder: (_, - networkQuality, + isSIPPeer, __) { - return networkQuality != -1 && networkQuality < 3 + 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), + )) + : const SizedBox(); + }, + selector: (_, participantsStore) => + participantsStore.peer.type == + HMSPeerType.sip), + Selector< + ParticipantsStore, + Tuple2>( + selector: (_, participantsStore) => Tuple2( + participantsStore.peer.networkQuality?.quality ?? -1, + participantsStore.peer.type != HMSPeerType.sip), + builder: (_, participantData, __) { + return participantData.item1 != -1 && participantData.item1 < 3 && participantData.item2 ? Padding( padding: const EdgeInsets.only(right: 16.0), child: CircleAvatar( radius: 16, backgroundColor: HMSThemeColors.surfaceDefault, child: SvgPicture.asset( - "packages/hms_room_kit/lib/src/assets/icons/network_$networkQuality.svg", + "packages/hms_room_kit/lib/src/assets/icons/network_${participantData.item1}.svg", height: 16, width: 16, ), ), ) - : Container(); + : const SizedBox(); }), Selector< ParticipantsStore, @@ -527,7 +547,7 @@ class _ParticipantsBottomSheetState extends State { ), ), ) - : Container(); + : const SizedBox(); }), _kebabMenu( currentPeer diff --git a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/remote_peer_bottom_sheet.dart b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/remote_peer_bottom_sheet.dart index 8e6288fbc..8ed1fec2e 100644 --- a/packages/hms_room_kit/lib/src/widgets/bottom_sheets/remote_peer_bottom_sheet.dart +++ b/packages/hms_room_kit/lib/src/widgets/bottom_sheets/remote_peer_bottom_sheet.dart @@ -10,6 +10,7 @@ import 'package:hms_room_kit/src/meeting/meeting_store.dart'; import 'package:hms_room_kit/src/model/peer_track_node.dart'; import 'package:hms_room_kit/src/widgets/common_widgets/hms_cross_button.dart'; import 'package:hms_room_kit/src/widgets/common_widgets/hms_subheading_text.dart'; +import 'package:hmssdk_flutter/hmssdk_flutter.dart'; import 'package:provider/provider.dart'; ///[RemotePeerBottomSheet] is a widget that is used to render the bottom sheet for remote peers @@ -188,8 +189,9 @@ class _RemotePeerBottomSheetState extends State { ? HMSThemeColors.onSurfaceLowEmphasis : HMSThemeColors.onSurfaceHighEmphasis)), - if (widget.meetingStore.localPeer?.role.permissions.mute ?? - false) + if ((widget.meetingStore.localPeer?.role.permissions.mute ?? + false) && + widget.peerTrackNode.peer.type == HMSPeerType.regular) ListTile( horizontalTitleGap: 2, onTap: () async { diff --git a/packages/hms_room_kit/lib/src/widgets/chat_widgets/recipient_selector_widget.dart b/packages/hms_room_kit/lib/src/widgets/chat_widgets/recipient_selector_widget.dart index e6adc83f6..e1ce29be5 100644 --- a/packages/hms_room_kit/lib/src/widgets/chat_widgets/recipient_selector_widget.dart +++ b/packages/hms_room_kit/lib/src/widgets/chat_widgets/recipient_selector_widget.dart @@ -305,7 +305,10 @@ class _RecipientSelectorWidgetState extends State { child: Column( children: data.item1 .where((peer) => - peer.isLocal == false) + + ///Don't show local and SIP peers + peer.isLocal == false && + peer.type != HMSPeerType.sip) .map((peer) => ListTile( onTap: () { setState(() { diff --git a/packages/hms_room_kit/lib/src/widgets/peer_widgets/name_and_network.dart b/packages/hms_room_kit/lib/src/widgets/peer_widgets/name_and_network.dart index d87af295f..ba6fb26ab 100644 --- a/packages/hms_room_kit/lib/src/widgets/peer_widgets/name_and_network.dart +++ b/packages/hms_room_kit/lib/src/widgets/peer_widgets/name_and_network.dart @@ -1,10 +1,14 @@ -///Package imports library; +///Package import import 'package:flutter/cupertino.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; +import 'package:hmssdk_flutter/hmssdk_flutter.dart'; ///Project imports import 'package:hms_room_kit/src/layout_api/hms_theme_colors.dart'; +import 'package:hms_room_kit/src/model/peer_track_node.dart'; import 'package:hms_room_kit/src/widgets/peer_widgets/network_icon_widget.dart'; import 'package:hms_room_kit/src/widgets/peer_widgets/peer_name.dart'; @@ -35,6 +39,16 @@ class NameAndNetwork extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ + ///Phone icon is only rendered if its a SIP peer + if (context.read().peer.type == HMSPeerType.sip) + Padding( + padding: const EdgeInsets.only(right: 2.0), + child: SvgPicture.asset( + 'packages/hms_room_kit/lib/src/assets/icons/sip_call.svg', + height: 12, + semanticsLabel: "fl_sip_call_icon_label", + ), + ), PeerName( maxWidth: maxWidth, ), diff --git a/packages/hms_room_kit/lib/src/widgets/peer_widgets/network_icon_widget.dart b/packages/hms_room_kit/lib/src/widgets/peer_widgets/network_icon_widget.dart index eb82c7907..2c609a9ae 100644 --- a/packages/hms_room_kit/lib/src/widgets/peer_widgets/network_icon_widget.dart +++ b/packages/hms_room_kit/lib/src/widgets/peer_widgets/network_icon_widget.dart @@ -3,6 +3,7 @@ library; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:hmssdk_flutter/hmssdk_flutter.dart'; import 'package:provider/provider.dart'; import 'package:tuple/tuple.dart'; @@ -22,20 +23,24 @@ class NetworkIconWidget extends StatelessWidget { return Selector>( builder: (_, networkQuality, __) { ///If the track is degraded, we render the degraded network icon - ///If the network quality is not null and not -1, we render the network icon - return networkQuality.item2 - ? SvgPicture.asset( - 'packages/hms_room_kit/lib/src/assets/icons/degraded_network.svg', - height: 20, - semanticsLabel: "fl_network_icon_label", - ) - : (networkQuality.item1 != null && networkQuality.item1 != -1) + ///If the network quality is not null and not -1, + ///and the peer is a regular peer + ///we render the network icon + return context.read().peer.type == HMSPeerType.regular + ? networkQuality.item2 ? SvgPicture.asset( - 'packages/hms_room_kit/lib/src/assets/icons/network_${networkQuality.item1}.svg', + 'packages/hms_room_kit/lib/src/assets/icons/degraded_network.svg', height: 20, semanticsLabel: "fl_network_icon_label", ) - : Container(); + : (networkQuality.item1 != null && networkQuality.item1 != -1) + ? SvgPicture.asset( + 'packages/hms_room_kit/lib/src/assets/icons/network_${networkQuality.item1}.svg', + height: 20, + semanticsLabel: "fl_network_icon_label", + ) + : const SizedBox() + : const SizedBox(); }, selector: (_, peerTrackNode) => Tuple2(peerTrackNode.networkQuality, peerTrackNode.track?.isDegraded ?? false)); diff --git a/packages/hms_room_kit/lib/src/widgets/peer_widgets/peer_name.dart b/packages/hms_room_kit/lib/src/widgets/peer_widgets/peer_name.dart index e932bde45..1b471f985 100644 --- a/packages/hms_room_kit/lib/src/widgets/peer_widgets/peer_name.dart +++ b/packages/hms_room_kit/lib/src/widgets/peer_widgets/peer_name.dart @@ -1,12 +1,12 @@ -///Package imports library; +///Package imports import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:tuple/tuple.dart'; ///Project imports -import 'package:hms_room_kit/src/layout_api/hms_theme_colors.dart'; +import 'package:hms_room_kit/hms_room_kit.dart'; import 'package:hms_room_kit/src/model/peer_track_node.dart'; import 'package:hms_room_kit/src/widgets/common_widgets/hms_subheading_text.dart'; diff --git a/packages/hms_room_kit/pubspec.yaml b/packages/hms_room_kit/pubspec.yaml index 5a9c25bc0..cc9d7d6f0 100644 --- a/packages/hms_room_kit/pubspec.yaml +++ b/packages/hms_room_kit/pubspec.yaml @@ -15,10 +15,7 @@ dependencies: sdk: flutter hmssdk_flutter: - git: - url: https://github.com/100mslive/100ms-flutter.git - ref: develop - path: packages/hmssdk_flutter + path: ../hmssdk_flutter intl: ^0.18.0 permission_handler: ^11.0.0 provider: ^6.0.5 diff --git a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSPeerExtension.kt b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSPeerExtension.kt index c26811c9f..8f57848fb 100644 --- a/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSPeerExtension.kt +++ b/packages/hmssdk_flutter/android/src/main/kotlin/live/hms/hmssdk_flutter/HMSPeerExtension.kt @@ -1,6 +1,7 @@ package live.hms.hmssdk_flutter import live.hms.video.sdk.models.HMSPeer +import live.hms.video.sdk.models.HMSPeerType import live.hms.video.sdk.models.enums.HMSPeerUpdate class HMSPeerExtension { @@ -14,6 +15,7 @@ class HMSPeerExtension { args["is_local"] = peer.isLocal args["role"] = HMSRoleExtension.toDictionary(peer.hmsRole) args["metadata"] = peer.metadata + args["type"] = getValueFromPeerType(peer.type) args["is_hand_raised"] = peer.isHandRaised args["customer_user_id"] = peer.customerUserID args["audio_track"] = HMSTrackExtension.toDictionary(peer.audioTrack) @@ -45,5 +47,13 @@ class HMSPeerExtension { else -> "defaultUpdate" } } + + private fun getValueFromPeerType(peerType: HMSPeerType): String { + return when(peerType){ + HMSPeerType.SIP -> "sip" + HMSPeerType.REGULAR -> "regular" + else -> "regular" + } + } } } diff --git a/packages/hmssdk_flutter/example/ExampleAppChangelog.txt b/packages/hmssdk_flutter/example/ExampleAppChangelog.txt index af752cc54..35ad1f0ba 100644 --- a/packages/hmssdk_flutter/example/ExampleAppChangelog.txt +++ b/packages/hmssdk_flutter/example/ExampleAppChangelog.txt @@ -3,6 +3,9 @@ Board: https://100ms.atlassian.net/jira/software/projects/FLUT/boards/34/ - Added active noise cancellation feature https://100ms.atlassian.net/browse/FLUT-259 +- Added SIP Peer support +https://100ms.atlassian.net/browse/FLUT-260 + - Fixed: UI inconsistent when using a Screenshare only Role https://100ms.atlassian.net/browse/FLUT-279 @@ -12,4 +15,4 @@ https://100ms.atlassian.net/browse/FLUT-280 Room Kit: 1.1.0 Core SDK: 1.10.0 Android SDK: 2.9.52 -iOS SDK: 1.7.0 \ No newline at end of file +iOS SDK: 1.8.0 \ No newline at end of file diff --git a/packages/hmssdk_flutter/example/android/app/build.gradle b/packages/hmssdk_flutter/example/android/app/build.gradle index 39390e661..c72879468 100644 --- a/packages/hmssdk_flutter/example/android/app/build.gradle +++ b/packages/hmssdk_flutter/example/android/app/build.gradle @@ -36,8 +36,8 @@ android { applicationId "live.hms.flutter" minSdkVersion 21 targetSdkVersion 34 - versionCode 461 - versionName "1.5.161" + versionCode 462 + versionName "1.5.162" } signingConfigs { diff --git a/packages/hmssdk_flutter/example/ios/Podfile.lock b/packages/hmssdk_flutter/example/ios/Podfile.lock index d45a0498e..9fc9c08e8 100644 --- a/packages/hmssdk_flutter/example/ios/Podfile.lock +++ b/packages/hmssdk_flutter/example/ios/Podfile.lock @@ -127,7 +127,7 @@ PODS: - HMSHLSPlayerSDK (0.0.2): - HMSAnalyticsSDK (= 0.0.2) - HMSNoiseCancellationModels (1.0.0) - - HMSSDK (1.7.0): + - HMSSDK (1.8.0): - HMSAnalyticsSDK (= 0.0.2) - HMSWebRTC (= 1.0.5118) - hmssdk_flutter (1.10.0): @@ -135,7 +135,7 @@ PODS: - HMSBroadcastExtensionSDK (= 0.0.9) - HMSHLSPlayerSDK (= 0.0.2) - HMSNoiseCancellationModels (= 1.0.0) - - HMSSDK (= 1.7.0) + - HMSSDK (= 1.8.0) - HMSWebRTC (1.0.5118) - MLImage (1.0.0-beta4) - MLKitBarcodeScanning (3.0.0): @@ -293,8 +293,8 @@ SPEC CHECKSUMS: HMSBroadcastExtensionSDK: d80fe325f6c928bd8e5176290b5a4b7ae15d6fbb HMSHLSPlayerSDK: 6a54ad4d12f3dc2270d1ecd24019d71282a4f6a3 HMSNoiseCancellationModels: a3bda1405a16015632f4bcabd46ce48f35103b02 - HMSSDK: 421b4ce83a601bbda283b3b9fbcd1da6898d2a84 - hmssdk_flutter: 8f60b63db6286c0b92d9224585362ade6d7e1602 + HMSSDK: c893d1381a47ed02760ef6d06625b9aa5251f998 + hmssdk_flutter: 997715f0bedfcb22750fb95549672bf3fea380ff HMSWebRTC: 4487c7200f1e9358412c1d8cd974edd2766467dc MLImage: 7bb7c4264164ade9bf64f679b40fb29c8f33ee9b MLKitBarcodeScanning: 04e264482c5f3810cb89ebc134ef6b61e67db505 diff --git a/packages/hmssdk_flutter/example/ios/Runner.xcodeproj/project.pbxproj b/packages/hmssdk_flutter/example/ios/Runner.xcodeproj/project.pbxproj index d5a582928..db4c1d5ae 100644 --- a/packages/hmssdk_flutter/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/hmssdk_flutter/example/ios/Runner.xcodeproj/project.pbxproj @@ -245,7 +245,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1340; - LastUpgradeCheck = 1510; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = 100ms; TargetAttributes = { 97C146ED1CF9000F007C117D = { diff --git a/packages/hmssdk_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/hmssdk_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 5e31d3d34..a6b826db2 100644 --- a/packages/hmssdk_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/hmssdk_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.5.161 + 1.5.162 CFBundleSignature ???? CFBundleURLTypes @@ -48,7 +48,7 @@ CFBundleVersion - 461 + 462 ITSAppUsesNonExemptEncryption LSApplicationCategoryType diff --git a/packages/hmssdk_flutter/example/pubspec.lock b/packages/hmssdk_flutter/example/pubspec.lock index 8b6dad398..f0b8c72af 100644 --- a/packages/hmssdk_flutter/example/pubspec.lock +++ b/packages/hmssdk_flutter/example/pubspec.lock @@ -306,11 +306,9 @@ packages: hmssdk_flutter: dependency: transitive description: - path: "packages/hmssdk_flutter" - ref: develop - resolved-ref: f23908cdd1254aab1ebe01df6dfc75bdbbd44ae8 - url: "https://github.com/100mslive/100ms-flutter.git" - source: git + path: ".." + relative: true + source: path version: "1.10.0" http: dependency: transitive diff --git a/packages/hmssdk_flutter/ios/Classes/Models/HMSPeerExtension.swift b/packages/hmssdk_flutter/ios/Classes/Models/HMSPeerExtension.swift index 873ddf980..4f308ce58 100644 --- a/packages/hmssdk_flutter/ios/Classes/Models/HMSPeerExtension.swift +++ b/packages/hmssdk_flutter/ios/Classes/Models/HMSPeerExtension.swift @@ -16,6 +16,7 @@ class HMSPeerExtension { "peer_id": peer.peerID, "name": peer.name, "is_local": peer.isLocal, + "type": getPeerType(peer.type), "is_hand_raised": peer.isHandRaised, "customer_description": peer.metadata ?? "", "customer_user_id": peer.customerUserID ?? "", @@ -72,4 +73,15 @@ class HMSPeerExtension { return "defaultUpdate" } } + + private static func getPeerType(_ peerType: HMSPeerType) -> String { + switch peerType { + case .sip: + return "sip" + case .regular: + return "regular" + @unknown default: + return "regular" + } + } } diff --git a/packages/hmssdk_flutter/lib/assets/sdk-versions.json b/packages/hmssdk_flutter/lib/assets/sdk-versions.json index 2c17ec577..2bae0357f 100644 --- a/packages/hmssdk_flutter/lib/assets/sdk-versions.json +++ b/packages/hmssdk_flutter/lib/assets/sdk-versions.json @@ -1,6 +1,6 @@ { "flutter": "1.10.0", - "ios": "1.7.0", + "ios": "1.8.0", "iOSBroadcastExtension": "0.0.9", "iOSHLSPlayerSDK": "0.0.2", "iOSNoiseCancellationModels": "1.0.0", diff --git a/packages/hmssdk_flutter/lib/hmssdk_flutter.dart b/packages/hmssdk_flutter/lib/hmssdk_flutter.dart index 92fce95bd..58bf560c6 100644 --- a/packages/hmssdk_flutter/lib/hmssdk_flutter.dart +++ b/packages/hmssdk_flutter/lib/hmssdk_flutter.dart @@ -23,6 +23,7 @@ export 'src/enum/hms_simulcast_layer.dart'; export 'src/enum/hms_audio_mode.dart'; export 'src/enum/hms_hls_playback_state.dart'; export 'src/enum/hms_poll_enum.dart'; +export 'src/enum/hms_peer_type.dart'; //EXCEPTIONS export 'src/exceptions/hms_exception.dart'; diff --git a/packages/hmssdk_flutter/lib/src/enum/hms_peer_type.dart b/packages/hmssdk_flutter/lib/src/enum/hms_peer_type.dart new file mode 100644 index 000000000..f38e68499 --- /dev/null +++ b/packages/hmssdk_flutter/lib/src/enum/hms_peer_type.dart @@ -0,0 +1,13 @@ +///[HMSPeerType] contains peer types i.e peer joined using SIP or using the application +enum HMSPeerType { sip, regular } + +extension HMSPeerTypevalues on HMSPeerType { + static HMSPeerType getPeerTypeFromString(String peerType) { + switch (peerType) { + case "sip": + return HMSPeerType.sip; + default: + return HMSPeerType.regular; + } + } +} diff --git a/packages/hmssdk_flutter/lib/src/model/hms_local_peer.dart b/packages/hmssdk_flutter/lib/src/model/hms_local_peer.dart index 59957cf29..eaaa2deae 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_local_peer.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_local_peer.dart @@ -27,7 +27,8 @@ class HMSLocalPeer extends HMSPeer { List? auxiliaryTracks, HMSNetworkQuality? networkQuality, DateTime? joinedAt, - DateTime? updatedAt}) + DateTime? updatedAt, + HMSPeerType type = HMSPeerType.regular}) : super( isLocal: isLocal, name: name, @@ -41,32 +42,35 @@ class HMSLocalPeer extends HMSPeer { auxiliaryTracks: auxiliaryTracks, networkQuality: networkQuality, joinedAt: joinedAt, - updatedAt: updatedAt); + updatedAt: updatedAt, + type: type); factory HMSLocalPeer.fromMap(Map map) { return HMSLocalPeer( - peerId: map['peer_id'], - name: map['name'], - isLocal: map['is_local'], - isHandRaised: map['is_hand_raised'], - role: HMSRole.fromMap(map['role']), - metadata: map['metadata'], - customerUserId: map['customer_user_id'], - audioTrack: map["audio_track"] != null - ? HMSLocalAudioTrack.fromMap(map: map["audio_track"]) - : null, - videoTrack: map["video_track"] != null - ? HMSLocalVideoTrack.fromMap(map: map["video_track"]) - : null, - networkQuality: map["network_quality"] != null - ? HMSNetworkQuality.fromMap(map["network_quality"]) - : null, - joinedAt: map.containsKey("joined_at") - ? HMSDateExtension.convertDateFromEpoch(map["joined_at"]) - : null, - updatedAt: map.containsKey("updated_at") - ? HMSDateExtension.convertDateFromEpoch(map["updated_at"]) - : null, - ); + peerId: map['peer_id'], + name: map['name'], + isLocal: map['is_local'], + isHandRaised: map['is_hand_raised'], + role: HMSRole.fromMap(map['role']), + metadata: map['metadata'], + customerUserId: map['customer_user_id'], + audioTrack: map["audio_track"] != null + ? HMSLocalAudioTrack.fromMap(map: map["audio_track"]) + : null, + videoTrack: map["video_track"] != null + ? HMSLocalVideoTrack.fromMap(map: map["video_track"]) + : null, + networkQuality: map["network_quality"] != null + ? HMSNetworkQuality.fromMap(map["network_quality"]) + : null, + joinedAt: map.containsKey("joined_at") + ? HMSDateExtension.convertDateFromEpoch(map["joined_at"]) + : null, + updatedAt: map.containsKey("updated_at") + ? HMSDateExtension.convertDateFromEpoch(map["updated_at"]) + : null, + type: map.containsKey("type") + ? HMSPeerTypevalues.getPeerTypeFromString(map["type"]) + : HMSPeerType.regular); } } diff --git a/packages/hmssdk_flutter/lib/src/model/hms_peer.dart b/packages/hmssdk_flutter/lib/src/model/hms_peer.dart index d1eb9a1ac..8d7e54b85 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_peer.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_peer.dart @@ -21,6 +21,10 @@ class HMSPeer { ///returns whether the peer is local or not. final bool isLocal; + ///contains the type of peer whether it's a regular or SIP peer + ///Default value is regular + final HMSPeerType type; + ///returns whether peer's hand is raised or not final bool isHandRaised; @@ -51,21 +55,21 @@ class HMSPeer { ///updatedAt is the time when the peer object was last updated final DateTime? updatedAt; - HMSPeer({ - required this.peerId, - required this.name, - required this.isLocal, - required this.role, - required this.isHandRaised, - this.customerUserId, - this.metadata, - this.audioTrack, - this.videoTrack, - this.auxiliaryTracks, - this.networkQuality, - this.joinedAt, - this.updatedAt, - }); + HMSPeer( + {required this.peerId, + required this.name, + required this.isLocal, + required this.role, + required this.isHandRaised, + this.customerUserId, + this.metadata, + this.audioTrack, + this.videoTrack, + this.auxiliaryTracks, + this.networkQuality, + this.joinedAt, + this.updatedAt, + this.type = HMSPeerType.regular}); ///important to compare using [peerId] @override diff --git a/packages/hmssdk_flutter/lib/src/model/hms_remote_peer.dart b/packages/hmssdk_flutter/lib/src/model/hms_remote_peer.dart index b820c6f0b..b4727b651 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_remote_peer.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_remote_peer.dart @@ -34,7 +34,8 @@ class HMSRemotePeer extends HMSPeer { List? auxiliaryTracks, HMSNetworkQuality? networkQuality, DateTime? joinedAt, - DateTime? updatedAt}) + DateTime? updatedAt, + HMSPeerType type = HMSPeerType.regular}) : super( peerId: peerId, name: name, @@ -48,7 +49,8 @@ class HMSRemotePeer extends HMSPeer { auxiliaryTracks: auxiliaryTracks, networkQuality: networkQuality, joinedAt: joinedAt, - updatedAt: updatedAt); + updatedAt: updatedAt, + type: type); ///important to compare using [peerId] @override @@ -64,23 +66,25 @@ class HMSRemotePeer extends HMSPeer { factory HMSRemotePeer.fromMap(Map map) { HMSRole role = HMSRole.fromMap(map['role']); HMSRemotePeer peer = HMSRemotePeer( - peerId: map['peer_id'], - name: map['name'], - isLocal: map['is_local'], - isHandRaised: map['is_hand_raised'], - role: role, - metadata: map['metadata'], - customerUserId: map['customer_user_id'], - networkQuality: map["network_quality"] != null - ? HMSNetworkQuality.fromMap(map["network_quality"]) - : null, - joinedAt: map.containsKey("joined_at") - ? HMSDateExtension.convertDateFromEpoch(map["joined_at"]) - : null, - updatedAt: map.containsKey("updated_at") - ? HMSDateExtension.convertDateFromEpoch(map["updated_at"]) - : null, - ); + peerId: map['peer_id'], + name: map['name'], + isLocal: map['is_local'], + isHandRaised: map['is_hand_raised'], + role: role, + metadata: map['metadata'], + customerUserId: map['customer_user_id'], + networkQuality: map["network_quality"] != null + ? HMSNetworkQuality.fromMap(map["network_quality"]) + : null, + joinedAt: map.containsKey("joined_at") + ? HMSDateExtension.convertDateFromEpoch(map["joined_at"]) + : null, + updatedAt: map.containsKey("updated_at") + ? HMSDateExtension.convertDateFromEpoch(map["updated_at"]) + : null, + type: map.containsKey("type") + ? HMSPeerTypevalues.getPeerTypeFromString(map["type"]) + : HMSPeerType.regular); if (map['audio_track'] != null) { peer.audioRemoteTrack =