Compare commits

...

53 Commits
3.3.0 ... 3.8.1

Author SHA1 Message Date
Brett
6a446a7b33 chore: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.1 2024-09-29 17:27:30 +08:00
Brett
9f57971ee9 feat: Added getFriendListPageMap interface. 2024-08-15 16:28:18 +08:00
Brett
29b43d03ac feat: Add input status related API; update synchronization monitoring related API. 2024-08-07 16:57:15 +08:00
Brett
cade0091a7 fix: Calling setConversationEx will report that type 'String' is not a subtype of type 'List<dynamic>' in type cast. (#138) 2024-08-07 14:55:35 +08:00
Brett
d90bb33764 feat: [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.1-rc.0) 2024-08-06 15:24:10 +08:00
Brett
8c64af6798 feat: [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.1-rc.0) 2024-08-06 15:22:10 +08:00
Brett
c10dabc7e8 feat: [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.0) 2024-08-02 21:59:30 +08:00
Brett
ff25636516 fix: Bug fixes and performance enhancements. 2024-07-28 19:02:22 +08:00
Brett
43d3f05d4d Update README.md 2024-05-16 14:45:23 +08:00
Brett
3b8ec30625 Update README.md 2024-04-25 21:01:53 +08:00
Brett
44fe1a3210 chore: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1 2024-03-06 21:01:19 +08:00
Brett
9b11686dac fix: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1-alpha.8 2024-02-02 11:05:32 +08:00
Brett
1764da125b fix: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1-alpha.7 2024-01-23 14:49:31 +08:00
Brett
bf4cdf0754 fix: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1-alpha.7 2024-01-23 14:32:11 +08:00
Brett
45cd497d94 fix: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1-alpha.7 2024-01-23 11:34:29 +08:00
Brett
1db776e23d fix: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1-alpha.7 2024-01-23 11:30:51 +08:00
Brett
98227756df chore: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1-alpha.2 2024-01-08 11:39:17 +08:00
oliver
da148f78e3 3.5.1-alpha.2 2024-01-08 11:05:06 +08:00
oliver
883627f077 3.5.0-rc.1+1 2024-01-02 15:02:19 +08:00
oliver
50f8350987 3.5.0-rc.2 2024-01-02 14:58:08 +08:00
oliver
d098a50eaa Merge remote-tracking branch 'origin/main' 2024-01-02 12:12:37 +08:00
oliver
9e50ecf341 3.5.0+1 2024-01-02 12:12:20 +08:00
oliver
9aa861ff74 3.5.0+1 2024-01-02 12:08:13 +08:00
oliver
cfadcc5e35 3.5.0+1 2024-01-02 11:59:26 +08:00
Brett
8b4b21e18d feat: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.0-rc.1 2023-12-29 20:19:29 +08:00
Brett
2814122ba4 Merge branch 'main' of https://github.com/OpenIMSDK/Open-IM-SDK-Flutter 2023-12-13 16:28:33 +08:00
Brett
2e94254192 feat: Add the log upload function of SDK. 2023-12-13 16:28:25 +08:00
Brett
a9573dbc63 Update README.md 2023-11-22 11:30:48 +08:00
Brett
92dd3adad5 Correct homepage and other information. 2023-11-17 17:01:22 +08:00
Brett
ebae12f11d fix: 'Fix return value type of 'getFriendsInfo'. 2023-11-17 16:45:22 +08:00
Brett
0dec034a55 Adjust some fields and APIs. 2023-11-17 15:05:27 +08:00
Brett
2b3f062e5c chore: Adjust the default values of some properties. 2023-11-16 18:28:39 +08:00
Brett
a4b52f5895 fix: Fixed some parameter errors. 2023-11-16 16:20:54 +08:00
Brett
bf9cd3ca21 chore: change log. 2023-11-11 09:02:01 +08:00
Brett
0e1473ff0f feat: https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.4.0 2023-11-10 22:28:19 +08:00
Brett
7e1969d8ad Update README.md 2023-11-10 09:49:10 +08:00
Brett
e6b479726b Update README.md 2023-11-07 17:18:09 +08:00
Brett
2aec080e2f add 'getConversationIDBySessionType' 2023-11-01 14:18:09 +08:00
Brett
0ef41147fd add 'localEx' 2023-11-01 12:09:33 +08:00
Brett
cd506801cf feat: add 'hideAllConversations', 'updateFcmToken' 2023-11-01 11:41:18 +08:00
Brett
2cafa6bab8 fix: 'unsubscribeUsersStatus' 2023-10-26 10:21:57 +08:00
Brett
ceba9e827f Add some APIs. 2023-10-19 19:08:54 +08:00
Brett
4fef487562 fix: Fixed some issues. 2023-10-17 17:01:56 +08:00
Brett
dc61665f13 Merge branch 'main' of https://github.com/OpenIMSDK/Open-IM-SDK-Flutter 2023-10-17 16:09:29 +08:00
Brett
67251ae7ea fix: Fixed some issues. 2023-10-17 16:09:19 +08:00
Brett
908d7dd7e7 Update README.md 2023-10-13 15:28:35 +08:00
Brett
d07495fff6 Update README.md 2023-10-12 18:08:04 +08:00
Brett
2f8b019d83 Update README.md 2023-10-12 18:06:51 +08:00
Oliver Wong
4a72a37e2b Merge pull request #122 from openimsdk/patch-1
Update README.md
2023-10-12 16:24:06 +08:00
Oliver Wong
b6a71d0b6f Update README.md
Update README.md
2023-10-12 16:23:45 +08:00
std-s
627ee54a67 feat: Optimize comments and field names. 2023-10-12 15:01:38 +08:00
Brett
cc6d164985 Update README.md 2023-10-11 10:33:42 +08:00
std-s
29b66de9bf Update README.zh-cn.md 2023-09-12 17:36:34 +08:00
88 changed files with 2794 additions and 4767 deletions

View File

@@ -1,25 +1,27 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Dart SDK"> <library name="Dart SDK">
<CLASSES> <CLASSES>
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/async" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/async" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/cli" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/cli" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/collection" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/collection" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/convert" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/convert" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/core" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/core" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/developer" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/developer" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/ffi" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/ffi" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/html" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/html" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/indexed_db" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/indexed_db" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/io" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/io" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/isolate" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/isolate" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/js" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/js" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/js_util" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/js_interop" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/math" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/js_interop_unsafe" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/mirrors" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/js_util" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/svg" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/math" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/typed_data" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/mirrors" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/web_audio" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/svg" />
<root url="file://$USER_HOME$/Development/flutter/bin/cache/dart-sdk/lib/web_gl" /> <root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/typed_data" />
<root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/web_audio" />
<root url="file://$PROJECT_DIR$/../../install/flutter_sdk/bin/cache/dart-sdk/lib/web_gl" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />

1
.idea/misc.xml generated
View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="FrameworkDetectionExcludesConfiguration"> <component name="FrameworkDetectionExcludesConfiguration">
<type id="android" /> <type id="android" />

View File

@@ -1,3 +1,43 @@
## 3.8.1
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.1)
## 3.8.1-rc.0
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.1-rc.0)
## 3.8.0
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.0)
## 3.8.0-rc.16
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.8.0-rc.16)
## 3.5.1
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1)
## 3.5.1-alpha.7
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1-alpha.7)
## 3.5.1-alpha.2
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.1-alpha.2)
## 3.5.0-rc.1
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.5.0-rc.1)
## 3.4.0+1
- Adjust some fields and APIs.
## 3.4.0
- [Bug fixes and performance enhancements.](https://github.com/openimsdk/openim-sdk-core/releases/tag/v3.4.0)
## 3.3.0 ## 3.3.0
- [Bug fixes and performance enhancements.](https://github.com/OpenIMSDK/openim-sdk-core/releases/tag/v3.3.0) - [Bug fixes and performance enhancements.](https://github.com/OpenIMSDK/openim-sdk-core/releases/tag/v3.3.0)

170
README.md
View File

@@ -1,18 +1,158 @@
# flutter_openim_sdk # Flutter Client SDK for OpenIM 👨‍💻💬
<img src="https://github.com/OpenIMSDK/OpenIM-Docs/blob/main/docs/images/WechatIMG20.jpeg" alt="image" style="width: 350px; " />
[![pub package](https://img.shields.io/pub/v/flutter_openim_sdk.svg)](https://pub.flutter-io.cn/packages/flutter_openim_sdk) Use this SDK to add instant messaging capabilities to your Flutter app. By connecting to a self-hosted [OpenIM](https://www.openim.online/) server, you can quickly integrate instant messaging capabilities into your app with just a few lines of code.
[![Generic badge](https://img.shields.io/badge/platform-android%20|%20ios%20-blue.svg)](https://pub.dev/packages/flutter_openim_sdk)
[![GitHub license](https://img.shields.io/github/license/OpenIMSDK/Open-IM-SDK-Flutter)](https://github.com/OpenIMSDK/Open-IM-SDK-Flutter/blob/main/LICENSE)
A flutter im plugin for android and ios.
#### [demo open source code](https://github.com/OpenIMSDK/Open-IM-Flutter-Demo.git) | [UI library source code](https://github.com/hrxiang/flutter_openim_widget.git)
Scan the QR code below to experience the SDK call example Demo
![Android](https://www.pgyer.com/app/qrcode/OpenIM-Flutter)
# [SDK Documents](https://doc.rentsoft.cn/sdks/quickstart/flutter)
The underlying SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using [gomobile](https://github.com/golang/mobile), it can be compiled into an AAR file for Android integration. Android interacts with the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) through JSON, and the SDK exposes a re-encapsulated API for easy usage. In terms of data storage, Android utilizes the SQLite layer provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core).
The underlying SDK core is implemented in [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core). Using [gomobile](https://github.com/golang/mobile), it can be compiled into an XCFramework for iOS integration. iOS interacts with the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core) through JSON, and the SDK exposes a re-encapsulated API for easy usage. In terms of data storage, iOS utilizes the SQLite layer provided internally by the [OpenIM SDK Core](https://github.com/openimsdk/openim-sdk-core).
Based on the above AAR and XCFramework packages, the IM SDK for Flutter is encapsulated through the Flutter plug-in.
## Documentation 📚
Visit [https://docs.openim.io/](https://docs.openim.io/) for detailed documentation and guides.
For the SDK reference, see [https://docs.openim.io/sdks/quickstart/flutter](https://docs.openim.io/sdks/quickstart/flutter).
## Installation 💻
### Adding Dependencies
```dart
flutter_openim_sdk: lastest
```
## Usage 🚀
The following examples demonstrate how to use the SDK.
### Importing the SDK
```dart
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
```
### Initialize
```
final success = await OpenIM.iMManager.initSDK(
platform: 0, // Platform, referring to the IMPlatform class.
apiAddr: "", // SDK's API interface address.
wsAddr: "", // SDK's WebSocket address.
dataDir: "", // Data storage path. For example, you can use getApplicationDocumentsDirectory() to get a path.
logLevel: 6, // Log level (default value is 6).
listener: OnConnectListener(
onConnectSuccess: () {
// Successfully connected to the server.
},
onConnecting: () {
// Connecting to the server, suitable for showing a "Connecting" status on the UI.
},
onConnectFailed: (code, errorMsg) {
// Failed to connect to the server, you can notify the user that the current network connection is not available.
},
onUserSigExpired: () {
// User's login token (UserSig) has expired, prompting the user to log in again with a new token.
},
onKickedOffline: () {
// The current user has been kicked offline, and you can prompt the user to log in again with a message like "You have been logged in on another device. Do you want to log in again?"
},
),
);
```
### Logging In and Listening for Connection Status
> Note1: You need to [deploy](https://github.com/openimsdk/open-im-server#rocket-quick-start) OpenIM Server first, the default port of OpenIM Server is 10001, 10002.
> Note2: You need to set up the listeners first and then log in.
```dart
// Set listener
OpenIM.iMManager
//
..userManager.setUserListener(OnUserListener(
))
// Add message listener (remove when not in use)
..messageManager.setAdvancedMsgListener(OnAdvancedMsgListener(
))
// Set up message sending progress listener
..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener(
))
..messageManager.setCustomBusinessListener(
)
// Set up friend relationship listener
..friendshipManager.setFriendshipListener(OnFriendshipListener(
))
// Set up conversation listener
..conversationManager.setConversationListener(OnConversationListener(
))
// Set up group listener
..groupManager.setGroupListener(OnGroupListener(
));
// Retrieve the profile of the currently logged-in user
final userInfo = await OpenIM.iMManager.login(
userID: "", // userID is obtained from your own business server
token: "", // The token should be acquired by your business server by exchanging with OpenIM server based on a secret key
);
```
To log into the IM server, you need to create an account and obtain a user ID and token. Refer to the [access token documentation](https://doc.rentsoft.cn/restapi/userManagement/userRegister) for details.
### Receiving and Sending Messages 💬
OpenIM makes it easy to send and receive messages. By default, there is no restriction on having a friend relationship to send messages (although you can configure other policies on the server). If you know the user ID of the recipient, you can conveniently send a message to them.
```dart
//Send
OpenIM.iMManager.messageManager.sendMessage(
message: await OpenIM.iMManager.messageManager.createTextMessage(
text: 'hello openim',
),
userID: userID
).catchError((error, _){
// Message sent successfully ✉️
} )
.whenComplete(() {
// Failed to send message ❌
});
//Receive
OpenIM.iMManager.messageManager.setAdvancedMsgListener(OnAdvancedMsgListener(
onRecvNewMessage:(Message msg) {
// Received new message 📨
}
))
```
## Examples 🌟
You can find a demo Flutter app that uses the SDK in the [open-im-flutter-demo](https://github.com/openimsdk/open-im-flutter-demo) repository.
## Community :busts_in_silhouette:
- 📚 [OpenIM Community](https://github.com/OpenIMSDK/community)
- 💕 [OpenIM Interest Group](https://github.com/Openim-sigs)
- 🚀 [Join our Slack community](https://join.slack.com/t/openimsdk/shared_invite/zt-2ijy1ys1f-O0aEDCr7ExRZ7mwsHAVg9A)
- :eyes: [Join our wechat (微信群)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg)
## Community Meetings :calendar:
We want anyone to get involved in our community and contributing code, we offer gifts and rewards, and we welcome you to join us every Thursday night.
Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) 🎯, then you can search the Open-IM-Server pipeline to join
We take notes of each [biweekly meeting](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) in [GitHub discussions](https://github.com/openimsdk/open-im-server/discussions/categories/meeting), Our historical meeting notes, as well as replays of the meetings are available at [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing).
## Who are using OpenIM :eyes:
Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [📝comment](https://github.com/openimsdk/open-im-server/issues/379) and share your use case.
## License :page_facing_up:
OpenIM is licensed under the Apache 2.0 license. See [LICENSE](https://github.com/openimsdk/open-im-server/tree/main/LICENSE) for the full license text.

File diff suppressed because it is too large Load Diff

View File

@@ -52,5 +52,5 @@ android {
dependencies { dependencies {
// 本地依赖现将aar复制到libs/io/openim/core-sdk/0.0.1/ 下命名core-sdk-0.0.1.aar // 本地依赖现将aar复制到libs/io/openim/core-sdk/0.0.1/ 下命名core-sdk-0.0.1.aar
// implementation 'io.openim:core-sdk:0.0.1@aar' // implementation 'io.openim:core-sdk:0.0.1@aar'
implementation 'io.openim:core-sdk:3.3.0@aar' implementation 'io.openim:core-sdk:3.8.1@aar'
} }

View File

@@ -37,42 +37,6 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg
CommonUtil.emitEvent("advancedMsgListener", "onRecvC2CReadReceipt", values); CommonUtil.emitEvent("advancedMsgListener", "onRecvC2CReadReceipt", values);
} }
@Override
public void onRecvGroupReadReceipt(String s) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("groupMsgReceiptList", s);
CommonUtil.emitEvent("advancedMsgListener", "onRecvGroupReadReceipt", values);
}
@Override
public void onRecvMessageExtensionsAdded(String s, String s1) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("msgID", s);
values.put("reactionExtensionList", s1);
CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsAdded", values);
}
@Override
public void onRecvMessageExtensionsChanged(String s, String s1) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("msgID", s);
values.put("reactionExtensionList", s1);
CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsChanged", values);
}
@Override
public void onRecvMessageExtensionsDeleted(String s, String s1) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("msgID", s);
values.put("reactionExtensionKeyList", s1);
CommonUtil.emitEvent("advancedMsgListener", "onRecvMessageExtensionsDeleted", values);
}
@Override @Override
public void onRecvNewMessage(String s) { public void onRecvNewMessage(String s) {
final Map<String, String> values = new ArrayMap<>(); final Map<String, String> values = new ArrayMap<>();
@@ -88,4 +52,12 @@ public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsg
values.put("message", s); values.put("message", s);
CommonUtil.emitEvent("advancedMsgListener", "onRecvOfflineNewMessage", values); CommonUtil.emitEvent("advancedMsgListener", "onRecvOfflineNewMessage", values);
} }
@Override
public void onRecvOnlineOnlyMessage(String s) {
final Map<String, String> values = new ArrayMap<>();
values.put("id", id);
values.put("message", s);
CommonUtil.emitEvent("advancedMsgListener", "onRecvOnlineOnlyMessage", values);
}
} }

View File

@@ -19,13 +19,15 @@ public class OnBaseListener implements Base {
@Override @Override
public void onError(int l, String s) { public void onError(int l, String s) {
Log.i("F-OpenIMSDK(native call flutter)", "method: 【 " + call.method + " 】, onError: { code:" + l + ", message:" + s + "}"); String threadName = Thread.currentThread().getName();
Log.i("F-OpenIMSDK(native call flutter)", "thread: " + threadName + " method: 【 " + call.method + " 】, onError: { code:" + l + ", message:" + s + "}");
CommonUtil.runMainThreadReturnError(result, l, s, null); CommonUtil.runMainThreadReturnError(result, l, s, null);
} }
@Override @Override
public void onSuccess(String s) { public void onSuccess(String s) {
Log.i("F-OpenIMSDK(native call flutter)", "method: 【 " + call.method + " 】, onSuccess: " + s); String threadName = Thread.currentThread().getName();
Log.i("F-OpenIMSDK(native call flutter)", "thread: " + threadName + " method: 【 " + call.method + " 】, onSuccess: " + s);
CommonUtil.runMainThreadReturn(result, s); CommonUtil.runMainThreadReturn(result, s);
} }
} }

View File

@@ -31,4 +31,9 @@ public class OnConnListener implements open_im_sdk_callback.OnConnListener {
public void onUserTokenExpired() { public void onUserTokenExpired() {
CommonUtil.emitEvent("connectListener", "onUserTokenExpired", null); CommonUtil.emitEvent("connectListener", "onUserTokenExpired", null);
} }
@Override
public void onUserTokenInvalid(String s) {
CommonUtil.emitEvent("connectListener", "onUserTokenInvalid", s);
}
} }

View File

@@ -10,24 +10,34 @@ public class OnConversationListener implements open_im_sdk_callback.OnConversati
CommonUtil.emitEvent("conversationListener", "onConversationChanged", s); CommonUtil.emitEvent("conversationListener", "onConversationChanged", s);
} }
@Override
public void onConversationUserInputStatusChanged(String s) {
CommonUtil.emitEvent("conversationListener", "onConversationUserInputStatusChanged", s);
}
@Override @Override
public void onNewConversation(String s) { public void onNewConversation(String s) {
CommonUtil.emitEvent("conversationListener", "onNewConversation", s); CommonUtil.emitEvent("conversationListener", "onNewConversation", s);
} }
@Override @Override
public void onSyncServerFailed() { public void onSyncServerFailed(boolean reinstalled) {
CommonUtil.emitEvent("conversationListener", "onSyncServerFailed", null); CommonUtil.emitEvent("conversationListener", "onSyncServerFailed", reinstalled);
} }
@Override @Override
public void onSyncServerFinish() { public void onSyncServerFinish(boolean reinstalled) {
CommonUtil.emitEvent("conversationListener", "onSyncServerFinish", null); CommonUtil.emitEvent("conversationListener", "onSyncServerFinish", reinstalled);
} }
@Override @Override
public void onSyncServerStart() { public void onSyncServerStart(boolean reinstalled) {
CommonUtil.emitEvent("conversationListener", "onSyncServerStart", null); CommonUtil.emitEvent("conversationListener", "onSyncServerStart", reinstalled);
}
@Override
public void onSyncServerProgress(long progress) {
CommonUtil.emitEvent("conversationListener", "onSyncServerProgress", progress);
} }
@Override @Override

View File

@@ -1,30 +1,30 @@
package io.openim.flutter_openim_sdk.listener; //package io.openim.flutter_openim_sdk.listener;
//
import io.openim.flutter_openim_sdk.util.CommonUtil; //import io.openim.flutter_openim_sdk.util.CommonUtil;
//
public class OnListenerForService implements open_im_sdk_callback.OnListenerForService { //public class OnListenerForService implements open_im_sdk_callback.OnListenerForService {
@Override // @Override
public void onFriendApplicationAccepted(String s) { // public void onFriendApplicationAccepted(String s) {
CommonUtil.emitEvent("listenerForService", "onFriendApplicationAccepted", s); // CommonUtil.emitEvent("listenerForService", "onFriendApplicationAccepted", s);
} // }
//
@Override // @Override
public void onFriendApplicationAdded(String s) { // public void onFriendApplicationAdded(String s) {
CommonUtil.emitEvent("listenerForService", "onFriendApplicationAdded", s); // CommonUtil.emitEvent("listenerForService", "onFriendApplicationAdded", s);
} // }
//
@Override // @Override
public void onGroupApplicationAccepted(String s) { // public void onGroupApplicationAccepted(String s) {
CommonUtil.emitEvent("listenerForService", "onGroupApplicationAccepted", s); // CommonUtil.emitEvent("listenerForService", "onGroupApplicationAccepted", s);
} // }
//
@Override // @Override
public void onGroupApplicationAdded(String s) { // public void onGroupApplicationAdded(String s) {
CommonUtil.emitEvent("listenerForService", "onGroupApplicationAdded", s); // CommonUtil.emitEvent("listenerForService", "onGroupApplicationAdded", s);
} // }
//
@Override // @Override
public void onRecvNewMessage(String s) { // public void onRecvNewMessage(String s) {
CommonUtil.emitEvent("listenerForService", "onRecvNewMessage", s); // CommonUtil.emitEvent("listenerForService", "onRecvNewMessage", s);
} // }
} //}

View File

@@ -1,12 +0,0 @@
package io.openim.flutter_openim_sdk.listener;
import io.openim.flutter_openim_sdk.util.CommonUtil;
public class OnMessageKvInfoListener implements open_im_sdk_callback.OnMessageKvInfoListener {
// 经过聚合后的kv计算了总数判断了是否包含自己
@Override
public void onMessageKvInfoChanged(String s) {
CommonUtil.emitEvent("messageKvInfoListener", "onMessageKvInfoChanged", s);
}
}

View File

@@ -0,0 +1,26 @@
package io.openim.flutter_openim_sdk.listener;
import android.util.ArrayMap;
import java.util.Map;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.openim.flutter_openim_sdk.util.CommonUtil;
import open_im_sdk_callback.UploadLogProgress;
public class OnUploadLogsListener implements UploadLogProgress {
final private MethodChannel.Result result;
public OnUploadLogsListener(MethodChannel.Result result, MethodCall call) {
this.result = result;
}
@Override
public void onProgress(long current, long size) {
final Map<String, Object> values = new ArrayMap<>();
values.put("current", current);
values.put("size", size);
CommonUtil.emitEvent("uploadLogsListener", "onProgress", values);
}
}

View File

@@ -13,4 +13,19 @@ public class OnUserListener implements open_im_sdk_callback.OnUserListener {
public void onUserStatusChanged(String s) { public void onUserStatusChanged(String s) {
CommonUtil.emitEvent("userListener", "onUserStatusChanged", s); CommonUtil.emitEvent("userListener", "onUserStatusChanged", s);
} }
@Override
public void onUserCommandAdd(String s) {
CommonUtil.emitEvent("userListener", "onUserCommandAdd", s);
}
@Override
public void onUserCommandDelete(String s) {
CommonUtil.emitEvent("userListener", "onUserCommandDelete", s);
}
@Override
public void onUserCommandUpdate(String s) {
CommonUtil.emitEvent("userListener", "onUserCommandUpdate", s);
}
} }

View File

@@ -59,15 +59,6 @@ public class ConversationManager extends BaseManager {
); );
} }
public void pinConversation(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.pinConversation(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
value(methodCall, "isPinned")
);
}
public void hideConversation(MethodCall methodCall, MethodChannel.Result result) { public void hideConversation(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.hideConversation( Open_im_sdk.hideConversation(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
@@ -98,32 +89,6 @@ public class ConversationManager extends BaseManager {
int2long(methodCall, "sessionType"))); int2long(methodCall, "sessionType")));
} }
public void setConversationRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationRecvMessageOpt(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
int2long(methodCall, "status")
);
}
public void getConversationRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getConversationRecvMessageOpt(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "conversationIDList")
);
}
public void setConversationPrivateChat(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationPrivateChat(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "conversationID"),
value(methodCall, "isPrivate")
);
}
public void clearConversationAndDeleteAllMsg(MethodCall methodCall, MethodChannel.Result result) { public void clearConversationAndDeleteAllMsg(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.clearConversationAndDeleteAllMsg( Open_im_sdk.clearConversationAndDeleteAllMsg(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
@@ -140,57 +105,58 @@ public class ConversationManager extends BaseManager {
); );
} }
public void deleteAllConversationFromLocal(MethodCall methodCall, MethodChannel.Result result) { public void getAtAllTag(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.deleteAllConversationFromLocal( CommonUtil.runMainThreadReturn(result, Open_im_sdk.getAtAllTag(value(methodCall, "operationID")));
}
public void hideAllConversations(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.hideAllConversations(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID") value(methodCall, "operationID")
); );
} }
public void resetConversationGroupAtType(MethodCall methodCall, MethodChannel.Result result) { public void searchConversation(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.resetConversationGroupAtType( Open_im_sdk.searchConversation(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "conversationID") value(methodCall, "name")
); );
} }
public void getAtAllTag(MethodCall methodCall, MethodChannel.Result result) { public void changeInputStates(MethodCall methodCall, MethodChannel.Result result) {
CommonUtil.runMainThreadReturn(result, Open_im_sdk.getAtAllTag(value(methodCall, "operationID"))); Open_im_sdk.changeInputStates(
}
public void setGlobalRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGlobalRecvMessageOpt(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
int2long(methodCall, "status")
);
}
public void setConversationBurnDuration(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationBurnDuration(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "conversationID"), value(methodCall, "conversationID"),
value(methodCall, "burnDuration") value(methodCall, "focus")
); );
} }
public void setConversationIsMsgDestruct(MethodCall methodCall, MethodChannel.Result result) { public void getInputStates(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationIsMsgDestruct( Open_im_sdk.getInputStates(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "conversationID"), value(methodCall, "conversationID"),
value(methodCall, "isMsgDestruct") value(methodCall, "userID")
); );
} }
public void setConversationMsgDestructTime(MethodCall methodCall, MethodChannel.Result result) { public void setConversation(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setConversationMsgDestructTime( Open_im_sdk.setConversation(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "conversationID"), value(methodCall, "conversationID"),
int2long(methodCall, "duration") jsonValue(methodCall, "req")
);
}
public void searchConversations(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.searchConversation(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "name")
); );
} }
} }

View File

@@ -19,7 +19,8 @@ public class FriendshipManager extends BaseManager {
Open_im_sdk.getSpecifiedFriendsInfo( Open_im_sdk.getSpecifiedFriendsInfo(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "userIDList") jsonValue(methodCall, "userIDList"),
value(methodCall, "filterBlack")
); );
} }
@@ -48,15 +49,18 @@ public class FriendshipManager extends BaseManager {
public void getFriendList(MethodCall methodCall, MethodChannel.Result result) { public void getFriendList(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getFriendList( Open_im_sdk.getFriendList(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID") value(methodCall, "operationID"),
value(methodCall, "filterBlack")
); );
} }
public void setFriendRemark(MethodCall methodCall, MethodChannel.Result result) { public void getFriendListPage(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setFriendRemark( Open_im_sdk.getFriendListPage(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall) value(methodCall, "offset"),
value(methodCall, "count"),
value(methodCall, "filterBlack")
); );
} }
@@ -64,7 +68,8 @@ public class FriendshipManager extends BaseManager {
Open_im_sdk.addBlack( Open_im_sdk.addBlack(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "userID") value(methodCall, "userID"),
value(methodCall, "ex")
); );
} }
@@ -122,4 +127,12 @@ public class FriendshipManager extends BaseManager {
jsonValue(methodCall, "searchParam") jsonValue(methodCall, "searchParam")
); );
} }
public void updateFriends(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.updateFriends(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "req")
);
}
} }

View File

@@ -62,6 +62,15 @@ public class GroupManager extends BaseManager {
); );
} }
public void getJoinedGroupListPage(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getJoinedGroupListPage(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "offset"),
value(methodCall, "count")
);
}
public void createGroup(MethodCall methodCall, MethodChannel.Result result) { public void createGroup(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.createGroup( Open_im_sdk.createGroup(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
@@ -92,7 +101,8 @@ public class GroupManager extends BaseManager {
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "groupID"), value(methodCall, "groupID"),
value(methodCall, "reason"), value(methodCall, "reason"),
value(methodCall, "joinSource") value(methodCall, "joinSource"),
value(methodCall, "ex")
); );
} }
@@ -176,15 +186,6 @@ public class GroupManager extends BaseManager {
); );
} }
public void setGroupMemberNickname(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupMemberNickname(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID"),
value(methodCall, "userID"),
value(methodCall, "groupNickname")
);
}
public void searchGroups(MethodCall methodCall, MethodChannel.Result result) { public void searchGroups(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.searchGroups(new OnBaseListener(result, methodCall), Open_im_sdk.searchGroups(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
@@ -192,15 +193,6 @@ public class GroupManager extends BaseManager {
); );
} }
public void setGroupMemberRoleLevel(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupMemberRoleLevel(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID"),
value(methodCall, "userID"),
int2long(methodCall, "roleLevel")
);
}
public void getGroupMemberListByJoinTimeFilter(MethodCall methodCall, MethodChannel.Result result) { public void getGroupMemberListByJoinTimeFilter(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getGroupMemberListByJoinTimeFilter(new OnBaseListener(result, methodCall), Open_im_sdk.getGroupMemberListByJoinTimeFilter(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
@@ -213,30 +205,6 @@ public class GroupManager extends BaseManager {
); );
} }
public void setGroupVerification(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupVerification(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID"),
value(methodCall, "needVerification")
);
}
public void setGroupLookMemberInfo(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupLookMemberInfo(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID"),
value(methodCall, "status")
);
}
public void setGroupApplyMemberFriend(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setGroupApplyMemberFriend(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID"),
value(methodCall, "status")
);
}
public void getGroupMemberOwnerAndAdmin(MethodCall methodCall, MethodChannel.Result result) { public void getGroupMemberOwnerAndAdmin(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getGroupMemberOwnerAndAdmin(new OnBaseListener(result, methodCall), Open_im_sdk.getGroupMemberOwnerAndAdmin(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
@@ -264,4 +232,12 @@ public class GroupManager extends BaseManager {
value(methodCall, "groupID") value(methodCall, "groupID")
); );
} }
public void getUsersInGroup(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getUsersInGroup(new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "groupID"),
jsonValue(methodCall, "userIDs")
);
}
} }

View File

