diff --git a/CHANGELOG.md b/CHANGELOG.md index 363c50f..740fa96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.3.4+1 + +- Add signalingGetTokenByRoomID method for SignalingManager + ## 2.3.4 - Fix bug diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/SignalingManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/SignalingManager.java index 7917cae..9de5062 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/SignalingManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/SignalingManager.java @@ -60,4 +60,11 @@ public class SignalingManager extends BaseManager { value(methodCall, "operationID"), value(methodCall, "groupID")); } + + public void signalingGetTokenByRoomID(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.signalingGetTokenByRoomID( + new OnBaseListener(result, methodCall), + value(methodCall, "operationID"), + value(methodCall, "roomID")); + } } diff --git a/lib/src/manager/im_signaling_manager.dart b/lib/src/manager/im_signaling_manager.dart index 3d1af3f..a22ff08 100644 --- a/lib/src/manager/im_signaling_manager.dart +++ b/lib/src/manager/im_signaling_manager.dart @@ -117,6 +117,24 @@ class SignalingManager { .then((value) => Utils.toObj(value, (map) => RoomCallingInfo.fromJson(map))); + /// 获取进入房间的信息 + /// [roomID] 当前房间ID + Future signalingGetTokenByRoomID({ + required String roomID, + String? operationID, + }) => + _channel + .invokeMethod( + 'signalingGetTokenByRoomID', + _buildParam({ + 'roomID': roomID, + 'operationID': Utils.checkOperationID(operationID), + })) + .then((value) => Utils.toObj( + value, + (map) => SignalingCertificate.fromJson( + map..addAll({'roomID': roomID})))); + static Map _buildParam(Map param) { param["ManagerName"] = "signalingManager"; return param; diff --git a/lib/src/models/signaling_info.dart b/lib/src/models/signaling_info.dart index 7db6d49..080b213 100644 --- a/lib/src/models/signaling_info.dart +++ b/lib/src/models/signaling_info.dart @@ -65,16 +65,15 @@ class InvitationInfo { /// 平台[Platform] int? platformID; - InvitationInfo( - {this.inviterUserID, - this.inviteeUserIDList, - this.groupID, - this.roomID, - this.timeout, - this.initiateTime, - this.mediaType, - this.sessionType, - this.platformID}); + InvitationInfo({this.inviterUserID, + this.inviteeUserIDList, + this.groupID, + this.roomID, + this.timeout, + this.initiateTime, + this.mediaType, + this.sessionType, + this.platformID}); InvitationInfo.fromJson(Map json) { inviterUserID = json['inviterUserID']; @@ -128,7 +127,9 @@ class SignalingCertificate { token = json['token']; roomID = json['roomID']; liveURL = json['liveURL']; - busyLineUserIDList = json['busyLineUserIDList']; + busyLineUserIDList = + null == json['busyLineUserIDList'] ? null : json['busyLineUserIDList'].cast< + String>(); } Map toJson() { @@ -144,16 +145,16 @@ class SignalingCertificate { class RoomCallingInfo { InvitationInfo? invitation; List? participant; - String? token; String? roomID; + String? token; String? liveURL; String? groupID; RoomCallingInfo({ this.invitation, this.participant, - this.token, this.roomID, + this.token, this.liveURL, this.groupID, }); @@ -168,8 +169,8 @@ class RoomCallingInfo { participant!.add(Participant.fromJson(v)); }); } - token = json['token']; roomID = json['roomID'] ?? invitation?.roomID; + token = json['token']; liveURL = json['liveURL']; groupID = json['groupID']; } @@ -182,8 +183,8 @@ class RoomCallingInfo { if (this.participant != null) { data['participant'] = this.participant!.map((v) => v.toJson()).toList(); } - data['token'] = this.token; data['roomID'] = this.roomID; + data['token'] = this.token; data['liveURL'] = this.liveURL; data['groupID'] = this.groupID; return data; @@ -205,7 +206,7 @@ class Participant { ? GroupMembersInfo.fromJson(json['groupMemberInfo']) : null; userInfo = - json['userInfo'] != null ? UserInfo.fromJson(json['userInfo']) : null; + json['userInfo'] != null ? UserInfo.fromJson(json['userInfo']) : null; } Map toJson() { diff --git a/pubspec.yaml b/pubspec.yaml index 4767d89..407164f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_openim_sdk description: An instant messaging plug-in that supports Android and IOS. And the server is also all open source. -version: 2.3.4 +version: 2.3.4+1 homepage: https://www.rentsoft.cn repository: https://github.com/OpenIMSDK/Open-IM-SDK-Flutter