From 1bf420165bfbdf08b39a3dfe475afbd27c897237 Mon Sep 17 00:00:00 2001 From: Decoder07 Date: Tue, 7 Nov 2023 17:27:00 +0530 Subject: [PATCH] Update HMSPeer object --- .../lib/src/model/hms_peer.dart | 37 +------------------ 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/packages/hmssdk_flutter/lib/src/model/hms_peer.dart b/packages/hmssdk_flutter/lib/src/model/hms_peer.dart index 350256fb9..76ffb8ff1 100644 --- a/packages/hmssdk_flutter/lib/src/model/hms_peer.dart +++ b/packages/hmssdk_flutter/lib/src/model/hms_peer.dart @@ -80,42 +80,9 @@ class HMSPeer { int get hashCode => peerId.hashCode; factory HMSPeer.fromMap(Map map) { - HMSRole role = HMSRole.fromMap(map['role']); - - // TODO: add auxiliary tracks - - HMSPeer peer = (map['is_local'] == true) + return (map['is_local'] == true) ? HMSLocalPeer.fromMap(map) - : 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 - ? null - : HMSNetworkQuality.fromMap(map['network_quality']), - joinedAt: map.containsKey("joined_at") - ? HMSDateExtension.convertDate(map["joined_at"]) - : null, - updatedAt: map.containsKey("updated_at") - ? HMSDateExtension.convertDate(map["updated_at"]) - : null, - ); - - if (map['audio_track'] != null) { - peer.audioTrack = HMSAudioTrack.fromMap( - map: map['audio_track']!, isLocal: peer.isLocal); - } - - if (map['video_track'] != null) { - peer.videoTrack = HMSVideoTrack.fromMap( - map: map['video_track']!, isLocal: peer.isLocal); - } - - return peer; + : HMSRemotePeer.fromMap(map); } @override