diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d7ea1e..6b7a8d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.8.3+hotfix.7 + +- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.3-patch.7) + ## 3.8.3+3 - [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.3-patch.3) diff --git a/android/build.gradle b/android/build.gradle index 7ca92d8..e517fa6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -50,5 +50,5 @@ android { } dependencies { - implementation 'io.openim:core-sdk:3.8.3-patch3@aar' + implementation 'io.openim:core-sdk:3.8.3-patch7@aar' } \ No newline at end of file diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java index d987f60..6efae10 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/FriendshipManager.java @@ -35,14 +35,16 @@ public class FriendshipManager extends BaseManager { public void getFriendApplicationListAsRecipient(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.getFriendApplicationListAsRecipient( new OnBaseListener(result, methodCall), - value(methodCall, "operationID") + value(methodCall, "operationID"), + jsonValue(methodCall, "req") ); } public void getFriendApplicationListAsApplicant(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.getFriendApplicationListAsApplicant( new OnBaseListener(result, methodCall), - value(methodCall, "operationID") + value(methodCall, "operationID"), + jsonValue(methodCall, "req") ); } @@ -135,4 +137,12 @@ public class FriendshipManager extends BaseManager { jsonValue(methodCall, "req") ); } + + public void getFriendApplicationUnhandledCount(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getFriendApplicationUnhandledCount( + new OnBaseListener(result, methodCall), + value(methodCall, "operationID"), + jsonValue(methodCall, "req") + ); + } } diff --git a/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java b/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java index a5a2667..528ee4b 100644 --- a/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java +++ b/android/src/main/java/io/openim/flutter_openim_sdk/manager/GroupManager.java @@ -126,14 +126,16 @@ public class GroupManager extends BaseManager { public void getGroupApplicationListAsRecipient(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.getGroupApplicationListAsRecipient( new OnBaseListener(result, methodCall), - value(methodCall, "operationID") + value(methodCall, "operationID"), + jsonValue(methodCall, "req") ); } public void getGroupApplicationListAsApplicant(MethodCall methodCall, MethodChannel.Result result) { Open_im_sdk.getGroupApplicationListAsApplicant( new OnBaseListener(result, methodCall), - value(methodCall, "operationID") + value(methodCall, "operationID"), + jsonValue(methodCall, "req") ); } @@ -240,4 +242,11 @@ public class GroupManager extends BaseManager { jsonValue(methodCall, "userIDs") ); } + + public void getGroupApplicationUnhandledCount(MethodCall methodCall, MethodChannel.Result result) { + Open_im_sdk.getGroupApplicationUnhandledCount(new OnBaseListener(result, methodCall), + value(methodCall, "operationID"), + jsonValue(methodCall, "req") + ); + } } \ No newline at end of file diff --git a/ios/Classes/Module/FriendshipManager.swift b/ios/Classes/Module/FriendshipManager.swift index 06fd37b..df33753 100644 --- a/ios/Classes/Module/FriendshipManager.swift +++ b/ios/Classes/Module/FriendshipManager.swift @@ -21,6 +21,7 @@ public class FriendshipManager: BaseServiceManager { self["searchFriends"] = searchFriends self["setFriendListener"] = setFriendListener self["updateFriends"] = updateFriends + self["getFriendApplicationUnhandledCount"] = getFriendApplicationUnhandledCount } func acceptFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -48,11 +49,11 @@ public class FriendshipManager: BaseServiceManager { } func getFriendApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetFriendApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"]) + Open_im_sdkGetFriendApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "req"]) } func getFriendApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ - Open_im_sdkGetFriendApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"]) + Open_im_sdkGetFriendApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "req"]) } func getFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ @@ -87,6 +88,10 @@ public class FriendshipManager: BaseServiceManager { func updateFriends(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ Open_im_sdkUpdateFriends(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "req"]) } + + func getFriendApplicationUnhandledCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ + Open_im_sdkGetFriendApplicationUnhandledCount(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "req"]) + } } public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListenerProtocol { diff --git a/ios/Classes/Module/GroupManager.swift b/ios/Classes/Module/GroupManager.swift index 62e2bd3..1e4db81 100644 --- a/ios/Classes/Module/GroupManager.swift +++ b/ios/Classes/Module/GroupManager.swift @@ -32,6 +32,7 @@ public class GroupManager: BaseServiceManager { self["setGroupListener"] = setGroupListener self["setGroupMemberInfo"] = setGroupMemberInfo self["transferGroupOwner"] = transferGroupOwner + self["getGroupApplicationUnhandledCount"] = getGroupApplicationUnhandledCount } func acceptGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { @@ -55,11 +56,11 @@ public class GroupManager: BaseServiceManager { } func getGroupApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetGroupApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"]) + Open_im_sdkGetGroupApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "req"]) } func getGroupApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { - Open_im_sdkGetGroupApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"]) + Open_im_sdkGetGroupApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "req"]) } func getGroupMemberList(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { @@ -147,6 +148,10 @@ public class GroupManager: BaseServiceManager { func transferGroupOwner(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { Open_im_sdkTransferGroupOwner(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"]) } + + func getGroupApplicationUnhandledCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { + Open_im_sdkGetGroupApplicationUnhandledCount(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "req"]) + } } public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtocol { diff --git a/ios/flutter_openim_sdk.podspec b/ios/flutter_openim_sdk.podspec index 8d06b73..da915be 100644 --- a/ios/flutter_openim_sdk.podspec +++ b/ios/flutter_openim_sdk.podspec @@ -17,7 +17,7 @@ A new Flutter project. s.dependency 'Flutter' s.platform = :ios, '11.0' - s.dependency 'OpenIMSDKCore','3.8.3+3' + s.dependency 'OpenIMSDKCore','3.8.3-hotfix.7' s.static_framework = true s.library = 'resolv' diff --git a/lib/src/manager/im_conversation_manager.dart b/lib/src/manager/im_conversation_manager.dart index cbbb6b2..2cd39a2 100644 --- a/lib/src/manager/im_conversation_manager.dart +++ b/lib/src/manager/im_conversation_manager.dart @@ -4,8 +4,6 @@ import 'dart:developer'; import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; -import '../models/update_req.dart'; - class ConversationManager { MethodChannel _channel; late OnConversationListener listener; diff --git a/lib/src/manager/im_friendship_manager.dart b/lib/src/manager/im_friendship_manager.dart index e132805..5d3c310 100644 --- a/lib/src/manager/im_friendship_manager.dart +++ b/lib/src/manager/im_friendship_manager.dart @@ -3,8 +3,6 @@ import 'dart:async'; import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; -import '../models/update_req.dart'; - class FriendshipManager { MethodChannel _channel; late OnFriendshipListener listener; @@ -51,22 +49,36 @@ class FriendshipManager { })); /// Get Friend Requests Sent to Me - Future> getFriendApplicationListAsRecipient({String? operationID}) => _channel - .invokeMethod( - 'getFriendApplicationListAsRecipient', - _buildParam({ - "operationID": Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); + Future> getFriendApplicationListAsRecipient( + {GetFriendApplicationListAsRecipientReq? req, String? operationID}) { + if (req != null && req.offset > 0) { + assert(req.count > 0, 'count must be greater than 0'); + } + return _channel + .invokeMethod( + 'getFriendApplicationListAsRecipient', + _buildParam({ + 'req': req?.toJson() ?? {}, + "operationID": Utils.checkOperationID(operationID), + })) + .then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); + } /// Get Friend Requests Sent by Me - Future> getFriendApplicationListAsApplicant({String? operationID}) => _channel - .invokeMethod( - 'getFriendApplicationListAsApplicant', - _buildParam({ - "operationID": Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); + Future> getFriendApplicationListAsApplicant( + {GetFriendApplicationListAsApplicantReq? req, String? operationID}) { + if (req != null && req.offset > 0) { + assert(req.count > 0, 'count must be greater than 0'); + } + return _channel + .invokeMethod( + 'getFriendApplicationListAsApplicant', + _buildParam({ + 'req': req?.toJson() ?? {}, + "operationID": Utils.checkOperationID(operationID), + })) + .then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v))); + } /// Get Friend List, including friends who have been put into the blacklist Future> getFriendList({ diff --git a/lib/src/manager/im_group_manager.dart b/lib/src/manager/im_group_manager.dart index 15eee11..b8c6a14 100644 --- a/lib/src/manager/im_group_manager.dart +++ b/lib/src/manager/im_group_manager.dart @@ -2,7 +2,6 @@ import 'dart:developer'; import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; -import 'package:flutter_openim_sdk/src/models/set_group_member_info.dart'; class GroupManager { MethodChannel _channel; @@ -257,22 +256,41 @@ class GroupManager { })); /// Handle group membership applications received as a group owner or administrator - Future> getGroupApplicationListAsRecipient({String? operationID}) => _channel - .invokeMethod( - 'getGroupApplicationListAsRecipient', - _buildParam({ - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); + Future> getGroupApplicationListAsRecipient({ + GetGroupApplicationListAsRecipientReq? req, + String? operationID, + }) { + if (req != null && req.offset > 0) { + assert(req.count > 0, 'count must be greater than 0'); + } + return _channel + .invokeMethod( + 'getGroupApplicationListAsRecipient', + _buildParam({ + 'req': req?.toJson() ?? {}, + "operationID": Utils.checkOperationID(operationID), + })) + .then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); + } /// Get the list of group membership applications sent by the user - Future> getGroupApplicationListAsApplicant({String? operationID}) => _channel - .invokeMethod( - 'getGroupApplicationListAsApplicant', - _buildParam({ - 'operationID': Utils.checkOperationID(operationID), - })) - .then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); + Future> getGroupApplicationListAsApplicant({ + GetGroupApplicationListAsApplicantReq? req, + String? operationID, + }) { + if (req != null && req.offset > 0) { + assert(req.count > 0, 'count must be greater than 0'); + } + + return _channel + .invokeMethod( + 'getGroupApplicationListAsApplicant', + _buildParam({ + 'req': req?.toJson() ?? {}, + "operationID": Utils.checkOperationID(operationID), + })) + .then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map))); + } /// Accept a group membership application as an administrator or group owner /// Note: Membership applications require approval from administrators or the group. diff --git a/lib/src/models/group_info.dart b/lib/src/models/group_info.dart index df65b13..ccb91b8 100644 --- a/lib/src/models/group_info.dart +++ b/lib/src/models/group_info.dart @@ -422,3 +422,90 @@ class GroupInviteResult { return data; } } + +class GetGroupApplicationListAsRecipientReq { + final List groupIDs; + final List handleResults; + final int offset; + final int count; + + GetGroupApplicationListAsRecipientReq({ + this.groupIDs = const [], + this.handleResults = const [], + required this.offset, + required this.count, + }); + + GetGroupApplicationListAsRecipientReq.fromJson(Map json) + : groupIDs = json['groupIDs'] == null ? [] : List.from(json['groupIDs'].map((x) => x)), + handleResults = json['handleResults'] == null ? [] : List.from(json['handleResults'].map((x) => x)), + offset = json['offset'], + count = json['count']; + + Map toJson() { + final data = {}; + data['groupIDs'] = groupIDs; + data['handleResults'] = handleResults; + data['offset'] = offset; + data['count'] = count; + return data; + } + + @override + String toString() { + return 'GetGroupApplicationListAsRecipientReq{groupIDs: $groupIDs, handleResults: $handleResults, offset: $offset, count: $count}'; + } +} + +class GetGroupApplicationListAsApplicantReq { + final List groupIDs; + final List handleResults; + final int offset; + final int count; + + GetGroupApplicationListAsApplicantReq({ + this.groupIDs = const [], + this.handleResults = const [], + required this.offset, + required this.count, + }); + + GetGroupApplicationListAsApplicantReq.fromJson(Map json) + : groupIDs = json['groupIDs'] == null ? [] : List.from(json['groupIDs'].map((x) => x)), + handleResults = json['handleResults'] == null ? [] : List.from(json['handleResults'].map((x) => x)), + offset = json['offset'], + count = json['count']; + + Map toJson() { + final data = {}; + data['groupIDs'] = groupIDs; + data['handleResults'] = handleResults; + data['offset'] = offset; + data['count'] = count; + return data; + } + + @override + String toString() { + return 'GetGroupApplicationListAsApplicantReq{groupIDs: $groupIDs, handleResults: $handleResults, offset: $offset, count: $count}'; + } +} + +class GetGroupApplicationUnhandledCountReq { + final int time; + + GetGroupApplicationUnhandledCountReq({this.time = 0}); + + GetGroupApplicationUnhandledCountReq.fromJson(Map json) : time = json['time']; + + Map toJson() { + final data = {}; + data['time'] = time; + return data; + } + + @override + String toString() { + return 'GetGroupApplicationUnhandledCountReq{time: $time}'; + } +} diff --git a/lib/src/models/search_info.dart b/lib/src/models/search_info.dart index 0748239..70fd776 100644 --- a/lib/src/models/search_info.dart +++ b/lib/src/models/search_info.dart @@ -124,6 +124,6 @@ class SearchFriendsInfo extends FriendInfo { Map toJson() { final data = super.toJson(); data['relationship'] = this.relationship; - return data ?? {}; + return data; } } diff --git a/lib/src/models/user_info.dart b/lib/src/models/user_info.dart index 7f3e463..9145e69 100644 --- a/lib/src/models/user_info.dart +++ b/lib/src/models/user_info.dart @@ -423,3 +423,78 @@ class UserStatusInfo { return data; } } + +class GetFriendApplicationListAsRecipientReq { + final List handleResults; + final int offset; + final int count; + + GetFriendApplicationListAsRecipientReq({ + this.handleResults = const [], + required this.offset, + required this.count, + }); + + GetFriendApplicationListAsRecipientReq.fromJson(Map json) + : handleResults = json['handleResults'] == null ? [] : List.from(json['handleResults'].map((x) => x)), + offset = json['offset'], + count = json['count']; + + Map toJson() { + final data = {}; + data['handleResults'] = handleResults; + data['offset'] = offset; + data['count'] = count; + return data; + } + + @override + String toString() { + return 'GetFriendApplicationListAsRecipientReq{handleResults: $handleResults, offset: $offset, count: $count}'; + } +} + +class GetFriendApplicationListAsApplicantReq { + final int offset; + final int count; + + GetFriendApplicationListAsApplicantReq({ + required this.offset, + required this.count, + }); + + GetFriendApplicationListAsApplicantReq.fromJson(Map json) + : offset = json['offset'], + count = json['count']; + + Map toJson() { + final data = {}; + data['offset'] = offset; + data['count'] = count; + return data; + } + + @override + String toString() { + return 'GetFriendApplicationListAsApplicantReq{offset: $offset, count: $count}'; + } +} + +class GetFriendApplicationUnhandledCountReq { + final int time; + + GetFriendApplicationUnhandledCountReq({this.time = 0}); + + GetFriendApplicationUnhandledCountReq.fromJson(Map json) : time = json['time']; + + Map toJson() { + final data = {}; + data['time'] = time; + return data; + } + + @override + String toString() { + return 'GetSelfUnhandledApplyCountReq{time: $time}'; + } +} diff --git a/lib/src/openim.dart b/lib/src/openim.dart index e8fe9fe..c4f7a19 100644 --- a/lib/src/openim.dart +++ b/lib/src/openim.dart @@ -2,7 +2,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; class OpenIM { - static const version = '3.8.3+hotfix.3.1'; + static const version = '3.8.3+hotfix.7'; static const _channel = MethodChannel('flutter_openim_sdk'); diff --git a/pubspec.yaml b/pubspec.yaml index 0148832..dd171a5 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: 3.8.3+hotfix.3.1 +version: 3.8.3+hotfix.7 homepage: https://www.openim.io repository: https://github.com/openimsdk/open-im-sdk-flutter