@@ -6,6 +6,7 @@ import io.openim.flutter_openim_sdk.FlutterOpenimSdkPlugin;
import io.openim.flutter_openim_sdk.listener.OnBaseListener; import io.openim.flutter_openim_sdk.listener.OnBaseListener;
import io.openim.flutter_openim_sdk.listener.OnConnListener; import io.openim.flutter_openim_sdk.listener.OnConnListener;
import io.openim.flutter_openim_sdk.listener.OnUploadFileListener; import io.openim.flutter_openim_sdk.listener.OnUploadFileListener;
import io.openim.flutter_openim_sdk.listener.OnUploadLogsListener;
import io.openim.flutter_openim_sdk.util.CommonUtil; import io.openim.flutter_openim_sdk.util.CommonUtil;
import open_im_sdk.Open_im_sdk; import open_im_sdk.Open_im_sdk;
@@ -57,10 +58,33 @@ public class IMManager extends BaseManager {
Open_im_sdk.updateFcmToken( Open_im_sdk.updateFcmToken(
new OnBaseListener(result, methodCall), new OnBaseListener(result, methodCall),
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "fcmToken") value(methodCall, "fcmToken"),
int2long(methodCall, "expireTime")
); );
} }
public void uploadLogs(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.uploadLogs(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
int2long(methodCall, "line"),
value(methodCall, "ex"),
new OnUploadLogsListener(result, methodCall)
);
}
public void logs(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.logs(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
int2long(methodCall, "logLevel"),
value(methodCall, "file"),
int2long(methodCall, "line"),
value(methodCall, "msgs"),
value(methodCall, "err"),
value(methodCall, "keyAndValue")
);
}
public void setAppBackgroundStatus(MethodCall methodCall, MethodChannel.Result result) { public void setAppBackgroundStatus(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setAppBackgroundStatus( Open_im_sdk.setAppBackgroundStatus(

View File

@@ -5,7 +5,6 @@ import io.flutter.plugin.common.MethodChannel;
import io.openim.flutter_openim_sdk.listener.OnAdvancedMsgListener; import io.openim.flutter_openim_sdk.listener.OnAdvancedMsgListener;
import io.openim.flutter_openim_sdk.listener.OnBaseListener; import io.openim.flutter_openim_sdk.listener.OnBaseListener;
import io.openim.flutter_openim_sdk.listener.OnCustomBusinessListener; import io.openim.flutter_openim_sdk.listener.OnCustomBusinessListener;
import io.openim.flutter_openim_sdk.listener.OnMessageKvInfoListener;
import io.openim.flutter_openim_sdk.listener.OnMsgSendListener; import io.openim.flutter_openim_sdk.listener.OnMsgSendListener;
import io.openim.flutter_openim_sdk.util.CommonUtil; import io.openim.flutter_openim_sdk.util.CommonUtil;
import open_im_sdk.Open_im_sdk; import open_im_sdk.Open_im_sdk;
@@ -14,74 +13,6 @@ import open_im_sdk.Open_im_sdk;
public class MessageManager extends BaseManager { public class MessageManager extends BaseManager {
private final static String KEY_ID = "id"; private final static String KEY_ID = "id";
// private final static Map<String, OnAdvancedMsgListener> listeners = new HashMap<>();
/* private static boolean initializedListener = false;
private final static Map<String, AdvancedMsgListener> listeners = new ConcurrentHashMap<>();
protected void clearListeners() {
initializedListener = false;
listeners.clear();
}
private final static OnAdvancedMsgListener sdkMsgListener = new OnAdvancedMsgListener() {
@Override
public void onRecvC2CReadReceipt(String s) {
for (AdvancedMsgListener l : listeners.values()) {
l.onRecvC2CReadReceipt(s);
}
}
@Override
public void onRecvMessageRevoked(String s) {
for (AdvancedMsgListener l : listeners.values()) {
l.onRecvMessageRevoked(s);
}
}
@Override
public void onRecvNewMessage(String s) {
for (AdvancedMsgListener l : listeners.values()) {
l.onRecvNewMessage(s);
}
}
};
public void addAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) {
String key = methodCall.argument(KEY_ID);
Open_im_sdk.addAdvancedMsgListener(new AdvancedMsgListener(key));
listeners.put(key, new AdvancedMsgListener(key));
if (!initializedListener) {
initializedListener = true;
Open_im_sdk.addAdvancedMsgListener(sdkMsgListener);
}
}
public void removeAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) {
String key = methodCall.argument(KEY_ID);
listeners.remove(key);
if (listeners.isEmpty()) {
initializedListener = false;
Open_im_sdk.removeAdvancedMsgListener(sdkMsgListener);
}
}*/
/*
public void addAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) {
String key = methodCall.argument(KEY_ID);
if (!listeners.containsKey(key)) {
AdvancedMsgListener listener = new AdvancedMsgListener(key);
listeners.put(methodCall.argument(KEY_ID), listener);
Open_im_sdk.addAdvancedMsgListener(listener);
}
}
public void removeAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) {
String key = methodCall.argument(KEY_ID);
OnAdvancedMsgListener listener = listeners.remove(key);
Open_im_sdk.removeAdvancedMsgListener(listener);
}
*/
public void setAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) { public void setAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) {
String key = methodCall.argument(KEY_ID); String key = methodCall.argument(KEY_ID);
Open_im_sdk.setAdvancedMsgListener(new OnAdvancedMsgListener(key)); Open_im_sdk.setAdvancedMsgListener(new OnAdvancedMsgListener(key));
@@ -96,7 +27,8 @@ public class MessageManager extends BaseManager {
jsonValue(methodCall, "message"), jsonValue(methodCall, "message"),
value(methodCall, "userID"), value(methodCall, "userID"),
value(methodCall, "groupID"), value(methodCall, "groupID"),
jsonValue(methodCall, "offlinePushInfo") jsonValue(methodCall, "offlinePushInfo"),
value(methodCall, "isOnlineOnly")
); );
} }
@@ -391,6 +323,15 @@ public class MessageManager extends BaseManager {
value(methodCall, "localEx") value(methodCall, "localEx")
); );
} }
public void setAppBadge(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setAppBadge(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
value(methodCall, "count")
);
}
public void sendMessageNotOss(MethodCall methodCall, MethodChannel.Result result) { public void sendMessageNotOss(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.sendMessageNotOss( Open_im_sdk.sendMessageNotOss(
new OnMsgSendListener(result, methodCall), new OnMsgSendListener(result, methodCall),
@@ -398,7 +339,8 @@ public class MessageManager extends BaseManager {
jsonValue(methodCall, "message"), jsonValue(methodCall, "message"),
value(methodCall, "userID"), value(methodCall, "userID"),
value(methodCall, "groupID"), value(methodCall, "groupID"),
jsonValue(methodCall, "offlinePushInfo") jsonValue(methodCall, "offlinePushInfo"),
value(methodCall, "isOnlineOnly")
); );
} }
@@ -406,6 +348,7 @@ public class MessageManager extends BaseManager {
CommonUtil.runMainThreadReturn(result, CommonUtil.runMainThreadReturn(result,
Open_im_sdk.createImageMessageByURL( Open_im_sdk.createImageMessageByURL(
value(methodCall, "operationID"), value(methodCall, "operationID"),
value(methodCall, "sourcePath"),
jsonValue(methodCall, "sourcePicture"), jsonValue(methodCall, "sourcePicture"),
jsonValue(methodCall, "bigPicture"), jsonValue(methodCall, "bigPicture"),
jsonValue(methodCall, "snapshotPicture"))); jsonValue(methodCall, "snapshotPicture")));
@@ -437,54 +380,4 @@ public class MessageManager extends BaseManager {
result.success(null); result.success(null);
} }
public void setMessageKvInfoListener(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.setMessageKvInfoListener(new OnMessageKvInfoListener());
result.success(null);
}
// public void setMessageReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.setMessageReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "message"),
// jsonValue(methodCall, "list")
// );
// }
//
// public void deleteMessageReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.deleteMessageReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "message"),
// jsonValue(methodCall, "list")
// );
// }
//
// public void getMessageListReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.getMessageListReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "messageList")
// );
// }
//
// public void addMessageReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.addMessageReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "message"),
// jsonValue(methodCall, "list")
// );
// }
//
// public void getMessageListSomeReactionExtensions(MethodCall methodCall, MethodChannel.Result result) {
// Open_im_sdk.getMessageListSomeReactionExtensions(
// new OnBaseListener(result, methodCall),
// value(methodCall, "operationID"),
// jsonValue(methodCall, "messageList"),
// jsonValue(methodCall, "list")
// );
// }
} }

View File

@@ -61,12 +61,4 @@ public class UserManager extends BaseManager {
value(methodCall, "operationID"), value(methodCall, "operationID"),
jsonValue(methodCall, "userIDs")); jsonValue(methodCall, "userIDs"));
} }
public void getUsersInfoStranger(MethodCall methodCall, MethodChannel.Result result) {
Open_im_sdk.getUsersInfoStranger(
new OnBaseListener(result, methodCall),
value(methodCall, "operationID"),
jsonValue(methodCall, "userIDs"),
value(methodCall, "groupID"));
}
} }

View File

@@ -33,6 +33,7 @@ public class CommonUtil {
} }
public synchronized static <T> void emitEvent(String method, String type, Object errCode, String errMsg, T data) { public synchronized static <T> void emitEvent(String method, String type, Object errCode, String errMsg, T data) {
String threadName = Thread.currentThread().getName();
runMainThread(() -> { runMainThread(() -> {
Map<String, Object> res = new ArrayMap<>(); Map<String, Object> res = new ArrayMap<>();
if (null != type) { if (null != type) {
@@ -47,7 +48,7 @@ public class CommonUtil {
if (null != errMsg) { if (null != errMsg) {
res.put("errMsg", errMsg); res.put("errMsg", errMsg);
} }
Log.i("F-OpenIMSDK(native call flutter)", "{ method:" + method + ", type:" + type + " }"); Log.i("F-OpenIMSDK(native call flutter)", "thread: " + threadName + " { method:" + method + ", type:" + type + " }");
FlutterOpenimSdkPlugin.channel.invokeMethod(method, res); FlutterOpenimSdkPlugin.channel.invokeMethod(method, res);
}); });
} }

View File

@@ -1,9 +1,9 @@
buildscript { buildscript {
repositories { repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
google() google()
mavenCentral() mavenCentral()
} }
@@ -15,10 +15,10 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' } maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
google() google()
mavenCentral() mavenCentral()
} }
@@ -30,6 +30,6 @@ subprojects {
project.evaluationDependsOn(':app') project.evaluationDependsOn(':app')
} }
task clean(type: Delete) { tasks.register("clean", Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip

View File

@@ -1,5 +1,4 @@
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency. # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true' ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@@ -2,8 +2,8 @@ PODS:
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_openim_sdk (0.0.1): - flutter_openim_sdk (0.0.1):
- Flutter - Flutter
- OpenIMSDKCore (= 3.0.0) - OpenIMSDKCore (= 3.8.1-rc.0)
- "OpenIMSDKCore (3.0.0+1)" - OpenIMSDKCore (3.8.1-rc.0)
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
@@ -20,10 +20,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_openim_sdk/ios" :path: ".symlinks/plugins/flutter_openim_sdk/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_openim_sdk: 12daf3769f8bf40001970304445b6155c146b7eb flutter_openim_sdk: 754e4ad0177918ce2c37dfba63973db26ce89c90
OpenIMSDKCore: 2e38a5b9be23e588b5049ebd378161cf277e41a0 OpenIMSDKCore: 0c92e9e3eb2a91b6b6528e7781a1e28ed42bc518
PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d PODFILE CHECKSUM: d4ba08011ff3d270b662299a448a7c436eb30089
COCOAPODS: 1.11.2 COCOAPODS: 1.14.3

View File

@@ -341,14 +341,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = BDLHL8GNFV; DEVELOPMENT_TEAM = V57RT7LMFH;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = cn.rentsoft.uni; PRODUCT_BUNDLE_IDENTIFIER = io.openim.sdk.example;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
@@ -473,14 +473,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = BDLHL8GNFV; DEVELOPMENT_TEAM = V57RT7LMFH;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = cn.rentsoft.uni; PRODUCT_BUNDLE_IDENTIFIER = io.openim.sdk.example;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -497,14 +497,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = BDLHL8GNFV; DEVELOPMENT_TEAM = V57RT7LMFH;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
PRODUCT_BUNDLE_IDENTIFIER = cn.rentsoft.uni; PRODUCT_BUNDLE_IDENTIFIER = io.openim.sdk.example;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;

View File

@@ -19,7 +19,6 @@ class _MyAppState extends State<MyApp> {
apiAddr: '', apiAddr: '',
wsAddr: '', wsAddr: '',
dataDir: '/', dataDir: '/',
objectStorage: 'minio',
listener: OnConnectListener()); listener: OnConnectListener());
} }

View File

@@ -5,56 +5,56 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async name: async
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.10.0" version: "2.11.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" version: "1.3.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.0" version: "1.18.0"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.5" version: "1.0.6"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
flutter: flutter:
@@ -68,52 +68,68 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "3.0.0" version: "3.8.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
js: leak_tracker:
dependency: transitive dependency: transitive
description: description:
name: js name: leak_tracker
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.5" version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.13" version: "0.12.16+1"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.0" version: "0.8.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.0" version: "1.12.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.2" version: "1.9.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -123,32 +139,32 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.1" version: "1.10.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.11.0" version: "1.11.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
term_glyph: term_glyph:
@@ -156,25 +172,33 @@ packages:
description: description:
name: term_glyph name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.16" version: "0.7.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.1"
sdks: sdks:
dart: ">=2.18.0 <3.0.0" dart: ">=3.3.0 <4.0.0"
flutter: ">=1.20.0" flutter: ">=3.18.0-18.0.pre.54"

View File

@@ -8,7 +8,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_openim_sdk_example/main.dart'; import '../lib/main.dart';
void main() { void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async { testWidgets('Verify Platform version', (WidgetTester tester) async {
@@ -18,8 +18,7 @@ void main() {
// Verify that platform version is retrieved. // Verify that platform version is retrieved.
expect( expect(
find.byWidgetPredicate( find.byWidgetPredicate(
(Widget widget) => widget is Text && (Widget widget) => widget is Text && widget.data!.startsWith('Running on:'),
widget.data!.startsWith('Running on:'),
), ),
findsOneWidget, findsOneWidget,
); );

38
ios/.gitignore vendored
View File

@@ -1,38 +0,0 @@
.idea/
.vagrant/
.sconsign.dblite
.svn/
.DS_Store
*.swp
profile
DerivedData/
build/
GeneratedPluginRegistrant.h
GeneratedPluginRegistrant.m
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
/Flutter/Generated.xcconfig
/Flutter/ephemeral/
/Flutter/flutter_export_environment.sh

View File

View File

@@ -2,151 +2,146 @@ import Foundation
import OpenIMCore import OpenIMCore
public class ConversationManager: BaseServiceManager { public class ConversationManager: BaseServiceManager {
public override func registerHandlers() { public override func registerHandlers() {
super.registerHandlers() super.registerHandlers()
self["setConversationListener"] = setConversationListener self["changeInputStates"] = changeInputStates
self["getAllConversationList"] = getAllConversationList
self["getConversationListSplit"] = getConversationListSplit
self["getOneConversation"] = getOneConversation
self["getMultipleConversation"] = getMultipleConversation
self["setConversationDraft"] = setConversationDraft
self["pinConversation"] = pinConversation
self["hideConversation"] = hideConversation
self["markConversationMessageAsRead"] = markConversationMessageAsRead
self["getTotalUnreadMsgCount"] = getTotalUnreadMsgCount
self["getConversationIDBySessionType"] = getConversationIDBySessionType
self["setConversationRecvMessageOpt"] = setConversationRecvMessageOpt
self["getConversationRecvMessageOpt"] = getConversationRecvMessageOpt
self["setConversationPrivateChat"] = setConversationPrivateChat
self["clearConversationAndDeleteAllMsg"] = clearConversationAndDeleteAllMsg self["clearConversationAndDeleteAllMsg"] = clearConversationAndDeleteAllMsg
self["deleteConversationAndDeleteAllMsg"] = deleteConversationAndDeleteAllMsg self["deleteConversationAndDeleteAllMsg"] = deleteConversationAndDeleteAllMsg
self["deleteAllConversationFromLocal"] = deleteAllConversationFromLocal self["getAllConversationList"] = getAllConversationList
self["resetConversationGroupAtType"] = resetConversationGroupAtType
self["getAtAllTag"] = getAtAllTag self["getAtAllTag"] = getAtAllTag
self["setGlobalRecvMessageOpt"] = setGlobalRecvMessageOpt self["getConversationIDBySessionType"] = getConversationIDBySessionType
self["setConversationBurnDuration"] = setConversationBurnDuration self["getConversationListSplit"] = getConversationListSplit
self["getInputStates"] = getInputStates
self["getMultipleConversation"] = getMultipleConversation
self["getOneConversation"] = getOneConversation
self["getTotalUnreadMsgCount"] = getTotalUnreadMsgCount
self["hideAllConversations"] = hideAllConversations
self["hideConversation"] = hideConversation
self["markConversationMessageAsRead"] = markConversationMessageAsRead
self["searchConversation"] = searchConversation
self["setConversationDraft"] = setConversationDraft
self["setConversationListener"] = setConversationListener
self["setConversation"] = setConversation
self["searchConversations"] = searchConversations
} }
func setConversationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func changeInputStates(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetConversationListener(ConversationListener(channel: channel)) Open_im_sdkChangeInputStates(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[bool: "focus"])
callBack(result)
} }
func getAllConversationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func clearConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkClearConversationAndDeleteAllMsg(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
}
func deleteConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkDeleteConversationAndDeleteAllMsg(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
}
func getAllConversationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetAllConversationList(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkGetAllConversationList(BaseCallback(result: result), methodCall[string: "operationID"])
} }
func getConversationListSplit(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getAtAllTag(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetConversationListSplit(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "offset"], methodCall[int: "count"]) callBack(result, Open_im_sdkGetAtAllTag(methodCall[string: "operationID"]))
} }
func getOneConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getConversationIDBySessionType(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetOneConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int32: "sessionType"], methodCall[string: "sourceID"]) let conversationID = Open_im_sdkGetConversationIDBySessionType(methodCall[string: "operationID"], methodCall[string: "sourceID"], methodCall[int: "sessionType"])
}
func getMultipleConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetMultipleConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"])
}
func setConversationDraft(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetConversationDraft(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[string: "draftText"])
}
func pinConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkPinConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[bool: "isPinned"])
}
func hideConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkHideConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
}
func markConversationMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkMarkConversationMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
}
func getTotalUnreadMsgCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetTotalUnreadMsgCount(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getConversationIDBySessionType(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let conversationID = Open_im_sdkGetConversationIDBySessionType( methodCall[string: "operationID"],methodCall[string: "sourceID"], methodCall[int: "sessionType"])
callBack(result, conversationID) callBack(result, conversationID)
} }
func setConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getConversationListSplit(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[int: "status"]) Open_im_sdkGetConversationListSplit(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "offset"], methodCall[int: "count"])
} }
func getConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getInputStates(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"]) Open_im_sdkGetInputStates(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[string: "userID"])
} }
func setConversationPrivateChat(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getMultipleConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetConversationPrivateChat(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[bool: "isPrivate"]) Open_im_sdkGetMultipleConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"])
} }
func clearConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getOneConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkClearConversationAndDeleteAllMsg(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) Open_im_sdkGetOneConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int32: "sessionType"], methodCall[string: "sourceID"])
} }
func deleteConversationAndDeleteAllMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getTotalUnreadMsgCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkDeleteConversationAndDeleteAllMsg(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) Open_im_sdkGetTotalUnreadMsgCount(BaseCallback(result: result), methodCall[string: "operationID"])
} }
func deleteAllConversationFromLocal(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func hideAllConversations(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkDeleteAllConversationFromLocal(BaseCallback(result: result), methodCall[string: "operationID"]) Open_im_sdkHideAllConversations(BaseCallback(result: result), methodCall[string: "operationID"])
} }
func resetConversationGroupAtType(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func hideConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkResetConversationGroupAtType(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"]) Open_im_sdkHideConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
} }
func getAtAllTag(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func markConversationMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
callBack(result, Open_im_sdkGetAtAllTag(methodCall[string: "operationID"])) Open_im_sdkMarkConversationMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
} }
func setGlobalRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func searchConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetGlobalRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "status"]) Open_im_sdkSearchConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "name"])
} }
func setConversationBurnDuration(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setConversationDraft(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetConversationBurnDuration(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[int32: "burnDuration"]) Open_im_sdkSetConversationDraft(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[string: "draftText"])
}
func setConversationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetConversationListener(ConversationListener(channel: channel))
callBack(result)
}
func setConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[jsonString: "req"])
}
func searchConversations(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSearchConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "name"])
} }
} }
public class ConversationListener: NSObject, Open_im_sdk_callbackOnConversationListenerProtocol { public class ConversationListener: NSObject, Open_im_sdk_callbackOnConversationListenerProtocol {
private let channel:FlutterMethodChannel private let channel: FlutterMethodChannel
init(channel:FlutterMethodChannel) { init(channel: FlutterMethodChannel) {
self.channel = channel self.channel = channel
} }
public func onConversationChanged(_ conversationList: String?) { public func onConversationChanged(_ conversationList: String?) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onConversationChanged", errCode: nil, errMsg: nil, data: conversationList) CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onConversationChanged", errCode: nil, errMsg: nil, data: conversationList)
} }
public func onConversationUserInputStatusChanged(_ change: String?) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onConversationUserInputStatusChanged", errCode: nil, errMsg: nil, data: change)
}
public func onNewConversation(_ conversationList: String?) { public func onNewConversation(_ conversationList: String?) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onNewConversation", errCode: nil, errMsg: nil, data: conversationList) CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onNewConversation", errCode: nil, errMsg: nil, data: conversationList)
} }
public func onSyncServerFailed() { public func onSyncServerFailed(_ reinstalled: Bool) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerFailed", errCode: nil, errMsg: nil, data: nil) CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerFailed", errCode: nil, errMsg: nil, data: reinstalled)
} }
public func onSyncServerFinish() { public func onSyncServerFinish(_ reinstalled: Bool) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerFinish", errCode: nil, errMsg: nil, data: nil) CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerFinish", errCode: nil, errMsg: nil, data: reinstalled)
} }
public func onSyncServerStart() { public func onSyncServerProgress(_ progress: Int) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerStart", errCode: nil, errMsg: nil, data: nil) CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerProgress", errCode: nil, errMsg: nil, data: progress)
} }
public func onSyncServerStart(_ reinstalled: Bool) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onSyncServerStart", errCode: nil, errMsg: nil, data: reinstalled)
}
public func onTotalUnreadMessageCountChanged(_ totalUnreadCount: Int32) { public func onTotalUnreadMessageCountChanged(_ totalUnreadCount: Int32) {
CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onTotalUnreadMessageCountChanged", errCode: nil, errMsg: nil, data: totalUnreadCount) CommonUtil.emitEvent(channel: channel, method: "conversationListener", type: "onTotalUnreadMessageCountChanged", errCode: nil, errMsg: nil, data: totalUnreadCount)
} }
} }

View File

@@ -5,64 +5,36 @@ public class FriendshipManager: BaseServiceManager {
public override func registerHandlers() { public override func registerHandlers() {
super.registerHandlers() super.registerHandlers()
self["setFriendListener"] = setFriendListener self["acceptFriendApplication"] = acceptFriendApplication
self["getFriendsInfo"] = getFriendsInfo
self["addFriend"] = addFriend
self["getFriendApplicationListAsRecipient"] = getFriendApplicationListAsRecipient
self["getFriendApplicationListAsApplicant"] = getFriendApplicationListAsApplicant
self["getFriendList"] = getFriendList
self["setFriendRemark"] = setFriendRemark
self["addBlacklist"] = addBlacklist self["addBlacklist"] = addBlacklist
self["getBlacklist"] = getBlacklist self["addFriend"] = addFriend
self["removeBlacklist"] = removeBlacklist
self["checkFriend"] = checkFriend self["checkFriend"] = checkFriend
self["deleteFriend"] = deleteFriend self["deleteFriend"] = deleteFriend
self["acceptFriendApplication"] = acceptFriendApplication self["getBlacklist"] = getBlacklist
self["getFriendApplicationListAsApplicant"] = getFriendApplicationListAsApplicant
self["getFriendApplicationListAsRecipient"] = getFriendApplicationListAsRecipient
self["getFriendList"] = getFriendList
self["getFriendListPage"] = getFriendListPage
self["getFriendsInfo"] = getFriendsInfo
self["refuseFriendApplication"] = refuseFriendApplication self["refuseFriendApplication"] = refuseFriendApplication
self["removeBlacklist"] = removeBlacklist
self["searchFriends"] = searchFriends self["searchFriends"] = searchFriends
self["setFriendListener"] = setFriendListener
self["updateFriends"] = updateFriends
} }
func setFriendListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func acceptFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetFriendListener(FriendshipListener(channel: channel)) Open_im_sdkAcceptFriendApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
callBack(result)
} }
func getFriendsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func addBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetSpecifiedFriendsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDList"]) Open_im_sdkAddBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"], methodCall[string: "ex"])
} }
func addFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func addFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAddFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) Open_im_sdkAddFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
} }
func getFriendApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getFriendApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendList(BaseCallback(result: result), methodCall[string: "operationID"])
}
func setFriendRemark(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetFriendRemark(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
}
func addBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAddBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"])
}
func getBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetBlackList(BaseCallback(result: result), methodCall[string: "operationID"])
}
func removeBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkRemoveBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"])
}
func checkFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func checkFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkCheckFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDList"]) Open_im_sdkCheckFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDList"])
} }
@@ -71,17 +43,50 @@ public class FriendshipManager: BaseServiceManager {
Open_im_sdkDeleteFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"]) Open_im_sdkDeleteFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"])
} }
func acceptFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAcceptFriendApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) Open_im_sdkGetBlackList(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getFriendApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getFriendApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[bool: "filterBlack"])
}
func getFriendListPage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetFriendListPage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int32: "offset"], methodCall[int32: "count"], methodCall[bool: "filterBlack"])
}
func getFriendsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetSpecifiedFriendsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDList"], methodCall[bool: "filterBlack"])
} }
func refuseFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func refuseFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkRefuseFriendApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString()) Open_im_sdkRefuseFriendApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
} }
func removeBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkRemoveBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"])
}
func searchFriends(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func searchFriends(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSearchFriends(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"]) Open_im_sdkSearchFriends(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"])
} }
func setFriendListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetFriendListener(FriendshipListener(channel: channel))
callBack(result)
}
func updateFriends(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkUpdateFriends(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "req"])
}
} }
public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListenerProtocol { public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListenerProtocol {
@@ -127,4 +132,3 @@ public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListe
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendInfoChanged", errCode: nil, errMsg: nil, data: friendInfo) CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendInfoChanged", errCode: nil, errMsg: nil, data: friendInfo)
} }
} }

View File

@@ -5,207 +5,194 @@ public class GroupManager: BaseServiceManager {
public override func registerHandlers() { public override func registerHandlers() {
super.registerHandlers() super.registerHandlers()
self["setGroupListener"] = setGroupListener
self["inviteUserToGroup"] = inviteUserToGroup
self["kickGroupMember"] = kickGroupMember
self["getGroupMembersInfo"] = getGroupMembersInfo
self["getGroupMemberList"] = getGroupMemberList
self["getJoinedGroupList"] = getJoinedGroupList
self["createGroup"] = createGroup
self["setGroupInfo"] = setGroupInfo
self["getGroupsInfo"] = getGroupsInfo
self["joinGroup"] = joinGroup
self["quitGroup"] = quitGroup
self["transferGroupOwner"] = transferGroupOwner
self["getGroupApplicationListAsRecipient"] = getGroupApplicationListAsRecipient
self["getGroupApplicationListAsApplicant"] = getGroupApplicationListAsApplicant
self["acceptGroupApplication"] = acceptGroupApplication self["acceptGroupApplication"] = acceptGroupApplication
self["refuseGroupApplication"] = refuseGroupApplication
self["dismissGroup"] = dismissGroup
self["changeGroupMute"] = changeGroupMute
self["changeGroupMemberMute"] = changeGroupMemberMute self["changeGroupMemberMute"] = changeGroupMemberMute
self["setGroupMemberNickname"] = setGroupMemberNickname self["changeGroupMute"] = changeGroupMute
self["searchGroups"] = searchGroups self["createGroup"] = createGroup
self["setGroupMemberRoleLevel"] = setGroupMemberRoleLevel self["dismissGroup"] = dismissGroup
self["getGroupApplicationListAsApplicant"] = getGroupApplicationListAsApplicant
self["getGroupApplicationListAsRecipient"] = getGroupApplicationListAsRecipient
self["getGroupMemberList"] = getGroupMemberList
self["getGroupMemberListByJoinTimeFilter"] = getGroupMemberListByJoinTimeFilter self["getGroupMemberListByJoinTimeFilter"] = getGroupMemberListByJoinTimeFilter
self["setGroupVerification"] = setGroupVerification
self["setGroupLookMemberInfo"] = setGroupLookMemberInfo
self["setGroupApplyMemberFriend"] = setGroupApplyMemberFriend
self["getGroupMemberOwnerAndAdmin"] = getGroupMemberOwnerAndAdmin self["getGroupMemberOwnerAndAdmin"] = getGroupMemberOwnerAndAdmin
self["searchGroupMembers"] = searchGroupMembers self["getGroupMembersInfo"] = getGroupMembersInfo
self["setGroupMemberInfo"] = setGroupMemberInfo self["getGroupsInfo"] = getGroupsInfo
self["getJoinedGroupList"] = getJoinedGroupList
self["getJoinedGroupListPage"] = getJoinedGroupListPage
self["getUsersInGroup"] = getUsersInGroup
self["inviteUserToGroup"] = inviteUserToGroup
self["isJoinGroup"] = isJoinGroup self["isJoinGroup"] = isJoinGroup
self["joinGroup"] = joinGroup
self["kickGroupMember"] = kickGroupMember
self["quitGroup"] = quitGroup
self["refuseGroupApplication"] = refuseGroupApplication
self["searchGroupMembers"] = searchGroupMembers
self["searchGroups"] = searchGroups
self["setGroupInfo"] = setGroupInfo
self["setGroupListener"] = setGroupListener
self["setGroupMemberInfo"] = setGroupMemberInfo
self["transferGroupOwner"] = transferGroupOwner
} }
func setGroupListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func acceptGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkAcceptGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"], methodCall[string: "handleMsg"])
}
func changeGroupMemberMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkChangeGroupMemberMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string:"userID"], methodCall[int:"seconds"])
}
func changeGroupMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkChangeGroupMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[bool: "mute"])
}
func createGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkCreateGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
}
func dismissGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkDismissGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
}
func getGroupApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetGroupApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getGroupApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetGroupApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getGroupMemberList(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetGroupMemberList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32: "filter"],
methodCall[int32: "offset"], methodCall[int32: "count"])
}
func getGroupMemberListByJoinTimeFilter(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetGroupMemberListByJoinTimeFilter(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32: "offset"], methodCall[int32: "count"], methodCall[int64: "joinTimeBegin"], methodCall[int64: "joinTimeEnd"], methodCall[jsonString: "excludeUserIDList"])
}
func getGroupMemberOwnerAndAdmin(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetGroupMemberOwnerAndAdmin(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
}
func getGroupMembersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetSpecifiedGroupMembersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[jsonString: "userIDList"])
}
func getGroupsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetSpecifiedGroupsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "groupIDList"])
}
func getJoinedGroupList(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetJoinedGroupList(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getJoinedGroupListPage(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetJoinedGroupListPage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int32: "offset"], methodCall[int32: "count"])
}
func getUsersInGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkGetUsersInGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"],
methodCall[jsonString: "userIDs"])
}
func inviteUserToGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkInviteUserToGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"],
methodCall[jsonString: "userIDList"])
}
func isJoinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkIsJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
}
func joinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string:
"reason"], methodCall[int32: "joinSource"], methodCall[jsonString: "ex"])
}
func kickGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkKickGroupMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"],
methodCall[jsonString: "userIDList"])
}
func quitGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkQuitGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
}
func refuseGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkRefuseGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"], methodCall[string: "handleMsg"])
}
func searchGroupMembers(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSearchGroupMembers(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"])
}
func searchGroups(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSearchGroups(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"])
}
func setGroupInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetGroupInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "groupInfo"])
}
func setGroupListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkSetGroupListener(GroupListener(channel: channel)) Open_im_sdkSetGroupListener(GroupListener(channel: channel))
callBack(result) callBack(result)
} }
func inviteUserToGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setGroupMemberInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkInviteUserToGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"],
methodCall[jsonString: "userIDList"])
}
func kickGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkKickGroupMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"],
methodCall[jsonString: "userIDList"])
}
func getGroupMembersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetSpecifiedGroupMembersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[jsonString: "userIDList"])
}
func getGroupMemberList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupMemberList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32: "filter"],
methodCall[int32: "offset"], methodCall[int32: "count"])
}
func getJoinedGroupList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetJoinedGroupList(BaseCallback(result: result), methodCall[string: "operationID"])
}
func createGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkCreateGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
}
func setGroupInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "groupInfo"])
}
func getGroupsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetSpecifiedGroupsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "groupIDList"])
}
func joinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "reason"], methodCall[int32: "joinSource"])
}
func quitGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkQuitGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
}
func transferGroupOwner(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkTransferGroupOwner(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"])
}
func getGroupApplicationListAsRecipient(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupApplicationListAsRecipient(BaseCallback(result: result), methodCall[string: "operationID"])
}
func getGroupApplicationListAsApplicant(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupApplicationListAsApplicant(BaseCallback(result: result), methodCall[string: "operationID"])
}
func acceptGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkAcceptGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"], methodCall[string: "handleMsg"])
}
func refuseGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkRefuseGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"], methodCall[string: "handleMsg"])
}
func dismissGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkDismissGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
}
func changeGroupMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkChangeGroupMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[bool: "mute"])
}
func changeGroupMemberMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkChangeGroupMemberMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string:"userID"],methodCall[int:"seconds"])
}
func setGroupMemberNickname(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupMemberNickname(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string:"userID"],methodCall[string:"groupNickname"])
}
func searchGroups(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSearchGroups(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"])
}
func setGroupMemberRoleLevel(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupMemberRoleLevel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string:"userID"],methodCall[int:"roleLevel"])
}
func getGroupMemberListByJoinTimeFilter(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupMemberListByJoinTimeFilter(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32: "offset"], methodCall[int32: "count"], methodCall[int64: "joinTimeBegin"], methodCall[int64: "joinTimeEnd"], methodCall[jsonString: "excludeUserIDList"])
}
func setGroupVerification(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupVerification(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32:"needVerification"])
}
func setGroupLookMemberInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupLookMemberInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32:"status"])
}
func setGroupApplyMemberFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupApplyMemberFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[int32:"status"])
}
func getGroupMemberOwnerAndAdmin(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetGroupMemberOwnerAndAdmin(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
}
func searchGroupMembers(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSearchGroupMembers(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"])
}
func setGroupMemberInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetGroupMemberInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"]) Open_im_sdkSetGroupMemberInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "info"])
} }
func isJoinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func transferGroupOwner(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkIsJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"]) Open_im_sdkTransferGroupOwner(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[string: "userID"])
} }
} }
public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtocol { public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtocol {
private let channel:FlutterMethodChannel private let channel: FlutterMethodChannel
init(channel:FlutterMethodChannel) { init(channel: FlutterMethodChannel) {
self.channel = channel self.channel = channel
} }
public func onGroupApplicationAccepted(_ s: String?) { public func onGroupApplicationAccepted(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationAccepted", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationAccepted", errCode: nil, errMsg: nil, data: s)
} }
public func onGroupApplicationAdded(_ s: String?) { public func onGroupApplicationAdded(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationAdded", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationAdded", errCode: nil, errMsg: nil, data: s)
} }
public func onGroupApplicationDeleted(_ s: String?) { public func onGroupApplicationDeleted(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationDeleted", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationDeleted", errCode: nil, errMsg: nil, data: s)
} }
public func onGroupApplicationRejected(_ s: String?) { public func onGroupApplicationRejected(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationRejected", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationRejected", errCode: nil, errMsg: nil, data: s)
} }
public func onGroupDismissed(_ s: String?) { public func onGroupDismissed(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupDismissed", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupDismissed", errCode: nil, errMsg: nil, data: s)
} }
public func onGroupInfoChanged(_ s: String?) { public func onGroupInfoChanged(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupInfoChanged", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupInfoChanged", errCode: nil, errMsg: nil, data: s)
} }
public func onGroupMemberAdded(_ s: String?) { public func onGroupMemberAdded(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberAdded", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberAdded", errCode: nil, errMsg: nil, data: s)
} }
public func onGroupMemberDeleted(_ s: String?) { public func onGroupMemberDeleted(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberDeleted", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberDeleted", errCode: nil, errMsg: nil, data: s)
} }
public func onGroupMemberInfoChanged(_ s: String?) { public func onGroupMemberInfoChanged(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberInfoChanged", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberInfoChanged", errCode: nil, errMsg: nil, data: s)
} }
public func onJoinedGroupAdded(_ s: String?) { public func onJoinedGroupAdded(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onJoinedGroupAdded", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onJoinedGroupAdded", errCode: nil, errMsg: nil, data: s)
} }

View File

@@ -13,6 +13,8 @@ public class IMMananger: BaseServiceManager {
self["logout"] = logout self["logout"] = logout
self["getLoginStatus"] = getLoginStatus self["getLoginStatus"] = getLoginStatus
self["uploadFile"] = uploadFile self["uploadFile"] = uploadFile
self["uploadLogs"] = uploadLogs
self["logs"] = logs
self["updateFcmToken"] = updateFcmToken self["updateFcmToken"] = updateFcmToken
self["setAppBackgroundStatus"] = setAppBackgroundStatus self["setAppBackgroundStatus"] = setAppBackgroundStatus
self["networkStatusChanged"] = networkStatusChanged self["networkStatusChanged"] = networkStatusChanged
@@ -83,9 +85,19 @@ public class IMMananger: BaseServiceManager {
func uploadFile(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func uploadFile(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkUploadFile(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString(), UploadFileListener(channel: self.channel,id: methodCall[string: "id"])) Open_im_sdkUploadFile(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString(), UploadFileListener(channel: self.channel,id: methodCall[string: "id"]))
} }
func uploadLogs(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkUploadLogs(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "line"], methodCall[string: "ex"],
UploadLogsListener(channel: self.channel))
}
func logs(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkLogs(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "logLevel"], methodCall[string: "file"], methodCall[int: "line"], methodCall[string: "msgs"], methodCall[string: "err"], methodCall[string: "keyAndValue"])
}
func updateFcmToken(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func updateFcmToken(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
Open_im_sdkUpdateFcmToken(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "fcmToken"]) Open_im_sdkUpdateFcmToken(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "fcmToken"], methodCall[int64:
"expireTime"])
} }
func setAppBackgroundStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult) { func setAppBackgroundStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
@@ -98,6 +110,10 @@ public class IMMananger: BaseServiceManager {
} }
public class ConnListener: NSObject, Open_im_sdk_callbackOnConnListenerProtocol { public class ConnListener: NSObject, Open_im_sdk_callbackOnConnListenerProtocol {
public func onUserTokenInvalid(_ errMsg: String?) {
CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onUserTokenInvalid", errCode: nil, errMsg: errMsg, data: nil)
}
private let channel:FlutterMethodChannel private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) { init(channel:FlutterMethodChannel) {
@@ -125,11 +141,28 @@ public class ConnListener: NSObject, Open_im_sdk_callbackOnConnListenerProtocol
} }
} }
public class UploadLogsListener: NSObject, Open_im_sdk_callbackUploadLogProgressProtocol {
private let channel:FlutterMethodChannel
init(channel:FlutterMethodChannel) {
self.channel = channel
}
public func onProgress(_ current: Int64, size: Int64) {
var values: [String: Any] = [:]
values["current"] = current
values["size"] = size
CommonUtil.emitEvent(channel: channel, method: "uploadLogsListener", type: "onProgress", errCode: nil, errMsg: nil, data: values)
}
}
public class UploadFileListener: NSObject, Open_im_sdk_callbackUploadFileCallbackProtocol { public class UploadFileListener: NSObject, Open_im_sdk_callbackUploadFileCallbackProtocol {
private let channel:FlutterMethodChannel private let channel:FlutterMethodChannel
private let id: String private let id: String
init(channel:FlutterMethodChannel, id: String) { init(channel:FlutterMethodChannel, id: String) {
self.channel = channel self.channel = channel
self.id = id self.id = id

View File

@@ -3,8 +3,7 @@ import OpenIMCore
public class MessageManager: BaseServiceManager { public class MessageManager: BaseServiceManager {
private let KEY_ID: String = "id" private let KEY_ID: String = "id"
// private var listeners: [String: AdvancedMsgListener] = [:]
public override func registerHandlers() { public override func registerHandlers() {
super.registerHandlers() super.registerHandlers()
self["setAdvancedMsgListener"] = setAdvancedMsgListener self["setAdvancedMsgListener"] = setAdvancedMsgListener
@@ -46,15 +45,14 @@ public class MessageManager: BaseServiceManager {
self["findMessageList"] = findMessageList self["findMessageList"] = findMessageList
self["setMessageLocalEx"] = setMessageLocalEx self["setMessageLocalEx"] = setMessageLocalEx
self["setAppBadge"] = setAppBadge
self["sendMessageNotOss"] = sendMessageNotOss self["sendMessageNotOss"] = sendMessageNotOss
self["createImageMessageByURL"] = createImageMessageByURL self["createImageMessageByURL"] = createImageMessageByURL
self["createSoundMessageByURL"] = createSoundMessageByURL self["createSoundMessageByURL"] = createSoundMessageByURL
self["createVideoMessageByURL"] = createVideoMessageByURL self["createVideoMessageByURL"] = createVideoMessageByURL
self["createFileMessageByURL"] = createFileMessageByURL self["createFileMessageByURL"] = createFileMessageByURL
self["setCustomBusinessListener"] = setCustomBusinessListener self["setCustomBusinessListener"] = setCustomBusinessListener
self["setMessageKvInfoListener"] = setMessageKvInfoListener
} }
func setAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -67,7 +65,7 @@ public class MessageManager: BaseServiceManager {
func sendMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func sendMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let sendMsgProgressListener: SendMsgProgressListener = SendMsgProgressListener(channel: channel,result: result,methodCall: methodCall) let sendMsgProgressListener: SendMsgProgressListener = SendMsgProgressListener(channel: channel,result: result,methodCall: methodCall)
Open_im_sdkSendMessage(sendMsgProgressListener, methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[string: "userID"], Open_im_sdkSendMessage(sendMsgProgressListener, methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[string: "userID"],
methodCall[string: "groupID"], methodCall[jsonString: "offlinePushInfo"]) methodCall[string: "groupID"], methodCall[jsonString: "offlinePushInfo"], methodCall[bool: "isOnlineOnly"])
} }
func revokeMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func revokeMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -222,15 +220,18 @@ public class MessageManager: BaseServiceManager {
func setMessageLocalEx(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setMessageLocalEx(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetMessageLocalEx(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[string: "clientMsgID"], methodCall[string: "localEx"]) Open_im_sdkSetMessageLocalEx(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[string: "clientMsgID"], methodCall[string: "localEx"])
} }
func setAppBadge(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetAppBadge(BaseCallback(result: result), methodCall[string: "operationID"], Int32(methodCall[int64: "count"]))
}
func sendMessageNotOss(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func sendMessageNotOss(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
let sendMsgProgressListener: SendMsgProgressListener = SendMsgProgressListener(channel: channel,result: result,methodCall: methodCall) let sendMsgProgressListener: SendMsgProgressListener = SendMsgProgressListener(channel: channel,result: result,methodCall: methodCall)
Open_im_sdkSendMessageNotOss(sendMsgProgressListener, methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[string: "userID"], Open_im_sdkSendMessageNotOss(sendMsgProgressListener, methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[string: "userID"], methodCall[string: "groupID"], methodCall[jsonString: "offlinePushInfo"], methodCall[bool: "isOnlineOnly"])
methodCall[string: "groupID"], methodCall[jsonString: "offlinePushInfo"])
} }
func createImageMessageByURL(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func createImageMessageByURL(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
callBack(result, Open_im_sdkCreateImageMessageByURL(methodCall[string: "operationID"], methodCall[jsonString: "sourcePicture"], methodCall[jsonString: "bigPicture"], methodCall[jsonString: "snapshotPicture"])) callBack(result, Open_im_sdkCreateImageMessageByURL(methodCall[string: "operationID"], methodCall[string: "sourcePath"], methodCall[jsonString: "sourcePicture"], methodCall[jsonString: "bigPicture"], methodCall[jsonString: "snapshotPicture"]))
} }
func createSoundMessageByURL(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func createSoundMessageByURL(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -249,11 +250,6 @@ public class MessageManager: BaseServiceManager {
Open_im_sdkSetCustomBusinessListener(CustomBusinessListener(channel: channel)) Open_im_sdkSetCustomBusinessListener(CustomBusinessListener(channel: channel))
callBack(result) callBack(result)
} }
func setMessageKvInfoListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkSetMessageKvInfoListener(MessageKvInfoListener(channel: channel))
callBack(result)
}
} }
public class SendMsgProgressListener: NSObject, Open_im_sdk_callbackSendMsgCallBackProtocol { public class SendMsgProgressListener: NSObject, Open_im_sdk_callbackSendMsgCallBackProtocol {
@@ -315,37 +311,6 @@ public class AdvancedMsgListener: NSObject, Open_im_sdk_callbackOnAdvancedMsgLis
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvC2CReadReceipt", errCode: nil, errMsg: nil, data: values) CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvC2CReadReceipt", errCode: nil, errMsg: nil, data: values)
} }
public func onRecvGroupReadReceipt(_ groupMsgReceiptList: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["groupMsgReceiptList"] = groupMsgReceiptList
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvGroupReadReceipt", errCode: nil, errMsg: nil, data: values)
}
public func onRecvMessageExtensionsAdded(_ msgID: String?, reactionExtensionList: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["msgID"] = msgID
values["reactionExtensionList"] = reactionExtensionList
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsAdded", errCode: nil, errMsg: nil, data: values)
}
public func onRecvMessageExtensionsChanged(_ msgID: String?, reactionExtensionList: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["msgID"] = msgID
values["reactionExtensionList"] = reactionExtensionList
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsChanged", errCode: nil, errMsg: nil, data: values)
}
public func onRecvMessageExtensionsDeleted(_ msgID: String?, reactionExtensionKeyList: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["msgID"] = msgID
values["reactionExtensionKeyList"] = reactionExtensionKeyList
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageExtensionsDeleted", errCode: nil, errMsg: nil, data: values)
}
public func onRecvNewMessage(_ message: String?) { public func onRecvNewMessage(_ message: String?) {
var values: [String: Any] = [:] var values: [String: Any] = [:]
values["id"] = id values["id"] = id
@@ -353,14 +318,19 @@ public class AdvancedMsgListener: NSObject, Open_im_sdk_callbackOnAdvancedMsgLis
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvNewMessage", errCode: nil, errMsg: nil, data: values) CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvNewMessage", errCode: nil, errMsg: nil, data: values)
} }
public func onRecvOfflineNewMessage(_ message: String?) {
public func onRecvOfflineNewMessage(_ message: String?) { var values: [String: Any] = [:]
var values: [String: Any] = [:] values["id"] = id
values["id"] = id values["message"] = message
values["message"] = message CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvOfflineNewMessage", errCode: nil, errMsg: nil, data: values);
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvOfflineNewMessage", errCode: nil, errMsg: nil, data: values); }
}
public func onRecvOnlineOnlyMessage(_ message: String?) {
var values: [String: Any] = [:]
values["id"] = id
values["message"] = message
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvOnlineOnlyMessage", errCode: nil, errMsg: nil, data: values);
}
} }
public class CustomBusinessListener: NSObject, Open_im_sdk_callbackOnCustomBusinessListenerProtocol { public class CustomBusinessListener: NSObject, Open_im_sdk_callbackOnCustomBusinessListenerProtocol {
@@ -374,19 +344,3 @@ public class CustomBusinessListener: NSObject, Open_im_sdk_callbackOnCustomBusin
CommonUtil.emitEvent(channel: channel, method: "customBusinessListener", type: "onRecvCustomBusinessMessage", errCode: nil, errMsg: nil, data: s) CommonUtil.emitEvent(channel: channel, method: "customBusinessListener", type: "onRecvCustomBusinessMessage", errCode: nil, errMsg: nil, data: s)
} }
} }
public class MessageKvInfoListener: NSObject, Open_im_sdk_callbackOnMessageKvInfoListenerProtocol {
private let channel: FlutterMethodChannel
init(channel: FlutterMethodChannel) {
self.channel = channel
}
public func onMessageKvInfoChanged(_ s: String?) {
CommonUtil.emitEvent(channel: channel, method: "messageKvInfoListener", type: "onMessageKvInfoChanged", errCode: nil, errMsg: nil, data: s)
}
}

View File

@@ -13,7 +13,6 @@ public class UserManager: BaseServiceManager {
self["unsubscribeUsersStatus"] = unsubscribeUsersStatus self["unsubscribeUsersStatus"] = unsubscribeUsersStatus
self["getSubscribeUsersStatus"] = getSubscribeUsersStatus self["getSubscribeUsersStatus"] = getSubscribeUsersStatus
self["getUserStatus"] = getUserStatus self["getUserStatus"] = getUserStatus
self["getUsersInfoStranger"] = getUsersInfoStranger
} }
func setUserListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func setUserListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
@@ -48,13 +47,21 @@ public class UserManager: BaseServiceManager {
func getUserStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult){ func getUserStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetUserStatus(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDs"]) Open_im_sdkGetUserStatus(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDs"])
} }
func getUsersInfoStranger(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
Open_im_sdkGetUsersInfoStranger(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "userIDs"], methodCall[string: "groupID"])
}
} }
public class UserListener: NSObject, Open_im_sdk_callbackOnUserListenerProtocol { public class UserListener: NSObject, Open_im_sdk_callbackOnUserListenerProtocol {
public func onUserCommandAdd(_ userCommand: String?) {
CommonUtil.emitEvent(channel: self.channel, method: "userListener", type: "onUserCommandAdd", errCode: nil, errMsg: nil, data: userCommand)
}
public func onUserCommandDelete(_ userCommand: String?) {
CommonUtil.emitEvent(channel: self.channel, method: "userListener", type: "onUserCommandDelete", errCode: nil, errMsg: nil, data: userCommand)
}
public func onUserCommandUpdate(_ userCommand: String?) {
CommonUtil.emitEvent(channel: self.channel, method: "userListener", type: "onUserCommandUpdate", errCode: nil, errMsg: nil, data: userCommand)
}
private let channel:FlutterMethodChannel private let channel:FlutterMethodChannel

View File

@@ -8,9 +8,6 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
let messageManager: MessageManager let messageManager: MessageManager
let groupManager: GroupManager let groupManager: GroupManager
let userManger: UserManager let userManger: UserManager
// let signalingManager: SignalingManager
// let workMomentsManager: WorkMomentsManager
// let organizationManager: OrganizationManager
init(channel: FlutterMethodChannel) { init(channel: FlutterMethodChannel) {
self.imManager = IMMananger(channel: channel) self.imManager = IMMananger(channel: channel)
@@ -19,9 +16,6 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
self.messageManager = MessageManager(channel: channel) self.messageManager = MessageManager(channel: channel)
self.groupManager = GroupManager(channel: channel) self.groupManager = GroupManager(channel: channel)
self.userManger = UserManager(channel: channel) self.userManger = UserManager(channel: channel)
// self.signalingManager = SignalingManager(channel: channel)
// self.workMomentsManager = WorkMomentsManager(channel: channel)
// self.organizationManager = OrganizationManager(channel: channel)
} }
public static func register(with registrar: FlutterPluginRegistrar) { public static func register(with registrar: FlutterPluginRegistrar) {
@@ -45,12 +39,6 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
groupManager.handleMethod(call: call, result: result) groupManager.handleMethod(call: call, result: result)
case "userManager": case "userManager":
userManger.handleMethod(call: call, result: result) userManger.handleMethod(call: call, result: result)
// case "signalingManager":
// signalingManager.handleMethod(call: call, result: result)
// case "workMomentsManager":
// workMomentsManager.handleMethod(call: call, result: result)
// case "organizationManager":
// organizationManager.handleMethod(call: call, result: result)
default: default:
print("Handle ManagerName Error: \(managerName) not found") print("Handle ManagerName Error: \(managerName) not found")
} }

View File

@@ -17,9 +17,11 @@ A new Flutter project.
s.dependency 'Flutter' s.dependency 'Flutter'
s.platform = :ios, '11.0' s.platform = :ios, '11.0'
s.dependency 'OpenIMSDKCore','3.3.0' s.dependency 'OpenIMSDKCore','3.8.1'
s.static_framework = true s.static_framework = true
# s.vendored_frameworks = 'Framework/*.framework' s.library = 'resolv'
# s.vendored_frameworks = 'Framework/*.xcframework'
# Flutter.framework does not contain a i386 slice. # Flutter.framework does not contain a i386 slice.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386 arm64' } s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386 arm64' }
s.swift_version = '5.0' s.swift_version = '5.0'

BIN
lib/.DS_Store vendored

Binary file not shown.

View File

@@ -18,7 +18,6 @@ export 'src/listener/custom_business_listener.dart';
export 'src/listener/friendship_listener.dart'; export 'src/listener/friendship_listener.dart';
export 'src/listener/group_listener.dart'; export 'src/listener/group_listener.dart';
export 'src/listener/listener_for_service.dart'; export 'src/listener/listener_for_service.dart';
export 'src/listener/message_kv_info_listener.dart';
export 'src/listener/msg_send_progress_listener.dart'; export 'src/listener/msg_send_progress_listener.dart';
export 'src/listener/upload_file_listener.dart'; export 'src/listener/upload_file_listener.dart';
export 'src/listener/user_listener.dart'; export 'src/listener/user_listener.dart';
@@ -30,10 +29,11 @@ export 'src/manager/im_message_manager.dart';
export 'src/manager/im_user_manager.dart'; export 'src/manager/im_user_manager.dart';
export 'src/models/conversation_info.dart'; export 'src/models/conversation_info.dart';
export 'src/models/group_info.dart'; export 'src/models/group_info.dart';
export 'src/models/meeting_info.dart'; export 'src/models/init_config.dart';
export 'src/models/message.dart'; export 'src/models/message.dart';
export 'src/models/notification_info.dart'; export 'src/models/notification_info.dart';
export 'src/models/search_info.dart'; export 'src/models/search_info.dart';
export 'src/models/user_info.dart'; export 'src/models/user_info.dart';
export 'src/models/input_status_changed_data.dart';
export 'src/openim.dart'; export 'src/openim.dart';
export 'src/utils.dart'; export 'src/utils.dart';

View File

@@ -0,0 +1,4 @@
class AllowType {
static const allow = 0;
static const notAllow = 1;
}

View File

@@ -1,14 +1,15 @@
/// 会话类型 /// Conversation types
class ConversationType { class ConversationType {
/// 单聊 /// Single chat
static const single = 1; static const single = 1;
/// /// Group (Deprecated in v3)
@Deprecated('Use superGroup instead')
static const group = 2; static const group = 2;
/// 大群 /// Super group chat
static const superGroup = 3; static const superGroup = 3;
/// 通知 /// Notification
static const notification = 4; static const notification = 4;
} }

View File

@@ -1,17 +1,17 @@
/// 会话强提示内容 /// Conversation Strong Hint Content
class GroupAtType { class GroupAtType {
/// 取消所有提示,即调用了resetConversationGroupAtType方法 /// Cancel all hints, equivalent to calling the resetConversationGroupAtType method
static const atNormal = 0; static const atNormal = 0;
/// @了我提示 /// @ me hint
static const atMe = 1; static const atMe = 1;
/// @了所有人提示 /// @ all hint
static const atAll = 2; static const atAll = 2;
/// @了所有人@了我 /// @ all and @ me hint
static const atAllAtMe = 3; static const atAllAtMe = 3;
/// 群公告提示 /// Group notification hint
static const groupNotification = 4; static const groupNotification = 4;
} }

View File

@@ -0,0 +1,14 @@
/// Group Member Filter
class GroupMemberFilter {
static const all = 0;
static const owner = 1;
static const admin = 2;
static const member = 3;
static const adminAndMember = 4;
static const superAndAdmin = 4;
}

View File

@@ -1,11 +1,11 @@
/// 群成员角色 /// Group Member Roles
class GroupRoleLevel { class GroupRoleLevel {
/// 群主 /// Group owner
static const owner = 100; static const owner = 100;
/// 管理员 /// Administrator
static const admin = 60; static const admin = 60;
/// 普通成员 /// Regular member
static const member = 20; static const member = 20;
} }

View File

@@ -0,0 +1,7 @@
/// Group Status
class GroupStatus {
static const normal = 0;
static const baned = 1;
static const dismissed = 2;
static const muted = 3;
}

View File

@@ -1,8 +1,9 @@
/// 组类型 /// Group Types
class GroupType { class GroupType {
/// 普通群 /// General group (Deprecated in v3)
@Deprecated('Use work instead')
static const int general = 0; static const int general = 0;
/// 工作群 /// Work group
static const int work = 2; static const int work = 2;
} }

View File

@@ -1,11 +1,11 @@
/// 进群验证设置选项 /// Group Join Verification Settings
class GroupVerification { class GroupVerification {
/// 申请需要同意 邀请直接进 /// Apply and invite directly for entry
static const int applyNeedVerificationInviteDirectly = 0; static const int applyNeedVerificationInviteDirectly = 0;
/// 所有人进群需要验证,除了群主管理员邀 /// Everyone needs verification to join, except for group owners and administrators who can invite directly
static const int allNeedVerification = 1; static const int allNeedVerification = 1;
/// 直接进群 /// Directly join the group
static const int directly = 2; static const int directly = 2;
} }

View File

@@ -1,15 +1,16 @@
/// 当前flutter平台仅支持Android/ios /// The current Flutter platform supports only Android/iOS
class IMPlatform { class IMPlatform {
/// IOS /// iOS
static const ios = 1; static const ios = 1;
/// Android /// Android
static const android = 2; static const android = 2;
static const windows = 3; static const windows = 3;
static const xos = 4; static const xos = 4;
static const web = 5; static const web = 5;
static const mini_web = 6; static const miniWeb = 6;
static const linux = 7; static const linux = 7;
static const android_pad = 8; static const androidPad = 8;
static const ipad = 9; static const ipad = 9;
} }

View File

@@ -0,0 +1,5 @@
class JoinSource {
static const invited = 2;
static const search = 3;
static const QRCode = 4;
}

View File

@@ -1,4 +1,4 @@
/// callback类型 /// Callback Types
class ListenerType { class ListenerType {
static const simpleMsgListener = 'simpleMsgListener'; static const simpleMsgListener = 'simpleMsgListener';
static const connectListener = 'connectListener'; static const connectListener = 'connectListener';
@@ -15,4 +15,5 @@ class ListenerType {
static const messageKvInfoListener = "messageKvInfoListener"; static const messageKvInfoListener = "messageKvInfoListener";
static const listenerForService = "listenerForService"; static const listenerForService = "listenerForService";
static const uploadFileListener = "uploadFileListener"; static const uploadFileListener = "uploadFileListener";
static const uploadLogsListener = "uploadLogsListener";
} }

View File

@@ -1,14 +1,14 @@
/// 消息发送状态 /// Message Send Status
class MessageStatus { class MessageStatus {
/// 发送中 /// Sending
static const sending = 1; static const sending = 1;
/// 已发送成功 /// Successfully sent
static const succeeded = 2; static const succeeded = 2;
/// 发送失败 /// Send failed
static const failed = 3; static const failed = 3;
/// 已经删除 /// Already deleted
static const deleted = 4; static const deleted = 4;
} }

View File

@@ -1,171 +1,176 @@
/// 消息类型 /// Message Types
class MessageType { class MessageType {
/// 普通文本 /// Normal text
static const text = 101; static const text = 101;
/// 图片 /// Picture
static const picture = 102; static const picture = 102;
/// 语音 /// Voice
static const voice = 103; static const voice = 103;
/// 视频 /// Video
static const video = 104; static const video = 104;
/// 文件 /// File
static const file = 105; static const file = 105;
/// @消息 /// @ Message
static const at_text = 106; static const atText = 106;
/// 合并 /// Merge
static const merger = 107; static const merger = 107;
/// 名片 /// Business Card
static const card = 108; static const card = 108;
/// 位置 /// Location
static const location = 109; static const location = 109;
/// 自定义 /// Custom
static const custom = 110; static const custom = 110;
/// 已读回执 /// Typing
static const has_read_receipt = 112;
/// 正字输入
static const typing = 113; static const typing = 113;
/// 引用回复 /// Quote Reply
static const quote = 114; static const quote = 114;
/// 自定义表情 /// Custom Emoji
static const custom_face = 115; static const customFace = 115;
/// 群消息已读回执 /// Group Message Has Read Receipt (Deprecated in v3)
@Deprecated('Use GroupHasReadReceiptNotification instead')
static const groupHasReadReceipt = 116; static const groupHasReadReceipt = 116;
/// 富文本消息 /// Rich Text Message
static const advancedText = 117; static const advancedText = 117;
static const customMsgNotTriggerConversation = 119; static const customMsgNotTriggerConversation = 119;
static const customMsgOnlineOnly = 120; static const customMsgOnlineOnly = 120;
/// 通知类型 /// Notification Types
static const notificationBegin = 1000; static const notificationBegin = 1000;
static const friendNotificationBegin = 1200; static const friendNotificationBegin = 1200;
/// 好友申请已接受 /// Friend Request Accepted
static const friendApplicationApprovedNotification = 1201; static const friendApplicationApprovedNotification = 1201;
/// 好友申请已拒绝 /// Friend Request Rejected
static const friendApplicationRejectedNotification = 1202; static const friendApplicationRejectedNotification = 1202;
/// 好友申请 /// Friend Request
static const friendApplicationNotification = 1203; static const friendApplicationNotification = 1203;
/// 好友已添加 /// Friend Added
static const friendAddedNotification = 1204; static const friendAddedNotification = 1204;
/// 好友已删除 /// Friend Deleted
static const friendDeletedNotification = 1205; static const friendDeletedNotification = 1205;
/// 设置好友备注 /// Set Friend Remark
static const friendRemarkSetNotification = 1206; static const friendRemarkSetNotification = 1206;
/// 好友加入黑名单 /// Friend Added to Blacklist
static const blackAddedNotification = 1207; static const blackAddedNotification = 1207;
/// 已从黑名单移除 /// Removed from Blacklist
static const blackDeletedNotification = 1208; static const blackDeletedNotification = 1208;
static const friendNotificationEnd = 1299; static const friendNotificationEnd = 1299;
/// 会话改变 /// Conversation Change
static const conversationChangeNotification = 1300; static const conversationChangeNotification = 1300;
static const userNotificationBegin = 1301; static const userNotificationBegin = 1301;
/// 用户信息改变 /// User Information Changed
static const userInfoUpdatedNotification = 1303; static const userInfoUpdatedNotification = 1303;
static const userNotificationEnd = 1399; static const userNotificationEnd = 1399;
/// OA通知 /// OA Notification
static const oaNotification = 1400; static const oaNotification = 1400;
static const groupNotificationBegin = 1500; static const groupNotificationBegin = 1500;
/// 群已被创建 /// Group Created
static const groupCreatedNotification = 1501; static const groupCreatedNotification = 1501;
/// 群资料改变 /// Group Info Set
static const groupInfoSetNotification = 1502; static const groupInfoSetNotification = 1502;
/// 进群申请 /// Join Group Application
static const joinGroupApplicationNotification = 1503; static const joinGroupApplicationNotification = 1503;
/// 群成员退出 /// Group Member Quit
static const memberQuitNotification = 1504; static const memberQuitNotification = 1504;
/// 群申请被接受 /// Group Application Accepted
static const groupApplicationAcceptedNotification = 1505; static const groupApplicationAcceptedNotification = 1505;
/// 群申请被拒绝 /// Group Application Rejected
static const groupApplicationRejectedNotification = 1506; static const groupApplicationRejectedNotification = 1506;
/// 群拥有者权限转移 /// Group Owner Transferred
static const groupOwnerTransferredNotification = 1507; static const groupOwnerTransferredNotification = 1507;
/// 群成员被踢出群 /// Member Kicked from Group
static const memberKickedNotification = 1508; static const memberKickedNotification = 1508;
/// 邀请进群 /// Member Invited to Group
static const memberInvitedNotification = 1509; static const memberInvitedNotification = 1509;
/// 群成员进群 /// Member Entered Group
static const memberEnterNotification = 1510; static const memberEnterNotification = 1510;
/// 解散群 /// Dismiss Group
static const dismissGroupNotification = 1511; static const dismissGroupNotification = 1511;
static const groupNotificationEnd = 1599; static const groupNotificationEnd = 1599;
/// 群成员被禁言 /// Group Member Muted
static const groupMemberMutedNotification = 1512; static const groupMemberMutedNotification = 1512;
/// 群成员被取消禁言 /// Group Member Cancel Muted
static const groupMemberCancelMutedNotification = 1513; static const groupMemberCancelMutedNotification = 1513;
/// 群禁言 /// Group Muted
static const groupMutedNotification = 1514; static const groupMutedNotification = 1514;
/// 取消群禁言 /// Cancel Group Muted
static const groupCancelMutedNotification = 1515; static const groupCancelMutedNotification = 1515;
/// 群成员信息改变 /// Group Member Information Changed
static const groupMemberInfoChangedNotification = 1516; static const groupMemberInfoChangedNotification = 1516;
/// 群公告修改 /// Group Member Set to Admin
static const groupNoticeChangedNotification = 1519; static const groupMemberSetToAdminNotification = 1517;
/// 群名字修改 static const groupMemberSetToOrdinaryUserNotification = 1518;
static const groupNameChangedNotification = 1520;
static const signalingNotificationBegin = 1600; /// Group Notice Changed
static const groupInfoSetAnnouncementNotification = 1519;
/// 信令 /// Group Name Changed
static const signalingNotification = 1601; static const groupInfoSetNameNotification = 1520;
static const signalingNotificationEnd = 1699; /// Burn After Reading
/// 阅后即焚
static const burnAfterReadingNotification = 1701; static const burnAfterReadingNotification = 1701;
static const notificationEnd = 2000; static const notificationEnd = 2000;
/// 撤回消息 /// Business Notification
static const businessNotification = 2001;
/// Recall Message
static const revokeMessageNotification = 2101; static const revokeMessageNotification = 2101;
/// Single Chat Has Read Receipt
static const signalHasReadReceiptNotification = 2150;
/// Group Chat Has Read Receipt
static const groupHasReadReceiptNotification = 2155;
} }

View File

@@ -0,0 +1,5 @@
class ReceiveMessageOpt {
static const receive = 0;
static const notReceive = 1;
static const notNotify = 2;
}

View File

@@ -0,0 +1,4 @@
class AllowType {
static const black = 0;
static const friend = 1;
}

View File

@@ -1,172 +1,155 @@
// /// 消息发送失败 /// SDK Error Codes
// class MessageFailedCode {
// /// 被对方拉黑
// static const int blockedByFriend = 1302;
//
// /// 被对方删除
// static const int deletedByFriend = 1303;
//
// /// 已被移除群聊/群已解散
// static const int notInGroup = 1204;
// }
//
// /// 添加好友失败
// class AddFriendFailedCode {
// /// 该用户已设置不可添加
// static const int refuseToAddFriends = 10013;
// }
class SDKErrorCode { class SDKErrorCode {
/// 网络请求错误 /// Network Request Error
static const int networkRequestError = 10000; static const int networkRequestError = 10000;
/// 网络等待超时错误 /// Network Waiting Timeout Error
static const int networkWaitTimeoutError = 10001; static const int networkWaitTimeoutError = 10001;
/// 参数错误 /// Parameter Error
static const int parameterError = 10002; static const int parameterError = 10002;
/// 上下文超时错误,通常为用户已经退出 /// Context Timeout Error, usually when the user has already logged out
static const int contextTimeoutError = 10003; static const int contextTimeoutError = 10003;
/// 资源未加载完毕,通常为未初始化,或者登录接口还未成功返回 /// Resources not loaded completely, usually uninitialized or login hasn't completed
static const int resourceNotLoaded = 10004; static const int resourceNotLoaded = 10004;
/// 未知错误,需要根据 errmsg 确认原因 /// Unknown Error, check the error message for details
static const int unknownError = 10005; static const int unknownError = 10005;
/// sdk 内部错误,需要根据 errmsg 确认原因 /// SDK Internal Error, check the error message for details
static const int sdkInternalError = 10006; static const int sdkInternalError = 10006;
/// 该用户已设置不可添加 /// This user has set not to be added
static const int refuseToAddFriends = 10013; static const int refuseToAddFriends = 10013;
/// 用户不存在或未注册 /// User does not exist or is not registered
static const int userNotExistOrNotRegistered = 10100; static const int userNotExistOrNotRegistered = 10100;
/// 用户已经退出登录 /// User has already logged out
static const int userHasLoggedOut = 10101; static const int userHasLoggedOut = 10101;
/// 用户重复登录,可以通过 getloginstatus 确认登录状态,避免重复登录 /// User is attempting to log in again, check the login status to avoid duplicate logins
static const int repeatLogin = 10102; static const int repeatLogin = 10102;
/// 需要上传的文件不存在 /// The file to upload does not exist
static const int uploadFileNotExist = 10200; static const int uploadFileNotExist = 10200;
/// 消息解压失败 /// Message decompression failed
static const int messageDecompressionFailed = 10201; static const int messageDecompressionFailed = 10201;
/// 消息解码失败 /// Message decoding failed
static const int messageDecodingFailed = 10202; static const int messageDecodingFailed = 10202;
/// 不支持的长连接二进制协议 /// Unsupported long connection binary protocol
static const int unsupportedLongConnection = 10203; static const int unsupportedLongConnection = 10203;
/// 消息重复发送 /// Message sent multiple times
static const int messageRepeated = 10204; static const int messageRepeated = 10204;
/// 消息内容类型不支持 /// Message content type not supported
static const int messageContentTypeNotSupported = 10205; static const int messageContentTypeNotSupported = 10205;
/// 不支持的会话操作 /// Unsupported session operation
static const int unsupportedSessionOperation = 10301; static const int unsupportedSessionOperation = 10301;
/// 群 ID 不存在 /// Group ID does not exist
static const int groupIDNotExist = 10400; static const int groupIDNotExist = 10400;
/// 群组类型错误 /// Group type is incorrect
static const int wrongGroupType = 10401; static const int wrongGroupType = 10401;
/// 服务器内部错误,通常为内部网络错误,需要检查服务器各节点运行是否正常 /// Server Internal Error, usually an internal network error, check if server nodes are running correctly
static const int serverInternalError = 500; static const int serverInternalError = 500;
/// 参数错误,需要检查 body 参数以及 header 参数是否正确 /// Parameter Error on the server, check if body and header parameters are correct
static const int serverParameterError = 1001; static const int serverParameterError = 1001;
/// 权限不足,一般为 header 参数中携带 token 不正确,或者权限越级操作 /// Insufficient Permissions, typically when the token in the header is incorrect or when trying to perform unauthorized actions
static const int insufficientPermissions = 1002; static const int insufficientPermissions = 1002;
/// 数据库主键重复 /// Duplicate Database Primary Key
static const int duplicateDatabasePrimaryKey = 1003; static const int duplicateDatabasePrimaryKey = 1003;
/// 数据库记录未找到 /// Database Record Not Found
static const int databaseRecordNotFound = 1004; static const int databaseRecordNotFound = 1004;
/// 用户 ID 不存在 /// User ID does not exist
static const int userIDNotExist = 1101; static const int userIDNotExist = 1101;
/// 用户已经注册 /// User is already registered
static const int userAlreadyRegistered = 1102; static const int userAlreadyRegistered = 1102;
/// 群不存在 /// Group does not exist
static const int groupNotExis = 1201; static const int groupNotExis = 1201;
/// 群已存在 /// Group already exists
static const int groupAlreadyExists = 1202; static const int groupAlreadyExists = 1202;
/// 用户不在群组中 /// User is not in the group
static const int userIsNotInGroup = 1203; static const int userIsNotInGroup = 1203;
/// 群组已解散 /// Group has been disbanded
static const int groupDisbanded = 1204; static const int groupDisbanded = 1204;
/// 群申请已经被处理,不需要重复处理 /// Group application has already been processed, no need to process it again
static const int groupApplicationHasBeenProcessed = 1206; static const int groupApplicationHasBeenProcessed = 1206;
/// 不能添加自己为好友 /// Cannot add yourself as a friend
static const int notAddMyselfAsAFriend = 1301; static const int notAddMyselfAsAFriend = 1301;
/// 已被对方拉黑 /// You have been blocked by the other party
static const int hasBeenBlocked = 1302; static const int hasBeenBlocked = 1302;
/// 对方不是自己的好友 /// The other party is not your friend
static const int notFriend = 1303; static const int notFriend = 1303;
/// 已经是好友关系,不需要重复申请 /// Already in a friend relationship, no need to reapply
static const int alreadyAFriendRelationship = 1304; static const int alreadyAFriendRelationship = 1304;
/// 消息已读功能被关闭 /// Message read function is turned off
static const int messageReadFunctionIsTurnedOff = 1401; static const int messageReadFunctionIsTurnedOff = 1401;
/// 你已被禁言,不能在群里发言 /// You have been banned from speaking in the group
static const int youHaveBeenBanned = 1402; static const int youHaveBeenBanned = 1402;
/// 群已被禁言,不能发言 /// The group has been banned from posting
static const int groupHasBeenBanned = 1403; static const int groupHasBeenBanned = 1403;
/// 该消息已被撤回 /// This message has been retracted
static const int messageHasBeenRetracted = 1404; static const int messageHasBeenRetracted = 1404;
/// 授权过期 /// Authorization has expired
static const int licenseExpired = 1405; static const int licenseExpired = 1405;
/// token 已经过期 /// Token has expired
static const int tokenHasExpired = 1501; static const int tokenHasExpired = 1501;
/// token 无效 /// Invalid token
static const int tokenInvalid = 1502; static const int tokenInvalid = 1502;
/// token 格式错误 /// Token format error
static const int tokenFormatError = 1503; static const int tokenFormatError = 1503;
/// token 还未生效 /// Token has not yet taken effect
static const int tokenHasNotYetTakenEffect = 1504; static const int tokenHasNotYetTakenEffect = 1504;
/// 未知 token 错误 /// Unknown token error
static const int unknownTokenError = 1505; static const int unknownTokenError = 1505;
/// 被踢出的 token无效 /// The kicked-out token is invalid
static const int thekickedOutTokenIsInvalid = 1506; static const int thekickedOutTokenIsInvalid = 1506;
/// token 不存在 /// Token does not exist
static const int tokenNotExist = 1507; static const int tokenNotExist = 1507;
/// 连接数超过网关最大限制 /// Number of Connections Exceeds Gateway's Maximum Limit
static const int connectionsExceedsMaximumLimit = 1601; static const int connectionsExceedsMaximumLimit = 1601;
/// 连接握手参数错误 /// Handshake Parameter Error
static const int handshakeParameterError = 1602; static const int handshakeParameterError = 1602;
/// 文件上传过期 /// File Upload Expired
static const int fileUploadExpired = 1701; static const int fileUploadExpired = 1701;
} }

View File

@@ -1,16 +1,13 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 消息监听 /// Message Listener
class OnAdvancedMsgListener { class OnAdvancedMsgListener {
Function(Message msg)? onMsgDeleted; Function(Message msg)? onMsgDeleted;
Function(RevokedInfo info)? onNewRecvMessageRevoked; Function(RevokedInfo info)? onNewRecvMessageRevoked;
Function(List<ReadReceiptInfo> list)? onRecvC2CReadReceipt; Function(List<ReadReceiptInfo> list)? onRecvC2CReadReceipt;
Function(List<ReadReceiptInfo> list)? onRecvGroupReadReceipt;
Function(String msgID, List<KeyValue> list)? onRecvMessageExtensionsAdded;
Function(String msgID, List<KeyValue> list)? onRecvMessageExtensionsChanged;
Function(String msgID, List<String> list)? onRecvMessageExtensionsDeleted;
Function(Message msg)? onRecvNewMessage; Function(Message msg)? onRecvNewMessage;
Function(Message msg)? onRecvOfflineNewMessage; Function(Message msg)? onRecvOfflineNewMessage;
Function(Message msg)? onRecvOnlineOnlyMessage;
/// Uniquely identifies /// Uniquely identifies
String id; String id;
@@ -19,50 +16,26 @@ class OnAdvancedMsgListener {
this.onMsgDeleted, this.onMsgDeleted,
this.onNewRecvMessageRevoked, this.onNewRecvMessageRevoked,
this.onRecvC2CReadReceipt, this.onRecvC2CReadReceipt,
this.onRecvGroupReadReceipt,
this.onRecvMessageExtensionsAdded,
this.onRecvMessageExtensionsChanged,
this.onRecvMessageExtensionsDeleted,
this.onRecvNewMessage, this.onRecvNewMessage,
this.onRecvOfflineNewMessage, this.onRecvOfflineNewMessage,
this.onRecvOnlineOnlyMessage,
}) : id = "id_${DateTime.now().microsecondsSinceEpoch}"; }) : id = "id_${DateTime.now().microsecondsSinceEpoch}";
void msgDeleted(Message msg) { void msgDeleted(Message msg) {
onMsgDeleted?.call(msg); onMsgDeleted?.call(msg);
} }
/// 消息被撤回 /// Message has been retracted
void newRecvMessageRevoked(RevokedInfo info) { void newRecvMessageRevoked(RevokedInfo info) {
onNewRecvMessageRevoked?.call(info); onNewRecvMessageRevoked?.call(info);
} }
/// C2C消息已读回执 /// C2C Message Read Receipt
void recvC2CReadReceipt(List<ReadReceiptInfo> list) { void recvC2CReadReceipt(List<ReadReceiptInfo> list) {
onRecvC2CReadReceipt?.call(list); onRecvC2CReadReceipt?.call(list);
} }
/// 群消息已读回执 /// Received a new message
void recvGroupReadReceipt(List<ReadReceiptInfo> list) {
onRecvGroupReadReceipt?.call(list);
}
/// 收到拓展消息kv新增
void recvMessageExtensionsAdded(String msgID, List<KeyValue> list) {
onRecvMessageExtensionsAdded?.call(msgID, list);
}
/// 收到拓展消息kv改变
void recvMessageExtensionsChanged(String msgID, List<KeyValue> list) {
onRecvMessageExtensionsChanged?.call(msgID, list);
}
/// 收到扩展消息被删除
/// [list] 被删除的TypeKey
void recvMessageExtensionsDeleted(String msgID, List<String> list) {
onRecvMessageExtensionsDeleted?.call(msgID, list);
}
/// 收到了一条新消息
void recvNewMessage(Message msg) { void recvNewMessage(Message msg) {
onRecvNewMessage?.call(msg); onRecvNewMessage?.call(msg);
} }
@@ -70,4 +43,8 @@ class OnAdvancedMsgListener {
void recvOfflineNewMessage(Message msg) { void recvOfflineNewMessage(Message msg) {
onRecvOfflineNewMessage?.call(msg); onRecvOfflineNewMessage?.call(msg);
} }
void recvOnlineOnlyMessage(Message msg) {
onRecvOnlineOnlyMessage?.call(msg);
}
} }

View File

@@ -1,10 +1,11 @@
/// SDK 连接状态监听 /// SDK Connection State Listener
class OnConnectListener { class OnConnectListener {
Function(int? code, String? errorMsg)? onConnectFailed; Function(int? code, String? errorMsg)? onConnectFailed;
Function()? onConnectSuccess; Function()? onConnectSuccess;
Function()? onConnecting; Function()? onConnecting;
Function()? onKickedOffline; Function()? onKickedOffline;
Function()? onUserTokenExpired; Function()? onUserTokenExpired;
Function()? onUserTokenInvalid;
OnConnectListener({ OnConnectListener({
this.onConnectFailed, this.onConnectFailed,
@@ -12,30 +13,35 @@ class OnConnectListener {
this.onConnecting, this.onConnecting,
this.onKickedOffline, this.onKickedOffline,
this.onUserTokenExpired, this.onUserTokenExpired,
this.onUserTokenInvalid,
}); });
/// SDK连接服务器失败 /// SDK failed to connect to the server
void connectFailed(int? code, String? errorMsg) { void connectFailed(int? code, String? errorMsg) {
onConnectFailed?.call(code, errorMsg); onConnectFailed?.call(code, errorMsg);
} }
/// SDK连接服务器成功 /// SDK successfully connected to the server
void connectSuccess() { void connectSuccess() {
onConnectSuccess?.call(); onConnectSuccess?.call();
} }
/// SDK正在连接服务器 /// SDK is currently connecting to the server
void connecting() { void connecting() {
onConnecting?.call(); onConnecting?.call();
} }
/// 账号已在其他地方登录,当前设备被踢下线 /// The account has been logged in from another location, and the current device has been kicked offline
void kickedOffline() { void kickedOffline() {
onKickedOffline?.call(); onKickedOffline?.call();
} }
/// 登录凭证过期,需要重新登录 /// Login credentials have expired and require reauthentication
void userTokenExpired() { void userTokenExpired() {
onUserTokenExpired?.call(); onUserTokenExpired?.call();
} }
void userTokenInvalid() {
onUserTokenInvalid?.call();
}
} }

View File

@@ -1,47 +1,60 @@
import 'package:flutter/foundation.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 会话监听 /// Conversation Listener
class OnConversationListener { class OnConversationListener {
Function(List<ConversationInfo> list)? onConversationChanged; Function(List<ConversationInfo> list)? onConversationChanged;
Function(List<ConversationInfo> list)? onNewConversation; Function(List<ConversationInfo> list)? onNewConversation;
Function(int count)? onTotalUnreadMessageCountChanged; Function(int count)? onTotalUnreadMessageCountChanged;
Function()? onSyncServerFailed; Function(bool? reinstalled)? onSyncServerStart;
Function()? onSyncServerFinish; Function(int? progress)? onSyncServerProgress;
Function()? onSyncServerStart; Function(bool? reinstalled)? onSyncServerFinish;
Function(bool? reinstalled)? onSyncServerFailed;
ValueChanged<InputStatusChangedData>? onInputStatusChanged;
OnConversationListener({ OnConversationListener({
this.onConversationChanged, this.onConversationChanged,
this.onNewConversation, this.onNewConversation,
this.onTotalUnreadMessageCountChanged, this.onTotalUnreadMessageCountChanged,
this.onSyncServerFailed,
this.onSyncServerFinish,
this.onSyncServerStart, this.onSyncServerStart,
this.onSyncServerProgress,
this.onSyncServerFinish,
this.onSyncServerFailed,
this.onInputStatusChanged,
}); });
/// 会话发生改变 /// Conversations have changed
void conversationChanged(List<ConversationInfo> list) { void conversationChanged(List<ConversationInfo> list) {
onConversationChanged?.call(list); onConversationChanged?.call(list);
} }
/// 有新会话产生 /// New conversations have been created
void newConversation(List<ConversationInfo> list) { void newConversation(List<ConversationInfo> list) {
onNewConversation?.call(list); onNewConversation?.call(list);
} }
/// 未读消息总数发送改变 /// Total unread message count has changed
void totalUnreadMessageCountChanged(int i) { void totalUnreadMessageCountChanged(int count) {
onTotalUnreadMessageCountChanged?.call(i); onTotalUnreadMessageCountChanged?.call(count);
} }
void syncServerFailed() { void syncServerStart(bool? reinstalled) {
onSyncServerFailed?.call(); onSyncServerStart?.call(reinstalled);
} }
void syncServerFinish() { void syncServerProgress(int? progress) {
onSyncServerFinish?.call(); onSyncServerProgress?.call(progress);
} }
void syncServerStart() { void syncServerFailed(bool? reinstalled) {
onSyncServerStart?.call(); onSyncServerFailed?.call(reinstalled);
}
void syncServerFinish(bool? reinstalled) {
onSyncServerFinish?.call(reinstalled);
}
void conversationUserInputStatusChanged(InputStatusChangedData data) {
onInputStatusChanged?.call(data);
} }
} }

View File

@@ -1,16 +1,16 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 好友关系监听 /// Friendship Listener
class OnFriendshipListener { class OnFriendshipListener {
Function(BlacklistInfo i)? onBlackAdded; Function(BlacklistInfo info)? onBlackAdded;
Function(BlacklistInfo i)? onBlackDeleted; Function(BlacklistInfo info)? onBlackDeleted;
Function(FriendInfo i)? onFriendAdded; Function(FriendInfo info)? onFriendAdded;
Function(FriendApplicationInfo i)? onFriendApplicationAccepted; Function(FriendApplicationInfo info)? onFriendApplicationAccepted;
Function(FriendApplicationInfo i)? onFriendApplicationAdded; Function(FriendApplicationInfo info)? onFriendApplicationAdded;
Function(FriendApplicationInfo i)? onFriendApplicationDeleted; Function(FriendApplicationInfo info)? onFriendApplicationDeleted;
Function(FriendApplicationInfo i)? onFriendApplicationRejected; Function(FriendApplicationInfo info)? onFriendApplicationRejected;
Function(FriendInfo i)? onFriendDeleted; Function(FriendInfo info)? onFriendDeleted;
Function(FriendInfo i)? onFriendInfoChanged; Function(FriendInfo info)? onFriendInfoChanged;
OnFriendshipListener({ OnFriendshipListener({
this.onBlackAdded, this.onBlackAdded,
@@ -24,48 +24,48 @@ class OnFriendshipListener {
this.onFriendInfoChanged, this.onFriendInfoChanged,
}); });
/// 已被加入黑名单 /// Added to the blacklist
void blackAdded(BlacklistInfo u) { void blackAdded(BlacklistInfo info) {
onBlackAdded?.call(u); onBlackAdded?.call(info);
} }
/// 已从黑名单移除 /// Removed from the blacklist
void blackDeleted(BlacklistInfo u) { void blackDeleted(BlacklistInfo info) {
onBlackDeleted?.call(u); onBlackDeleted?.call(info);
} }
/// 好友已添加 /// Friend added
void friendAdded(FriendInfo u) { void friendAdded(FriendInfo info) {
onFriendAdded?.call(u); onFriendAdded?.call(info);
} }
/// 好友申请已被接受 /// Friend application accepted
void friendApplicationAccepted(FriendApplicationInfo u) { void friendApplicationAccepted(FriendApplicationInfo info) {
onFriendApplicationAccepted?.call(u); onFriendApplicationAccepted?.call(info);
} }
/// 已添加新的好友申请 /// New friend application added
void friendApplicationAdded(FriendApplicationInfo u) { void friendApplicationAdded(FriendApplicationInfo info) {
onFriendApplicationAdded?.call(u); onFriendApplicationAdded?.call(info);
} }
/// 好友申请已被删除 /// Friend application deleted
void friendApplicationDeleted(FriendApplicationInfo u) { void friendApplicationDeleted(FriendApplicationInfo info) {
onFriendApplicationDeleted?.call(u); onFriendApplicationDeleted?.call(info);
} }
/// 好友申请已被拒绝 /// Friend application rejected
void friendApplicationRejected(FriendApplicationInfo u) { void friendApplicationRejected(FriendApplicationInfo info) {
onFriendApplicationRejected?.call(u); onFriendApplicationRejected?.call(info);
} }
/// 好友已被删除 /// Friend deleted
void friendDeleted(FriendInfo u) { void friendDeleted(FriendInfo info) {
onFriendDeleted?.call(u); onFriendDeleted?.call(info);
} }
/// 好友资料发生改变 /// Friend information changed
void friendInfoChanged(FriendInfo u) { void friendInfoChanged(FriendInfo info) {
onFriendInfoChanged?.call(u); onFriendInfoChanged?.call(info);
} }
} }

View File

@@ -1,6 +1,6 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 群组监听 /// Group Listener
class OnGroupListener { class OnGroupListener {
Function(GroupApplicationInfo info)? onGroupApplicationAccepted; Function(GroupApplicationInfo info)? onGroupApplicationAccepted;
Function(GroupApplicationInfo info)? onGroupApplicationAdded; Function(GroupApplicationInfo info)? onGroupApplicationAdded;
@@ -28,22 +28,22 @@ class OnGroupListener {
this.onJoinedGroupDeleted, this.onJoinedGroupDeleted,
}); });
/// 群申请已被接受 /// Group application accepted
void groupApplicationAccepted(GroupApplicationInfo info) { void groupApplicationAccepted(GroupApplicationInfo info) {
onGroupApplicationAccepted?.call(info); onGroupApplicationAccepted?.call(info);
} }
/// 群申请已被添加 /// Group application added
void groupApplicationAdded(GroupApplicationInfo info) { void groupApplicationAdded(GroupApplicationInfo info) {
onGroupApplicationAdded?.call(info); onGroupApplicationAdded?.call(info);
} }
/// 群申请已被删除 /// Group application deleted
void groupApplicationDeleted(GroupApplicationInfo info) { void groupApplicationDeleted(GroupApplicationInfo info) {
onGroupApplicationDeleted?.call(info); onGroupApplicationDeleted?.call(info);
} }
/// 群申请已被拒绝 /// Group application rejected
void groupApplicationRejected(GroupApplicationInfo info) { void groupApplicationRejected(GroupApplicationInfo info) {
onGroupApplicationRejected?.call(info); onGroupApplicationRejected?.call(info);
} }
@@ -52,32 +52,32 @@ class OnGroupListener {
onGroupDismissed?.call(info); onGroupDismissed?.call(info);
} }
/// 群资料发生改变 /// Group information changed
void groupInfoChanged(GroupInfo info) { void groupInfoChanged(GroupInfo info) {
onGroupInfoChanged?.call(info); onGroupInfoChanged?.call(info);
} }
/// 群成员已添加 /// Group member added
void groupMemberAdded(GroupMembersInfo info) { void groupMemberAdded(GroupMembersInfo info) {
onGroupMemberAdded?.call(info); onGroupMemberAdded?.call(info);
} }
/// 群成员已删除 /// Group member deleted
void groupMemberDeleted(GroupMembersInfo info) { void groupMemberDeleted(GroupMembersInfo info) {
onGroupMemberDeleted?.call(info); onGroupMemberDeleted?.call(info);
} }
/// 群成员信息发送改变 /// Group member information changed
void groupMemberInfoChanged(GroupMembersInfo info) { void groupMemberInfoChanged(GroupMembersInfo info) {
onGroupMemberInfoChanged?.call(info); onGroupMemberInfoChanged?.call(info);
} }
/// 已加入的群有新增 /// Joined group added
void joinedGroupAdded(GroupInfo info) { void joinedGroupAdded(GroupInfo info) {
onJoinedGroupAdded?.call(info); onJoinedGroupAdded?.call(info);
} }
/// 已加入的群减少 /// Joined group deleted
void joinedGroupDeleted(GroupInfo info) { void joinedGroupDeleted(GroupInfo info) {
onJoinedGroupDeleted?.call(info); onJoinedGroupDeleted?.call(info);
} }

View File

@@ -1,6 +1,6 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 好友关系监听 /// Friend Relationship Listener
class OnListenerForService { class OnListenerForService {
Function(FriendApplicationInfo i)? onFriendApplicationAdded; Function(FriendApplicationInfo i)? onFriendApplicationAdded;
Function(FriendApplicationInfo i)? onFriendApplicationAccepted; Function(FriendApplicationInfo i)? onFriendApplicationAccepted;

View File

@@ -1,11 +0,0 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class OnMessageKvInfoListener {
Function(List<MessageKv> list)? onMessageKvInfoChanged;
OnMessageKvInfoListener({this.onMessageKvInfoChanged});
void messageKvInfoChanged(List<MessageKv> list) {
onMessageKvInfoChanged?.call(list);
}
}

View File

@@ -1,10 +1,10 @@
/// 消息发送进度监听 /// Message Sending Progress Listener
class OnMsgSendProgressListener { class OnMsgSendProgressListener {
Function(String clientMsgID, int progress)? onProgress; Function(String clientMsgID, int progress)? onProgress;
OnMsgSendProgressListener({this.onProgress}); OnMsgSendProgressListener({this.onProgress});
/// 消息发送进度 /// Message sending progress
void progress(String clientMsgID, int progress) { void progress(String clientMsgID, int progress) {
onProgress?.call(clientMsgID, progress); onProgress?.call(clientMsgID, progress);
} }

View File

@@ -1,14 +1,32 @@
class OnUploadLogsListener {
Function(int current, int size)? onUploadProgress;
OnUploadLogsListener({this.onUploadProgress});
void onProgress(int current, int size) {
onUploadProgress?.call(current, size);
}
}
class OnUploadFileListener { class OnUploadFileListener {
OnUploadFileListener({
this.onComplete,
this.onHashPartComplete,
this.onHashPartProgress,
this.onOpen,
this.onPartSize,
this.onUploadID,
this.onUploadPartComplete,
this.onUploadProgress,
});
Function(String id, int size, String url, int type)? onComplete; Function(String id, int size, String url, int type)? onComplete;
Function(String id, String partHash, String fileHash)? onHashPartComplete; Function(String id, String partHash, String fileHash)? onHashPartComplete;
Function(String id, int index, int size, String partHash)? onHashPartProgress; Function(String id, int index, int size, String partHash)? onHashPartProgress;
Function(String id, int size)? onOpen; Function(String id, int size)? onOpen;
Function(String id, int partSize, int num)? onPartSize; Function(String id, int partSize, int num)? onPartSize;
Function(String id, int fileSize, int streamSize, int storageSize)? Function(String id, int fileSize, int streamSize, int storageSize)? onUploadProgress;
onUploadProgress;
Function(String id, String uploadID)? onUploadID; Function(String id, String uploadID)? onUploadID;
Function(String id, int index, int partSize, String partHash)? Function(String id, int index, int partSize, String partHash)? onUploadPartComplete;
onUploadPartComplete;
void complete(String id, int size, String url, int type) { void complete(String id, int size, String url, int type) {
onComplete?.call(id, size, url, type); onComplete?.call(id, size, url, type);
@@ -30,8 +48,7 @@ class OnUploadFileListener {
onPartSize?.call(id, partSize, num); onPartSize?.call(id, partSize, num);
} }
void uploadProgress( void uploadProgress(String id, int fileSize, int streamSize, int storageSize) {
String id, int fileSize, int streamSize, int storageSize) {
onUploadProgress?.call(id, fileSize, streamSize, storageSize); onUploadProgress?.call(id, fileSize, streamSize, storageSize);
} }

View File

@@ -1,6 +1,6 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 当前用户资料监听 /// Current User Profile Listener
class OnUserListener { class OnUserListener {
/// The information of the logged-in user has been updated /// The information of the logged-in user has been updated
Function(UserInfo info)? onSelfInfoUpdated; Function(UserInfo info)? onSelfInfoUpdated;
@@ -8,11 +8,12 @@ class OnUserListener {
OnUserListener({this.onSelfInfoUpdated, this.onUserStatusChanged}); OnUserListener({this.onSelfInfoUpdated, this.onUserStatusChanged});
/// 自身信息发送变化回调 /// Callback for changes in user's own information
void selfInfoUpdated(UserInfo info) { void selfInfoUpdated(UserInfo info) {
onSelfInfoUpdated?.call(info); onSelfInfoUpdated?.call(info);
} }
/// Callback for changes in user status
void userStatusChanged(UserStatusInfo info) { void userStatusChanged(UserStatusInfo info) {
onUserStatusChanged?.call(info); onUserStatusChanged?.call(info);
} }

View File

@@ -1,35 +1,35 @@
import 'dart:async';
import 'dart:developer'; import 'dart:developer';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
import '../models/update_req.dart';
class ConversationManager { class ConversationManager {
MethodChannel _channel; MethodChannel _channel;
late OnConversationListener listener; late OnConversationListener listener;
ConversationManager(this._channel); ConversationManager(this._channel);
/// 会话监听 /// Conversation Listener
Future setConversationListener(OnConversationListener listener) { Future setConversationListener(OnConversationListener listener) {
this.listener = listener; this.listener = listener;
return _channel.invokeMethod('setConversationListener', _buildParam({})); return _channel.invokeMethod('setConversationListener', _buildParam({}));
} }
/// 获取所有会话 /// Get All Conversations
Future<List<ConversationInfo>> getAllConversationList( Future<List<ConversationInfo>> getAllConversationList({String? operationID}) => _channel
{String? operationID}) => .invokeMethod(
_channel 'getAllConversationList',
.invokeMethod( _buildParam({
'getAllConversationList', "operationID": Utils.checkOperationID(operationID),
_buildParam({ }))
"operationID": Utils.checkOperationID(operationID), .then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
}))
.then((value) =>
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
/// 分页获取会话 /// Paginate Through Conversations
/// [offset] 开始下标 /// [offset] Starting index
/// [count] 每页数量 /// [count] Number of items per page
Future<List<ConversationInfo>> getConversationListSplit({ Future<List<ConversationInfo>> getConversationListSplit({
int offset = 0, int offset = 0,
int count = 20, int count = 20,
@@ -43,12 +43,11 @@ class ConversationManager {
'count': count, 'count': count,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
/// 查询会话,如果会话不存在会自动生成一个 /// Query a Conversation; if it doesn't exist, it will be created
/// [sourceID] 如果是单聊会话传userID如果是群聊会话传GroupID /// [sourceID] UserID for one-on-one conversation, GroupID for group conversation
/// [sessionType] 参考[ConversationType] /// [sessionType] Reference [ConversationType]
Future<ConversationInfo> getOneConversation({ Future<ConversationInfo> getOneConversation({
required String sourceID, required String sourceID,
required int sessionType, required int sessionType,
@@ -62,11 +61,10 @@ class ConversationManager {
"sessionType": sessionType, "sessionType": sessionType,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toObj(value, (map) => ConversationInfo.fromJson(map)));
Utils.toObj(value, (map) => ConversationInfo.fromJson(map)));
/// 根据会话id获取多个会话 /// Get Multiple Conversations by Conversation ID
/// [conversationIDList] 会话id列表 /// [conversationIDList] List of conversation IDs
Future<List<ConversationInfo>> getMultipleConversation({ Future<List<ConversationInfo>> getMultipleConversation({
required List<String> conversationIDList, required List<String> conversationIDList,
String? operationID, String? operationID,
@@ -78,12 +76,11 @@ class ConversationManager {
"conversationIDList": conversationIDList, "conversationIDList": conversationIDList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
/// 设置会话草稿 /// Set Conversation Draft
/// [conversationID] 会话id /// [conversationID] Conversation ID
/// [draftText] 草稿 /// [draftText] Draft text
Future setConversationDraft({ Future setConversationDraft({
required String conversationID, required String conversationID,
required String draftText, required String draftText,
@@ -97,24 +94,21 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 置顶会话 /// Pin a Conversation
/// [conversationID] 会话id /// [conversationID] Conversation ID
/// [isPinned] true置顶false取消置顶 /// [isPinned] true: pin, false: unpin
Future pinConversation({ Future pinConversation({
required String conversationID, required String conversationID,
required bool isPinned, required bool isPinned,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = ConversationReq(isPinned: isPinned);
'pinConversation',
_buildParam({
"conversationID": conversationID,
"isPinned": isPinned,
"operationID": Utils.checkOperationID(operationID),
}));
/// 置顶会话 return setConversation(conversationID, req, operationID: operationID);
/// [conversationID] 会话id }
/// Hide a Conversation
/// [conversationID] Conversation ID
Future hideConversation({ Future hideConversation({
required String conversationID, required String conversationID,
String? operationID, String? operationID,
@@ -126,7 +120,34 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 获取未读消息总数 /// Hide All Conversations
Future hideAllConversations({
String? operationID,
}) =>
_channel.invokeMethod(
'hideAllConversations',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}));
/// Query Conversation ID
/// [sourceID] UserID for one-on-one, GroupID for group
/// [sessionType] Reference [ConversationType]
Future<dynamic> getConversationIDBySessionType({
required String sourceID,
required int sessionType,
String? operationID,
}) {
return _channel.invokeMethod(
'getConversationIDBySessionType',
_buildParam({
'sourceID': sourceID,
'sessionType': sessionType,
'operationID': Utils.checkOperationID(operationID),
}));
}
/// get total unread message count
/// int.tryParse(count) ?? 0; /// int.tryParse(count) ?? 0;
Future<dynamic> getTotalUnreadMsgCount({ Future<dynamic> getTotalUnreadMsgCount({
String? operationID, String? operationID,
@@ -137,39 +158,23 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 查询会话id /// Message Do-Not-Disturb Setting
/// [sourceID] 如果是单聊值传用户ID如果是群聊值传组ID /// [conversationID] Conversation ID
/// [sessionType] 参考[ConversationType] /// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
// Future<dynamic> getConversationIDBySessionType({ @Deprecated('use [setConversation] instead')
// required String sourceID,
// required int sessionType,
// }) =>
// _channel.invokeMethod(
// 'getConversationIDBySessionType',
// _buildParam({
// "sourceID": sourceID,
// "sessionType": sessionType,
// }));
/// 消息免打扰设置
/// [conversationID] 会话id
/// [status] 0正常1不接受消息2接受在线消息不接受离线消息
Future<dynamic> setConversationRecvMessageOpt({ Future<dynamic> setConversationRecvMessageOpt({
required String conversationID, required String conversationID,
required int status, required int status,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = ConversationReq(recvMsgOpt: status);
'setConversationRecvMessageOpt',
_buildParam({
"conversationID": conversationID,
"status": status,
"operationID": Utils.checkOperationID(operationID),
}));
/// 查询免打扰状态 return setConversation(conversationID, req, operationID: operationID);
/// [conversationIDList] 会话id列表 }
/// 返回:[{"conversationId":"single_13922222222","result":0}]result值0正常1不接受消息2接受在线消息不接受离线消息
/// Message Do-Not-Disturb Setting
/// [conversationID] Conversation ID
/// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
Future<List<dynamic>> getConversationRecvMessageOpt({ Future<List<dynamic>> getConversationRecvMessageOpt({
required List<String> conversationIDList, required List<String> conversationIDList,
String? operationID, String? operationID,
@@ -183,24 +188,22 @@ class ConversationManager {
})) }))
.then((value) => Utils.toListMap(value)); .then((value) => Utils.toListMap(value));
/// 阅后即焚 /// Self-Destruct Messages
/// [conversationID] 会话id /// [conversationID] Conversation ID
/// [isPrivate] true开启false关闭 /// [isPrivate] true: enable, false: disable
@Deprecated('use [setConversation] instead')
Future<dynamic> setConversationPrivateChat({ Future<dynamic> setConversationPrivateChat({
required String conversationID, required String conversationID,
required bool isPrivate, required bool isPrivate,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = ConversationReq(isPrivateChat: isPrivate);
'setConversationPrivateChat',
_buildParam({
"conversationID": conversationID,
"isPrivate": isPrivate,
"operationID": Utils.checkOperationID(operationID),
}));
/// 删除本地以及服务器的会话 return setConversation(conversationID, req, operationID: operationID);
/// [conversationID] 会话ID }
/// Delete a Conversation Locally and from the Server
/// [conversationID] Conversation ID
Future<dynamic> deleteConversationAndDeleteAllMsg({ Future<dynamic> deleteConversationAndDeleteAllMsg({
required String conversationID, required String conversationID,
String? operationID, String? operationID,
@@ -212,8 +215,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 清空会话里的消息 /// Clear Messages in a Conversation
/// [conversationID] 会话ID /// [conversationID] Conversation ID
Future<dynamic> clearConversationAndDeleteAllMsg({ Future<dynamic> clearConversationAndDeleteAllMsg({
required String conversationID, required String conversationID,
String? operationID, String? operationID,
@@ -225,7 +228,8 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 删除所有本地会话 /// Delete All Local Conversations
@Deprecated('use hideAllConversations instead')
Future<dynamic> deleteAllConversationFromLocal({ Future<dynamic> deleteAllConversationFromLocal({
String? operationID, String? operationID,
}) => }) =>
@@ -235,20 +239,19 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 重置强提醒标识[GroupAtType] /// Reset Mentioned (Group At) Flags [GroupAtType]
/// [conversationID] 会话id /// [conversationID] Conversation ID
@Deprecated('use [setConversation] instead')
Future<dynamic> resetConversationGroupAtType({ Future<dynamic> resetConversationGroupAtType({
required String conversationID, required String conversationID,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = ConversationReq(groupAtType: 0);
'resetConversationGroupAtType',
_buildParam({
"conversationID": conversationID,
"operationID": Utils.checkOperationID(operationID),
}));
/// 查询@所有人标识 return setConversation(conversationID, req, operationID: operationID);
}
/// Query @ All Flag
Future<dynamic> getAtAllTag({ Future<dynamic> getAtAllTag({
String? operationID, String? operationID,
}) => }) =>
@@ -258,41 +261,35 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 查询@所有人标识 /// Get @ All Tag
String get atAllTag => 'AtAllTag'; String get atAllTag => 'AtAllTag';
/// 全局免打扰 /// Global Do-Not-Disturb
/// [status] 0正常1不接受消息2接受在线消息不接受离线消息 /// [status] 0: normal; 1: not receiving messages; 2: receive online messages but not offline messages
@Deprecated('use [OpenIM.iMManager.userManager.setSelfInfo()] instead')
Future<dynamic> setGlobalRecvMessageOpt({ Future<dynamic> setGlobalRecvMessageOpt({
required int status, required int status,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( throw UnimplementedError('setGlobalRecvMessageOpt');
'setGlobalRecvMessageOpt', }
_buildParam({
"status": status,
"operationID": Utils.checkOperationID(operationID),
}));
/// 设置阅后即焚时长 /// Set Self-Destruct Message Duration
/// [conversationID] 会话id /// [conversationID] Conversation ID
/// [burnDuration] 时长s默认30s /// [burnDuration] Duration in seconds, default: 30s
@Deprecated('use [setConversation] instead')
Future<dynamic> setConversationBurnDuration({ Future<dynamic> setConversationBurnDuration({
required String conversationID, required String conversationID,
int burnDuration = 30, int burnDuration = 30,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = ConversationReq(burnDuration: burnDuration);
'setConversationBurnDuration',
_buildParam({
"conversationID": conversationID,
"burnDuration": burnDuration,
"operationID": Utils.checkOperationID(operationID),
}));
/// 标记消息已读 return setConversation(conversationID, req, operationID: operationID);
/// [conversationID] 会话ID }
/// [messageIDList] 被标记的消息clientMsgID
/// Mark Messages as Read
/// [conversationID] Conversation ID
Future markConversationMessageAsRead({ Future markConversationMessageAsRead({
required String conversationID, required String conversationID,
String? operationID, String? operationID,
@@ -304,47 +301,38 @@ class ConversationManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 开启定期删除 /// search Conversations
/// [isMsgDestruct] true 开启 Future<List<ConversationInfo>> searchConversations(
Future<dynamic> setConversationIsMsgDestruct({ String name, {
required String conversationID,
bool isMsgDestruct = true,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( return _channel
'setConversationIsMsgDestruct', .invokeMethod(
_buildParam({ 'searchConversations',
"conversationID": conversationID, _buildParam({
"isMsgDestruct": isMsgDestruct, 'name': name,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }))
.then((value) => Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
}
/// 定期删除聊天记录 @Deprecated('use [setConversation] instead')
/// [duration] 秒 Future setConversationEx(
Future<dynamic> setConversationMsgDestructTime({ String conversationID, {
required String conversationID, String? ex,
int duration = 1 * 24 * 60 * 60,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = ConversationReq(ex: ex);
'setConversationMsgDestructTime',
_buildParam({
"conversationID": conversationID,
"duration": duration,
"operationID": Utils.checkOperationID(operationID),
}));
/// 会话列表自定义排序规则。 return setConversation(conversationID, req, operationID: operationID);
}
/// Custom Sort for Conversation List
List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list
..sort((a, b) { ..sort((a, b) {
if ((a.isPinned == true && b.isPinned == true) || if ((a.isPinned == true && b.isPinned == true) || (a.isPinned != true && b.isPinned != true)) {
(a.isPinned != true && b.isPinned != true)) { int aCompare = a.draftTextTime! > a.latestMsgSendTime! ? a.draftTextTime! : a.latestMsgSendTime!;
int aCompare = a.draftTextTime! > a.latestMsgSendTime! int bCompare = b.draftTextTime! > b.latestMsgSendTime! ? b.draftTextTime! : b.latestMsgSendTime!;
? a.draftTextTime!
: a.latestMsgSendTime!;
int bCompare = b.draftTextTime! > b.latestMsgSendTime!
? b.draftTextTime!
: b.latestMsgSendTime!;
if (aCompare > bCompare) { if (aCompare > bCompare) {
return -1; return -1;
} else if (aCompare < bCompare) { } else if (aCompare < bCompare) {
@@ -359,9 +347,68 @@ class ConversationManager {
} }
}); });
static Map _buildParam(Map param) { Future changeInputStates({
required String conversationID,
required bool focus,
String? operationID,
}) {
return _channel.invokeMethod(
'changeInputStates',
_buildParam(
{
'focus': focus,
'conversationID': conversationID,
'operationID': Utils.checkOperationID(operationID),
},
),
);
}
Future<List<int>?> getInputStates(
String conversationID,
String userID, {
String? operationID,
}) {
return _channel
.invokeMethod(
'getInputStates',
_buildParam(
{
'conversationID': conversationID,
'userID': userID,
'operationID': Utils.checkOperationID(operationID),
},
),
)
.then((value) {
print('getInputStates: $value');
final result = Utils.toListMap(value);
return List<int>.from(result);
});
}
Future setConversation(
String conversationID,
ConversationReq req, {
String? operationID,
}) {
return _channel.invokeMethod(
'setConversation',
_buildParam(
{
'conversationID': conversationID,
'req': req.toJson(),
'operationID': Utils.checkOperationID(operationID),
},
),
);
}
static Map _buildParam(Map<String, dynamic> param) {
param["ManagerName"] = "conversationManager"; param["ManagerName"] = "conversationManager";
param = Utils.cleanMap(param);
log('param: $param'); log('param: $param');
return param; return param;
} }
} }

View File

@@ -1,22 +1,27 @@
import 'dart:async';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
import '../models/update_req.dart';
class FriendshipManager { class FriendshipManager {
MethodChannel _channel; MethodChannel _channel;
late OnFriendshipListener listener; late OnFriendshipListener listener;
FriendshipManager(this._channel); FriendshipManager(this._channel);
/// 好友关系监听 /// Friend Relationship Listener
Future setFriendshipListener(OnFriendshipListener listener) { Future setFriendshipListener(OnFriendshipListener listener) {
this.listener = listener; this.listener = listener;
return _channel.invokeMethod('setFriendListener', _buildParam({})); return _channel.invokeMethod('setFriendListener', _buildParam({}));
} }
/// 查询好友信息 /// Query Friend Information
/// [userIDList] userID集合 /// [userIDList] List of user IDs
Future<List<UserInfo>> getFriendsInfo({ Future<List<PublicUserInfo>> getFriendsInfo({
required List<String> userIDList, required List<String> userIDList,
bool filterBlack = false,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
@@ -24,13 +29,14 @@ class FriendshipManager {
'getFriendsInfo', 'getFriendsInfo',
_buildParam({ _buildParam({
"userIDList": userIDList, "userIDList": userIDList,
'filterBlack': filterBlack,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); .then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
/// 发送一个好友请求,需要对方调用同意申请才能成为好友。 /// Send a Friend Request, the other party needs to accept the request to become friends.
/// [userID] 被邀请的用户ID /// [userID] User ID to be invited
/// [reason] 备注说明 /// [reason] Remark description
Future<dynamic> addFriend({ Future<dynamic> addFriend({
required String userID, required String userID,
String? reason, String? reason,
@@ -44,40 +50,56 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 获取别人加我为好友的申请 /// Get Friend Requests Sent to Me
Future<List<FriendApplicationInfo>> getFriendApplicationListAsRecipient( Future<List<FriendApplicationInfo>> getFriendApplicationListAsRecipient({String? operationID}) => _channel
{String? operationID}) =>
_channel
.invokeMethod(
'getFriendApplicationListAsRecipient',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// 获取我发出的好友申请
Future<List<FriendApplicationInfo>> getFriendApplicationListAsApplicant(
{String? operationID}) =>
_channel
.invokeMethod(
'getFriendApplicationListAsApplicant',
_buildParam({
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// 获取好友列表,返回的列表包含了已拉入黑名单的好友
Future<List<UserInfo>> getFriendList({String? operationID}) => _channel
.invokeMethod( .invokeMethod(
'getFriendList', 'getFriendApplicationListAsRecipient',
_buildParam({ _buildParam({
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); .then((value) => Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
/// 获取好友列表,返回的列表包含了已拉入黑名单的好友 /// Get Friend Requests Sent by Me
Future<List<FriendApplicationInfo>> getFriendApplicationListAsApplicant({String? operationID}) => _channel
.invokeMethod(
'getFriendApplicationListAsApplicant',
_buildParam({
"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<List<PublicUserInfo>> getFriendList({
String? operationID,
bool filterBlack = false,
}) =>
_channel
.invokeMethod(
'getFriendList',
_buildParam({
'filterBlack': filterBlack,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
Future<List<PublicUserInfo>> getFriendListPage({
bool filterBlack = false,
int offset = 0,
int count = 40,
String? operationID,
}) =>
_channel
.invokeMethod(
'getFriendListPage',
_buildParam({
'offset': offset,
'count': count,
'filterBlack': filterBlack,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
/// Get Friend List, including friends who have been put into the blacklist (returns a map)
Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel
.invokeMethod( .invokeMethod(
'getFriendList', 'getFriendList',
@@ -86,46 +108,63 @@ class FriendshipManager {
})) }))
.then((value) => Utils.toListMap(value)); .then((value) => Utils.toListMap(value));
/// 设置好友备注 Future<List<dynamic>> getFriendListPageMap({
/// [userID] 好友的userID bool filterBlack = false,
/// [remark] 好友的备注 String? operationID,
int offset = 0,
int count = 40,
}) =>
_channel
.invokeMethod(
'getFriendListPage',
_buildParam({
'offset': offset,
'count': count,
'filterBlack': filterBlack,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toListMap(value));
/// Set Friend's Remark
/// [userID] Friend's userID
/// [remark] Friend's remark
@Deprecated('Use [updateFriends] instead')
Future<dynamic> setFriendRemark({ Future<dynamic> setFriendRemark({
required String userID, required String userID,
required String remark, required String remark,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = UpdateFriendsReq(friendUserIDs: [userID], remark: remark);
'setFriendRemark',
_buildParam({
'toUserID': userID,
'remark': remark,
"operationID": Utils.checkOperationID(operationID),
}));
/// 加入黑名单 return updateFriends(req, operationID: operationID);
/// [userID] 被加入黑名单的好友ID }
/// Add to Blacklist
/// [userID] Friend's ID to be added to the blacklist
Future<dynamic> addBlacklist({ Future<dynamic> addBlacklist({
required String userID, required String userID,
String? ex,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'addBlacklist', 'addBlacklist',
_buildParam({ _buildParam({
"userID": userID, "userID": userID,
"ex": ex,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 获取黑名单列表 /// Get Blacklist
Future<List<UserInfo>> getBlacklist({String? operationID}) => _channel Future<List<BlacklistInfo>> getBlacklist({String? operationID}) => _channel
.invokeMethod( .invokeMethod(
'getBlacklist', 'getBlacklist',
_buildParam({ _buildParam({
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); .then((value) => Utils.toList(value, (v) => BlacklistInfo.fromJson(v)));
/// 从黑名单移除 /// Remove from Blacklist
/// [userID] 用户ID /// [userID] User ID
Future<dynamic> removeBlacklist({ Future<dynamic> removeBlacklist({
required String userID, required String userID,
String? operationID, String? operationID,
@@ -137,8 +176,8 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 检查友好关系 /// Check Friendship Status
/// [userIDList] userID列表 /// [userIDList] List of user IDs
Future<List<FriendshipInfo>> checkFriend({ Future<List<FriendshipInfo>> checkFriend({
required List<String> userIDList, required List<String> userIDList,
String? operationID, String? operationID,
@@ -150,11 +189,10 @@ class FriendshipManager {
'userIDList': userIDList, 'userIDList': userIDList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (v) => FriendshipInfo.fromJson(v)));
Utils.toList(value, (v) => FriendshipInfo.fromJson(v)));
/// 删除好友 /// Delete Friend
/// [userID] 用户ID /// [userID] User ID
Future<dynamic> deleteFriend({ Future<dynamic> deleteFriend({
required String userID, required String userID,
String? operationID, String? operationID,
@@ -166,9 +204,9 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 接受好友请求 /// Accept Friend Request
/// [userID] 用户ID /// [userID] User ID
/// [handleMsg]备注说明 /// [handleMsg] Remark description
Future<dynamic> acceptFriendApplication({ Future<dynamic> acceptFriendApplication({
required String userID, required String userID,
String? handleMsg, String? handleMsg,
@@ -182,9 +220,9 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 拒绝好友请求 /// Reject Friend Request
/// [userID] 用户ID /// [userID] User ID
/// [handleMsg]备注说明 /// [handleMsg] Remark description
Future<dynamic> refuseFriendApplication({ Future<dynamic> refuseFriendApplication({
required String userID, required String userID,
String? handleMsg, String? handleMsg,
@@ -198,12 +236,12 @@ class FriendshipManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 查好友 /// Search for Friends
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空 /// [keywordList] Search keywords, currently supports only one keyword search, cannot be empty
/// [isSearchUserID] 是否以关键词搜索好友ID(注不可以同时为false)为空默认false /// [isSearchUserID] Whether to search for friend IDs with keywords (note: cannot be false at the same time), defaults to false if empty
/// [isSearchNickname] 是否以关键词搜索昵称为空默认false /// [isSearchNickname] Whether to search by nickname with keywords, defaults to false if empty
/// [isSearchRemark] 是否以关键词搜索备注名为空默认false /// [isSearchRemark] Whether to search by remark name with keywords, defaults to false if empty
Future<List<FriendInfo>> searchFriends({ Future<List<SearchFriendsInfo>> searchFriends({
List<String> keywordList = const [], List<String> keywordList = const [],
bool isSearchUserID = false, bool isSearchUserID = false,
bool isSearchNickname = false, bool isSearchNickname = false,
@@ -222,11 +260,37 @@ class FriendshipManager {
}, },
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => SearchFriendsInfo.fromJson(map)));
Utils.toList(value, (map) => FriendInfo.fromJson(map)));
static Map _buildParam(Map param) { @Deprecated('Use [updateFriends] instead')
Future setFriendsEx(
List<String> friendIDs, {
String? ex,
String? operationID,
}) {
final req = UpdateFriendsReq(friendUserIDs: friendIDs, ex: ex);
return updateFriends(req, operationID: operationID);
}
Future<dynamic> updateFriends(
UpdateFriendsReq updateFriendsReq, {
String? operationID,
}) {
return _channel
.invokeMethod(
'updateFriends',
_buildParam({
'req': updateFriendsReq.toJson(),
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => value);
}
static Map _buildParam(Map<String, dynamic> param) {
param["ManagerName"] = "friendshipManager"; param["ManagerName"] = "friendshipManager";
param = Utils.cleanMap(param);
return param; return param;
} }
} }

View File

@@ -2,6 +2,7 @@ import 'dart:developer';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
import 'package:flutter_openim_sdk/src/models/set_group_member_info.dart';
class GroupManager { class GroupManager {
MethodChannel _channel; MethodChannel _channel;
@@ -9,15 +10,15 @@ class GroupManager {
GroupManager(this._channel); GroupManager(this._channel);
/// 组关系监听 /// Group relationship listener
Future setGroupListener(OnGroupListener listener) { Future setGroupListener(OnGroupListener listener) {
this.listener = listener; this.listener = listener;
return _channel.invokeMethod('setGroupListener', _buildParam({})); return _channel.invokeMethod('setGroupListener', _buildParam({}));
} }
/// 邀请进组,直接进组无需同意。 /// Invite users to a group, allowing them to join without approval.
/// [groupID] ID /// [groupID] Group ID
/// [userIDList] 用户ID列表 /// [userIDList] List of user IDs
Future<List<GroupInviteResult>> inviteUserToGroup({ Future<List<GroupInviteResult>> inviteUserToGroup({
required String groupID, required String groupID,
required List<String> userIDList, required List<String> userIDList,
@@ -33,13 +34,12 @@ class GroupManager {
'reason': reason, 'reason': reason,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
/// 移除组成员 /// Remove group members
/// [groupID] ID /// [groupID] Group ID
/// [userIDList] 用户ID列表 /// [userIDList] List of user IDs
/// [reason] 备注说明 /// [reason] Reason for removal
Future<List<GroupInviteResult>> kickGroupMember({ Future<List<GroupInviteResult>> kickGroupMember({
required String groupID, required String groupID,
required List<String> userIDList, required List<String> userIDList,
@@ -55,12 +55,11 @@ class GroupManager {
'reason': reason, 'reason': reason,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
/// 查询组成员资料 /// Query group member information
/// [groupID] ID /// [groupID] Group ID
/// [userIDList] 用户ID列表 /// [userIDList] List of user IDs
Future<List<GroupMembersInfo>> getGroupMembersInfo({ Future<List<GroupMembersInfo>> getGroupMembersInfo({
required String groupID, required String groupID,
required List<String> userIDList, required List<String> userIDList,
@@ -74,14 +73,13 @@ class GroupManager {
'userIDList': userIDList, 'userIDList': userIDList,
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 分页获取组成员列表 /// Paginate and retrieve the group member list
/// [groupID] ID /// [groupID] Group ID
/// [filter] 过滤成员 0所有1群主 , 2管理员3普通成员4管理员+普通成员 5,群主+管理员 /// [filter] Member filter (0: All, 1: Group owner, 2: Administrator, 3: Regular member, 4: Admin + Regular member, 5: Group owner + Admin)
/// [offset] 开始下标 /// [offset] Starting index
/// [count] 总数 /// [count] Total count
Future<List<GroupMembersInfo>> getGroupMemberList({ Future<List<GroupMembersInfo>> getGroupMemberList({
required String groupID, required String groupID,
int filter = 0, int filter = 0,
@@ -99,14 +97,13 @@ class GroupManager {
'count': count, 'count': count,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 分页获取组成员列表 /// Paginate and retrieve the group member list as a map
/// [groupID] ID /// [groupID] Group ID
/// [filter] 过滤成员 0所有1群主 , 2管理员3普通成员4管理员+普通成员 5,群主+管理员 /// [filter] Member filter (0: All, 1: Group owner, 2: Administrator, 3: Regular member, 4: Admin + Regular member, 5: Group owner + Admin)
/// [offset] 开始下标 /// [offset] Starting index
/// [count] 总数 /// [count] Total count
Future<List<dynamic>> getGroupMemberListMap({ Future<List<dynamic>> getGroupMemberListMap({
required String groupID, required String groupID,
int filter = 0, int filter = 0,
@@ -126,7 +123,7 @@ class GroupManager {
})) }))
.then((value) => Utils.toListMap(value)); .then((value) => Utils.toListMap(value));
/// 查询已加入的组列表 /// Query the list of joined groups
Future<List<GroupInfo>> getJoinedGroupList({String? operationID}) => _channel Future<List<GroupInfo>> getJoinedGroupList({String? operationID}) => _channel
.invokeMethod( .invokeMethod(
'getJoinedGroupList', 'getJoinedGroupList',
@@ -135,7 +132,17 @@ class GroupManager {
})) }))
.then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map))); .then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// 查询已加入的组列表 Future<List<GroupInfo>> getJoinedGroupListPage({String? operationID, int offset = 0, int count = 40}) => _channel
.invokeMethod(
'getJoinedGroupListPage',
_buildParam({
'offset': offset,
'count': count,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// Query the list of joined groups
Future<List<dynamic>> getJoinedGroupListMap({String? operationID}) => _channel Future<List<dynamic>> getJoinedGroupListMap({String? operationID}) => _channel
.invokeMethod( .invokeMethod(
'getJoinedGroupList', 'getJoinedGroupList',
@@ -144,8 +151,8 @@ class GroupManager {
})) }))
.then((value) => Utils.toListMap(value)); .then((value) => Utils.toListMap(value));
/// 检查是否已加入组 /// Check if the user has joined a group
/// [groupID] ID /// [groupID] Group ID
Future<bool> isJoinedGroup({ Future<bool> isJoinedGroup({
required String groupID, required String groupID,
String? operationID, String? operationID,
@@ -159,14 +166,11 @@ class GroupManager {
})) }))
.then((value) => value == 'true' ? true : false); .then((value) => value == 'true' ? true : false);
/// 创建一个组 /// Create a new group
/// [groupName] 群名 /// [groupInfo] Group information
/// [notification] 公告 /// [memberUserIDs] List of user IDs to add as initial members
/// [introduction] 群介绍 /// [adminUserIDs] List of user IDs to add as administrators
/// [faceUrl] 群头像 /// [ownerUserID] User ID of the owner
/// [groupType] 组类型 [GroupType]
/// [ex] 额外信息
/// [list] 初创群成员以及其角色列表[GroupMemberRole]
Future<GroupInfo> createGroup({ Future<GroupInfo> createGroup({
required GroupInfo groupInfo, required GroupInfo groupInfo,
List<String> memberUserIDs = const [], List<String> memberUserIDs = const [],
@@ -184,47 +188,21 @@ class GroupManager {
'ownerUserID': ownerUserID, 'ownerUserID': ownerUserID,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then( .then((value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map)));
(value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map)));
/// 编辑组资料 /// Edit group information
/// [groupID] 被编辑的群ID Future<dynamic> setGroupInfo(
/// [groupName] 新的群名 GroupInfo groupInfo, {
/// [notification] 新的公告
/// [introduction] 新的群介绍
/// [faceURL] 新的群头像
/// [ex] 新的额外信息
Future<dynamic> setGroupInfo({
required String groupID,
String? groupName,
String? notification,
String? introduction,
String? faceURL,
String? ex,
int? needVerification,
int? lookMemberInfo,
int? applyMemberFriend,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'setGroupInfo', 'setGroupInfo',
_buildParam({ _buildParam({
'groupInfo': { 'groupInfo': groupInfo.toJson(),
"groupID": groupID,
"groupName": groupName,
"notification": notification,
"introduction": introduction,
"faceURL": faceURL,
"ex": ex,
'needVerification': needVerification,
'lookMemberInfo': lookMemberInfo,
'applyMemberFriend': applyMemberFriend,
},
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 查询组信息 /// Query group information
/// [groupIDList] 组ID列表
Future<List<GroupInfo>> getGroupsInfo({ Future<List<GroupInfo>> getGroupsInfo({
required List<String> groupIDList, required List<String> groupIDList,
String? operationID, String? operationID,
@@ -236,27 +214,23 @@ class GroupManager {
'groupIDList': groupIDList, 'groupIDList': groupIDList,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then( .then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// 申请加入组,需要通过管理员/群组同意。 /// Apply to join a group, requiring approval from an administrator or the group.
/// [joinSource] 2:通过邀请 3通过搜索 4通过二维码 /// [joinSource] 2: Invited, 3: Searched, 4: Using a QR code
Future<dynamic> joinGroup({ Future<dynamic> joinGroup(
required String groupID, {required String groupID, String? reason, String? operationID, int joinSource = 3, String? ex}) =>
String? reason,
String? operationID,
int joinSource = 3,
}) =>
_channel.invokeMethod( _channel.invokeMethod(
'joinGroup', 'joinGroup',
_buildParam({ _buildParam({
'groupID': groupID, 'groupID': groupID,
'reason': reason, 'reason': reason,
'joinSource': joinSource, 'joinSource': joinSource,
'ex': ex,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 退出组 /// Exit a group
Future<dynamic> quitGroup({ Future<dynamic> quitGroup({
required String groupID, required String groupID,
String? operationID, String? operationID,
@@ -268,9 +242,9 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 转移组拥有者权限 // (Continuing the code)
/// [groupID] 组ID
/// [userID] 新拥有者ID /// Transfer group ownership
Future<dynamic> transferGroupOwner({ Future<dynamic> transferGroupOwner({
required String groupID, required String groupID,
required String userID, required String userID,
@@ -284,34 +258,26 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 作为群主或者管理员,收到的群成员入群申请 /// Handle group membership applications received as a group owner or administrator
Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient( Future<List<GroupApplicationInfo>> getGroupApplicationListAsRecipient({String? operationID}) => _channel
{String? operationID}) => .invokeMethod(
_channel 'getGroupApplicationListAsRecipient',
.invokeMethod( _buildParam({
'getGroupApplicationListAsRecipient', 'operationID': Utils.checkOperationID(operationID),
_buildParam({ }))
'operationID': Utils.checkOperationID(operationID), .then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
}))
.then((value) =>
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
/// 获取自己发出的入群申请记录 /// Get the list of group membership applications sent by the user
Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant( Future<List<GroupApplicationInfo>> getGroupApplicationListAsApplicant({String? operationID}) => _channel
{String? operationID}) => .invokeMethod(
_channel 'getGroupApplicationListAsApplicant',
.invokeMethod( _buildParam({
'getGroupApplicationListAsApplicant', 'operationID': Utils.checkOperationID(operationID),
_buildParam({ }))
'operationID': Utils.checkOperationID(operationID), .then((value) => Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
}))
.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.
/// [groupID] 组id
/// [userID] 申请者用户ID
Future<dynamic> acceptGroupApplication({ Future<dynamic> acceptGroupApplication({
required String groupID, required String groupID,
required String userID, required String userID,
@@ -327,11 +293,8 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 管理员或者群主拒绝某人进入某群 /// Refuse a group membership application as an administrator or group owner
/// 注:主动申请入群需要通过管理员/群组处理,被别人拉入群不需要管理员/群组处理 /// Note: Membership applications require approval from administrators or the group.
/// [groupID] 组id
/// [userID] 申请者用户ID
/// [handleMsg] 说明
Future<dynamic> refuseGroupApplication({ Future<dynamic> refuseGroupApplication({
required String groupID, required String groupID,
required String userID, required String userID,
@@ -347,8 +310,10 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 解散群 // (Continuing the code)
/// [groupID] 群ID
/// Dissolve a group
/// [groupID] Group ID
Future<dynamic> dismissGroup({ Future<dynamic> dismissGroup({
required String groupID, required String groupID,
String? operationID, String? operationID,
@@ -360,9 +325,9 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 开启群禁言,所有群成员禁止发言 /// Enable or disable group mute, preventing all group members from sending messages
/// [groupID] 将开启群禁言的组ID /// [groupID] Group ID
/// [mute] true开启false关闭 /// [mute] true: Enable, false: Disable
Future<dynamic> changeGroupMute({ Future<dynamic> changeGroupMute({
required String groupID, required String groupID,
required bool mute, required bool mute,
@@ -376,10 +341,10 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 禁言群成员 /// Mute a group member
/// [groupID] ID /// [groupID] Group ID
/// [userID] 将被禁言的成员ID /// [userID] Member ID to mute
/// [seconds] 被禁言的时间s设置为0则为解除禁言 /// [seconds] Duration of the mute in seconds (set to 0 to unmute)
Future<dynamic> changeGroupMemberMute({ Future<dynamic> changeGroupMemberMute({
required String groupID, required String groupID,
required String userID, required String userID,
@@ -395,29 +360,26 @@ class GroupManager {
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 设置群成员昵称 /// Set the nickname of a group member
/// [groupID] ID /// [groupID] Group ID
/// [userID] 群成员的用户ID /// [userID] User ID of the group member
/// [groupNickname] 群昵称 /// [groupNickname] Group nickname
@Deprecated('Use [setGroupMemberInfo] instead')
Future<dynamic> setGroupMemberNickname({ Future<dynamic> setGroupMemberNickname({
required String groupID, required String groupID,
required String userID, required String userID,
String? groupNickname, String? groupNickname,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = SetGroupMemberInfo(groupID: groupID, userID: userID, nickname: groupNickname);
'setGroupMemberNickname',
_buildParam({
'groupID': groupID,
'userID': userID,
'groupNickname': groupNickname ?? '',
'operationID': Utils.checkOperationID(operationID),
}));
/// 查询群 return setGroupMemberInfo(groupMembersInfo: req, operationID: operationID);
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空 }
/// [isSearchGroupID] 是否以关键词搜索群ID(注两个不可以同时为false)为空默认false
/// [isSearchGroupName] 是否以关键词搜索群名字为空默认false /// Query a group
/// [keywordList] Search keywords; currently, only one keyword is supported, and it cannot be empty.
/// [isSearchGroupID] Whether to search by group ID (Note: cannot set both to false at the same time); defaults to false if not set.
/// [isSearchGroupName] Whether to search by group name; defaults to false if not set.
Future<List<GroupInfo>> searchGroups({ Future<List<GroupInfo>> searchGroups({
List<String> keywordList = const [], List<String> keywordList = const [],
bool isSearchGroupID = false, bool isSearchGroupID = false,
@@ -435,42 +397,32 @@ class GroupManager {
}, },
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then( .then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
/// 设置群成员权限 /// Set group member role
/// [groupID] ID /// [groupID] Group ID
/// [userID] 群成员的用户ID /// [userID] User ID of the group member
/// [roleLevel] 角色等级,参考[GroupRoleLevel] /// [roleLevel] Role level; see [GroupRoleLevel]
@Deprecated('Use [setGroupMemberInfo] instead')
Future<dynamic> setGroupMemberRoleLevel({ Future<dynamic> setGroupMemberRoleLevel({
required String groupID, required String groupID,
required String userID, required String userID,
required int roleLevel, required int roleLevel,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = SetGroupMemberInfo(groupID: groupID, userID: userID, roleLevel: roleLevel);
'setGroupMemberRoleLevel',
_buildParam({
'groupID': groupID,
'userID': userID,
'roleLevel': roleLevel,
'operationID': Utils.checkOperationID(operationID),
}));
/// 根据加入时间分页获取组成员列表 return setGroupMemberInfo(groupMembersInfo: req, operationID: operationID);
/// [groupID] 群ID }
/// [joinTimeBegin] 加入开始时间
/// [joinTimeEnd] 加入结束时间 /// Get a group member list based on join time
/// [offset] 开始下标
/// [count] 总数
/// [excludeUserIDList] 排除的用户
Future<List<GroupMembersInfo>> getGroupMemberListByJoinTime({ Future<List<GroupMembersInfo>> getGroupMemberListByJoinTime({
required String groupID, required String groupID,
int offset = 0, int offset = 0,
int count = 0, int count = 0,
int joinTimeBegin = 0, int joinTimeBegin = 0,
int joinTimeEnd = 0, int joinTimeEnd = 0,
List<String> excludeUserIDList = const [], List<String> filterUserIDList = const [],
String? operationID, String? operationID,
}) => }) =>
_channel _channel
@@ -482,62 +434,55 @@ class GroupManager {
'count': count, 'count': count,
'joinTimeBegin': joinTimeBegin, 'joinTimeBegin': joinTimeBegin,
'joinTimeEnd': joinTimeEnd, 'joinTimeEnd': joinTimeEnd,
'excludeUserIDList': excludeUserIDList, 'excludeUserIDList': filterUserIDList,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 进群验证设置 /// Set group verification for joining
/// [groupID] ID /// [groupID] Group ID
/// [needVerification] 进群设置,参考[GroupVerification] /// [needVerification] Verification setting; see [GroupVerification] class
@Deprecated('Use [setGroupInfo] instead')
Future<dynamic> setGroupVerification({ Future<dynamic> setGroupVerification({
required String groupID, required String groupID,
required int needVerification, required int needVerification,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = GroupInfo(groupID: groupID, needVerification: needVerification);
'setGroupVerification',
_buildParam({
'groupID': groupID,
'needVerification': needVerification,
'operationID': Utils.checkOperationID(operationID),
}));
/// 不允许通过群获取成员资料 return setGroupInfo(req, operationID: operationID);
/// [groupID] 群ID }
/// [status] 0关闭1打开
/// Allow/disallow members to add friends through the group
/// [groupID] Group ID
/// [status] 0: Disable, 1: Enable
@Deprecated('Use [setGroupInfo] instead')
Future<dynamic> setGroupLookMemberInfo({ Future<dynamic> setGroupLookMemberInfo({
required String groupID, required String groupID,
required int status, required int status,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = GroupInfo(groupID: groupID, lookMemberInfo: status);
'setGroupLookMemberInfo',
_buildParam({
'groupID': groupID,
'status': status,
'operationID': Utils.checkOperationID(operationID),
}));
/// 不允许通过群添加好友 return setGroupInfo(req, operationID: operationID);
/// [groupID] 群ID }
/// [status] 0关闭1打开
/// Allow/disallow members to add friends through the group
/// [groupID] Group ID
/// [status] 0: Disable, 1: Enable
@Deprecated('Use [setGroupInfo] instead')
Future<dynamic> setGroupApplyMemberFriend({ Future<dynamic> setGroupApplyMemberFriend({
required String groupID, required String groupID,
required int status, required int status,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( final req = GroupInfo(groupID: groupID, applyMemberFriend: status);
'setGroupApplyMemberFriend',
_buildParam({
'groupID': groupID,
'status': status,
'operationID': Utils.checkOperationID(operationID),
}));
/// 获取群拥有者,管理员 return setGroupInfo(req, operationID: operationID);
/// [groupId] 群ID }
/// Get group owners and administrators
/// [groupId] Group ID
Future<List<GroupMembersInfo>> getGroupOwnerAndAdmin({ Future<List<GroupMembersInfo>> getGroupOwnerAndAdmin({
required String groupID, required String groupID,
String? operationID, String? operationID,
@@ -549,16 +494,15 @@ class GroupManager {
'groupID': groupID, 'groupID': groupID,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 查询群 /// Search for group members
/// [groupID] 群id /// [groupID] Group ID
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空 /// [keywordList] Search keywords; currently, only one keyword is supported, and it cannot be empty.
/// [isSearchUserID] 是否以关键词搜成员id /// [isSearchUserID] Whether to search by member ID
/// [isSearchMemberNickname] 是否以关键词搜索成员昵称 /// [isSearchMemberNickname] Whether to search by member nickname
/// [offset] 开始index /// [offset] Start index
/// [count] 每次获取的总数 /// [count] Total count to retrieve
Future<List<GroupMembersInfo>> searchGroupMembers({ Future<List<GroupMembersInfo>> searchGroupMembers({
required String groupID, required String groupID,
List<String> keywordList = const [], List<String> keywordList = const [],
@@ -582,16 +526,15 @@ class GroupManager {
}, },
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => .then((value) => Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
/// 查询群 /// Query a group
/// [groupID] 群id /// [groupID] Group ID
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空 /// [keywordList] Search keyword, currently only supports searching with one keyword, and it cannot be empty
/// [isSearchUserID] 是否以关键词搜成员id /// [isSearchUserID] Whether to search member IDs with the keyword
/// [isSearchMemberNickname] 是否以关键词搜索成员昵称 /// [isSearchMemberNickname] Whether to search member nicknames with the keyword
/// [offset] 开始index /// [offset] Starting index
/// [count] 每次获取的总数 /// [count] Total number to retrieve each time
Future<List<dynamic>> searchGroupMembersListMap({ Future<List<dynamic>> searchGroupMembersListMap({
required String groupID, required String groupID,
List<String> keywordList = const [], List<String> keywordList = const [],
@@ -617,27 +560,38 @@ class GroupManager {
})) }))
.then((value) => Utils.toListMap(value)); .then((value) => Utils.toListMap(value));
/// 修改GroupMemberInfo ex字段 /// Modify the GroupMemberInfo ex field
Future<dynamic> setGroupMemberInfo({ Future<dynamic> setGroupMemberInfo({
required String groupID, required SetGroupMemberInfo groupMembersInfo,
required String userID,
String? ex,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'setGroupMemberInfo', 'setGroupMemberInfo',
_buildParam({ _buildParam({
'info': { 'info': groupMembersInfo.toJson(),
'groupID': groupID,
'userID': userID,
'ex': ex,
},
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
static Map _buildParam(Map param) { Future<dynamic> getUsersInGroup(
String groupID,
List<String> userIDs, {
String? operationID,
}) =>
_channel.invokeMethod(
'getUsersInGroup',
_buildParam({
'groupID': groupID,
'userIDs': userIDs,
'operationID': Utils.checkOperationID(operationID),
}));
static Map _buildParam(Map<String, dynamic> param) {
param["ManagerName"] = "groupManager"; param["ManagerName"] = "groupManager";
param = Utils.cleanMap(param);
log('param: $param'); log('param: $param');
return param; return param;
} }
} }

View File

@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:developer'; import 'dart:developer';
import 'dart:io'; import 'dart:io';
@@ -16,6 +17,8 @@ class IMManager {
late OnConnectListener _connectListener; late OnConnectListener _connectListener;
OnListenerForService? _listenerForService; OnListenerForService? _listenerForService;
OnUploadFileListener? _uploadFileListener; OnUploadFileListener? _uploadFileListener;
OnUploadLogsListener? _uploadLogsListener;
late String userID; late String userID;
late UserInfo userInfo; late UserInfo userInfo;
bool isLogined = false; bool isLogined = false;
@@ -54,6 +57,9 @@ class IMManager {
case 'onUserTokenExpired': case 'onUserTokenExpired':
_connectListener.userTokenExpired(); _connectListener.userTokenExpired();
break; break;
case 'onUserTokenInvalid':
_connectListener.userTokenInvalid();
break;
} }
} else if (call.method == ListenerType.userListener) { } else if (call.method == ListenerType.userListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
@@ -65,7 +71,7 @@ class IMManager {
break; break;
case 'onUserStatusChanged': case 'onUserStatusChanged':
final status = Utils.toObj(data, (map) => UserStatusInfo.fromJson(map)); final status = Utils.toObj(data, (map) => UserStatusInfo.fromJson(map));
userManager.listener.userStatusChanged(status); userManager.listener.userStatusChanged(status);
break; break;
} }
} else if (call.method == ListenerType.groupListener) { } else if (call.method == ListenerType.groupListener) {
@@ -136,30 +142,6 @@ class IMManager {
var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map)); var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
messageManager.msgListener.recvC2CReadReceipt(list); messageManager.msgListener.recvC2CReadReceipt(list);
break; break;
case 'onRecvGroupReadReceipt':
var value = call.arguments['data']['groupMsgReceiptList'];
var list = Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
messageManager.msgListener.recvGroupReadReceipt(list);
break;
case 'onRecvMessageExtensionsAdded':
var msgID = call.arguments['data']['msgID'];
var value = call.arguments['data']['reactionExtensionList'];
var list = Utils.toList(value, (map) => KeyValue.fromJson(map));
messageManager.msgListener.recvMessageExtensionsAdded(msgID, list);
break;
case 'onRecvMessageExtensionsChanged':
var msgID = call.arguments['data']['msgID'];
var value = call.arguments['data']['reactionExtensionList'];
var list = Utils.toList(value, (map) => KeyValue.fromJson(map));
messageManager.msgListener.recvMessageExtensionsChanged(msgID, list);
break;
case 'onRecvMessageExtensionsDeleted':
var msgID = call.arguments['data']['msgID'];
var value = call.arguments['data']['reactionExtensionKeyList'];
var list = Utils.toList(value, (map) => '$map');
messageManager.msgListener.recvMessageExtensionsDeleted(msgID, list);
break;
case 'onRecvNewMessage': case 'onRecvNewMessage':
var value = call.arguments['data']['message']; var value = call.arguments['data']['message'];
final msg = Utils.toObj(value, (map) => Message.fromJson(map)); final msg = Utils.toObj(value, (map) => Message.fromJson(map));
@@ -170,6 +152,11 @@ class IMManager {
final msg = Utils.toObj(value, (map) => Message.fromJson(map)); final msg = Utils.toObj(value, (map) => Message.fromJson(map));
messageManager.msgListener.recvOfflineNewMessage(msg); messageManager.msgListener.recvOfflineNewMessage(msg);
break; break;
case 'onRecvOnlineOnlyMessage':
var value = call.arguments['data']['message'];
final msg = Utils.toObj(value, (map) => Message.fromJson(map));
messageManager.msgListener.recvOnlineOnlyMessage(msg);
break;
} }
} else if (call.method == ListenerType.msgSendProgressListener) { } else if (call.method == ListenerType.msgSendProgressListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
@@ -189,14 +176,17 @@ class IMManager {
dynamic data = call.arguments['data']; dynamic data = call.arguments['data'];
switch (type) { switch (type) {
case 'onSyncServerStart': case 'onSyncServerStart':
conversationManager.listener.syncServerStart(); print('dart onSyncServerStart: $data');
conversationManager.listener.syncServerStart(data);
break;
case 'onSyncServerProgress':
conversationManager.listener.syncServerProgress(data);
break; break;
case 'onSyncServerFinish': case 'onSyncServerFinish':
conversationManager.listener.syncServerFinish(); conversationManager.listener.syncServerFinish(data);
break; break;
case 'onSyncServerFailed': case 'onSyncServerFailed':
conversationManager.listener.syncServerFailed(); conversationManager.listener.syncServerFailed(data);
break; break;
case 'onNewConversation': case 'onNewConversation':
var list = Utils.toList(data, (map) => ConversationInfo.fromJson(map)); var list = Utils.toList(data, (map) => ConversationInfo.fromJson(map));
@@ -209,6 +199,10 @@ class IMManager {
case 'onTotalUnreadMessageCountChanged': case 'onTotalUnreadMessageCountChanged':
conversationManager.listener.totalUnreadMessageCountChanged(data ?? 0); conversationManager.listener.totalUnreadMessageCountChanged(data ?? 0);
break; break;
case 'onConversationUserInputStatusChanged':
final i = Utils.toObj(data, (map) => InputStatusChangedData.fromJson(map));
conversationManager.listener.conversationUserInputStatusChanged(i);
break;
} }
} else if (call.method == ListenerType.friendListener) { } else if (call.method == ListenerType.friendListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
@@ -260,15 +254,6 @@ class IMManager {
messageManager.customBusinessListener?.recvCustomBusinessMessage(data); messageManager.customBusinessListener?.recvCustomBusinessMessage(data);
break; break;
} }
} else if (call.method == ListenerType.messageKvInfoListener) {
String type = call.arguments['type'];
String data = call.arguments['data'];
switch (type) {
case 'onMessageKvInfoChanged':
final list = Utils.toList(data, (map) => MessageKv.fromJson(map)).toList();
messageManager.messageKvInfoListener?.messageKvInfoChanged(list);
break;
}
} else if (call.method == ListenerType.listenerForService) { } else if (call.method == ListenerType.listenerForService) {
String type = call.arguments['type']; String type = call.arguments['type'];
String data = call.arguments['data']; String data = call.arguments['data'];
@@ -294,6 +279,15 @@ class IMManager {
_listenerForService?.recvNewMessage(msg); _listenerForService?.recvNewMessage(msg);
break; break;
} }
} else if (call.method == ListenerType.uploadLogsListener) {
String type = call.arguments['type'];
dynamic data = call.arguments['data'];
switch (type) {
case 'onProgress':
int size = data['size'];
int current = data['current'];
_uploadLogsListener?.onProgress(current, size);
}
} else if (call.method == ListenerType.uploadFileListener) { } else if (call.method == ListenerType.uploadFileListener) {
String type = call.arguments['type']; String type = call.arguments['type'];
dynamic data = call.arguments['data']; dynamic data = call.arguments['data'];
@@ -357,15 +351,32 @@ class IMManager {
}); });
} }
/// 初始化SDK Future<bool?> init(
/// [platform] 平台编号[IMPlatform] InitConfig config,
/// [apiAddr] SDK api地址 OnConnectListener listener, {
/// [wsAddr] SDK websocket地址 String? operationID,
/// [dataDir] SDK数据库存储目录 }) {
/// [objectStorage] 存储对象 cos/minio _connectListener = listener;
/// [logLevel] 日志 1不打印 config.logFilePath ??= config.dataDir;
/// [enabledEncryption] true加密 return _channel.invokeMethod(
/// [enabledCompression] true压缩 'initSDK',
_buildParam(
{
...config.toMap(),
"operationID": Utils.checkOperationID(operationID),
},
),
);
}
/// Initialize the SDK
/// [platform] Platform ID [IMPlatform]
/// [apiAddr] SDK API address
/// [wsAddr] SDK WebSocket address
/// [dataDir] SDK database storage directory
/// [logLevel] Log level, 1: no printing
/// [enabledEncryption] true: encryption
/// [enabledCompression] true: compression
Future<dynamic> initSDK({ Future<dynamic> initSDK({
required int platformID, required int platformID,
required String apiAddr, required String apiAddr,
@@ -373,46 +384,42 @@ class IMManager {
required String dataDir, required String dataDir,
required OnConnectListener listener, required OnConnectListener listener,
int logLevel = 6, int logLevel = 6,
String objectStorage = 'cos', bool isNeedEncryption = false,
// String? encryptionKey, bool isCompression = false,
// bool isNeedEncryption = false,
// bool isCompression = false,
// bool isExternalExtensions = false,
bool isLogStandardOutput = true, bool isLogStandardOutput = true,
String? logFilePath, String? logFilePath,
String? operationID, String? operationID,
}) { }) {
this._connectListener = listener; _connectListener = listener;
return _channel.invokeMethod( return _channel.invokeMethod(
'initSDK', 'initSDK',
_buildParam( _buildParam(
{ {
"platformID": platformID, "platformID": platformID,
"apiAddr": apiAddr, "apiAddr": apiAddr,
"wsAddr": wsAddr, "wsAddr": wsAddr,
"dataDir": dataDir, "dataDir": dataDir,
"logLevel": logLevel, "logLevel": logLevel,
"objectStorage": objectStorage, "isCompression": isCompression,
// "encryptionKey": encryptionKey, 'isNeedEncryption': isNeedEncryption,
// "isNeedEncryption": isNeedEncryption, "isLogStandardOutput": isLogStandardOutput,
// "isCompression": isCompression, "logFilePath": logFilePath,
// "isExternalExtensions": isExternalExtensions, 'systemType': 'flutter',
"isLogStandardOutput": isLogStandardOutput, "operationID": Utils.checkOperationID(operationID),
"logFilePath": logFilePath, },
"operationID": Utils.checkOperationID(operationID), ),
}, );
));
} }
/// 反初始化SDK /// Deinitialize the SDK
Future<dynamic> unInitSDK() { Future<dynamic> unInitSDK() {
return _channel.invokeMethod('unInitSDK', _buildParam({})); return _channel.invokeMethod('unInitSDK', _buildParam({}));
} }
/// 登录 /// Login
/// [userID] 用户id /// [userID] User ID
/// [token] 登录token从业务服务器上获取 /// [token] Login token obtained from the business server
/// [defaultValue] 获取失败后使用的默认值 /// [defaultValue] Default value to use if login fails
Future<UserInfo> login({ Future<UserInfo> login({
required String userID, required String userID,
required String token, required String token,
@@ -422,7 +429,7 @@ class IMManager {
}) async { }) async {
int? status; int? status;
if (checkLoginStatus) { if (checkLoginStatus) {
// 1: logout 2: logging 3:logged // 1: logout 2: logging 3: logged
status = await getLoginStatus(); status = await getLoginStatus();
} }
if (status != LoginStatus.logging && status != LoginStatus.logged) { if (status != LoginStatus.logging && status != LoginStatus.logged) {
@@ -450,36 +457,38 @@ class IMManager {
// return uInfo; // return uInfo;
} }
/// 登出 /// Logout
Future<dynamic> logout({String? operationID}) async { Future<dynamic> logout({String? operationID}) async {
var value = await _channel.invokeMethod( var value = await _channel.invokeMethod(
'logout', 'logout',
_buildParam({ _buildParam({
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }),
);
this.isLogined = false; this.isLogined = false;
this.token = null; this.token = null;
return value; return value;
} }
/// 获取登录状态 /// Get login status
/// 1: logout 2: logging 3:logged /// 1: logout 2: logging 3: logged
Future<int?> getLoginStatus({ Future<int?> getLoginStatus({
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod<int>( _channel.invokeMethod<int>(
'getLoginStatus', 'getLoginStatus',
_buildParam({ _buildParam({
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }),
);
/// 获取当前登录用户id /// Get the current logged-in user ID
Future<String> getLoginUserID() async => userID; Future<String> getLoginUserID() async => userID;
/// 获取当前登录用户信息 /// Get the current logged-in user information
Future<UserInfo> getLoginUserInfo() async => userInfo; Future<UserInfo> getLoginUserInfo() async => userInfo;
///[id] [OnUploadFileListener] id一致区分是哪个文件的回调 /// [id] Same as [OnUploadFileListener] ID, to distinguish which file callback it is
Future uploadFile({ Future uploadFile({
required String id, required String id,
required String filePath, required String filePath,
@@ -489,50 +498,70 @@ class IMManager {
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'uploadFile', 'uploadFile',
_buildParam({ _buildParam({
'id': id, 'id': id,
'filePath': filePath, 'filePath': filePath,
'name': fileName, 'name': fileName,
'contentType': contentType, 'contentType': contentType,
'cause': cause, 'cause': cause,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }),
);
/// 更新firebase客户端注册token /// Update the Firebase client registration token
/// [fcmToken] firebase token /// [fcmToken] Firebase token
Future updateFcmToken({ Future updateFcmToken({
required String fcmToken, required String fcmToken,
required int expireTime,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'updateFcmToken', 'updateFcmToken',
_buildParam({ _buildParam({
'fcmToken': fcmToken, 'fcmToken': fcmToken,
'expireTime': expireTime,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
/// 标记app处于后台 /// Upload logs
// Future setAppBackgroundStatus({ Future uploadLogs({
// required bool isBackground, String? ex,
// String? operationID, int line = 0,
// }) => String? operationID,
// _channel.invokeMethod( }) =>
// 'setAppBackgroundStatus', _channel.invokeMethod(
// _buildParam({ 'uploadLogs',
// 'isBackground': isBackground, _buildParam({
// 'operationID': Utils.checkOperationID(operationID), 'ex': ex,
// })); 'line': line,
'operationID': Utils.checkOperationID(operationID),
}));
/// 网络改变 Future logs({
// Future networkStatusChanged({ int logLevel = 5,
// String? operationID, String? file,
// }) => int line = 0,
// _channel.invokeMethod( String? msgs,
// 'networkStatusChanged', String? err,
// _buildParam({ List<dynamic>? keyAndValues,
// 'operationID': Utils.checkOperationID(operationID), String? operationID,
// })); }) =>
_channel.invokeMethod(
'logs',
_buildParam({
'line': line,
'logLevel': logLevel,
'file': file,
'msgs': msgs,
'err': err,
if (keyAndValues != null) 'keyAndValue': jsonEncode(keyAndValues),
'operationID': Utils.checkOperationID(operationID),
}));
void setUploadLogsListener(OnUploadLogsListener listener) {
_uploadLogsListener = listener;
}
void setUploadFileListener(OnUploadFileListener listener) { void setUploadFileListener(OnUploadFileListener listener) {
_uploadFileListener = listener; _uploadFileListener = listener;
@@ -550,8 +579,10 @@ class IMManager {
MethodChannel get channel => _channel; MethodChannel get channel => _channel;
static Map _buildParam(Map param) { static Map _buildParam(Map<String, dynamic> param) {
param["ManagerName"] = "imManager"; param["ManagerName"] = "imManager";
param = Utils.cleanMap(param);
return param; return param;
} }
} }

View File

@@ -4,15 +4,13 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class MessageManager { class MessageManager {
MethodChannel _channel; MethodChannel _channel;
// List<AdvancedMsgListener> advancedMsgListeners = List.empty(growable: true);
OnMsgSendProgressListener? msgSendProgressListener; OnMsgSendProgressListener? msgSendProgressListener;
late OnAdvancedMsgListener msgListener; late OnAdvancedMsgListener msgListener;
OnCustomBusinessListener? customBusinessListener; OnCustomBusinessListener? customBusinessListener;
OnMessageKvInfoListener? messageKvInfoListener;
MessageManager(this._channel); MessageManager(this._channel);
/// 消息监听 /// Message listener
Future setAdvancedMsgListener(OnAdvancedMsgListener listener) { Future setAdvancedMsgListener(OnAdvancedMsgListener listener) {
this.msgListener = listener; this.msgListener = listener;
// advancedMsgListeners.add(listener); // advancedMsgListeners.add(listener);
@@ -23,21 +21,22 @@ class MessageManager {
})); }));
} }
/// 消息发送进度监听 /// Message send progress listener
void setMsgSendProgressListener(OnMsgSendProgressListener listener) { void setMsgSendProgressListener(OnMsgSendProgressListener listener) {
msgSendProgressListener = listener; msgSendProgressListener = listener;
} }
/// 发送消息 /// Send a message
/// [message] 消息体 /// [message] Message content
/// [userID] 接收消息的用户id /// [userID] User ID of the recipient
/// [groupID] 接收消息的组id /// [groupID] Group ID of the recipient
/// [offlinePushInfo] 离线消息显示内容 /// [offlinePushInfo] Offline message display content
Future<Message> sendMessage({ Future<Message> sendMessage({
required Message message, required Message message,
required OfflinePushInfo offlinePushInfo, required OfflinePushInfo offlinePushInfo,
String? userID, String? userID,
String? groupID, String? groupID,
bool isOnlineOnly = false,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
@@ -48,12 +47,13 @@ class MessageManager {
'offlinePushInfo': offlinePushInfo.toJson(), 'offlinePushInfo': offlinePushInfo.toJson(),
'userID': userID ?? '', 'userID': userID ?? '',
'groupID': groupID ?? '', 'groupID': groupID ?? '',
'isOnlineOnly': isOnlineOnly,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 删除本地消息 /// Delete a message from local storage
/// [message] 被删除的消息体 /// [message] Message to be deleted
Future deleteMessageFromLocalStorage({ Future deleteMessageFromLocalStorage({
required String conversationID, required String conversationID,
required String clientMsgID, required String clientMsgID,
@@ -68,8 +68,8 @@ class MessageManager {
})); }));
/// core-sdk: DeleteMessage /// core-sdk: DeleteMessage
/// 删除本地跟服务器的指定的消息 /// Delete a specified message from local and server
/// [message] 被删除的消息 /// [message] Message to be deleted
Future<dynamic> deleteMessageFromLocalAndSvr({ Future<dynamic> deleteMessageFromLocalAndSvr({
required String conversationID, required String conversationID,
required String clientMsgID, required String clientMsgID,
@@ -83,7 +83,7 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 删除本地所有聊天记录 /// Delete all local chat records
Future<dynamic> deleteAllMsgFromLocal({ Future<dynamic> deleteAllMsgFromLocal({
String? operationID, String? operationID,
}) => }) =>
@@ -93,7 +93,7 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 删除本地跟服务器所有聊天记录 /// Delete all chat records from local and server
Future<dynamic> deleteAllMsgFromLocalAndSvr({ Future<dynamic> deleteAllMsgFromLocalAndSvr({
String? operationID, String? operationID,
}) => }) =>
@@ -103,10 +103,10 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 插入单聊消息到本地 /// Insert a single chat message into local storage
/// [receiverID] 接收者id /// [receiverID] Receiver's ID
/// [senderID] 发送者id /// [senderID] Sender's ID
/// [message] 消息体 /// [message] Message content
Future<Message> insertSingleMessageToLocalStorage({ Future<Message> insertSingleMessageToLocalStorage({
String? receiverID, String? receiverID,
String? senderID, String? senderID,
@@ -124,10 +124,10 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 插入群聊消息到本地 /// Insert a group chat message into local storage
/// [groupID] 群id /// [groupID] Group ID
/// [senderID] 发送者id /// [senderID] Sender's ID
/// [message] 消息体 /// [message] Message content
Future<Message> insertGroupMessageToLocalStorage({ Future<Message> insertGroupMessageToLocalStorage({
String? groupID, String? groupID,
String? senderID, String? senderID,
@@ -145,22 +145,18 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 正在输入提示 /// Typing status update
/// [msgTip] 自定义内容 /// [msgTip] Custom content
@Deprecated('Use [OpenIM.iMManager.conversationManager.changeInputStates(conversationID:focus:)] instead')
Future typingStatusUpdate({ Future typingStatusUpdate({
required String userID, required String userID,
String? msgTip, String? msgTip,
String? operationID, String? operationID,
}) => }) {
_channel.invokeMethod( throw UnimplementedError('typingStatusUpdate');
'typingStatusUpdate', }
_buildParam({
"msgTip": msgTip,
"userID": userID,
"operationID": Utils.checkOperationID(operationID),
}));
/// 创建文本消息 /// Create a text message
Future<Message> createTextMessage({ Future<Message> createTextMessage({
required String text, required String text,
String? operationID, String? operationID,
@@ -174,11 +170,11 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建@消息 /// Create an @ message
/// [text] 输入内容 /// [text] Input content
/// [atUserIDList] 被@到的userID集合 /// [atUserIDList] Collection of userIDs being mentioned
/// [atUserInfoList] userIDnickname映射关系用在界面显示时将id替换为nickname /// [atUserInfoList] Mapping of userID to nickname, used for displaying nicknames instead of IDs in the user interface
/// [quoteMessage] 引用消息(被回复的消息) /// [quoteMessage] Quoted message (the message being replied to)
Future<Message> createTextAtMessage({ Future<Message> createTextAtMessage({
required String text, required String text,
required List<String> atUserIDList, required List<String> atUserIDList,
@@ -199,8 +195,8 @@ class MessageManager {
) )
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建图片消息 /// Create an image message
/// [imagePath] 路径 /// [imagePath] Path
Future<Message> createImageMessage({ Future<Message> createImageMessage({
required String imagePath, required String imagePath,
String? operationID, String? operationID,
@@ -215,8 +211,8 @@ class MessageManager {
) )
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建图片消息 /// Create an image message from a full path
/// [imagePath] 路径 /// [imagePath] Path
Future<Message> createImageMessageFromFullPath({ Future<Message> createImageMessageFromFullPath({
required String imagePath, required String imagePath,
String? operationID, String? operationID,
@@ -231,9 +227,9 @@ class MessageManager {
) )
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建语音消息 /// Create a sound message
/// [soundPath] 路径 /// [soundPath] Path
/// [duration] 时长s /// [duration] Duration in seconds
Future<Message> createSoundMessage({ Future<Message> createSoundMessage({
required String soundPath, required String soundPath,
required int duration, required int duration,
@@ -250,9 +246,9 @@ class MessageManager {
) )
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建语音消息 /// Create a sound message from a full path
/// [soundPath] 路径 /// [soundPath] Path
/// [duration] 时长s /// [duration] Duration in seconds
Future<Message> createSoundMessageFromFullPath({ Future<Message> createSoundMessageFromFullPath({
required String soundPath, required String soundPath,
required int duration, required int duration,
@@ -269,11 +265,11 @@ class MessageManager {
) )
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息 /// Create a video message
/// [videoPath] 路径 /// [videoPath] Path
/// [videoType] 视频mime类型 /// [videoType] Video MIME type
/// [duration] 时长s /// [duration] Duration in seconds
/// [snapshotPath] 默认站位图路径 /// [snapshotPath] Default snapshot image path
Future<Message> createVideoMessage({ Future<Message> createVideoMessage({
required String videoPath, required String videoPath,
required String videoType, required String videoType,
@@ -293,11 +289,11 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息 /// Create a video message from a full path
/// [videoPath] 路径 /// [videoPath] Path
/// [videoType] 视频mime类型 /// [videoType] Video MIME type
/// [duration] 时长s /// [duration] Duration in seconds
/// [snapshotPath] 默认站位图路径 /// [snapshotPath] Default snapshot image path
Future<Message> createVideoMessageFromFullPath({ Future<Message> createVideoMessageFromFullPath({
required String videoPath, required String videoPath,
required String videoType, required String videoType,
@@ -317,9 +313,9 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建文件消息 /// Create a file message
/// [filePath] 路径 /// [filePath] Path
/// [fileName] 文件名 /// [fileName] File name
Future<Message> createFileMessage({ Future<Message> createFileMessage({
required String filePath, required String filePath,
required String fileName, required String fileName,
@@ -336,9 +332,9 @@ class MessageManager {
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
} }
/// 创建文件消息 /// Create a file message from a full path
/// [filePath] 路径 /// [filePath] Path
/// [fileName] 文件名 /// [fileName] File name
Future<Message> createFileMessageFromFullPath({ Future<Message> createFileMessageFromFullPath({
required String filePath, required String filePath,
required String fileName, required String fileName,
@@ -354,10 +350,10 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建合并消息 /// Create a merged message
/// [messageList] 被选中的消息 /// [messageList] Selected messages
/// [title] 摘要标题 /// [title] Summary title
/// [summaryList] 摘要内容 /// [summaryList] Summary content
Future<Message> createMergerMessage({ Future<Message> createMergerMessage({
required List<Message> messageList, required List<Message> messageList,
required String title, required String title,
@@ -375,8 +371,8 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建转发消息 /// Create a forwarded message
/// [message] 被转发的消息 /// [message] Message to be forwarded
Future<Message> createForwardMessage({ Future<Message> createForwardMessage({
required Message message, required Message message,
String? operationID, String? operationID,
@@ -391,10 +387,10 @@ class MessageManager {
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
} }
/// 创建位置消息 /// Create a location message
/// [latitude] 纬度 /// [latitude] Latitude
/// [longitude] 经度 /// [longitude] Longitude
/// [description] 自定义描述信息 /// [description] Custom description
Future<Message> createLocationMessage({ Future<Message> createLocationMessage({
required double latitude, required double latitude,
required double longitude, required double longitude,
@@ -412,10 +408,10 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建自定义消息 /// Create a custom message
/// [data] 自定义数据 /// [data] Custom data
/// [extension] 自定义扩展内容 /// [extension] Custom extension content
/// [description] 自定义描述内容 /// [description] Custom description content
Future<Message> createCustomMessage({ Future<Message> createCustomMessage({
required String data, required String data,
required String extension, required String extension,
@@ -433,9 +429,9 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建引用消息 /// Create a quoted message
/// [text] 回复的内容 /// [text] Reply content
/// [quoteMsg] 被回复的消息 /// [quoteMsg] Message being replied to
Future<Message> createQuoteMessage({ Future<Message> createQuoteMessage({
required String text, required String text,
required Message quoteMsg, required Message quoteMsg,
@@ -451,8 +447,8 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建卡片消息 /// Create a card message
/// [data] 自定义数据 /// [data] Custom data
Future<Message> createCardMessage({ Future<Message> createCardMessage({
required String userID, required String userID,
required String nickname, required String nickname,
@@ -474,9 +470,9 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建自定义表情消息 /// Create a custom emoji message
/// [index] 位置表情,根据index匹配 /// [index] Positional emoji, matched based on index
/// [data] url表情直接使用url显示 /// [data] URL emoji, displayed directly using the URL
Future<Message> createFaceMessage({ Future<Message> createFaceMessage({
int index = -1, int index = -1,
String? data, String? data,
@@ -492,16 +488,16 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 搜索消息 /// Search messages
/// [conversationID] 根据会话查询如果是全局搜索传null /// [conversationID] Query based on conversation, pass null for global search
/// [keywordList] 搜索关键词列表,目前仅支持一个关键词搜索 /// [keywordList] Search keyword list, currently supports searching with a single keyword
/// [keywordListMatchType] 关键词匹配模式1代表与2代表或暂时未用 /// [keywordListMatchType] Keyword matching mode, 1 means AND, 2 means OR (currently unused)
/// [senderUserIDList] 指定消息发送的uid列表 暂时未用 /// [senderUserIDList] List of UIDs for messages sent (currently unused)
/// [messageTypeList] 消息类型列表 /// [messageTypeList] Message type list
/// [searchTimePosition] 搜索的起始时间点。默认为0即代表从现在开始搜索。UTC 时间戳,单位:秒 /// [searchTimePosition] Start time point for searching. Defaults to 0, meaning searching from now. UTC timestamp, in seconds
/// [searchTimePeriod] 从起始时间点开始的过去时间范围单位秒。默认为0即代表不限制时间范围传24x60x60代表过去一天 /// [searchTimePeriod] Time range in the past from the start time point, in seconds. Defaults to 0, meaning no time range limitation. Pass 24x60x60 to represent the past day
/// [pageIndex] 当前页数 /// [pageIndex] Current page number
/// [count] 每页数量 /// [count] Number of messages per page
Future<SearchResult> searchLocalMessages({ Future<SearchResult> searchLocalMessages({
String? conversationID, String? conversationID,
List<String> keywordList = const [], List<String> keywordList = const [],
@@ -533,8 +529,8 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map))); .then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map)));
/// 撤回消息 /// Revoke a message
/// [message] 被撤回的消息体 /// [message] The message to be revoked
Future revokeMessage({ Future revokeMessage({
required String conversationID, required String conversationID,
required String clientMsgID, required String clientMsgID,
@@ -548,9 +544,10 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 标记消息已读 /// Mark messages as read
/// [conversationID] 会话ID /// [conversationID] Conversation ID
/// [messageIDList] 被标记的消息clientMsgID /// [messageIDList] List of clientMsgIDs of messages to be marked as read
@Deprecated('Use markConversationMessageAsRead instead')
Future markMessagesAsReadByMsgID({ Future markMessagesAsReadByMsgID({
required String conversationID, required String conversationID,
required List<String> messageIDList, required List<String> messageIDList,
@@ -564,11 +561,11 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID), "operationID": Utils.checkOperationID(operationID),
})); }));
/// 获取聊天记录(以startMsg为节点以前的聊天记录) /// Get chat history (messages prior to startMsg)
/// [conversationID] 会话id查询通知时可用 /// [conversationID] Conversation ID, can be used for querying notifications
/// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息所以获取下一页历史记录startMsg=list.first /// [startMsg] Query [count] messages starting from this message. The message at index == length - 1 is the latest message, so to get the next page of history, use startMsg = list.first
/// [count] 一次拉取的总数 /// [count] Total number of messages to retrieve in one request
/// [lastMinSeq] 第一页消息不用传,获取第二页开始必传 跟[startMsg]一样 /// [lastMinSeq] Not required for the first page of messages, but necessary for getting the second page of history. Same as [startMsg]
Future<AdvancedMessage> getAdvancedHistoryMessageList({ Future<AdvancedMessage> getAdvancedHistoryMessageList({
String? conversationID, String? conversationID,
Message? startMsg, Message? startMsg,
@@ -588,10 +585,10 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => AdvancedMessage.fromJson(map))); .then((value) => Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
/// 获取聊天记录(以startMsg为节点新收到的聊天记录),用在全局搜索定位某一条消息,然后此条消息后新增的消息 /// Get chat history (newly received chat history after startMsg). Used for locating a specific message in global search and then fetching messages received after that message.
/// [conversationID] 会话id查询通知时可用 /// [conversationID] Conversation ID, can be used for querying notifications
/// [startMsg] 从这条消息开始查询[count]条,获取的列表index==length-1为最新消息所以获取下一页历史记录startMsg=list.last /// [startMsg] Query [count] messages starting from this message. The message at index == length - 1 is the latest message, so to get the next page of history, use startMsg = list.last
/// [count] 一次拉取的总数 /// [count] Total number of messages to retrieve in one request
Future<AdvancedMessage> getAdvancedHistoryMessageListReverse({ Future<AdvancedMessage> getAdvancedHistoryMessageListReverse({
String? conversationID, String? conversationID,
Message? startMsg, Message? startMsg,
@@ -611,9 +608,9 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => AdvancedMessage.fromJson(map))); .then((value) => Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
/// 查找消息详细 /// Find message details
/// [conversationID] 会话id /// [conversationID] Conversation ID
/// [clientMsgIDList] 消息id列表 /// [clientMsgIDList] List of message IDs
Future<SearchResult> findMessageList({ Future<SearchResult> findMessageList({
required List<SearchParams> searchParams, required List<SearchParams> searchParams,
String? operationID, String? operationID,
@@ -627,9 +624,9 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map))); .then((value) => Utils.toObj(value, (map) => SearchResult.fromJson(map)));
/// 富文本消息 /// Rich text message
/// [text] 输入内容 /// [text] Input content
/// [list] 富文本消息具体详细 /// [list] Details of the rich text message
Future<Message> createAdvancedTextMessage({ Future<Message> createAdvancedTextMessage({
required String text, required String text,
List<RichMessageInfo> list = const [], List<RichMessageInfo> list = const [],
@@ -646,10 +643,10 @@ class MessageManager {
) )
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 富文本消息 /// Rich text message with quote
/// [text] 回复的内容 /// [text] Content for the reply
/// [quoteMsg] 被回复的消息 /// [quoteMsg] The message being replied to
/// [list] 富文本消息具体详细 /// [list] Details of the rich text message
Future<Message> createAdvancedQuoteMessage({ Future<Message> createAdvancedQuoteMessage({
required String text, required String text,
required Message quoteMsg, required Message quoteMsg,
@@ -667,16 +664,17 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 发送消息 /// Send a message
/// [message] 消息体 [createImageMessageByURL],[createSoundMessageByURL],[createVideoMessageByURL],[createFileMessageByURL] /// [message] Message body [createImageMessageByURL],[createSoundMessageByURL],[createVideoMessageByURL],[createFileMessageByURL]
/// [userID] 接收消息的用户id /// [userID] User ID to receive the message
/// [groupID] 接收消息的组id /// [groupID] Group ID to receive the message
/// [offlinePushInfo] 离线消息显示内容 /// [offlinePushInfo] Offline message display content
Future<Message> sendMessageNotOss({ Future<Message> sendMessageNotOss({
required Message message, required Message message,
required OfflinePushInfo offlinePushInfo, required OfflinePushInfo offlinePushInfo,
String? userID, String? userID,
String? groupID, String? groupID,
bool isOnlineOnly = false,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
@@ -687,21 +685,24 @@ class MessageManager {
'offlinePushInfo': offlinePushInfo.toJson(), 'offlinePushInfo': offlinePushInfo.toJson(),
'userID': userID ?? '', 'userID': userID ?? '',
'groupID': groupID ?? '', 'groupID': groupID ?? '',
'isOnlineOnly': isOnlineOnly,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建图片消息 /// Create an image message by URL
Future<Message> createImageMessageByURL({ Future<Message> createImageMessageByURL({
required PictureInfo sourcePicture, required PictureInfo sourcePicture,
required PictureInfo bigPicture, required PictureInfo bigPicture,
required PictureInfo snapshotPicture, required PictureInfo snapshotPicture,
String? sourcePath,
String? operationID, String? operationID,
}) => }) =>
_channel _channel
.invokeMethod( .invokeMethod(
'createImageMessageByURL', 'createImageMessageByURL',
_buildParam({ _buildParam({
'sourcePath': sourcePath,
'sourcePicture': sourcePicture.toJson(), 'sourcePicture': sourcePicture.toJson(),
'bigPicture': bigPicture.toJson(), 'bigPicture': bigPicture.toJson(),
'snapshotPicture': snapshotPicture.toJson(), 'snapshotPicture': snapshotPicture.toJson(),
@@ -710,7 +711,7 @@ class MessageManager {
) )
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建语音消息 /// Create a sound message
Future<Message> createSoundMessageByURL({ Future<Message> createSoundMessageByURL({
required SoundElem soundElem, required SoundElem soundElem,
String? operationID, String? operationID,
@@ -725,7 +726,7 @@ class MessageManager {
) )
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息 /// Create a video message
Future<Message> createVideoMessageByURL({ Future<Message> createVideoMessageByURL({
required VideoElem videoElem, required VideoElem videoElem,
String? operationID, String? operationID,
@@ -739,7 +740,7 @@ class MessageManager {
})) }))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map))); .then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 创建视频消息 /// Create a file message
Future<Message> createFileMessageByURL({ Future<Message> createFileMessageByURL({
required FileElem fileElem, required FileElem fileElem,
String? operationID, String? operationID,
@@ -775,87 +776,22 @@ class MessageManager {
})); }));
} }
/// Future setAppBadge(
Future setMessageKvInfoListener(OnMessageKvInfoListener listener) { int count, {
this.messageKvInfoListener = listener; String? operationID,
return _channel.invokeMethod('setMessageKvInfoListener', _buildParam({})); }) {
return _channel.invokeMethod(
'setAppBadge',
_buildParam({
'count': count,
'operationID': Utils.checkOperationID(operationID),
}));
} }
Future<List<TypeKeySetResult>> setMessageReactionExtensions({ static Map _buildParam(Map<String, dynamic> param) {
required Message message,
List<KeyValue> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'setMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<TypeKeySetResult>> deleteMessageReactionExtensions({
required Message message,
List<String> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'deleteMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list,
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<MessageTypeKeyMapping>> getMessageListReactionExtensions({
List<Message> messageList = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'getMessageListReactionExtensions',
_buildParam({
'messageList': messageList.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => MessageTypeKeyMapping.fromJson(map)));
Future<List<TypeKeySetResult>> addMessageReactionExtensions({
required Message message,
List<KeyValue> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'addMessageReactionExtensions',
_buildParam({
'message': message.toJson(),
'list': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => TypeKeySetResult.fromJson(map)));
Future<List<MessageTypeKeyMapping>> getMessageListSomeReactionExtensions({
List<Message> messageList = const [],
List<KeyValue> kvList = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'getMessageListSomeReactionExtensions',
_buildParam({
'messageList': messageList.map((e) => e.toJson()).toList(),
'list': kvList.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => MessageTypeKeyMapping.fromJson(map)));
static Map _buildParam(Map param) {
param["ManagerName"] = "messageManager"; param["ManagerName"] = "messageManager";
param = Utils.cleanMap(param);
return param; return param;
} }
} }

View File

@@ -7,15 +7,15 @@ class UserManager {
UserManager(this._channel); UserManager(this._channel);
/// 用户资料改变监听 /// User profile change listener
Future setUserListener(OnUserListener listener) { Future setUserListener(OnUserListener listener) {
this.listener = listener; this.listener = listener;
return _channel.invokeMethod('setUserListener', _buildParam({})); return _channel.invokeMethod('setUserListener', _buildParam({}));
} }
/// 获取用户资料 /// Get user information
/// [userIDList] 用户ID列表 /// [userIDList] List of user IDs
Future<List<UserInfo>> getUsersInfo({ Future<List<PublicUserInfo>> getUsersInfo({
required List<String> userIDList, required List<String> userIDList,
String? operationID, String? operationID,
}) => }) =>
@@ -26,9 +26,9 @@ class UserManager {
'userIDList': userIDList, 'userIDList': userIDList,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})) }))
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v))); .then((value) => Utils.toList(value, (v) => PublicUserInfo.fromJson(v)));
/// 获取当前登录用户的信息 /// Get information of the currently logged-in user
Future<UserInfo> getSelfUserInfo({ Future<UserInfo> getSelfUserInfo({
String? operationID, String? operationID,
}) => }) =>
@@ -40,37 +40,24 @@ class UserManager {
})) }))
.then((value) => Utils.toObj(value, (map) => UserInfo.fromJson(map))); .then((value) => Utils.toObj(value, (map) => UserInfo.fromJson(map)));
/// 修改当前登录用户资料 /// Modify the profile of the currently logged-in user
/// [nickname] 昵称 /// [nickname] Nickname
/// [faceURL] 头像 /// [faceURL] Profile picture
/// [gender] 性别 /// [appManagerLevel]
/// [appMangerLevel] /// [ex] Additional fields
/// [phoneNumber] 手机号
/// [birth] 出生日期
/// [email] 邮箱
/// [ex] 扩展字段
Future<String?> setSelfInfo({ Future<String?> setSelfInfo({
String? nickname, String? nickname,
String? faceURL, String? faceURL,
int? gender, int? globalRecvMsgOpt,
int? appMangerLevel,
String? phoneNumber,
int? birth,
String? email,
String? ex, String? ex,
String? operationID, String? operationID,
}) => }) =>
_channel.invokeMethod( _channel.invokeMethod(
'setSelfInfo', 'setSelfInfo',
_buildParam({ _buildParam({
// 'userID': userID,
'nickname': nickname, 'nickname': nickname,
'faceURL': faceURL, 'faceURL': faceURL,
'gender': gender, 'globalRecvMsgOpt': globalRecvMsgOpt,
'appMangerLevel': appMangerLevel,
'phoneNumber': phoneNumber,
'birth': birth,
'email': email,
'ex': ex, 'ex': ex,
'operationID': Utils.checkOperationID(operationID), 'operationID': Utils.checkOperationID(operationID),
})); }));
@@ -89,18 +76,16 @@ class UserManager {
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map))); .then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
} }
Future<List<UserStatusInfo>> unsubscribeUsersStatus( Future unsubscribeUsersStatus(
List<String> userIDs, { List<String> userIDs, {
String? operationID, String? operationID,
}) { }) {
return _channel return _channel.invokeMethod(
.invokeMethod( 'unsubscribeUsersStatus',
'unsubscribeUsersStatus', _buildParam({
_buildParam({ 'userIDs': userIDs,
'userIDs': userIDs, 'operationID': Utils.checkOperationID(operationID),
'operationID': Utils.checkOperationID(operationID), }));
}))
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
} }
Future<List<UserStatusInfo>> getSubscribeUsersStatus({ Future<List<UserStatusInfo>> getSubscribeUsersStatus({
@@ -129,24 +114,28 @@ class UserManager {
.then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map))); .then((value) => Utils.toList(value, (map) => UserStatusInfo.fromJson(map)));
} }
Future<List<UserInfo>> getUsersInfoStranger( @Deprecated('Use [getUsersInfo] instead')
Future<List<PublicUserInfo>> getUsersInfoWithCache(
List<String> userIDs, { List<String> userIDs, {
String? groupID,
String? operationID, String? operationID,
}) { }) {
return _channel return getUsersInfo(userIDList: userIDs, operationID: operationID);
.invokeMethod(
'getUsersInfoStranger',
_buildParam({
'userIDs': userIDs,
'groupID': groupID,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toList(value, (map) => UserInfo.fromJson(map)));
} }
static Map _buildParam(Map param) { /// Global Do Not Disturb
/// [status] 0: Normal; 1: Do not accept messages; 2: Accept online messages but not offline messages;
@Deprecated('use [setSelfInfo] instead')
Future<dynamic> setGlobalRecvMessageOpt({
required int status,
String? operationID,
}) {
return setSelfInfo(globalRecvMsgOpt: status);
}
static Map _buildParam(Map<String, dynamic> param) {
param["ManagerName"] = "userManager"; param["ManagerName"] = "userManager";
param = Utils.cleanMap(param);
return param; return param;
} }
} }

View File

@@ -3,66 +3,67 @@ import 'dart:convert';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class ConversationInfo { class ConversationInfo {
/// 会话ID // Unique identifier for the conversation
String conversationID; String conversationID;
/// 会话类型[ConversationType] // Type of the conversation (e.g., single, group, super group)
int? conversationType; int? conversationType;
/// 参与会话的userID // User ID in case of a single chat
String? userID; String? userID;
/// 参与会话的groupID // Group ID in case of a group chat
String? groupID; String? groupID;
/// 昵称 // Display name or nickname
String? showName; String? showName;
/// 头像 // URL of the user's or group's profile picture
String? faceURL; String? faceURL;
/// 免打扰 0正常1不接受消息2接受在线消息不接受离线消息 // Message reception option (0: normal, 1: do not accept messages, 2: accept online messages but not offline messages)
int? recvMsgOpt; int? recvMsgOpt;
/// 未读消息数 // Number of unread messages in the conversation
int? unreadCount; int unreadCount = 0;
/// 强制提示,[GroupAtType]包含@所有人,@个人以及公告提示 // Latest message in the conversation
int? groupAtType;
/// 会话最新消息内容
Message? latestMsg; Message? latestMsg;
/// 最新消息发送时间 // Timestamp of the latest message
int? latestMsgSendTime; int? latestMsgSendTime;
/// 草稿 // Draft text for the conversation
String? draftText; String? draftText;
/// 草稿生成时间 // Timestamp when the draft text was created
int? draftTextTime; int? draftTextTime;
/// 是否置顶 // Indicates whether the conversation is pinned
bool? isPinned; bool? isPinned;
/// 是否开启了私聊(阅后即焚) // Indicates whether the conversation is a private chat with features like self-destructing messages
bool? isPrivateChat; bool? isPrivateChat;
/// 可阅读期限 s // Duration for which messages are readable (in seconds)
int? burnDuration; int? burnDuration;
/// 是否开启定期销毁 // Indicates whether the conversation has self-destructing messages enabled
bool? isMsgDestruct; bool? isMsgDestruct;
/// 定期销毁时间 s // Timestamp for self-destructing messages (in seconds)
int? msgDestructTime; int? msgDestructTime;
/// 附加内容 // Additional data or metadata
String? ex; String? ex;
/// 是否还在组内如果退群返回true // Indicates whether the user is no longer in the group (if applicable)
bool? isNotInGroup; bool? isNotInGroup;
// Group @ type, which includes @ all, @ individual, and announcement prompts
int? groupAtType;
// Constructor to create a ConversationInfo object
ConversationInfo({ ConversationInfo({
required this.conversationID, required this.conversationID,
this.conversationType, this.conversationType,
@@ -71,7 +72,7 @@ class ConversationInfo {
this.showName, this.showName,
this.faceURL, this.faceURL,
this.recvMsgOpt, this.recvMsgOpt,
this.unreadCount, this.unreadCount = 0,
this.latestMsg, this.latestMsg,
this.latestMsgSendTime, this.latestMsgSendTime,
this.draftText, this.draftText,
@@ -86,8 +87,7 @@ class ConversationInfo {
this.msgDestructTime, this.msgDestructTime,
}); });
ConversationInfo.fromJson(Map<String, dynamic> json) ConversationInfo.fromJson(Map<String, dynamic> json) : conversationID = json['conversationID'] {
: conversationID = json['conversationID'] {
conversationType = json['conversationType']; conversationType = json['conversationType'];
userID = json['userID']; userID = json['userID'];
groupID = json['groupID']; groupID = json['groupID'];
@@ -115,6 +115,7 @@ class ConversationInfo {
msgDestructTime = json['msgDestructTime']; msgDestructTime = json['msgDestructTime'];
} }
// Method to convert the ConversationInfo object to a JSON map
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final data = Map<String, dynamic>(); final data = Map<String, dynamic>();
data['conversationID'] = this.conversationID; data['conversationID'] = this.conversationID;
@@ -140,23 +141,18 @@ class ConversationInfo {
return data; return data;
} }
/// 是单聊 // Check if it's a single chat
bool get isSingleChat => conversationType == ConversationType.single; bool get isSingleChat => conversationType == ConversationType.single;
/// 是群聊 // Check if it's a group chat
bool get isGroupChat => bool get isGroupChat => conversationType == ConversationType.group || conversationType == ConversationType.superGroup;
conversationType == ConversationType.group ||
conversationType == ConversationType.superGroup;
/// 是有效的 // Check if it's a valid conversation (not in a group if isNotInGroup is true)
bool get isValid => isSingleChat || isGroupChat && !isNotInGroup!; bool get isValid => isSingleChat || (isGroupChat && !isNotInGroup!);
@override @override
bool operator ==(Object other) => bool operator ==(Object other) =>
identical(this, other) || identical(this, other) || other is ConversationInfo && runtimeType == other.runtimeType && conversationID == other.conversationID;
other is ConversationInfo &&
runtimeType == other.runtimeType &&
conversationID == other.conversationID;
@override @override
int get hashCode => conversationID.hashCode; int get hashCode => conversationID.hashCode;

View File

@@ -1,56 +1,56 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
/// 群信息 /// Group Information
class GroupInfo { class GroupInfo {
/// ID /// Group ID
String groupID; String groupID;
/// 群名 /// Group Name
String? groupName; String? groupName;
/// 群公告 /// Group Announcement
String? notification; String? notification;
/// 群简介 /// Group Introduction
String? introduction; String? introduction;
/// 群头像 /// Group Avatar
String? faceURL; String? faceURL;
/// 拥有者ID /// Owner's ID
String? ownerUserID; String? ownerUserID;
/// 创建时间 /// Creation Time
int? createTime; int? createTime;
/// 群成员数 /// Number of Group Members
int? memberCount; int? memberCount;
/// 群状态0正常1被封2解散3禁言 /// Group Status: 0 - Normal, 1 - Blocked, 2 - Dissolved, 3 - Muted
int? status; int? status;
/// 创建者ID /// Creator's ID
String? creatorUserID; String? creatorUserID;
/// 群类型[GroupType] /// Group Type [GroupType]
int? groupType; int? groupType;
/// 扩展字段 /// Extra Information
String? ex; String? ex;
/// 进群验证方式[GroupVerification] /// Entry Verification Method [GroupVerification]
int? needVerification; int? needVerification;
/// 不允许通过群获取成员资料 0关闭1打开 /// Don't Allow Access to Member Information via the Group: 0 - Disabled, 1 - Enabled
int? lookMemberInfo; int? lookMemberInfo;
/// 不允许通过群添加好友 0关闭1打开 /// Don't Allow Adding Friends via the Group: 0 - Disabled, 1 - Enabled
int? applyMemberFriend; int? applyMemberFriend;
/// 通知更新时间 /// Notification Update Time
int? notificationUpdateTime; int? notificationUpdateTime;
/// 通知发起人 /// Notification Initiator
String? notificationUserID; String? notificationUserID;
GroupInfo({ GroupInfo({
@@ -74,7 +74,6 @@ class GroupInfo {
}); });
GroupInfo.fromJson(Map<String, dynamic> json) : groupID = json['groupID'] { GroupInfo.fromJson(Map<String, dynamic> json) : groupID = json['groupID'] {
/*groupID = json['groupID'];*/
groupName = json['groupName']; groupName = json['groupName'];
notification = json['notification']; notification = json['notification'];
introduction = json['introduction']; introduction = json['introduction'];
@@ -115,58 +114,53 @@ class GroupInfo {
return data; return data;
} }
/// 群类型对应的会话类型 /// Corresponding Conversation Type for Group Type
int get sessionType => groupType == GroupType.general int get sessionType => groupType == GroupType.general ? ConversationType.group : ConversationType.superGroup;
? ConversationType.group
: ConversationType.superGroup;
@override @override
bool operator ==(Object other) => bool operator ==(Object other) =>
identical(this, other) || identical(this, other) || other is GroupInfo && runtimeType == other.runtimeType && groupID == other.groupID;
other is GroupInfo &&
runtimeType == other.runtimeType &&
groupID == other.groupID;
@override @override
int get hashCode => groupID.hashCode; int get hashCode => groupID.hashCode;
} }
/// 群成员信息 /// Group Member Information
class GroupMembersInfo { class GroupMembersInfo {
/// 群id /// Group ID
String? groupID; String? groupID;
/// 用户id /// User ID
String? userID; String? userID;
/// 昵称 /// Nickname
String? nickname; String? nickname;
/// 头像 /// Avatar
String? faceURL; String? faceURL;
/// 角色[GroupRoleLevel] /// Role [GroupRoleLevel]
int? roleLevel; int? roleLevel;
/// 加入时间 /// Join Time
int? joinTime; int? joinTime;
/// 入群方式 2邀请加入 3搜索加入 4通过二维码加入 /// Entry Source: 2 - Invited, 3 - Searched, 4 - QR Code
int? joinSource; int? joinSource;
/// 操作者id /// Operator's ID
String? operatorUserID; String? operatorUserID;
/// 扩展字段 /// Extra Information
String? ex; String? ex;
/// 禁言时间s /// Mute End Time (seconds)
int? muteEndTime; int? muteEndTime;
/// /// Application Manager Level
int? appMangerLevel; int? appManagerLevel;
/// 邀请人id /// Inviter's User ID
String? inviterUserID; String? inviterUserID;
GroupMembersInfo({ GroupMembersInfo({
@@ -180,7 +174,7 @@ class GroupMembersInfo {
this.joinSource, this.joinSource,
this.operatorUserID, this.operatorUserID,
this.muteEndTime, this.muteEndTime,
this.appMangerLevel, this.appManagerLevel,
this.inviterUserID, this.inviterUserID,
}); });
@@ -195,7 +189,7 @@ class GroupMembersInfo {
joinSource = json['joinSource']; joinSource = json['joinSource'];
operatorUserID = json['operatorUserID']; operatorUserID = json['operatorUserID'];
muteEndTime = json['muteEndTime']; muteEndTime = json['muteEndTime'];
appMangerLevel = json['appMangerLevel']; appManagerLevel = json['appManagerLevel'];
inviterUserID = json['inviterUserID']; inviterUserID = json['inviterUserID'];
} }
@@ -211,7 +205,7 @@ class GroupMembersInfo {
data['joinSource'] = this.joinSource; data['joinSource'] = this.joinSource;
data['operatorUserID'] = this.operatorUserID; data['operatorUserID'] = this.operatorUserID;
data['muteEndTime'] = this.muteEndTime; data['muteEndTime'] = this.muteEndTime;
data['appMangerLevel'] = this.appMangerLevel; data['appManagerLevel'] = this.appManagerLevel;
data['inviterUserID'] = this.inviterUserID; data['inviterUserID'] = this.inviterUserID;
return data; return data;
} }
@@ -228,12 +222,12 @@ class GroupMembersInfo {
int get hashCode => groupID.hashCode ^ userID.hashCode; int get hashCode => groupID.hashCode ^ userID.hashCode;
} }
/// 群成员角色 /// Group Member Role
class GroupMemberRole { class GroupMemberRole {
/// 用户ID /// User ID
String? userID; String? userID;
/// [GroupRoleLevel] 1普通成员, 2群主3管理员 /// [GroupRoleLevel] 1: Normal Member, 2: Group Owner, 3: Administrator
int? roleLevel; int? roleLevel;
GroupMemberRole({this.userID, this.roleLevel = 1}); GroupMemberRole({this.userID, this.roleLevel = 1});
@@ -251,78 +245,78 @@ class GroupMemberRole {
} }
} }
/// 群申请信息 /// Group Application Information
class GroupApplicationInfo { class GroupApplicationInfo {
/// ID /// Group ID
String? groupID; String? groupID;
/// 群昵称 /// Group Nickname
String? groupName; String? groupName;
/// 群公告 /// Group Announcement
String? notification; String? notification;
/// 群介绍 /// Group Introduction
String? introduction; String? introduction;
/// 群头像 /// Group Avatar
String? groupFaceURL; String? groupFaceURL;
/// 群创建时间 /// Group Creation Time
int? createTime; int? createTime;
/// 群状态 /// Group Status
int? status; int? status;
/// 创建者id /// Creator's ID
String? creatorUserID; String? creatorUserID;
/// 群类型 /// Group Type
int? groupType; int? groupType;
/// 拥有者id /// Owner's ID
String? ownerUserID; String? ownerUserID;
/// 成员数量 /// Member Count
int? memberCount; int? memberCount;
/// 发起入群申请的用户id /// User ID Initiating the Group Join Request
String? userID; String? userID;
/// 发起入群申请的用户昵称 /// User's Nickname Initiating the Group Join Request
String? nickname; String? nickname;
/// 发起入群申请的用户头像 /// User's Avatar Initiating the Group Join Request
String? userFaceURL; String? userFaceURL;
/// 发起入群申请的用户性别 /// User's Gender Initiating the Group Join Request
int? gender; int? gender;
/// 处理结果:-1拒绝1同意 /// Handling Result: -1 - Rejected, 1 - Accepted
int? handleResult; int? handleResult;
/// 请求说明 /// Request Description
String? reqMsg; String? reqMsg;
/// 处理结果说明 /// Handling Result Description
String? handledMsg; String? handledMsg;
/// 请求时间 /// Request Time
int? reqTime; int? reqTime;
/// 处理者用户ID /// Handler User ID
String? handleUserID; String? handleUserID;
/// 处理时间 /// Handling Time
int? handledTime; int? handledTime;
/// 扩展信息 /// Extra Information
String? ex; String? ex;
/// 2通过邀请 3通过搜索 4通过二维码 /// Join Source: 2 - Invited, 3 - Searched, 4 - QR Code
int? joinSource; int? joinSource;
/// 邀请进群用户ID /// Inviting User's ID
String? inviterUserID; String? inviterUserID;
GroupApplicationInfo({ GroupApplicationInfo({
@@ -409,6 +403,7 @@ class GroupApplicationInfo {
} }
} }
/// Group Invitation Result
class GroupInviteResult { class GroupInviteResult {
String? userID; String? userID;
int? result; int? result;

View File

@@ -0,0 +1,50 @@
class InitConfig {
String systemType;
int platformID;
String apiAddr;
String wsAddr;
String dataDir;
int logLevel;
bool isLogStandardOutput;
String? logFilePath;
bool enabledCompression;
InitConfig({
required this.platformID,
required this.apiAddr,
required this.wsAddr,
required this.dataDir,
this.logLevel = 6,
this.isLogStandardOutput = true,
this.logFilePath,
this.enabledCompression = false,
this.systemType = 'flutter',
});
factory InitConfig.fromJson(Map<String, dynamic> json) {
return InitConfig(
platformID: json['platformID'],
apiAddr: json['apiAddr'],
wsAddr: json['wsAddr'],
dataDir: json['dataDir'],
logLevel: json['logLevel'],
isLogStandardOutput: json['isLogStandardOutput'],
logFilePath: json['logFilePath'],
enabledCompression: json['isCompression'],
systemType: json['systemType']);
}
Map<String, dynamic> toMap() {
return {
'platformID': platformID,
'apiAddr': apiAddr,
'wsAddr': wsAddr,
'dataDir': dataDir,
'logLevel': logLevel,
'isLogStandardOutput': isLogStandardOutput,
'logFilePath': logFilePath,
'isCompression': enabledCompression,
'systemType': systemType,
};
}
}

View File

@@ -0,0 +1,24 @@
class InputStatusChangedData {
final String userID;
final String conversationID;
final List<int>? platformIDs;
InputStatusChangedData({
required this.userID,
required this.conversationID,
this.platformIDs,
});
InputStatusChangedData.fromJson(Map<String, dynamic> json)
: userID = json['userID'],
conversationID = json['conversationID'],
platformIDs = List<int>.from(json['platformIDs'] ?? []);
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['userID'] = userID;
data['conversationID'] = conversationID;
data['platformIDs'] = platformIDs;
return data;
}
}

View File

@@ -1,155 +0,0 @@
class MeetingInfoList {
List<MeetingInfo>? meetingInfoList;
MeetingInfoList({this.meetingInfoList});
MeetingInfoList.fromJson(Map<String, dynamic> json) {
if (json['meetingInfoList'] != null) {
meetingInfoList = <MeetingInfo>[];
json['meetingInfoList'].forEach((v) {
meetingInfoList!.add(MeetingInfo.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
if (this.meetingInfoList != null) {
data['meetingInfoList'] =
this.meetingInfoList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class MeetingInfo {
String? roomID;
String? meetingName;
String? ex;
String? hostUserID;
List<String>? inviteeUserIDList; //邀请列表
int? createTime;
int? startTime;
int? endTime;
bool? participantCanUnmuteSelf; //成员是否能自己解除禁言
bool? participantCanEnableVideo; //成员是否能开启视频
bool? onlyHostInviteUser; //仅主持人可邀请用户
bool? onlyHostShareScreen; //仅主持人可共享屏幕
bool? joinDisableMicrophone; //加入是否默认关麦克风
bool? joinDisableVideo; //加入是否默认关视频
bool? isMuteAllVideo; // 是否全员禁用视频
bool? isMuteAllMicrophone; // 是否全员禁用麦克风
List<String>? canScreenUserIDList; // 可共享屏幕的ID列表
List<String>? disableMicrophoneUserIDList; // 当前被禁言麦克风的id列表
List<String>? disableVideoUserIDList; // 当前禁用视频流的ID列表
List<String>? pinedUserIDList; // 置顶ID列表
List<String>? beWatchedUserIDList; // 正在被观看用户列表
MeetingInfo({
this.roomID,
this.meetingName,
this.ex,
this.hostUserID,
this.inviteeUserIDList,
this.createTime,
this.startTime,
this.endTime,
this.participantCanUnmuteSelf,
this.participantCanEnableVideo,
this.onlyHostInviteUser,
this.onlyHostShareScreen,
this.joinDisableMicrophone,
this.joinDisableVideo,
this.isMuteAllVideo,
this.isMuteAllMicrophone,
this.canScreenUserIDList,
this.disableMicrophoneUserIDList,
this.disableVideoUserIDList,
this.pinedUserIDList,
this.beWatchedUserIDList,
});
MeetingInfo.fromJson(Map<String, dynamic> json) {
roomID = json['roomID'];
meetingName = json['meetingName'];
ex = json['ex'];
hostUserID = json['hostUserID'];
inviteeUserIDList = json['inviteeUserIDList'] == null
? null
: (json['inviteeUserIDList'] as List).cast<String>();
createTime = json['createTime'];
startTime = json['startTime'];
endTime = json['endTime'];
participantCanUnmuteSelf = json['participantCanUnmuteSelf'];
participantCanEnableVideo = json['participantCanEnableVideo'];
onlyHostInviteUser = json['onlyHostInviteUser'];
onlyHostShareScreen = json['onlyHostShareScreen'];
joinDisableMicrophone = json['joinDisableMicrophone'];
joinDisableVideo = json['joinDisableVideo'];
isMuteAllVideo = json['isMuteAllVideo'];
isMuteAllMicrophone = json['isMuteAllMicrophone'];
canScreenUserIDList = json['canScreenUserIDList'] == null
? null
: (json['canScreenUserIDList'] as List).cast<String>();
disableMicrophoneUserIDList = json['disableMicrophoneUserIDList'] == null
? null
: (json['disableMicrophoneUserIDList'] as List).cast<String>();
disableVideoUserIDList = json['disableVideoUserIDList'] == null
? null
: (json['disableVideoUserIDList'] as List).cast<String>();
pinedUserIDList = json['pinedUserIDList'] == null
? null
: (json['pinedUserIDList'] as List).cast<String>();
beWatchedUserIDList = json['beWatchedUserIDList'] == null
? null
: (json['beWatchedUserIDList'] as List).cast<String>();
}
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['roomID'] = roomID;
data['meetingName'] = meetingName;
data['ex'] = ex;
data['hostUserID'] = hostUserID;
data['inviteeUserIDList'] = inviteeUserIDList;
data['createTime'] = createTime;
data['startTime'] = startTime;
data['endTime'] = endTime;
data['participantCanUnmuteSelf'] = participantCanUnmuteSelf;
data['participantCanEnableVideo'] = participantCanEnableVideo;
data['onlyHostInviteUser'] = onlyHostInviteUser;
data['onlyHostShareScreen'] = onlyHostShareScreen;
data['joinDisableMicrophone'] = joinDisableMicrophone;
data['joinDisableVideo'] = joinDisableVideo;
data['isMuteAllVideo'] = isMuteAllVideo;
data['isMuteAllMicrophone'] = isMuteAllMicrophone;
data['canScreenUserIDList'] = canScreenUserIDList;
data['disableMicrophoneUserIDList'] = disableMicrophoneUserIDList;
data['disableVideoUserIDList'] = disableVideoUserIDList;
data['pinedUserIDList'] = pinedUserIDList;
data['beWatchedUserIDList'] = beWatchedUserIDList;
return data;
}
}
class MeetingStreamEvent {
String? roomID;
String? streamType;
bool? mute;
MeetingStreamEvent({this.roomID, this.streamType, this.mute});
MeetingStreamEvent.fromJson(Map<String, dynamic> json) {
roomID = json['roomID'];
streamType = json['streamType'];
mute = json['mute'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['roomID'] = this.roomID;
data['streamType'] = this.streamType;
data['mute'] = this.mute;
return data;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,38 +1,41 @@
import '../../flutter_openim_sdk.dart'; import '../../flutter_openim_sdk.dart';
/// oa 通知 /// OA notification
class OANotification { class OANotification {
/// 标题 /// Title
String? notificationName; String? notificationName;
/// 头像 /// Avatar
String? notificationFaceURL; String? notificationFaceURL;
/// 类型 /// Type
int? notificationType; int? notificationType;
/// 文本内容 /// Text content
String? text; String? text;
/// 跳转链接 /// Redirect link
String? externalUrl; String? externalUrl;
/// 0:纯文字通知 1文字+图片通知 2文字+视频通知 3文字+文件通知 /// 0: Text-only notification
/// 1: Text + Image notification
/// 2: Text + Video notification
/// 3: Text + File notification
int? mixType; int? mixType;
/// 图片信息 /// Image information
PictureElem? pictureElem; PictureElem? pictureElem;
/// 语音信息 /// Sound information
SoundElem? soundElem; SoundElem? soundElem;
/// 视频信息 /// Video information
VideoElem? videoElem; VideoElem? videoElem;
/// 文件信息 /// File information
FileElem? fileElem; FileElem? fileElem;
/// 扩展字段 /// Additional field
String? ex; String? ex;
OANotification( OANotification(

View File

@@ -1,10 +1,10 @@
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class SearchResult { class SearchResult {
/// 获取到的总的消息数量 /// Total number of messages obtained
int? totalCount; int? totalCount;
/// 搜索到的具体内容 /// Specific search results
List<SearchResultItems>? searchResultItems; List<SearchResultItems>? searchResultItems;
List<SearchResultItems>? findResultItems; List<SearchResultItems>? findResultItems;
@@ -31,34 +31,32 @@ class SearchResult {
final data = Map<String, dynamic>(); final data = Map<String, dynamic>();
data['totalCount'] = this.totalCount; data['totalCount'] = this.totalCount;
if (this.searchResultItems != null) { if (this.searchResultItems != null) {
data['searchResultItems'] = data['searchResultItems'] = this.searchResultItems!.map((v) => v.toJson()).toList();
this.searchResultItems!.map((v) => v.toJson()).toList();
} }
if (this.findResultItems != null) { if (this.findResultItems != null) {
data['findResultItems'] = data['findResultItems'] = this.findResultItems!.map((v) => v.toJson()).toList();
this.findResultItems!.map((v) => v.toJson()).toList();
} }
return data; return data;
} }
} }
class SearchResultItems { class SearchResultItems {
/// 会话ID /// Conversation ID
String? conversationID; String? conversationID;
/// 会话类型1单聊2群聊3超级大群4通知会话 /// Conversation type: 1 for single chat, 2 for group chat, 3 for supergroup, 4 for notification conversation
int? conversationType; int? conversationType;
/// 显示名 /// Display name
String? showName; String? showName;
/// 头像 /// Profile picture
String? faceURL; String? faceURL;
/// 搜索到的这个会话下的消息数量 /// Number of messages found in this conversation
int? messageCount; int? messageCount;
/// [Message]的列表 /// List of [Message]s
List<Message>? messageList; List<Message>? messageList;
SearchResultItems({this.conversationID, this.messageCount, this.messageList}); SearchResultItems({this.conversationID, this.messageCount, this.messageList});
@@ -114,3 +112,18 @@ class SearchParams {
return data; return data;
} }
} }
class SearchFriendsInfo extends FriendInfo {
late int relationship;
SearchFriendsInfo({required this.relationship}) : super();
SearchFriendsInfo.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
relationship = json['relationship'];
}
Map<String, dynamic> toJson() {
final data = super.toJson();
data['relationship'] = this.relationship;
return data ?? {};
}
}

View File

@@ -0,0 +1,41 @@
class SetGroupMemberInfo {
SetGroupMemberInfo({
required this.groupID,
required this.userID,
this.roleLevel,
this.nickname,
this.faceURL,
this.ex,
});
final String groupID;
final String userID;
final int? roleLevel;
final String? nickname;
final String? faceURL;
final String? ex;
SetGroupMemberInfo.fromJson(Map<String, dynamic> json)
: groupID = json['groupID'],
userID = json['userID'],
roleLevel = json['roleLevel'],
nickname = json['nickname'],
faceURL = json['faceURL'],
ex = json['ex'];
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['groupID'] = groupID;
data['userID'] = userID;
data['roleLevel'] = roleLevel;
data['nickname'] = nickname;
data['faceURL'] = faceURL;
data['ex'] = ex;
return data;
}
@override
String toString() {
return 'SetGroupMemberInfo{groupID: $groupID, userID: $userID, roleLevel: $roleLevel, nickname: $nickname, faceURL: $faceURL, ex: $ex}';
}
}

View File

@@ -0,0 +1,91 @@
class UpdateFriendsReq {
final String? ownerUserID;
final List<String>? friendUserIDs;
final bool? isPinned;
final String? remark;
final String? ex;
UpdateFriendsReq({
this.ownerUserID,
this.friendUserIDs,
this.isPinned,
this.remark,
this.ex,
});
UpdateFriendsReq.fromJson(Map<String, dynamic> json)
: ownerUserID = json['ownerUserID'],
friendUserIDs = json['friendUserIDs'],
isPinned = json['isPinned'],
remark = json['remark'],
ex = json['ex'];
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['ownerUserID'] = ownerUserID;
data['friendUserIDs'] = friendUserIDs;
data['isPinned'] = isPinned;
data['remark'] = remark;
data['ex'] = ex;
return data;
}
@override
String toString() {
return 'UpdateFriendsReq{ownerUserID: $ownerUserID, friendUserIDs: $friendUserIDs, isPinned: $isPinned, remark: $remark, ex: $ex}';
}
}
class ConversationReq {
final String? userID;
final String? groupID;
final int? recvMsgOpt;
final bool? isPinned;
final bool? isPrivateChat;
final String? ex;
final int? burnDuration;
final bool? isMsgDestruct;
final int? msgDestructTime;
final int? groupAtType;
ConversationReq({
this.userID,
this.groupID,
this.recvMsgOpt,
this.isPinned,
this.isPrivateChat,
this.ex,
this.burnDuration,
this.isMsgDestruct,
this.msgDestructTime,
this.groupAtType,
});
ConversationReq.fromJson(Map<String, dynamic> json)
: userID = json['userID'],
groupID = json['groupID'],
recvMsgOpt = json['recvMsgOpt'],
isPinned = json['isPinned'],
isPrivateChat = json['isPrivateChat'],
ex = json['ex'],
burnDuration = json['burnDuration'],
isMsgDestruct = json['isMsgDestruct'],
msgDestructTime = json['msgDestructTime'],
groupAtType = json['groupAtType'];
Map<String, dynamic> toJson() {
final data = <String, dynamic>{};
data['userID'] = userID;
data['groupID'] = groupID;
data['recvMsgOpt'] = recvMsgOpt;
data['isPinned'] = isPinned;
data['isPrivateChat'] = isPrivateChat;
data['ex'] = ex;
data['burnDuration'] = burnDuration;
data['isMsgDestruct'] = isMsgDestruct;
data['msgDestructTime'] = msgDestructTime;
data['groupAtType'] = groupAtType;
return data;
}
}

View File

@@ -1,183 +1,65 @@
/// Is a friend not in the blacklist
/// 是好友不在黑名单
/// Not a friend on the blacklist
/// 不是好友在黑名单
/// Not a friend is not on the blacklist
/// 不是好友不在黑名单
class UserInfo { class UserInfo {
/// 用户id /// User ID
String? userID; String? userID;
/// 用户昵称 /// User nickname
String? nickname; String? nickname;
/// 头像 /// Profile picture
String? faceURL; String? faceURL;
/// 性别 /// Additional information
int? gender;
/// 手机号
String? phoneNumber;
/// 出生时间
int? birth;
/// 邮箱
String? email;
/// 扩展字段
String? ex; String? ex;
/// 创建时间 /// Creation time
int? createTime; int? createTime;
/// 备注 /// Remark
String? remark; String? remark;
/// 全局免打扰 0正常1不接受消息2接受在线消息不接受离线消息 /// Global do not disturb setting:
/// 0: Normal
/// 1: Do not accept messages
/// 2: Accept online messages but not offline messages
int? globalRecvMsgOpt; int? globalRecvMsgOpt;
/// 是允许添加为好友 1允许2 int? appMangerLevel;
int? allowAddFriend;
/// 新消息铃声 1允许2
int? allowBeep;
/// 新消息震动 1允许2
int? allowVibration;
/// 禁止登录
int? forbidden;
/// 用户公开的资料
PublicUserInfo? publicInfo;
/// 好友才能查看的资料
FriendInfo? friendInfo;
/// 黑名单资料
BlacklistInfo? blackInfo;
/// 是否好友关系
bool? isFriendship;
/// 是否黑名单
bool? isBlacklist;
UserInfo({ UserInfo({
this.publicInfo,
this.friendInfo,
this.blackInfo,
this.isFriendship,
this.isBlacklist,
//
this.userID, this.userID,
this.nickname, this.nickname,
this.faceURL, this.faceURL,
this.phoneNumber, this.appMangerLevel,
this.birth,
this.gender,
this.email,
this.ex, this.ex,
this.createTime, this.createTime,
this.remark, this.remark,
this.globalRecvMsgOpt, this.globalRecvMsgOpt,
this.allowAddFriend,
this.allowBeep,
this.allowVibration,
this.forbidden,
}); });
// UserInfo.self(Map<String, dynamic> json) {
// userID = json['userID'];
// nickname = json['nickname'];
// faceURL = json['faceURL'];
// gender = json['gender'];
// phoneNumber = json['phoneNumber'];
// birth = json['birth'];
// email = json['email'];
// ex = json['ex'];
// createTime = json['createTime'];
// }
UserInfo.fromJson(Map<String, dynamic> json) { UserInfo.fromJson(Map<String, dynamic> json) {
publicInfo = json['publicInfo'] != null ? PublicUserInfo.fromJson(json['publicInfo']) : null; userID = json['userID'] ?? userID;
friendInfo = json['friendInfo'] != null ? FriendInfo.fromJson(json['friendInfo']) : null; nickname = json['nickname'] ?? nickname;
blackInfo = json['blackInfo'] != null ? BlacklistInfo.fromJson(json['blackInfo']) : null; faceURL = json['faceURL'] ?? faceURL;
// remark = json['remark'] ?? remark;
isFriendship = friendInfo != null; ex = json['ex'] ?? ex;
isBlacklist = blackInfo != null;
userID = json['userID'] ?? _userID;
nickname = json['nickname'] ?? _nickname;
faceURL = json['faceURL'] ?? _faceUrl;
gender = json['gender'] ?? _gender;
phoneNumber = json['phoneNumber'] ?? _phoneNumber;
birth = json['birth'] ?? _birth;
email = json['email'] ?? _email;
remark = json['remark'] ?? _remark;
ex = json['ex'] ?? _ex;
createTime = json['createTime']; createTime = json['createTime'];
globalRecvMsgOpt = json['globalRecvMsgOpt']; globalRecvMsgOpt = json['globalRecvMsgOpt'];
allowAddFriend = json['allowAddFriend']; appMangerLevel = json['appMangerLevel'];
allowBeep = json['allowBeep'];
allowVibration = json['allowVibration'];
forbidden = json['forbidden'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final data = Map<String, dynamic>(); final data = Map<String, dynamic>();
data['publicInfo'] = this.publicInfo?.toJson(); data['appMangerLevel'] = this.appMangerLevel;
data['friendInfo'] = this.friendInfo?.toJson();
data['blackInfo'] = this.blackInfo?.toJson();
//
data['isFriendship'] = this.isFriendship;
data['isBlacklist'] = this.isBlacklist;
data['userID'] = this.userID; data['userID'] = this.userID;
data['nickname'] = this.nickname; data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL; data['faceURL'] = this.faceURL;
data['gender'] = this.gender;
data['phoneNumber'] = this.phoneNumber;
data['birth'] = this.birth;
data['email'] = this.email;
data['ex'] = this.ex; data['ex'] = this.ex;
data['createTime'] = this.createTime; data['createTime'] = this.createTime;
data['remark'] = this.remark; data['remark'] = this.remark;
data['globalRecvMsgOpt'] = this.globalRecvMsgOpt; data['globalRecvMsgOpt'] = this.globalRecvMsgOpt;
data['allowAddFriend'] = this.allowAddFriend;
data['allowBeep'] = this.allowBeep;
data['allowVibration'] = this.allowVibration;
data['forbidden'] = this.forbidden;
return data; return data;
} }
// bool get isFriendship => null != friendInfo;
//
// bool get isBlacklist => null != blackInfo;
bool get isMale => gender == 1;
String get _userID => isFriendship! ? friendInfo!.userID! : (isBlacklist! ? blackInfo!.userID! : publicInfo!.userID!);
String? get _nickname =>
isFriendship! ? friendInfo?.nickname : (isBlacklist! ? blackInfo?.nickname : publicInfo?.nickname);
String? get _faceUrl =>
isFriendship! ? friendInfo?.faceURL : (isBlacklist! ? blackInfo?.faceURL : publicInfo?.faceURL);
int? get _gender => isFriendship! ? friendInfo?.gender : (isBlacklist! ? blackInfo?.gender : publicInfo?.gender);
String? get _ex => isFriendship! ? friendInfo?.ex : (isBlacklist! ? blackInfo?.ex : publicInfo?.ex);
String? get _phoneNumber => friendInfo?.phoneNumber;
int? get _birth => friendInfo?.birth;
String? get _email => friendInfo?.email;
String? get _remark => friendInfo?.remark;
String getShowName() => _isNull(remark) ?? _isNull(nickname) ?? userID!; String getShowName() => _isNull(remark) ?? _isNull(nickname) ?? userID!;
static String? _isNull(String? value) { static String? _isNull(String? value) {
@@ -186,39 +68,35 @@ class UserInfo {
} }
@override @override
bool operator ==(Object other) => bool operator ==(Object other) => identical(this, other) || other is UserInfo && runtimeType == other.runtimeType && userID == other.userID;
identical(this, other) || other is UserInfo && runtimeType == other.runtimeType && userID == other.userID;
@override @override
int get hashCode => userID.hashCode; int get hashCode => userID.hashCode;
} }
/// 公开的资料
class PublicUserInfo { class PublicUserInfo {
/// 用户id /// User ID
String? userID; String? userID;
/// 昵称 /// Nickname
String? nickname; String? nickname;
/// 头像 /// Profile picture
String? faceURL; String? faceURL;
/// 性别 /// App Manager Level:
int? gender; /// 1: AppOrdinaryUsers
/// 2: AppAdmin
int? appManagerLevel;
/// AppOrdinaryUsers = 1 AppAdmin = 2 /// Additional information
int? appMangerLevel;
/// 扩展信息
String? ex; String? ex;
PublicUserInfo({ PublicUserInfo({
this.userID, this.userID,
this.nickname, this.nickname,
this.faceURL, this.faceURL,
this.gender, this.appManagerLevel,
this.appMangerLevel,
this.ex, this.ex,
}); });
@@ -226,8 +104,7 @@ class PublicUserInfo {
userID = json['userID']; userID = json['userID'];
nickname = json['nickname']; nickname = json['nickname'];
faceURL = json['faceURL']; faceURL = json['faceURL'];
gender = json['gender']; appManagerLevel = json['appManagerLevel'];
appMangerLevel = json['appMangerLevel'];
ex = json['ex']; ex = json['ex'];
} }
@@ -236,59 +113,49 @@ class PublicUserInfo {
data['userID'] = this.userID; data['userID'] = this.userID;
data['nickname'] = this.nickname; data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL; data['faceURL'] = this.faceURL;
data['gender'] = this.gender; data['appMangerLevel'] = this.appManagerLevel;
data['appMangerLevel'] = this.appMangerLevel;
data['ex'] = this.ex; data['ex'] = this.ex;
return data; return data;
} }
} }
/// 好友信息
class FriendInfo { class FriendInfo {
/// 用户id /// owner User ID
String? ownerUserID;
/// User ID
String? userID; String? userID;
/// 昵称 /// Nickname
String? nickname; String? nickname;
/// 头像 /// Profile picture
String? faceURL; String? faceURL;
/// 性别 /// friend User ID
int? gender; String? friendUserID;
/// 手机号 /// Remark
String? phoneNumber;
/// 出生日期
int? birth;
/// 邮箱
String? email;
/// 备注
String? remark; String? remark;
/// 扩展字段 /// Additional information
String? ex; String? ex;
/// 创建时间 /// Creation time
int? createTime; int? createTime;
/// 添加方式 /// Add source
int? addSource; int? addSource;
/// 操作者id /// Operator User ID
String? operatorUserID; String? operatorUserID;
FriendInfo({ FriendInfo({
this.ownerUserID,
this.userID, this.userID,
this.nickname, this.nickname,
this.faceURL, this.faceURL,
this.gender, this.friendUserID,
this.phoneNumber,
this.birth,
this.email,
this.remark, this.remark,
this.ex, this.ex,
this.createTime, this.createTime,
@@ -297,7 +164,7 @@ class FriendInfo {
}); });
FriendInfo.fromJson(Map<String, dynamic> json) { FriendInfo.fromJson(Map<String, dynamic> json) {
// ownerUserID = json['ownerUserID']; ownerUserID = json['ownerUserID'];
userID = json['userID']; userID = json['userID'];
remark = json['remark']; remark = json['remark'];
createTime = json['createTime']; createTime = json['createTime'];
@@ -305,16 +172,13 @@ class FriendInfo {
operatorUserID = json['operatorUserID']; operatorUserID = json['operatorUserID'];
nickname = json['nickname']; nickname = json['nickname'];
faceURL = json['faceURL']; faceURL = json['faceURL'];
gender = json['gender']; friendUserID = json['friendUserID'];
phoneNumber = json['phoneNumber'];
birth = json['birth'];
email = json['email'];
ex = json['ex']; ex = json['ex'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final data = Map<String, dynamic>(); final data = Map<String, dynamic>();
// data['ownerUserID'] = this.ownerUserID; data['ownerUserID'] = this.ownerUserID;
data['userID'] = this.userID; data['userID'] = this.userID;
data['remark'] = this.remark; data['remark'] = this.remark;
data['createTime'] = this.createTime; data['createTime'] = this.createTime;
@@ -322,10 +186,7 @@ class FriendInfo {
data['operatorUserID'] = this.operatorUserID; data['operatorUserID'] = this.operatorUserID;
data['nickname'] = this.nickname; data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL; data['faceURL'] = this.faceURL;
data['gender'] = this.gender; data['friendUserID'] = this.friendUserID;
data['phoneNumber'] = this.phoneNumber;
data['birth'] = this.birth;
data['email'] = this.email;
data['ex'] = this.ex; data['ex'] = this.ex;
return data; return data;
} }
@@ -338,33 +199,40 @@ class FriendInfo {
} }
} }
/// 黑名单信息
class BlacklistInfo { class BlacklistInfo {
/// 用户id /// User ID
String? userID; String? userID;
/// 昵称 /// Nickname
String? nickname; String? nickname;
/// 头像 /// owner User ID
String? ownerUserID;
/// block User ID
String? blockUserID;
/// Profile picture
String? faceURL; String? faceURL;
/// 性别 /// Gender
int? gender; int? gender;
/// 创建时间 /// Creation time
int? createTime; int? createTime;
/// 添加方式 /// Add source
int? addSource; int? addSource;
/// 操作者 /// Operator User ID
String? operatorUserID; String? operatorUserID;
/// 扩展信息 /// Additional information
String? ex; String? ex;
BlacklistInfo({ BlacklistInfo({
this.ownerUserID,
this.blockUserID,
this.userID, this.userID,
this.nickname, this.nickname,
this.faceURL, this.faceURL,
@@ -376,6 +244,8 @@ class BlacklistInfo {
}); });
BlacklistInfo.fromJson(Map<String, dynamic> json) { BlacklistInfo.fromJson(Map<String, dynamic> json) {
ownerUserID = json['ownerUserID'];
blockUserID = json['blockUserID'];
userID = json['userID']; userID = json['userID'];
nickname = json['nickname']; nickname = json['nickname'];
faceURL = json['faceURL']; faceURL = json['faceURL'];
@@ -388,6 +258,8 @@ class BlacklistInfo {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final data = Map<String, dynamic>(); final data = Map<String, dynamic>();
data['ownerUserID'] = this.ownerUserID;
data['blockUserID'] = this.blockUserID;
data['userID'] = this.userID; data['userID'] = this.userID;
data['nickname'] = this.nickname; data['nickname'] = this.nickname;
data['faceURL'] = this.faceURL; data['faceURL'] = this.faceURL;
@@ -400,12 +272,11 @@ class BlacklistInfo {
} }
} }
/// 关系
class FriendshipInfo { class FriendshipInfo {
/// 用户id /// User ID
String? userID; String? userID;
/// 1表示好友(并且不是黑名单) /// 1 represents a friend (and not in the blacklist)
int? result; int? result;
FriendshipInfo({this.userID, this.result}); FriendshipInfo({this.userID, this.result});
@@ -423,62 +294,53 @@ class FriendshipInfo {
} }
} }
/// 好友申请信息
class FriendApplicationInfo { class FriendApplicationInfo {
/// 发起者用户id /// Initiator user ID
String? fromUserID; String? fromUserID;
/// 发起者用户昵称 /// Initiator user nickname
String? fromNickname; String? fromNickname;
/// 发起者用户头像 /// Initiator user profile picture
String? fromFaceURL; String? fromFaceURL;
/// 发起者性别 /// Recipient user ID
int? fromGender;
/// 接收者用户id
String? toUserID; String? toUserID;
/// 接收者用户昵称 /// Recipient user nickname
String? toNickname; String? toNickname;
/// 接收者头像 /// Recipient user profile picture
String? toFaceURL; String? toFaceURL;
/// 接收者性别 /// Handling result
int? toGender;
/// 处理结果
int? handleResult; int? handleResult;
/// 请求消息 /// Request message
String? reqMsg; String? reqMsg;
/// 创建时间 /// Creation time
int? createTime; int? createTime;
/// 处理者id /// Handler user ID
String? handlerUserID; String? handlerUserID;
/// 处理备注 /// Handling remark
String? handleMsg; String? handleMsg;
/// 处理时间 /// Handling time
int? handleTime; int? handleTime;
/// 扩展字段 /// Additional information
String? ex; String? ex;
FriendApplicationInfo( FriendApplicationInfo(
{this.fromUserID, {this.fromUserID,
this.fromNickname, this.fromNickname,
this.fromFaceURL, this.fromFaceURL,
this.fromGender,
this.toUserID, this.toUserID,
this.toNickname, this.toNickname,
this.toFaceURL, this.toFaceURL,
this.toGender,
this.handleResult, this.handleResult,
this.reqMsg, this.reqMsg,
this.createTime, this.createTime,
@@ -491,11 +353,9 @@ class FriendApplicationInfo {
fromUserID = json['fromUserID']; fromUserID = json['fromUserID'];
fromNickname = json['fromNickname']; fromNickname = json['fromNickname'];
fromFaceURL = json['fromFaceURL']; fromFaceURL = json['fromFaceURL'];
fromGender = json['fromGender'];
toUserID = json['toUserID']; toUserID = json['toUserID'];
toNickname = json['toNickname']; toNickname = json['toNickname'];
toFaceURL = json['toFaceURL']; toFaceURL = json['toFaceURL'];
toGender = json['toGender'];
handleResult = json['handleResult']; handleResult = json['handleResult'];
reqMsg = json['reqMsg']; reqMsg = json['reqMsg'];
createTime = json['createTime']; createTime = json['createTime'];
@@ -510,11 +370,9 @@ class FriendApplicationInfo {
data['fromUserID'] = this.fromUserID; data['fromUserID'] = this.fromUserID;
data['fromNickname'] = this.fromNickname; data['fromNickname'] = this.fromNickname;
data['fromFaceURL'] = this.fromFaceURL; data['fromFaceURL'] = this.fromFaceURL;
data['fromGender'] = this.fromGender;
data['toUserID'] = this.toUserID; data['toUserID'] = this.toUserID;
data['toNickname'] = this.toNickname; data['toNickname'] = this.toNickname;
data['toFaceURL'] = this.toFaceURL; data['toFaceURL'] = this.toFaceURL;
data['toGender'] = this.toGender;
data['handleResult'] = this.handleResult; data['handleResult'] = this.handleResult;
data['reqMsg'] = this.reqMsg; data['reqMsg'] = this.reqMsg;
data['createTime'] = this.createTime; data['createTime'] = this.createTime;
@@ -525,24 +383,24 @@ class FriendApplicationInfo {
return data; return data;
} }
/// 等待处理 /// Waiting to be processed
bool get isWaitingHandle => handleResult == 0; bool get isWaitingHandle => handleResult == 0;
/// 已同意 /// Already agreed
bool get isAgreed => handleResult == 1; bool get isAgreed => handleResult == 1;
/// 已拒绝 /// Already rejected
bool get isRejected => handleResult == -1; bool get isRejected => handleResult == -1;
} }
class UserStatusInfo { class UserStatusInfo {
/// 用户id /// User ID
String? userID; String? userID;
/// 状态 /// Status
int? status; int? status;
/// 平台ID /// Platform IDs
List<int>? platformIDs; List<int>? platformIDs;
UserStatusInfo({ UserStatusInfo({

View File

@@ -2,9 +2,9 @@ import 'package:flutter/services.dart';
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
class OpenIM { class OpenIM {
static const version = '3.3.0'; static const version = '3.8.1';
static const _channel = const MethodChannel('flutter_openim_sdk'); static const _channel = MethodChannel('flutter_openim_sdk');
static final iMManager = IMManager(_channel); static final iMManager = IMManager(_channel);

View File

@@ -4,13 +4,21 @@ class Utils {
static List<T> toList<T>(String value, T f(Map<String, dynamic> map)) => static List<T> toList<T>(String value, T f(Map<String, dynamic> map)) =>
(formatJson(value) as List).map((e) => f(e)).toList(); (formatJson(value) as List).map((e) => f(e)).toList();
static T toObj<T>(String value, T f(Map<String, dynamic> map)) => static T toObj<T>(String value, T f(Map<String, dynamic> map)) => f(formatJson(value));
f(formatJson(value));
static List<dynamic> toListMap(String value) => formatJson(value); static List<dynamic> toListMap(String value) => formatJson(value);
static dynamic formatJson(String value) => jsonDecode(value); static dynamic formatJson(String value) => jsonDecode(value);
static String checkOperationID(String? obj) => static String checkOperationID(String? obj) => obj ?? DateTime.now().millisecondsSinceEpoch.toString();
obj ?? DateTime.now().millisecondsSinceEpoch.toString();
static Map<String, dynamic> cleanMap(Map<String, dynamic> map) {
map.removeWhere((key, value) {
if (value is Map<String, dynamic>) {
cleanMap(value);
}
return value == null;
});
return map;
}
} }

View File

@@ -5,48 +5,48 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async name: async
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.10.0" version: "2.11.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" version: "1.3.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.0" version: "1.18.0"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.1" version: "1.3.1"
flutter: flutter:
@@ -59,46 +59,62 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
js: leak_tracker:
dependency: transitive dependency: transitive
description: description:
name: js name: leak_tracker
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.5" version: "10.0.4"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
url: "https://pub.dev"
source: hosted
version: "3.0.3"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.13" version: "0.12.16+1"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.2.0" version: "0.8.0"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.0" version: "1.12.0"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.8.2" version: "1.9.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -108,32 +124,32 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.1" version: "1.10.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.11.0" version: "1.11.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" version: "2.1.2"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
term_glyph: term_glyph:
@@ -141,25 +157,33 @@ packages:
description: description:
name: term_glyph name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.1" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.16" version: "0.7.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.flutter-io.cn" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
url: "https://pub.dev"
source: hosted
version: "14.2.1"
sdks: sdks:
dart: ">=2.18.0 <3.0.0" dart: ">=3.3.0 <4.0.0"
flutter: ">=1.20.0" flutter: ">=3.18.0-18.0.pre.54"

View File

@@ -1,11 +1,11 @@
name: flutter_openim_sdk name: flutter_openim_sdk
description: An instant messaging plug-in that supports Android and IOS. And the server is also all open source. description: An instant messaging plug-in that supports Android and IOS. And the server is also all open source.
version: 3.3.0 version: 3.8.1
homepage: https://www.rentsoft.cn homepage: https://www.openim.io
repository: https://github.com/OpenIMSDK/Open-IM-SDK-Flutter repository: https://github.com/openimsdk/open-im-sdk-flutter
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=3.0.0 <4.0.0"
flutter: ">=1.20.0" flutter: ">=1.20.0"
dependencies: dependencies: