Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cb2c6d514 | ||
|
|
90be2f74ac | ||
|
|
53ef6c2173 | ||
|
|
373171aded | ||
|
|
58702fcbaf | ||
|
|
8b8c9d5923 | ||
|
|
d5e3947878 | ||
|
|
6edf9b74fa | ||
|
|
fcc8373560 | ||
|
|
7e8d72929a | ||
|
|
03fa70c585 | ||
|
|
8b4a35e6b7 | ||
|
|
71897bcb4e | ||
|
|
57340e52a7 | ||
|
|
197f0b482f | ||
|
|
e009224256 | ||
|
|
ad0563aee4 | ||
|
|
d120312ac9 | ||
|
|
d64b426c90 | ||
|
|
3a845dc40b | ||
|
|
700265c685 | ||
|
|
73b9eb776f | ||
|
|
372e573ea0 | ||
|
|
8ea08f9ce6 | ||
|
|
40b65f52a5 | ||
|
|
6c0676fbe5 | ||
|
|
80152e2314 | ||
|
|
2381d26729 | ||
|
|
b25f0d8547 | ||
|
|
f4e7eaf50e | ||
|
|
f40d4148a8 | ||
|
|
23fa27d2cc | ||
|
|
6a1dc1f62a | ||
|
|
07212474fe | ||
|
|
8655088af6 | ||
|
|
b7aa083f48 | ||
|
|
514fb53eca | ||
|
|
9345c6465a | ||
|
|
b05e68355e | ||
|
|
3746652552 | ||
|
|
e323eea8cd | ||
|
|
f111d0c69e | ||
|
|
ba661a516e | ||
|
|
43016d5e86 | ||
|
|
4c43d54a1a | ||
|
|
b71cd22dce | ||
|
|
f3261d2ce4 |
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@@ -3,4 +3,5 @@
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<type id="android" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Android API 25 Platform" project-jdk-type="Android SDK" />
|
||||
</project>
|
||||
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -3,6 +3,7 @@
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/flutter_openim_sdk.iml" filepath="$PROJECT_DIR$/.idea/flutter_openim_sdk.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/android/flutter_openim_sdk_android.iml" filepath="$PROJECT_DIR$/android/flutter_openim_sdk_android.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
55
CHANGELOG.md
55
CHANGELOG.md
@@ -1,3 +1,58 @@
|
||||
## 2.0.0+6
|
||||
|
||||
1.Fix bug</br>
|
||||
2.Adapter ios emulator</br>
|
||||
3.New modify group nickname</br>
|
||||
4.Update at message</br>
|
||||
5.ConverstaionInfo new add isNotInGroup field</br>
|
||||
6.New at type</br>
|
||||
7.New work moments</br>
|
||||
8.New global search</br>
|
||||
9.New getHistoryMessageListReverse method</br>
|
||||
10.New getAtAllTag method</br>
|
||||
11.New resetConversationGroupAtType method</br>
|
||||
12.New searchGroups method</br>
|
||||
|
||||
## 2.0.0+5
|
||||
|
||||
1.New notification parse </br>
|
||||
2.New deleteConversationFromLocalAndSvr method </br>
|
||||
3.New deleteMessageFromLocalAndSvr method </br>
|
||||
4.New deleteAllMsgFromLocal method </br>
|
||||
5.New deleteAllMsgFromLocalAndSvr method </br>
|
||||
6.New clearC2CHistoryMessageFromLocalAndSvr method </br>
|
||||
7.New clearGroupHistoryMessageFromLocalAndSvr method </br>
|
||||
8.New markMessageAsReadByConID method </br>
|
||||
9.New wakeUp method </br>
|
||||
10.New deleteAllConversationFromLocal method </br>
|
||||
|
||||
## 2.0.0+4
|
||||
|
||||
1.New dismiss group </br>
|
||||
2.New search local message </br>
|
||||
3.New private chat </br>
|
||||
4.New group mute
|
||||
|
||||
## 2.0.0+3
|
||||
|
||||
1.Fix bug </br>
|
||||
|
||||
## 2.0.0+2
|
||||
|
||||
1.Fix some one crash </br>
|
||||
2.New add signaling function </br>
|
||||
3.New add group have read receipt
|
||||
|
||||
## 2.0.0+1
|
||||
|
||||
1.Fix multi-terminal synchronization bug fix for retracted messages </br>
|
||||
2.Fix sending picture flashback bug </br>
|
||||
3.Fix other bug
|
||||
|
||||
## 2.0.0
|
||||
|
||||
1.Refactor mobile sdk, server sdk (2022-2-21)
|
||||
|
||||
## 1.1.1
|
||||
|
||||
1.Update sdk maven url
|
||||
|
||||
328
README.md
328
README.md
@@ -5,9 +5,7 @@
|
||||
|
||||
A flutter im plugin for android and ios.
|
||||
|
||||
#### [中文文档](README.zh-cn.md)
|
||||
|
||||
#### [demo](https://github.com/OpenIMSDK/Open-IM-Flutter-Demo.git) | [widget](https://github.com/hrxiang/flutter_openim_widget.git)
|
||||
#### [中文文档](README.zh-cn.md) | [demo(体验app源代码)](https://github.com/OpenIMSDK/Open-IM-Flutter-Demo.git) | [widget(聊天UI库)](https://github.com/hrxiang/flutter_openim_widget.git)
|
||||
|
||||

|
||||
|
||||
@@ -23,327 +21,3 @@ A flutter im plugin for android and ios.
|
||||
#### 2,Import package
|
||||
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
#### 3, Init config
|
||||
|
||||
```
|
||||
// Initialize SDK
|
||||
OpenIM.iMManager
|
||||
..initSDK(
|
||||
platform: Platform.isAndroid ? IMPlatform.android : IMPlatform.ios,
|
||||
ipApi: '',
|
||||
ipWs: '',
|
||||
dbPath: '',
|
||||
listener: OnInitSDKListener(
|
||||
onConnecting: () {},
|
||||
onConnectFailed: (code, error) {},
|
||||
onConnectSuccess: () {},
|
||||
onKickedOffline: () {},
|
||||
onUserSigExpired: () {},
|
||||
onSelfInfoUpdated: (user) {},
|
||||
),
|
||||
)
|
||||
|
||||
// Add message listener (remove when not in use)
|
||||
..messageManager.addAdvancedMsgListener(OnAdvancedMsgListener(
|
||||
onRecvMessageRevoked: (msgId) {},
|
||||
onRecvC2CReadReceipt: (list) {},
|
||||
onRecvNewMessage: (msg) {},
|
||||
))
|
||||
|
||||
// Set up message sending progress listener
|
||||
..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener(
|
||||
onProgress: (msgId, progress) {},
|
||||
))
|
||||
|
||||
// Set up friend relationship listener
|
||||
..friendshipManager.setFriendshipListener(OnFriendshipListener(
|
||||
onBlackListAdd: (u) {},
|
||||
onBlackListDeleted: (u) {},
|
||||
onFriendApplicationListAccept: (u) {},
|
||||
onFriendApplicationListAdded: (u) {},
|
||||
onFriendApplicationListDeleted: (u) {},
|
||||
onFriendApplicationListReject: (u) {},
|
||||
onFriendInfoChanged: (u) {},
|
||||
onFriendListAdded: (u) {},
|
||||
onFriendListDeleted: (u) {},
|
||||
))
|
||||
|
||||
// Set up conversation listener
|
||||
..conversationManager.setConversationListener(OnConversationListener(
|
||||
onConversationChanged: (list) {},
|
||||
onNewConversation: (list) {},
|
||||
onTotalUnreadMessageCountChanged: (count) {},
|
||||
onSyncServerFailed: () {},
|
||||
onSyncServerFinish: () {},
|
||||
onSyncServerStart: () {},
|
||||
))
|
||||
|
||||
// Set up group listener
|
||||
..groupManager.setGroupListener(OnGroupListener(
|
||||
onApplicationProcessed: (groupId, opUser, agreeOrReject, opReason) {},
|
||||
onGroupCreated: (groupId) {},
|
||||
onGroupInfoChanged: (groupId, info) {},
|
||||
onMemberEnter: (groupId, list) {},
|
||||
onMemberInvited: (groupId, opUser, list) {},
|
||||
onMemberKicked: (groupId, opUser, list) {},
|
||||
onMemberLeave: (groupId, info) {},
|
||||
onReceiveJoinApplication: (groupId, info, opReason) {},
|
||||
));
|
||||
```
|
||||
|
||||
#### 4, Log in
|
||||
|
||||
```
|
||||
OpenIM.iMManager.login(uid: uid, token: token).then((value){
|
||||
// login success
|
||||
});
|
||||
```
|
||||
|
||||
#### 5,Get a list of conversations
|
||||
|
||||
```
|
||||
OpenIM.iMManager.conversationManager.getAllConversationList().then((list) {
|
||||
});
|
||||
```
|
||||
|
||||
#### 6,Get friend list
|
||||
|
||||
```
|
||||
OpenIM.iMManager.friendshipManager.getFriendList().then((list) {
|
||||
});
|
||||
```
|
||||
|
||||
#### 7,Get chat history
|
||||
|
||||
```
|
||||
// If userID is not null and groupID is null, get a single chat message list
|
||||
// If the userID is null and the groupID is not null, get a group chat message list
|
||||
OpenIM.iMManager.messageManager.getHistoryMessageList(
|
||||
userID: uid,//User id
|
||||
startMsg: startMsg,//Last message, take chatMsgList[0]
|
||||
groupID: gid,//Group id
|
||||
count: count,//Page Size
|
||||
)
|
||||
.then((list){});
|
||||
|
||||
```
|
||||
|
||||
#### 8,Send a message
|
||||
|
||||
```
|
||||
// Create message
|
||||
var message = await OpenIM.iMManager.messageManager.createTextMessage(
|
||||
text: 'I am the content of the message',
|
||||
);
|
||||
// Send
|
||||
OpenIM.iMManager.messageManager.sendMessage(
|
||||
message: message,
|
||||
onlineUserOnly: false,
|
||||
userID: uid, // Single chat value is not null
|
||||
groupID: gid, // The group chat value is not null
|
||||
).then((v) {
|
||||
}).catchError((e){
|
||||
});
|
||||
```
|
||||
|
||||
#### 9,Sign out
|
||||
|
||||
```
|
||||
OpenIM.iMManager.logout();
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### OpenIM.iMManager
|
||||
|
||||
| method | description |
|
||||
| ---------------- | ------------------------------- |
|
||||
| initSDK | Initialize SDK |
|
||||
| unInitSDK | |
|
||||
| login | Log in |
|
||||
| logout | Sign out |
|
||||
| getLoginStatus | Login status |
|
||||
| getLoginUid | Current user id |
|
||||
| getLoginUserInfo | Current user information |
|
||||
| setSelfInfo | Modify current user information |
|
||||
| getUsersInfo | Get user information by user id |
|
||||
| enabledSDKLog | Setup sdk log |
|
||||
|
||||
|
||||
|
||||
#### OpenIM.iMManager.conversationManager
|
||||
|
||||
| method | description |
|
||||
| ----------------------------- | --------------------------------------- |
|
||||
| setConversationListener | Listener |
|
||||
| getAllConversationList | Get all conversation |
|
||||
| getSingleConversation | Get single conversation |
|
||||
| getMultipleConversation | Get multiple conversation |
|
||||
| deleteConversation | Delete conversation |
|
||||
| setConversationDraft | Set conversation draftText |
|
||||
| pinConversation | Top conversation |
|
||||
| markSingleMessageHasRead | Mark single chat messages as read |
|
||||
| markGroupMessageHasRead | Mark group chat messages as read |
|
||||
| getTotalUnreadMsgCount | Get the total number of unread messages |
|
||||
| getConversationID | Query conversation id |
|
||||
| setConversationRecvMessageOpt | Setup message do not disturb |
|
||||
| getConversationRecvMessageOpt | Message do not disturb status |
|
||||
|
||||
|
||||
|
||||
#### OpenIM.iMManager.friendshipManager
|
||||
|
||||
| method | description |
|
||||
| ------------------------ | ------------------------------------------------------------ |
|
||||
| setFriendshipListener | Listener |
|
||||
| getFriendsInfo | Get friend information |
|
||||
| addFriend | Send an friend application |
|
||||
| getFriendApplicationList | Get all friend application, sent to you by others |
|
||||
| getFriendList | Find all friends including those who have been added to the blacklist |
|
||||
| setFriendInfo | Modify friend information, only comment can be modified |
|
||||
| addToBlackList | Add to blacklist |
|
||||
| getBlackList | Get blacklist list |
|
||||
| deleteFromBlackList | Remove from blacklist |
|
||||
| checkFriend | Check friendship |
|
||||
| deleteFromFriendList | Remove friend |
|
||||
| acceptFriendApplication | Accept friend application |
|
||||
| refuseFriendApplication | Reject friend application |
|
||||
|
||||
|
||||
|
||||
#### OpenIM.iMManager.messageManager
|
||||
|
||||
| method | description |
|
||||
| --------------------------------- | --------------------------------- |
|
||||
| addAdvancedMsgListener | Add message listener |
|
||||
| setMsgSendProgressListener | Message sending progress listener |
|
||||
| sendMessage | Send a message |
|
||||
| getHistoryMessageList | Get history news |
|
||||
| revokeMessage | Revoke message |
|
||||
| deleteMessageFromLocalStorage | Delete message |
|
||||
| insertSingleMessageToLocalStorage | Insert message |
|
||||
| findMessages | Query the message by id |
|
||||
| markC2CMessageAsRead | Mark c2c message as read |
|
||||
| typingStatusUpdate | Typing prompt |
|
||||
| createTextMessage | Create text message |
|
||||
| createTextAtMessage | Create @ message |
|
||||
| createImageMessage | Create picture message |
|
||||
| createImageMessageFromFullPath | Create picture message |
|
||||
| createSoundMessage | Create voice message |
|
||||
| createSoundMessageFromFullPath | Create voice message |
|
||||
| createVideoMessage | Create video message |
|
||||
| createVideoMessageFromFullPath | Create video message |
|
||||
| createFileMessage | Create file message |
|
||||
| createFileMessageFromFullPath | Create file message |
|
||||
| createMergerMessage | Create merge message |
|
||||
| createForwardMessage | Create a forwarded message |
|
||||
| createLocationMessage | Create location message |
|
||||
| createCustomMessage | Create custom message |
|
||||
| createQuoteMessage | Create quote message |
|
||||
| createCardMessage | Create card message |
|
||||
| clearC2CHistoryMessage | Clear all message history |
|
||||
| clearGroupHistoryMessage | Clear all message history |
|
||||
|
||||
|
||||
|
||||
#### OpenIM.iMManager.groupManager
|
||||
|
||||
| method | description |
|
||||
| ----------------------- | ------------------------------- |
|
||||
| setGroupListener | Listener |
|
||||
| inviteUserToGroup | Invite into the group |
|
||||
| kickGroupMember | Remove group members |
|
||||
| getGroupMembersInfo | Get group member information |
|
||||
| getGroupMemberList | Get group members |
|
||||
| getJoinedGroupList | Get joined groups |
|
||||
| isJoinedGroup | Check you have joined the group |
|
||||
| createGroup | Create a group |
|
||||
| setGroupInfo | Edit group information |
|
||||
| getGroupsInfo | Get group information |
|
||||
| joinGroup | Join group |
|
||||
| quitGroup | Exit group |
|
||||
| transferGroupOwner | Group permission transfer |
|
||||
| getGroupApplicationList | Get group application list |
|
||||
| acceptGroupApplication | Accept group invitation |
|
||||
| refuseGroupApplication | Refuse group application |
|
||||
|
||||
#### Other
|
||||
|
||||
Message type
|
||||
|
||||
```
|
||||
static const text = 101;
|
||||
static const picture = 102;
|
||||
static const voice = 103;
|
||||
static const video = 104;
|
||||
static const file = 105;
|
||||
static const at_text = 106;
|
||||
static const merger = 107;
|
||||
static const card = 108;
|
||||
static const location = 109;
|
||||
static const custom = 110;
|
||||
static const revoke = 111;
|
||||
static const has_read_receipt = 112;
|
||||
static const typing = 113;
|
||||
static const quote = 114;
|
||||
|
||||
///
|
||||
static const accept_friend = 201;
|
||||
static const add_friend = 202;
|
||||
static const refuse_friend_application = 203;
|
||||
static const set_self_info = 204;
|
||||
static const revoke_message = 205;
|
||||
static const c2c_message_as_read = 206;
|
||||
|
||||
static const kick_online = 303;
|
||||
|
||||
|
||||
static const transfer_group_owner = 501;
|
||||
static const create_group = 502;
|
||||
// static const create_group = 503;
|
||||
static const join_group = 504;
|
||||
static const quit_group = 505;
|
||||
static const set_group_info = 506;
|
||||
static const accept_group_application = 507;
|
||||
static const refuse_group_application = 508;
|
||||
static const kick_group_member = 509;
|
||||
static const invited_user_to_group = 510;
|
||||
```
|
||||
|
||||
Platform
|
||||
|
||||
```
|
||||
static const ios = 1;
|
||||
static const android = 2;
|
||||
static const windows = 3;
|
||||
static const xos = 4;
|
||||
static const web = 5;
|
||||
static const mini_web = 6;
|
||||
static const linux = 7;
|
||||
```
|
||||
|
||||
Group member role
|
||||
|
||||
```
|
||||
static const member = 0;
|
||||
static const owner = 1;
|
||||
static const admin = 2;
|
||||
```
|
||||
|
||||
Conversation type
|
||||
|
||||
```
|
||||
static const single_chat = 1;
|
||||
static const group_chat = 2;
|
||||
```
|
||||
|
||||
Message status
|
||||
|
||||
```
|
||||
static const sending = 1;
|
||||
static const succeeded = 2;
|
||||
static const failed = 3;
|
||||
static const deleted = 4;
|
||||
```
|
||||
|
||||
|
||||
2315
README.zh-cn.md
2315
README.zh-cn.md
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,10 @@ version '1.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
|
||||
maven {
|
||||
allowInsecureProtocol = true
|
||||
url 'http://121.37.25.71:8081/repository/maven-releases/'
|
||||
@@ -18,6 +22,10 @@ buildscript {
|
||||
|
||||
rootProject.allprojects {
|
||||
repositories {
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
|
||||
maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
|
||||
maven {
|
||||
allowInsecureProtocol = true
|
||||
url 'http://121.37.25.71:8081/repository/maven-releases/'
|
||||
@@ -41,5 +49,5 @@ android {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation 'io.openim:client-sdk:1.4.5@aar'
|
||||
implementation 'io.openim:client-sdk:2.0.51@aar'
|
||||
}
|
||||
@@ -18,6 +18,9 @@ import io.openim.flutter_openim_sdk.manager.FriendshipManager;
|
||||
import io.openim.flutter_openim_sdk.manager.GroupManager;
|
||||
import io.openim.flutter_openim_sdk.manager.IMManager;
|
||||
import io.openim.flutter_openim_sdk.manager.MessageManager;
|
||||
import io.openim.flutter_openim_sdk.manager.SignalingManager;
|
||||
import io.openim.flutter_openim_sdk.manager.UserManager;
|
||||
import io.openim.flutter_openim_sdk.manager.WorkMomentsManager;
|
||||
|
||||
|
||||
/**
|
||||
@@ -31,20 +34,26 @@ public class FlutterOpenimSdkPlugin implements FlutterPlugin, MethodCallHandler
|
||||
|
||||
public static MethodChannel channel;
|
||||
private static IMManager imManager;
|
||||
private static UserManager userManager;
|
||||
private static FriendshipManager friendshipManager;
|
||||
private static MessageManager messageManager;
|
||||
private static ConversationManager conversationManager;
|
||||
private static GroupManager groupManager;
|
||||
private static SignalingManager signalingManager;
|
||||
private static WorkMomentsManager workMomentsManager;
|
||||
|
||||
public FlutterOpenimSdkPlugin() {
|
||||
}
|
||||
|
||||
private FlutterOpenimSdkPlugin(Context context) {
|
||||
FlutterOpenimSdkPlugin.imManager = new IMManager();
|
||||
FlutterOpenimSdkPlugin.userManager = new UserManager();
|
||||
FlutterOpenimSdkPlugin.friendshipManager = new FriendshipManager();
|
||||
FlutterOpenimSdkPlugin.messageManager = new MessageManager();
|
||||
FlutterOpenimSdkPlugin.conversationManager = new ConversationManager();
|
||||
FlutterOpenimSdkPlugin.groupManager = new GroupManager();
|
||||
FlutterOpenimSdkPlugin.signalingManager = new SignalingManager();
|
||||
FlutterOpenimSdkPlugin.workMomentsManager = new WorkMomentsManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
|
||||
import io.flutter.Log;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.Base;
|
||||
|
||||
public class BaseListener implements Base {
|
||||
|
||||
MethodChannel.Result result;
|
||||
|
||||
public BaseListener(MethodChannel.Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long l, String s) {
|
||||
// Log.e("F-OpenIMSD(callback)", s);
|
||||
CommonUtil.runMainThreadReturnError(result, l, s, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
// Log.i("F-OpenIMSDK(callback)", s);
|
||||
CommonUtil.runMainThreadReturn(result, s);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnFriendshipListener;
|
||||
|
||||
public class FriendshipListener implements OnFriendshipListener {
|
||||
|
||||
@Override
|
||||
public void onBlackListAdd(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onBlackListAdd", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlackListDeleted(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onBlackListDeleted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationListAccept(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendApplicationListAccept", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationListAdded(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendApplicationListAdded", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationListDeleted(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendApplicationListDeleted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationListReject(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendApplicationListReject", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendInfoChanged(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendInfoChanged", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendListAdded(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendListAdded", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendListDeleted(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendListDeleted", s);
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnGroupListener;
|
||||
|
||||
public class GroupListener implements OnGroupListener {
|
||||
@Override
|
||||
public void onApplicationProcessed(String s, String s1, int i, String s2) {
|
||||
Map<String, Object> map = new ArrayMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("opUser", s1);
|
||||
map.put("agreeOrReject", i);
|
||||
map.put("opReason", s2);
|
||||
CommonUtil.emitEvent("groupListener", "onApplicationProcessed", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupCreated(String s) {
|
||||
Map<String, Object> map = new ArrayMap<>();
|
||||
map.put("groupId", s);
|
||||
CommonUtil.emitEvent("groupListener", "onGroupCreated", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupInfoChanged(String s, String s1) {
|
||||
Map<String, Object> map = new ArrayMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("groupInfo", s1);
|
||||
CommonUtil.emitEvent("groupListener", "onGroupInfoChanged", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberEnter(String s, String s1) {
|
||||
Map<String, Object> map = new ArrayMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("memberList", s1);
|
||||
CommonUtil.emitEvent("groupListener", "onMemberEnter", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberInvited(String s, String s1, String s2) {
|
||||
Map<String, Object> map = new ArrayMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("opUser", s1);
|
||||
map.put("memberList", s2);
|
||||
CommonUtil.emitEvent("groupListener", "onMemberInvited", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberKicked(String s, String s1, String s2) {
|
||||
Map<String, Object> map = new ArrayMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("opUser", s1);
|
||||
map.put("memberList", s2);
|
||||
CommonUtil.emitEvent("groupListener", "onMemberKicked", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMemberLeave(String s, String s1) {
|
||||
Map<String, Object> map = new ArrayMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("member", s1);
|
||||
CommonUtil.emitEvent("groupListener", "onMemberLeave", map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceiveJoinApplication(String s, String s1, String s2) {
|
||||
Map<String, Object> map = new ArrayMap<>();
|
||||
map.put("groupId", s);
|
||||
map.put("member", s1);
|
||||
map.put("opReason", s2);
|
||||
CommonUtil.emitEvent("groupListener", "onReceiveJoinApplication", map);
|
||||
}
|
||||
}
|
||||
@@ -5,25 +5,30 @@ import android.util.ArrayMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnAdvancedMsgListener;
|
||||
|
||||
public class AdvancedMsgListener implements OnAdvancedMsgListener {
|
||||
// final Map<String, String> values = new HashMap<>();
|
||||
public class OnAdvancedMsgListener implements open_im_sdk_callback.OnAdvancedMsgListener {
|
||||
private final String id;
|
||||
|
||||
public AdvancedMsgListener(String listenerId) {
|
||||
public OnAdvancedMsgListener(String listenerId) {
|
||||
this.id = listenerId;
|
||||
// this.values.put("id", listenerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecvC2CReadReceipt(String s) {
|
||||
final Map<String, String> values = new ArrayMap<>();
|
||||
values.put("id", id);
|
||||
values.put("haveReadMessage", s);
|
||||
values.put("c2cMessageReadReceipt", s);
|
||||
CommonUtil.emitEvent("advancedMsgListener", "onRecvC2CReadReceipt", values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecvGroupReadReceipt(String s) {
|
||||
final Map<String, String> values = new ArrayMap<>();
|
||||
values.put("id", id);
|
||||
values.put("groupMessageReadReceipt", s);
|
||||
CommonUtil.emitEvent("advancedMsgListener", "onRecvGroupReadReceipt", values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecvMessageRevoked(String s) {
|
||||
final Map<String, String> values = new ArrayMap<>();
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
|
||||
import io.flutter.Log;
|
||||
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.Base;
|
||||
|
||||
public class OnBaseListener implements Base {
|
||||
|
||||
MethodChannel.Result result;
|
||||
MethodCall call;
|
||||
|
||||
public OnBaseListener(MethodChannel.Result result, MethodCall call) {
|
||||
this.result = result;
|
||||
this.call = call;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int l, String s) {
|
||||
Log.i("F-OpenIMSDK(flutter call native)", "method: 【 " + call.method + " 】, onError: { code:" + l + ", message:" + s + "}");
|
||||
CommonUtil.runMainThreadReturnError(result, l, s, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
Log.i("F-OpenIMSDK(flutter call native)", "method: 【 " + call.method + " 】, onSuccess: " + s);
|
||||
CommonUtil.runMainThreadReturn(result, s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
|
||||
|
||||
public class OnConnListener implements open_im_sdk_callback.OnConnListener {
|
||||
|
||||
@Override
|
||||
public void onConnectFailed(int i, String s) {
|
||||
CommonUtil.emitEvent("connectListener", "onConnectFailed", i, s, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
CommonUtil.emitEvent("connectListener", "onConnectSuccess", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnecting() {
|
||||
CommonUtil.emitEvent("connectListener", "onConnecting", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKickedOffline() {
|
||||
CommonUtil.emitEvent("connectListener", "onKickedOffline", null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUserTokenExpired() {
|
||||
CommonUtil.emitEvent("connectListener", "onUserTokenExpired", null);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnConversationListener;
|
||||
|
||||
public class ConversationListener implements OnConversationListener {
|
||||
|
||||
public class OnConversationListener implements open_im_sdk_callback.OnConversationListener {
|
||||
|
||||
@Override
|
||||
public void onConversationChanged(String s) {
|
||||
@@ -0,0 +1,51 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
|
||||
public class OnFriendshipListener implements open_im_sdk_callback.OnFriendshipListener {
|
||||
|
||||
@Override
|
||||
public void onBlackAdded(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onBlacklistAdded", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlackDeleted(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onBlacklistDeleted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendAdded(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendAdded", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationAccepted(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendApplicationAccepted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationAdded(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendApplicationAdded", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationDeleted(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendApplicationDeleted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendApplicationRejected(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendApplicationRejected", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendDeleted(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendDeleted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFriendInfoChanged(String s) {
|
||||
CommonUtil.emitEvent("friendListener", "onFriendInfoChanged", s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
|
||||
public class OnGroupListener implements open_im_sdk_callback.OnGroupListener {
|
||||
|
||||
@Override
|
||||
public void onGroupApplicationAccepted(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onGroupApplicationAccepted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupApplicationAdded(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onGroupApplicationAdded", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupApplicationDeleted(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onGroupApplicationDeleted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupApplicationRejected(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onGroupApplicationRejected", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupInfoChanged(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onGroupInfoChanged", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupMemberAdded(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onGroupMemberAdded", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupMemberDeleted(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onGroupMemberDeleted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGroupMemberInfoChanged(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onGroupMemberInfoChanged", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoinedGroupAdded(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onJoinedGroupAdded", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoinedGroupDeleted(String s) {
|
||||
CommonUtil.emitEvent("groupListener", "onJoinedGroupDeleted", s);
|
||||
}
|
||||
}
|
||||
@@ -7,31 +7,33 @@ 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.SendMsgCallBack;
|
||||
import open_im_sdk_callback.SendMsgCallBack;
|
||||
|
||||
public class MsgSendProgressListener implements SendMsgCallBack {
|
||||
public class OnMsgSendListener implements SendMsgCallBack {
|
||||
final private MethodChannel.Result result;
|
||||
// final private MethodCall call;
|
||||
final private Object clientMsgID;
|
||||
private Object clientMsgID;
|
||||
|
||||
public MsgSendProgressListener(MethodChannel.Result result, MethodCall call) {
|
||||
public OnMsgSendListener(MethodChannel.Result result, MethodCall call) {
|
||||
this.result = result;
|
||||
// this.call = call;
|
||||
Map<String, Object> args = call.argument("message");
|
||||
this.clientMsgID = args.get("clientMsgID");
|
||||
if (null != args) {
|
||||
this.clientMsgID = args.get("clientMsgID");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long l, String s) {
|
||||
public void onError(int l, String s) {
|
||||
CommonUtil.runMainThreadReturnError(result, l, s, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(long l) {
|
||||
final Map<String, Object> values = new ArrayMap<>();
|
||||
values.put("clientMsgID", clientMsgID);
|
||||
values.put("progress", l);
|
||||
CommonUtil.emitEvent("msgSendProgressListener", "onProgress", values);
|
||||
if (null != clientMsgID) {
|
||||
final Map<String, Object> values = new ArrayMap<>();
|
||||
values.put("clientMsgID", clientMsgID);
|
||||
values.put("progress", l);
|
||||
CommonUtil.emitEvent("msgSendProgressListener", "onProgress", values);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -0,0 +1,46 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
|
||||
public class OnSignalingListener implements open_im_sdk_callback.OnSignalingListener {
|
||||
|
||||
@Override
|
||||
public void onInvitationCancelled(String s) {
|
||||
CommonUtil.emitEvent("signalingListener", "onInvitationCancelled", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInvitationTimeout(String s) {
|
||||
CommonUtil.emitEvent("signalingListener", "onInvitationTimeout", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInviteeAccepted(String s) {
|
||||
CommonUtil.emitEvent("signalingListener", "onInviteeAccepted", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInviteeAcceptedByOtherDevice(String s) {
|
||||
CommonUtil.emitEvent("signalingListener", "onInviteeAcceptedByOtherDevice", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInviteeRejected(String s) {
|
||||
CommonUtil.emitEvent("signalingListener", "onInviteeRejected", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInviteeRejectedByOtherDevice(String s) {
|
||||
CommonUtil.emitEvent("signalingListener", "onInviteeRejectedByOtherDevice", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceiveNewInvitation(String s) {
|
||||
CommonUtil.emitEvent("signalingListener", "onReceiveNewInvitation", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHangUp(String s) {
|
||||
CommonUtil.emitEvent("signalingListener", "onHangUp", s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
|
||||
public class OnUserListener implements open_im_sdk_callback.OnUserListener {
|
||||
|
||||
@Override
|
||||
public void onSelfInfoUpdated(String s) {
|
||||
CommonUtil.emitEvent("userListener", "onSelfInfoUpdated", s);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
|
||||
public class OnWorkMomentsListener implements open_im_sdk_callback.OnWorkMomentsListener {
|
||||
|
||||
|
||||
@Override
|
||||
public void onRecvNewNotification() {
|
||||
CommonUtil.emitEvent("workMomentsListener", "OnRecvNewNotification", null);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package io.openim.flutter_openim_sdk.listener;
|
||||
|
||||
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.IMSDKListener;
|
||||
|
||||
public class SDKListener implements IMSDKListener {
|
||||
|
||||
@Override
|
||||
public void onConnectFailed(long l, String s) {
|
||||
CommonUtil.emitEvent("initSDKListener", "onConnectFailed", l, s, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectSuccess() {
|
||||
CommonUtil.emitEvent("initSDKListener", "onConnectSuccess", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnecting() {
|
||||
CommonUtil.emitEvent("initSDKListener", "onConnecting", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKickedOffline() {
|
||||
CommonUtil.emitEvent("initSDKListener", "onKickedOffline", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelfInfoUpdated(String s) {
|
||||
CommonUtil.emitEvent("initSDKListener", "onSelfInfoUpdated", s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserTokenExpired() {
|
||||
CommonUtil.emitEvent("initSDKListener", "onUserTokenExpired", null);
|
||||
}
|
||||
}
|
||||
@@ -2,74 +2,98 @@ package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.ConversationListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnBaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnConversationListener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class ConversationManager extends BaseManager {
|
||||
|
||||
public void setConversationListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setConversationListener(new ConversationListener());
|
||||
Open_im_sdk.setConversationListener(new OnConversationListener());
|
||||
}
|
||||
|
||||
|
||||
public void getAllConversationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getAllConversationList(new BaseListener(result));
|
||||
Open_im_sdk.getAllConversationList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getConversationListSplit(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getConversationListSplit(new BaseListener(result),
|
||||
Open_im_sdk.getConversationListSplit(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
int2long(methodCall, "offset"),
|
||||
int2long(methodCall, "count"));
|
||||
int2long(methodCall, "count")
|
||||
);
|
||||
}
|
||||
|
||||
public void getOneConversation(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getOneConversation(
|
||||
value(methodCall, "sourceID"),
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
int2long(methodCall, "sessionType"),
|
||||
new BaseListener(result));
|
||||
value(methodCall, "sourceID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getMultipleConversation(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getMultipleConversation(
|
||||
jsonValue(methodCall, "conversationIDList"),
|
||||
new BaseListener(result));
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "conversationIDList")
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteConversation(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteConversation(
|
||||
value(methodCall, "conversationID"),
|
||||
new BaseListener(result));
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "conversationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void setConversationDraft(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setConversationDraft(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "conversationID"),
|
||||
value(methodCall, "draftText"),
|
||||
new BaseListener(result));
|
||||
value(methodCall, "draftText")
|
||||
);
|
||||
}
|
||||
|
||||
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"),
|
||||
new BaseListener(result));
|
||||
value(methodCall, "isPinned")
|
||||
);
|
||||
}
|
||||
|
||||
public void markSingleMessageHasRead(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.markSingleMessageHasRead(
|
||||
new BaseListener(result),
|
||||
value(methodCall, "userID"));
|
||||
}
|
||||
// public void markSingleMessageHasRead(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.markSingleMessageHasRead(
|
||||
// new OnBaseListener(result, methodCall),
|
||||
// value(methodCall, "operationID"),
|
||||
// value(methodCall, "userID")
|
||||
// );
|
||||
// }
|
||||
|
||||
public void markGroupMessageHasRead(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.markGroupMessageHasRead(
|
||||
new BaseListener(result),
|
||||
value(methodCall, "groupID"));
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "groupID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getTotalUnreadMsgCount(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getTotalUnreadMsgCount(new BaseListener(result));
|
||||
Open_im_sdk.getTotalUnreadMsgCount(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getConversationIDBySessionType(MethodCall methodCall, MethodChannel.Result result) {
|
||||
@@ -80,7 +104,8 @@ public class ConversationManager extends BaseManager {
|
||||
|
||||
public void setConversationRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setConversationRecvMessageOpt(
|
||||
new BaseListener(result),
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "conversationIDList"),
|
||||
int2long(methodCall, "status")
|
||||
);
|
||||
@@ -88,8 +113,45 @@ public class ConversationManager extends BaseManager {
|
||||
|
||||
public void getConversationRecvMessageOpt(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getConversationRecvMessageOpt(
|
||||
new BaseListener(result),
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "conversationIDList")
|
||||
);
|
||||
}
|
||||
|
||||
public void setOneConversationPrivateChat(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setOneConversationPrivateChat(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "conversationID"),
|
||||
value(methodCall, "isPrivate")
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteConversationFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteConversationFromLocalAndSvr(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "conversationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteAllConversationFromLocal(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteAllConversationFromLocal(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void resetConversationGroupAtType(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.resetConversationGroupAtType(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "conversationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getAtAllTag(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.getAtAllTag());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,83 +2,114 @@ package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.FriendshipListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnBaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnFriendshipListener;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class FriendshipManager extends BaseManager {
|
||||
|
||||
|
||||
public void setFriendListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setFriendListener(new FriendshipListener());
|
||||
Open_im_sdk.setFriendListener(new OnFriendshipListener());
|
||||
}
|
||||
|
||||
public void getFriendsInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getFriendsInfo(new BaseListener(result),
|
||||
jsonValue(methodCall, "uidList"));
|
||||
Open_im_sdk.getDesignatedFriendsInfo(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "uidList")
|
||||
);
|
||||
}
|
||||
|
||||
public void addFriend(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.addFriend(new BaseListener(result),
|
||||
jsonValue(methodCall));
|
||||
Open_im_sdk.addFriend(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
|
||||
public void getFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getFriendApplicationList(new BaseListener(result));
|
||||
public void getRecvFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getRecvFriendApplicationList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getSendFriendApplicationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getSendFriendApplicationList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getFriendList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getFriendList(new BaseListener(result));
|
||||
Open_im_sdk.getFriendList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void setFriendInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setFriendInfo(
|
||||
jsonValue(methodCall), new BaseListener(result));
|
||||
public void setFriendRemark(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setFriendRemark(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
|
||||
public void addToBlackList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.addToBlackList(new BaseListener(result),
|
||||
jsonValue(methodCall, "uid"));
|
||||
public void addBlacklist(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.addBlack(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "uid")
|
||||
);
|
||||
}
|
||||
|
||||
public void getBlackList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getBlackList(new BaseListener(result));
|
||||
public void getBlacklist(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getBlackList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteFromBlackList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteFromBlackList(new BaseListener(result),
|
||||
jsonValue(methodCall, "uid"));
|
||||
public void removeBlacklist(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.removeBlack(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "uid")
|
||||
);
|
||||
}
|
||||
|
||||
public void checkFriend(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.checkFriend(new BaseListener(result),
|
||||
jsonValue(methodCall, "uidList"));
|
||||
Open_im_sdk.checkFriend(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "uidList")
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteFromFriendList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteFromFriendList(
|
||||
jsonValue(methodCall, "uid"), new BaseListener(result));
|
||||
public void deleteFriend(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteFriend(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "uid")
|
||||
);
|
||||
}
|
||||
|
||||
public void acceptFriendApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.acceptFriendApplication(new BaseListener(result),
|
||||
jsonValue(methodCall, "uid"));
|
||||
Open_im_sdk.acceptFriendApplication(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
|
||||
public void refuseFriendApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.refuseFriendApplication(new BaseListener(result),
|
||||
jsonValue(methodCall, "uid"));
|
||||
Open_im_sdk.refuseFriendApplication(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
|
||||
// public void forceSyncFriendApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.forceSyncFriendApplication();
|
||||
// }
|
||||
//
|
||||
// public void forceSyncFriend(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.forceSyncFriend();
|
||||
// }
|
||||
//
|
||||
// public void forceSyncBlackList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.forceSyncBlackList();
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -2,120 +2,192 @@ package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.GroupListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnBaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnGroupListener;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class GroupManager extends BaseManager {
|
||||
|
||||
public void setGroupListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setGroupListener(new GroupListener());
|
||||
Open_im_sdk.setGroupListener(new OnGroupListener());
|
||||
}
|
||||
|
||||
public void inviteUserToGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.inviteUserToGroup(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "reason"),
|
||||
jsonValue(methodCall, "uidList"),
|
||||
new BaseListener(result));
|
||||
jsonValue(methodCall, "uidList")
|
||||
);
|
||||
}
|
||||
|
||||
public void kickGroupMember(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.kickGroupMember(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "reason"),
|
||||
jsonValue(methodCall, "uidList"),
|
||||
new BaseListener(result));
|
||||
jsonValue(methodCall, "uidList")
|
||||
);
|
||||
}
|
||||
|
||||
public void getGroupMembersInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getGroupMembersInfo(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
jsonValue(methodCall, "uidList"),
|
||||
new BaseListener(result));
|
||||
jsonValue(methodCall, "uidList")
|
||||
);
|
||||
}
|
||||
|
||||
public void getGroupMemberList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getGroupMemberList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "filter"),
|
||||
value(methodCall, "next"),
|
||||
new BaseListener(result));
|
||||
value(methodCall, "offset"),
|
||||
value(methodCall, "count")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public void getJoinedGroupList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getJoinedGroupList(new BaseListener(result));
|
||||
Open_im_sdk.getJoinedGroupList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void createGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.createGroup(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "gInfo"),
|
||||
jsonValue(methodCall, "memberList"),
|
||||
new BaseListener(result));
|
||||
jsonValue(methodCall, "memberList")
|
||||
);
|
||||
}
|
||||
|
||||
public void setGroupInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setGroupInfo(jsonValue(methodCall, "gInfo"), new BaseListener(result));
|
||||
Open_im_sdk.setGroupInfo(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
jsonValue(methodCall, "gInfo")
|
||||
);
|
||||
}
|
||||
|
||||
public void getGroupsInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getGroupsInfo(jsonValue(methodCall, "gidList"), new BaseListener(result));
|
||||
Open_im_sdk.getGroupsInfo(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "gidList")
|
||||
);
|
||||
}
|
||||
|
||||
public void joinGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.joinGroup(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "reason"),
|
||||
new BaseListener(result));
|
||||
value(methodCall, "reason")
|
||||
);
|
||||
}
|
||||
|
||||
public void quitGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.quitGroup(
|
||||
value(methodCall, "gid"),
|
||||
new BaseListener(result));
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid")
|
||||
);
|
||||
}
|
||||
|
||||
public void transferGroupOwner(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.transferGroupOwner(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "uid"),
|
||||
new BaseListener(result));
|
||||
value(methodCall, "uid")
|
||||
);
|
||||
}
|
||||
|
||||
public void getGroupApplicationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getGroupApplicationList(new BaseListener(result));
|
||||
public void getRecvGroupApplicationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getRecvGroupApplicationList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getSendGroupApplicationList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getSendGroupApplicationList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void acceptGroupApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.acceptGroupApplication(
|
||||
jsonValue(methodCall, "application"),
|
||||
value(methodCall, "reason"),
|
||||
new BaseListener(result));
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "uid"),
|
||||
value(methodCall, "handleMsg")
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public void refuseGroupApplication(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.refuseGroupApplication(
|
||||
jsonValue(methodCall, "application"),
|
||||
value(methodCall, "reason"),
|
||||
new BaseListener(result));
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "uid"),
|
||||
value(methodCall, "handleMsg")
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// public void forceSyncApplyGroupRequest(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.forceSyncApplyGroupRequest();
|
||||
// }
|
||||
//
|
||||
// public void forceSyncGroupRequest(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.forceSyncGroupRequest();
|
||||
// }
|
||||
//
|
||||
// public void forceSyncJoinedGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.forceSyncJoinedGroup();
|
||||
// }
|
||||
//
|
||||
// public void forceSyncJoinedGroupMember(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.forceSyncJoinedGroupMember();
|
||||
// }
|
||||
public void dismissGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.dismissGroup(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid")
|
||||
);
|
||||
}
|
||||
|
||||
public void changeGroupMute(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.changeGroupMute(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "mute")
|
||||
);
|
||||
}
|
||||
|
||||
public void changeGroupMemberMute(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.changeGroupMemberMute(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "uid"),
|
||||
int2long(methodCall, "seconds")
|
||||
);
|
||||
}
|
||||
|
||||
public void setGroupMemberNickname(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setGroupMemberNickname(new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "gid"),
|
||||
value(methodCall, "uid"),
|
||||
value(methodCall, "groupNickname")
|
||||
);
|
||||
}
|
||||
|
||||
public void searchGroups(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.searchGroups(new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "searchParam")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.SDKListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnBaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnConnListener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
@@ -11,47 +11,37 @@ public class IMManager extends BaseManager {
|
||||
|
||||
public void initSDK(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.initSDK(
|
||||
jsonValue(methodCall), new SDKListener()));
|
||||
// CommonUtil.runMainThreadReturn(result, null);
|
||||
new OnConnListener(),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall))
|
||||
);
|
||||
}
|
||||
|
||||
public void login(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.login(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "uid"),
|
||||
value(methodCall, "token"), new BaseListener(result));
|
||||
value(methodCall, "token")
|
||||
);
|
||||
}
|
||||
|
||||
public void logout(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.logout(new BaseListener(result));
|
||||
Open_im_sdk.logout(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getLoginStatus(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.getLoginStatus());
|
||||
}
|
||||
|
||||
// public void getLoginUid(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// CommonUtil.runMainThreadReturn(result, Open_im_sdk.getLoginUid());
|
||||
// }
|
||||
|
||||
public void getUsersInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getUsersInfo(
|
||||
jsonValue(methodCall, "uidList"), new BaseListener(result));
|
||||
public void wakeUp(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.wakeUp(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void setSelfInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setSelfInfo(
|
||||
jsonValue(methodCall), new BaseListener(result));
|
||||
}
|
||||
|
||||
public void forceSyncLoginUerInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.forceSyncLoginUerInfo();
|
||||
}
|
||||
|
||||
// public void forceReConn(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.forceReConn();
|
||||
// }
|
||||
|
||||
public void setSdkLog(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setSdkLog(value(methodCall, "sdkLog"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.AdvancedMsgListener;
|
||||
import io.openim.flutter_openim_sdk.listener.BaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.MsgSendProgressListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnAdvancedMsgListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnBaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnMsgSendListener;
|
||||
import io.openim.flutter_openim_sdk.util.CommonUtil;
|
||||
import open_im_sdk.OnAdvancedMsgListener;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
|
||||
public class MessageManager extends BaseManager {
|
||||
private final static String KEY_ID = "id";
|
||||
// private final static Map<String, OnAdvancedMsgListener> listeners = new HashMap<>();
|
||||
private static boolean initializedListener = false;
|
||||
/* private static boolean initializedListener = false;
|
||||
private final static Map<String, AdvancedMsgListener> listeners = new ConcurrentHashMap<>();
|
||||
|
||||
// protected void clearListeners() {
|
||||
// initializedListener = false;
|
||||
// listeners.clear();
|
||||
// }
|
||||
protected void clearListeners() {
|
||||
initializedListener = false;
|
||||
listeners.clear();
|
||||
}
|
||||
|
||||
private final static OnAdvancedMsgListener sdkMsgListener = new OnAdvancedMsgListener() {
|
||||
@Override
|
||||
@@ -50,21 +46,21 @@ public class MessageManager extends BaseManager {
|
||||
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);
|
||||
// }
|
||||
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);
|
||||
// }
|
||||
}
|
||||
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) {
|
||||
@@ -83,81 +79,132 @@ public class MessageManager extends BaseManager {
|
||||
}
|
||||
|
||||
*/
|
||||
public void setAdvancedMsgListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
String key = methodCall.argument(KEY_ID);
|
||||
Open_im_sdk.setAdvancedMsgListener(new OnAdvancedMsgListener(key));
|
||||
}
|
||||
|
||||
public void sendMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
MsgSendProgressListener listener = new MsgSendProgressListener(result, methodCall);
|
||||
Open_im_sdk.sendMessage(listener,
|
||||
Open_im_sdk.sendMessage(
|
||||
new OnMsgSendListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "message"),
|
||||
value(methodCall, "userID"),
|
||||
value(methodCall, "groupID"),
|
||||
value(methodCall, "onlineUserOnly"));
|
||||
jsonValue(methodCall, "offlinePushInfo")
|
||||
);
|
||||
}
|
||||
|
||||
public void getHistoryMessageList(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getHistoryMessageList(new BaseListener(result), jsonValue(methodCall));
|
||||
Open_im_sdk.getHistoryMessageList(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
|
||||
public void revokeMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.revokeMessage(new BaseListener(result), jsonValue(methodCall));
|
||||
Open_im_sdk.revokeMessage(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteMessageFromLocalStorage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteMessageFromLocalStorage(new BaseListener(result), jsonValue(methodCall));
|
||||
Open_im_sdk.deleteMessageFromLocalStorage(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteMessages(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.deleteMessages(new BaseListener(result), CommonUtil.getSDKJsonParam(methodCall));
|
||||
}
|
||||
// public void deleteMessages(MethodCall methodCall, MethodChannel.Result result) {
|
||||
// Open_im_sdk.deleteMessages(new OnBaseListener(result, methodCall), CommonUtil.getSDKJsonParam(methodCall));
|
||||
// }
|
||||
|
||||
public void insertSingleMessageToLocalStorage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.insertSingleMessageToLocalStorage(new BaseListener(result),
|
||||
Open_im_sdk.insertSingleMessageToLocalStorage(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "message"),
|
||||
value(methodCall, "receiverID"),
|
||||
value(methodCall, "senderID"));
|
||||
value(methodCall, "senderID")
|
||||
);
|
||||
}
|
||||
|
||||
public void findMessages(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.findMessages(new BaseListener(result), jsonValue(methodCall, "messageIDList"));
|
||||
public void insertGroupMessageToLocalStorage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.insertGroupMessageToLocalStorage(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "message"),
|
||||
value(methodCall, "groupID"),
|
||||
value(methodCall, "senderID")
|
||||
);
|
||||
}
|
||||
|
||||
public void markC2CMessageAsRead(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.markC2CMessageAsRead(new BaseListener(result),
|
||||
Open_im_sdk.markC2CMessageAsRead(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "userID"),
|
||||
jsonValue(methodCall, "messageIDList"));
|
||||
jsonValue(methodCall, "messageIDList")
|
||||
);
|
||||
}
|
||||
|
||||
public void markGroupMessageAsRead(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.markGroupMessageAsRead(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "groupID"),
|
||||
jsonValue(methodCall, "messageIDList")
|
||||
);
|
||||
}
|
||||
|
||||
public void typingStatusUpdate(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.typingStatusUpdate(value(methodCall, "userID"),
|
||||
value(methodCall, "typing"));
|
||||
Open_im_sdk.typingStatusUpdate(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "userID"),
|
||||
value(methodCall, "msgTip")
|
||||
);
|
||||
}
|
||||
|
||||
public void createTextMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createTextMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "text")));
|
||||
}
|
||||
|
||||
public void createTextAtMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createTextAtMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "text"),
|
||||
jsonValue(methodCall, "atUserList")));
|
||||
jsonValue(methodCall, "atUserIDList"),
|
||||
jsonValue(methodCall, "atUserInfoList"),
|
||||
jsonValue(methodCall, "quoteMessage")
|
||||
));
|
||||
}
|
||||
|
||||
public void createImageMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createImageMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "imagePath")));
|
||||
}
|
||||
|
||||
public void createImageMessageFromFullPath(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createImageMessageFromFullPath(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "imagePath")));
|
||||
}
|
||||
public void createSoundMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createSoundMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "soundPath"),
|
||||
int2long(methodCall, "duration")));
|
||||
}
|
||||
@@ -165,6 +212,7 @@ public class MessageManager extends BaseManager {
|
||||
public void createSoundMessageFromFullPath(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createSoundMessageFromFullPath(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "soundPath"),
|
||||
int2long(methodCall, "duration")));
|
||||
}
|
||||
@@ -172,6 +220,7 @@ public class MessageManager extends BaseManager {
|
||||
public void createVideoMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createVideoMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "videoPath"),
|
||||
value(methodCall, "videoType"),
|
||||
int2long(methodCall, "duration"),
|
||||
@@ -181,6 +230,7 @@ public class MessageManager extends BaseManager {
|
||||
public void createVideoMessageFromFullPath(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createVideoMessageFromFullPath(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "videoPath"),
|
||||
value(methodCall, "videoType"),
|
||||
int2long(methodCall, "duration"),
|
||||
@@ -190,6 +240,7 @@ public class MessageManager extends BaseManager {
|
||||
public void createFileMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createFileMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "filePath"),
|
||||
value(methodCall, "fileName")));
|
||||
}
|
||||
@@ -197,6 +248,7 @@ public class MessageManager extends BaseManager {
|
||||
public void createFileMessageFromFullPath(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createFileMessageFromFullPath(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "filePath"),
|
||||
value(methodCall, "fileName")));
|
||||
}
|
||||
@@ -204,6 +256,7 @@ public class MessageManager extends BaseManager {
|
||||
public void createMergerMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createMergerMessage(
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "messageList"),
|
||||
value(methodCall, "title"),
|
||||
jsonValue(methodCall, "summaryList")));
|
||||
@@ -213,11 +266,13 @@ public class MessageManager extends BaseManager {
|
||||
public void createForwardMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result,
|
||||
Open_im_sdk.createForwardMessage(
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "message")));
|
||||
}
|
||||
|
||||
public void createLocationMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createLocationMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "description"),
|
||||
value(methodCall, "longitude"),
|
||||
value(methodCall, "latitude")
|
||||
@@ -226,6 +281,7 @@ public class MessageManager extends BaseManager {
|
||||
|
||||
public void createCustomMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createCustomMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "data"),
|
||||
value(methodCall, "extension"),
|
||||
value(methodCall, "description")
|
||||
@@ -234,6 +290,7 @@ public class MessageManager extends BaseManager {
|
||||
|
||||
public void createQuoteMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createQuoteMessage(
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "quoteText"),
|
||||
jsonValue(methodCall, "quoteMessage")
|
||||
));
|
||||
@@ -241,21 +298,95 @@ public class MessageManager extends BaseManager {
|
||||
|
||||
public void createCardMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createCardMessage(
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "cardMessage")
|
||||
));
|
||||
}
|
||||
|
||||
public void forceSyncMsg(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.forceSyncMsg();
|
||||
public void createFaceMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
CommonUtil.runMainThreadReturn(result, Open_im_sdk.createFaceMessage(
|
||||
value(methodCall, "operationID"),
|
||||
int2long(methodCall, "index"),
|
||||
value(methodCall, "data")
|
||||
));
|
||||
}
|
||||
|
||||
public void clearC2CHistoryMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.clearC2CHistoryMessage(new BaseListener(result),
|
||||
value(methodCall, "userID"));
|
||||
Open_im_sdk.clearC2CHistoryMessage(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "userID")
|
||||
);
|
||||
}
|
||||
|
||||
public void clearGroupHistoryMessage(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.clearGroupHistoryMessage(new BaseListener(result),
|
||||
value(methodCall, "groupID"));
|
||||
Open_im_sdk.clearGroupHistoryMessage(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "groupID")
|
||||
);
|
||||
}
|
||||
|
||||
public void searchLocalMessages(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.searchLocalMessages(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "filter")
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteMessageFromLocalAndSvr(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteAllMsgFromLocal(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteAllMsgFromLocal(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void deleteAllMsgFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.deleteAllMsgFromLocalAndSvr(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
|
||||
public void markMessageAsReadByConID(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.markMessageAsReadByConID(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "conversationID"),
|
||||
jsonValue(methodCall, "messageIDList")
|
||||
);
|
||||
}
|
||||
|
||||
public void clearC2CHistoryMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.clearC2CHistoryMessageFromLocalAndSvr(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "userID")
|
||||
);
|
||||
}
|
||||
|
||||
public void clearGroupHistoryMessageFromLocalAndSvr(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.clearGroupHistoryMessageFromLocalAndSvr(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
value(methodCall, "groupID")
|
||||
);
|
||||
}
|
||||
|
||||
public void getHistoryMessageListReverse(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getHistoryMessageListReverse(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.OnBaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnSignalingListener;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class SignalingManager extends BaseManager {
|
||||
|
||||
public void setSignalingListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setSignalingListener(new OnSignalingListener());
|
||||
}
|
||||
|
||||
public void signalingInvite(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.signalingInvite(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "signalingInfo"));
|
||||
}
|
||||
|
||||
public void signalingInviteInGroup(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.signalingInviteInGroup(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "signalingInfo"));
|
||||
}
|
||||
|
||||
public void signalingAccept(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.signalingAccept(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "signalingInfo"));
|
||||
}
|
||||
|
||||
public void signalingReject(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.signalingReject(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "signalingInfo"));
|
||||
}
|
||||
|
||||
public void signalingCancel(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.signalingCancel(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "signalingInfo"));
|
||||
}
|
||||
|
||||
public void signalingHungUp(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.signalingHungUp(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "signalingInfo"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.OnBaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnUserListener;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class UserManager extends BaseManager {
|
||||
|
||||
public void setUserListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setUserListener(new OnUserListener());
|
||||
}
|
||||
|
||||
public void getUsersInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getUsersInfo(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall, "uidList"));
|
||||
}
|
||||
|
||||
public void setSelfInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setSelfInfo(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
jsonValue(methodCall));
|
||||
}
|
||||
|
||||
public void getSelfUserInfo(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getSelfUserInfo(
|
||||
new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID")
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.openim.flutter_openim_sdk.manager;
|
||||
|
||||
import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.openim.flutter_openim_sdk.listener.OnBaseListener;
|
||||
import io.openim.flutter_openim_sdk.listener.OnWorkMomentsListener;
|
||||
import open_im_sdk.Open_im_sdk;
|
||||
|
||||
public class WorkMomentsManager extends BaseManager {
|
||||
|
||||
public void setWorkMomentsListener(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.setWorkMomentsListener(new OnWorkMomentsListener());
|
||||
}
|
||||
|
||||
public void getWorkMomentsUnReadCount(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getWorkMomentsUnReadCount(new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"));
|
||||
}
|
||||
|
||||
public void getWorkMomentsNotification(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.getWorkMomentsNotification(new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"),
|
||||
int2long(methodCall, "offset"),
|
||||
int2long(methodCall, "count"));
|
||||
}
|
||||
|
||||
public void clearWorkMomentsNotification(MethodCall methodCall, MethodChannel.Result result) {
|
||||
Open_im_sdk.clearWorkMomentsNotification(new OnBaseListener(result, methodCall),
|
||||
value(methodCall, "operationID"));
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class CommonUtil {
|
||||
runMainThreadReturnError(result, String.valueOf(errorCode), errorMessage, errorDetails);
|
||||
}
|
||||
|
||||
public synchronized static <T> void emitEvent(String method, String type, Long errCode, String errMsg, T data) {
|
||||
public synchronized static <T> void emitEvent(String method, String type, Object errCode, String errMsg, T data) {
|
||||
runMainThread(() -> {
|
||||
Map<String, Object> res = new ArrayMap<>();
|
||||
if (null != type) {
|
||||
|
||||
@@ -4,8 +4,9 @@ import org.json.JSONObject;
|
||||
|
||||
public class JsonUtil {
|
||||
public static String toString(Object o) {
|
||||
if (o == null) return null;
|
||||
if (o instanceof String) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append("\"");
|
||||
buffer.append(o);
|
||||
buffer.append("\"");
|
||||
|
||||
@@ -138,7 +138,6 @@
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
215A1CA82008A326A8ECBF65 /* [CP] Embed Pods Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -155,7 +154,7 @@
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1020;
|
||||
LastUpgradeCheck = 1300;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
97C146ED1CF9000F007C117D = {
|
||||
@@ -197,23 +196,6 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
215A1CA82008A326A8ECBF65 /* [CP] Embed Pods Frameworks */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||
);
|
||||
name = "[CP] Embed Pods Frameworks";
|
||||
outputFileListPaths = (
|
||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -302,6 +284,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = arm64;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
@@ -375,6 +358,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = arm64;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
@@ -430,6 +414,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = arm64;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
LastUpgradeVersion = "1300"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
@@ -15,7 +13,6 @@ class MyApp extends StatefulWidget {
|
||||
class _MyAppState extends State<MyApp> {
|
||||
@override
|
||||
void initState() {
|
||||
_initSDK();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -28,81 +25,10 @@ class _MyAppState extends State<MyApp> {
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
TextButton(onPressed: _login, child: Text('login')),
|
||||
TextButton(onPressed: () {}, child: Text('login')),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _login() {
|
||||
if (OpenIM.iMManager.isInitialized)
|
||||
OpenIM.iMManager.login(uid: '', token: '');
|
||||
}
|
||||
|
||||
void _initSDK() async {
|
||||
// Initialize SDK
|
||||
OpenIM.iMManager
|
||||
..initSDK(
|
||||
platform: Platform.isAndroid ? IMPlatform.android : IMPlatform.ios,
|
||||
ipApi: '',
|
||||
ipWs: '',
|
||||
dbPath: '',
|
||||
listener: OnInitSDKListener(
|
||||
onConnecting: () {},
|
||||
onConnectFailed: (code, error) {},
|
||||
onConnectSuccess: () {},
|
||||
onKickedOffline: () {},
|
||||
onUserSigExpired: () {},
|
||||
onSelfInfoUpdated: (user) {},
|
||||
),
|
||||
)
|
||||
|
||||
// Add message listener (remove when not in use)
|
||||
..messageManager.addAdvancedMsgListener(OnAdvancedMsgListener(
|
||||
onRecvMessageRevoked: (msgId) {},
|
||||
onRecvC2CReadReceipt: (list) {},
|
||||
onRecvNewMessage: (msg) {},
|
||||
))
|
||||
|
||||
// Set up message sending progress listener
|
||||
..messageManager.setMsgSendProgressListener(OnMsgSendProgressListener(
|
||||
onProgress: (msgId, progress) {},
|
||||
))
|
||||
|
||||
// Set up friend relationship listener
|
||||
..friendshipManager.setFriendshipListener(OnFriendshipListener(
|
||||
onBlackListAdd: (u) {},
|
||||
onBlackListDeleted: (u) {},
|
||||
onFriendApplicationListAccept: (u) {},
|
||||
onFriendApplicationListAdded: (u) {},
|
||||
onFriendApplicationListDeleted: (u) {},
|
||||
onFriendApplicationListReject: (u) {},
|
||||
onFriendInfoChanged: (u) {},
|
||||
onFriendListAdded: (u) {},
|
||||
onFriendListDeleted: (u) {},
|
||||
))
|
||||
|
||||
// Set up conversation listener
|
||||
..conversationManager.setConversationListener(OnConversationListener(
|
||||
onConversationChanged: (list) {},
|
||||
onNewConversation: (list) {},
|
||||
onTotalUnreadMessageCountChanged: (count) {},
|
||||
onSyncServerFailed: () {},
|
||||
onSyncServerFinish: () {},
|
||||
onSyncServerStart: () {},
|
||||
))
|
||||
|
||||
// Set up group listener
|
||||
..groupManager.setGroupListener(OnGroupListener(
|
||||
onApplicationProcessed: (groupId, opUser, agreeOrReject, opReason) {},
|
||||
onGroupCreated: (groupId) {},
|
||||
onGroupInfoChanged: (groupId, info) {},
|
||||
onMemberEnter: (groupId, list) {},
|
||||
onMemberInvited: (groupId, opUser, list) {},
|
||||
onMemberKicked: (groupId, opUser, list) {},
|
||||
onMemberLeave: (groupId, info) {},
|
||||
onReceiveJoinApplication: (groupId, info, opReason) {},
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "1.0.9"
|
||||
version: "2.0.0+6"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -81,6 +81,13 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.12.11"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -141,7 +148,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.4.3"
|
||||
version: "0.4.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
//
|
||||
// BaseCallback.swift
|
||||
// flutter_openim_sdk
|
||||
//
|
||||
// Created by willem on 2021/10/9.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
public class BaseCallback: NSObject, Open_im_sdkBaseProtocol {
|
||||
public class BaseCallback: NSObject, Open_im_sdk_callbackBaseProtocol {
|
||||
|
||||
private let result:FlutterResult
|
||||
|
||||
@@ -16,7 +9,7 @@ public class BaseCallback: NSObject, Open_im_sdkBaseProtocol {
|
||||
self.result = result
|
||||
}
|
||||
|
||||
public func onError(_ errCode: Int, errMsg: String?) {
|
||||
public func onError(_ errCode: Int32, errMsg: String?) {
|
||||
print("BaseResult: " + errMsg!)
|
||||
safeMainAsync { self.result(FlutterError(code: "\(errCode)", message: errMsg, details: nil)) }
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
public class CommonUtil {
|
||||
|
||||
public static func emitEvent(channel: FlutterMethodChannel, method: String, type: String, errCode: Int?, errMsg: String?, data: Any?){
|
||||
public static func emitEvent(channel: FlutterMethodChannel, method: String, type: String, errCode: Int32?, errMsg: String?, data: Any?){
|
||||
safeMainAsync {
|
||||
var res: [String: Any] = [:]
|
||||
res["type"] = type
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
//
|
||||
// JsonUtil.swift
|
||||
// Runner
|
||||
//
|
||||
// Created by z1u24 on 2021/6/28.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public class JsonUtil {
|
||||
|
||||
public static func toString(object: AnyObject?)->String {
|
||||
|
||||
if object is NSNull {
|
||||
return ""
|
||||
}
|
||||
|
||||
if object == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
if object is String{
|
||||
let s = object as! String
|
||||
let b = s.replacingOccurrences(of: "\"", with: "\\\"")
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
//
|
||||
// BaseServiceManager.swift
|
||||
// flutter_openim_sdk
|
||||
//
|
||||
// Created by willem on 2021/10/9.
|
||||
//
|
||||
|
||||
import Flutter
|
||||
import OpenIMCore
|
||||
import UIKit
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
//
|
||||
// ConversationManager.swift
|
||||
// Runner
|
||||
//
|
||||
// Created by z1u24 on 2021/6/29.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
@@ -12,7 +5,6 @@ public class ConversationManager: BaseServiceManager {
|
||||
|
||||
public override func registerHandlers() {
|
||||
super.registerHandlers()
|
||||
|
||||
self["setConversationListener"] = setConversationListener
|
||||
self["getAllConversationList"] = getAllConversationList
|
||||
self["getConversationListSplit"] = getConversationListSplit
|
||||
@@ -21,12 +13,17 @@ public class ConversationManager: BaseServiceManager {
|
||||
self["deleteConversation"] = deleteConversation
|
||||
self["setConversationDraft"] = setConversationDraft
|
||||
self["pinConversation"] = pinConversation
|
||||
self["markSingleMessageHasRead"] = markSingleMessageHasRead
|
||||
// self["markSingleMessageHasRead"] = markSingleMessageHasRead
|
||||
self["markGroupMessageHasRead"] = markGroupMessageHasRead
|
||||
self["getTotalUnreadMsgCount"] = getTotalUnreadMsgCount
|
||||
self["getConversationIDBySessionType"] = getConversationIDBySessionType
|
||||
self["setConversationRecvMessageOpt"] = setConversationRecvMessageOpt
|
||||
self["getConversationRecvMessageOpt"] = getConversationRecvMessageOpt
|
||||
self["setOneConversationPrivateChat"] = setOneConversationPrivateChat
|
||||
self["deleteConversationFromLocalAndSvr"] = deleteConversationFromLocalAndSvr
|
||||
self["deleteAllConversationFromLocal"] = deleteAllConversationFromLocal
|
||||
self["resetConversationGroupAtType"] = resetConversationGroupAtType
|
||||
self["getAtAllTag"] = getAtAllTag
|
||||
}
|
||||
|
||||
func setConversationListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
@@ -35,43 +32,43 @@ public class ConversationManager: BaseServiceManager {
|
||||
}
|
||||
|
||||
func getAllConversationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetAllConversationList(BaseCallback(result: result))
|
||||
Open_im_sdkGetAllConversationList(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func getConversationListSplit(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetConversationListSplit(BaseCallback(result: result), methodCall[int: "offset"], methodCall[int: "count"])
|
||||
Open_im_sdkGetConversationListSplit(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "offset"], methodCall[int: "count"])
|
||||
}
|
||||
|
||||
func getOneConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetOneConversation(methodCall[string: "sourceID"], methodCall[int: "sessionType"], BaseCallback(result: result))
|
||||
Open_im_sdkGetOneConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "sessionType"], methodCall[string: "sourceID"])
|
||||
}
|
||||
|
||||
func getMultipleConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetMultipleConversation(methodCall[jsonString: "conversationIDList"], BaseCallback(result: result))
|
||||
Open_im_sdkGetMultipleConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"])
|
||||
}
|
||||
|
||||
func deleteConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkDeleteConversation(methodCall[string: "conversationID"], BaseCallback(result: result))
|
||||
Open_im_sdkDeleteConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
|
||||
}
|
||||
|
||||
func setConversationDraft(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetConversationDraft(methodCall[string: "conversationID"], methodCall[string: "draftText"], BaseCallback(result: result))
|
||||
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(methodCall[string: "conversationID"], methodCall[bool: "isPinned"], BaseCallback(result: result))
|
||||
Open_im_sdkPinConversation(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[bool: "isPinned"])
|
||||
}
|
||||
|
||||
func markSingleMessageHasRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkMarkSingleMessageHasRead(BaseCallback(result: result), methodCall[string: "userID"])
|
||||
}
|
||||
// func markSingleMessageHasRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
// Open_im_sdkMarkSingleMessageHasRead(BaseCallback(result: result), methodCall[string: "userID"])
|
||||
// }
|
||||
|
||||
func markGroupMessageHasRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkMarkGroupMessageHasRead(BaseCallback(result: result), methodCall[string: "groupID"])
|
||||
Open_im_sdkMarkGroupMessageHasRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
|
||||
}
|
||||
|
||||
func getTotalUnreadMsgCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetTotalUnreadMsgCount(BaseCallback(result: result))
|
||||
Open_im_sdkGetTotalUnreadMsgCount(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func getConversationIDBySessionType(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
@@ -80,16 +77,36 @@ public class ConversationManager: BaseServiceManager {
|
||||
}
|
||||
|
||||
func setConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[jsonString: "conversationIDList"], methodCall[int: "status"])
|
||||
Open_im_sdkSetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"], methodCall[int: "status"])
|
||||
}
|
||||
|
||||
func getConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[jsonString: "conversationIDList"])
|
||||
Open_im_sdkGetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "conversationIDList"])
|
||||
}
|
||||
|
||||
func setOneConversationPrivateChat(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetOneConversationPrivateChat(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"],methodCall[bool: "isPrivate"])
|
||||
}
|
||||
|
||||
func deleteConversationFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkDeleteConversationFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
|
||||
}
|
||||
|
||||
func deleteAllConversationFromLocal(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkDeleteAllConversationFromLocal(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func resetConversationGroupAtType(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkResetConversationGroupAtType(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"])
|
||||
}
|
||||
|
||||
func getAtAllTag(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkGetAtAllTag())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ConversationListener: NSObject, Open_im_sdkOnConversationListenerProtocol {
|
||||
public class ConversationListener: NSObject, Open_im_sdk_callbackOnConversationListenerProtocol {
|
||||
|
||||
private let channel:FlutterMethodChannel
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
//
|
||||
// FriendshipManager.swift
|
||||
// Runner
|
||||
//
|
||||
// Created by z1u24 on 2021/6/29.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
@@ -15,14 +8,15 @@ public class FriendshipManager: BaseServiceManager {
|
||||
self["setFriendListener"] = setFriendListener
|
||||
self["getFriendsInfo"] = getFriendsInfo
|
||||
self["addFriend"] = addFriend
|
||||
self["getFriendApplicationList"] = getFriendApplicationList
|
||||
self["getRecvFriendApplicationList"] = getRecvFriendApplicationList
|
||||
self["getSendFriendApplicationList"] = getSendFriendApplicationList
|
||||
self["getFriendList"] = getFriendList
|
||||
self["setFriendInfo"] = setFriendInfo
|
||||
self["addToBlackList"] = addToBlackList
|
||||
self["getBlackList"] = getBlackList
|
||||
self["deleteFromBlackList"] = deleteFromBlackList
|
||||
self["setFriendRemark"] = setFriendRemark
|
||||
self["addBlacklist"] = addBlacklist
|
||||
self["getBlacklist"] = getBlacklist
|
||||
self["removeBlacklist"] = removeBlacklist
|
||||
self["checkFriend"] = checkFriend
|
||||
self["deleteFromFriendList"] = deleteFromFriendList
|
||||
self["deleteFriend"] = deleteFriend
|
||||
self["acceptFriendApplication"] = acceptFriendApplication
|
||||
self["refuseFriendApplication"] = refuseFriendApplication
|
||||
// self["forceSyncFriendApplication"] = forceSyncFriendApplication
|
||||
@@ -36,51 +30,55 @@ public class FriendshipManager: BaseServiceManager {
|
||||
}
|
||||
|
||||
func getFriendsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetFriendsInfo(BaseCallback(result: result), methodCall[jsonString: "uidList"])
|
||||
Open_im_sdkGetDesignatedFriendsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "uidList"])
|
||||
}
|
||||
|
||||
func addFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkAddFriend(BaseCallback(result: result), methodCall.toJsonString())
|
||||
Open_im_sdkAddFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
func getFriendApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetFriendApplicationList(BaseCallback(result: result))
|
||||
func getRecvFriendApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetRecvFriendApplicationList(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
|
||||
func getSendFriendApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetSendFriendApplicationList(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func getFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetFriendList(BaseCallback(result: result))
|
||||
Open_im_sdkGetFriendList(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func setFriendInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetFriendInfo(methodCall.toJsonString(), BaseCallback(result: result))
|
||||
func setFriendRemark(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetFriendRemark(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
func addToBlackList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkAddToBlackList(BaseCallback(result: result), methodCall[jsonString: "uid"])
|
||||
func addBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkAddBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "uid"])
|
||||
}
|
||||
|
||||
func getBlackList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetBlackList(BaseCallback(result: result))
|
||||
func getBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetBlackList(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func deleteFromBlackList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkDeleteFromBlackList(BaseCallback(result: result), methodCall[jsonString: "uid"])
|
||||
func removeBlacklist(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkRemoveBlack(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "uid"])
|
||||
}
|
||||
|
||||
func checkFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkCheckFriend(BaseCallback(result: result), methodCall[jsonString: "uidList"])
|
||||
Open_im_sdkCheckFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "uidList"])
|
||||
}
|
||||
|
||||
func deleteFromFriendList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkDeleteFromFriendList(methodCall[jsonString: "uid"], BaseCallback(result: result))
|
||||
func deleteFriend(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkDeleteFriend(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "uid"])
|
||||
}
|
||||
|
||||
func acceptFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkAcceptFriendApplication(BaseCallback(result: result), methodCall[jsonString: "uid"])
|
||||
Open_im_sdkAcceptFriendApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
func refuseFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkRefuseFriendApplication(BaseCallback(result: result), methodCall[jsonString: "uid"])
|
||||
Open_im_sdkRefuseFriendApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
// func forceSyncFriendApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
@@ -99,48 +97,47 @@ public class FriendshipManager: BaseServiceManager {
|
||||
// }
|
||||
}
|
||||
|
||||
public class FriendshipListener: NSObject, Open_im_sdkOnFriendshipListenerProtocol {
|
||||
public class FriendshipListener: NSObject, Open_im_sdk_callbackOnFriendshipListenerProtocol {
|
||||
private let channel:FlutterMethodChannel
|
||||
|
||||
init(channel:FlutterMethodChannel) {
|
||||
self.channel = channel
|
||||
}
|
||||
|
||||
public func onBlackListAdd(_ userInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlackListAdd", errCode: nil, errMsg: nil, data: userInfo)
|
||||
public func onBlackAdded(_ blackInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlacklistAdded", errCode: nil, errMsg: nil, data: blackInfo)
|
||||
}
|
||||
|
||||
public func onBlackListDeleted(_ userInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlackListDeleted", errCode: nil, errMsg: nil, data: userInfo)
|
||||
public func onBlackDeleted(_ blackInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onBlacklistDeleted", errCode: nil, errMsg: nil, data: blackInfo)
|
||||
}
|
||||
|
||||
public func onFriendApplicationListAccept(_ applyUserInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationListAccept", errCode: nil, errMsg: nil, data: applyUserInfo)
|
||||
public func onFriendApplicationAccepted(_ friendApplication: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationAccepted", errCode: nil, errMsg: nil, data: friendApplication)
|
||||
}
|
||||
|
||||
public func onFriendApplicationListAdded(_ applyUserInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationListAdded", errCode: nil, errMsg: nil, data: applyUserInfo)
|
||||
public func onFriendApplicationAdded(_ friendApplication: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationAdded", errCode: nil, errMsg: nil, data: friendApplication)
|
||||
}
|
||||
|
||||
public func onFriendApplicationListDeleted(_ applyUserInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationListDeleted", errCode: nil, errMsg: nil, data: applyUserInfo)
|
||||
public func onFriendApplicationDeleted(_ friendApplication: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationDeleted", errCode: nil, errMsg: nil, data: friendApplication)
|
||||
}
|
||||
|
||||
public func onFriendApplicationListReject(_ applyUserInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationListReject", errCode: nil, errMsg: nil, data: applyUserInfo)
|
||||
public func onFriendApplicationRejected(_ friendApplication: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendApplicationRejected", errCode: nil, errMsg: nil, data: friendApplication)
|
||||
}
|
||||
|
||||
public func onFriendInfoChanged(_ friendInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendInfoChanged", errCode: nil, errMsg: nil, data: friendInfo)
|
||||
}
|
||||
|
||||
public func onFriendListAdded(_ friendInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendListAdded", errCode: nil, errMsg: nil, data: friendInfo)
|
||||
public func onFriendAdded(_ friendInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendAdded", errCode: nil, errMsg: nil, data: friendInfo)
|
||||
}
|
||||
|
||||
public func onFriendListDeleted(_ friendInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendListDeleted", errCode: nil, errMsg: nil, data: friendInfo)
|
||||
public func onFriendDeleted(_ friendInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "friendListener", type: "onFriendDeleted", errCode: nil, errMsg: nil, data: friendInfo)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
//
|
||||
// GroupManager.swift
|
||||
// flutter_openim_sdk
|
||||
//
|
||||
// Created by z1u24 on 2021/7/5.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
@@ -24,13 +17,15 @@ public class GroupManager: BaseServiceManager {
|
||||
self["joinGroup"] = joinGroup
|
||||
self["quitGroup"] = quitGroup
|
||||
self["transferGroupOwner"] = transferGroupOwner
|
||||
self["getGroupApplicationList"] = getGroupApplicationList
|
||||
self["getRecvGroupApplicationList"] = getRecvGroupApplicationList
|
||||
self["getSendGroupApplicationList"] = getSendGroupApplicationList
|
||||
self["acceptGroupApplication"] = acceptGroupApplication
|
||||
self["refuseGroupApplication"] = refuseGroupApplication
|
||||
// self["forceSyncApplyGroupRequest"] = forceSyncApplyGroupRequest
|
||||
// self["forceSyncGroupRequest"] = forceSyncGroupRequest
|
||||
// self["forceSyncJoinedGroup"] = forceSyncJoinedGroup
|
||||
// self["forceSyncJoinedGroupMember"] = forceSyncJoinedGroupMember
|
||||
self["dismissGroup"] = dismissGroup
|
||||
self["changeGroupMute"] = changeGroupMute
|
||||
self["changeGroupMemberMute"] = changeGroupMemberMute
|
||||
self["setGroupMemberNickname"] = setGroupMemberNickname
|
||||
self["searchGroups"] = searchGroups
|
||||
}
|
||||
|
||||
func setGroupListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
@@ -39,86 +34,90 @@ public class GroupManager: BaseServiceManager {
|
||||
}
|
||||
|
||||
func inviteUserToGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkInviteUserToGroup(methodCall[string: "gid"], methodCall[string: "reason"],
|
||||
methodCall[jsonString: "uidList"], BaseCallback(result: result))
|
||||
Open_im_sdkInviteUserToGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"],
|
||||
methodCall[jsonString: "uidList"])
|
||||
}
|
||||
|
||||
func kickGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkKickGroupMember(methodCall[string: "gid"], methodCall[string: "reason"],
|
||||
methodCall[jsonString: "uidList"], BaseCallback(result: result))
|
||||
Open_im_sdkKickGroupMember(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"],
|
||||
methodCall[jsonString: "uidList"])
|
||||
}
|
||||
|
||||
func getGroupMembersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetGroupMembersInfo(methodCall[string: "gid"], methodCall[jsonString: "uidList"], BaseCallback(result: result))
|
||||
Open_im_sdkGetGroupMembersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[jsonString: "uidList"])
|
||||
}
|
||||
|
||||
func getGroupMemberList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetGroupMemberList(methodCall[string: "gid"], methodCall[int32: "filter"],
|
||||
methodCall[int32: "next"], BaseCallback(result: result))
|
||||
Open_im_sdkGetGroupMemberList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[int32: "filter"],
|
||||
methodCall[int32: "offset"], methodCall[int32: "count"])
|
||||
}
|
||||
|
||||
func getJoinedGroupList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetJoinedGroupList(BaseCallback(result: result))
|
||||
Open_im_sdkGetJoinedGroupList(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func createGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkCreateGroup(methodCall[jsonString: "gInfo"], methodCall[jsonString: "memberList"], BaseCallback(result: result))
|
||||
Open_im_sdkCreateGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "gInfo"], methodCall[jsonString: "memberList"])
|
||||
}
|
||||
|
||||
func setGroupInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetGroupInfo(methodCall[jsonString: "gInfo"], BaseCallback(result: result))
|
||||
Open_im_sdkSetGroupInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[jsonString: "gInfo"])
|
||||
}
|
||||
|
||||
func getGroupsInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetGroupsInfo(methodCall[jsonString: "gidList"], BaseCallback(result: result))
|
||||
Open_im_sdkGetGroupsInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "gidList"])
|
||||
}
|
||||
|
||||
func joinGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkJoinGroup(methodCall[string: "gid"], methodCall[string: "reason"], BaseCallback(result: result))
|
||||
Open_im_sdkJoinGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "reason"])
|
||||
}
|
||||
|
||||
func quitGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkQuitGroup(methodCall[string: "gid"], BaseCallback(result: result))
|
||||
Open_im_sdkQuitGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"])
|
||||
}
|
||||
|
||||
func transferGroupOwner(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkTransferGroupOwner(methodCall[string: "gid"], methodCall[string: "uid"], BaseCallback(result: result))
|
||||
Open_im_sdkTransferGroupOwner(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "uid"])
|
||||
}
|
||||
|
||||
func getGroupApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetGroupApplicationList(BaseCallback(result: result))
|
||||
func getRecvGroupApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetRecvGroupApplicationList(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func getSendGroupApplicationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetSendGroupApplicationList(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func acceptGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkAcceptGroupApplication(methodCall[jsonString: "application"], methodCall[string: "reason"], BaseCallback(result: result))
|
||||
Open_im_sdkAcceptGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "uid"], methodCall[string: "handleMsg"])
|
||||
}
|
||||
|
||||
func refuseGroupApplication(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkRefuseGroupApplication(methodCall[jsonString: "application"], methodCall[string: "reason"], BaseCallback(result: result))
|
||||
Open_im_sdkRefuseGroupApplication(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string: "uid"], methodCall[string: "handleMsg"])
|
||||
}
|
||||
|
||||
// func forceSyncApplyGroupRequest(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
// Open_im_sdkForceSyncApplyGroupRequest()
|
||||
// callBack(result)
|
||||
// }
|
||||
//
|
||||
// func forceSyncGroupRequest(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
// Open_im_sdkForceSyncGroupRequest()
|
||||
// callBack(result)
|
||||
// }
|
||||
//
|
||||
// func forceSyncJoinedGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
// Open_im_sdkForceSyncJoinedGroup()
|
||||
// callBack(result)
|
||||
// }
|
||||
//
|
||||
// func forceSyncJoinedGroupMember(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
// Open_im_sdkForceSyncJoinedGroupMember()
|
||||
// callBack(result)
|
||||
// }
|
||||
|
||||
func dismissGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkDismissGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"])
|
||||
}
|
||||
|
||||
func changeGroupMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkChangeGroupMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[bool: "mute"])
|
||||
}
|
||||
|
||||
func changeGroupMemberMute(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkChangeGroupMemberMute(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string:"uid"],methodCall[int:"seconds"])
|
||||
}
|
||||
|
||||
func setGroupMemberNickname(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetGroupMemberNickname(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "gid"], methodCall[string:"uid"],methodCall[string:"groupNickname"])
|
||||
}
|
||||
|
||||
func searchGroups(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSearchGroups(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "searchParam"])
|
||||
}
|
||||
}
|
||||
public class GroupListener: NSObject, Open_im_sdkOnGroupListenerProtocol {
|
||||
|
||||
public class GroupListener: NSObject, Open_im_sdk_callbackOnGroupListenerProtocol {
|
||||
|
||||
private let channel:FlutterMethodChannel
|
||||
|
||||
@@ -126,73 +125,43 @@ public class GroupListener: NSObject, Open_im_sdkOnGroupListenerProtocol {
|
||||
self.channel = channel
|
||||
}
|
||||
|
||||
public func onApplicationProcessed(_ groupId: String?, opUser: String?, agreeOrReject AgreeOrReject: Int32, opReason: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["groupId"] = groupId
|
||||
values["opUser"] = opUser
|
||||
values["agreeOrReject"] = AgreeOrReject
|
||||
values["opReason"] = opReason
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onApplicationProcessed", errCode: nil, errMsg: nil, data: values)
|
||||
public func onGroupApplicationAccepted(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationAccepted", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
// public func onApplicationProcessed(_ s: String?,s1: String?,i: Int?,s2: String?) {
|
||||
// let values: NSMutableDictionary = NSMutableDictionary(capacity: 0)
|
||||
// values.setValue(s, forKey: "groupId")
|
||||
// values.setValue(s1, forKey: "opUser")
|
||||
// values.setValue(i, forKey: "agreeOrReject")
|
||||
// values.setValue(s2, forKey: "opReason")
|
||||
// CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onApplicationProcessed", errCode: nil, errMsg: nil, data: values)
|
||||
// }
|
||||
|
||||
public func onGroupCreated(_ s: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["groupId"] = s
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupCreated", errCode: nil, errMsg: nil, data: values)
|
||||
public func onGroupApplicationAdded(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationAdded", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onGroupInfoChanged(_ s: String?, groupInfo s1: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["groupId"] = s
|
||||
values["groupInfo"] = s1
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupInfoChanged", errCode: nil, errMsg: nil, data: values)
|
||||
public func onGroupApplicationDeleted(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationDeleted", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onMemberEnter(_ s: String?, memberList s1: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["groupId"] = s
|
||||
values["memberList"] = s1
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onMemberEnter", errCode: nil, errMsg: nil, data: values)
|
||||
public func onGroupApplicationRejected(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupApplicationRejected", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onMemberInvited(_ s: String?,opUser s1: String?, memberList s2: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["groupId"] = s
|
||||
values["opUser"] = s1
|
||||
values["memberList"] = s2
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onMemberInvited", errCode: nil, errMsg: nil, data: values)
|
||||
public func onGroupInfoChanged(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupInfoChanged", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onMemberKicked(_ s: String?,opUser s1: String?,memberList s2: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["groupId"] = s
|
||||
values["opUser"] = s1
|
||||
values["memberList"] = s2
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onMemberKicked", errCode: nil, errMsg: nil, data: values)
|
||||
public func onGroupMemberAdded(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberAdded", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onMemberLeave(_ s: String?,member s1: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["groupId"] = s
|
||||
values["member"] = s1
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onMemberLeave", errCode: nil, errMsg: nil, data: values)
|
||||
public func onGroupMemberDeleted(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberDeleted", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onReceiveJoinApplication(_ s: String?,member s1: String?,opReason s2: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["groupId"] = s
|
||||
values["member"] = s1
|
||||
values["opReason"] = s2
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onReceiveJoinApplication", errCode: nil, errMsg: nil, data: values)
|
||||
public func onGroupMemberInfoChanged(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onGroupMemberInfoChanged", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onJoinedGroupAdded(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onJoinedGroupAdded", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onJoinedGroupDeleted(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "groupListener", type: "onJoinedGroupDeleted", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
//
|
||||
// IMManager.swift
|
||||
// Runner
|
||||
//
|
||||
// Created by z1u24 on 2021/6/28.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
@@ -12,90 +5,59 @@ public class IMMananger: BaseServiceManager {
|
||||
|
||||
public override func registerHandlers() {
|
||||
super.registerHandlers()
|
||||
|
||||
self["initSDK"] = initSDK
|
||||
self["login"] = login
|
||||
self["logout"] = logout
|
||||
self["getLoginStatus"] = getLoginStatus
|
||||
// self["getLoginUid"] = getLoginUid
|
||||
self["getUsersInfo"] = getUsersInfo
|
||||
self["setSelfInfo"] = setSelfInfo
|
||||
self["forceSyncLoginUerInfo"] = forceSyncLoginUerInfo
|
||||
// self["forceReConn"] = forceReConn
|
||||
self["setSdkLog"] = setSdkLog
|
||||
self["wakeUp"] = wakeUp
|
||||
}
|
||||
|
||||
func initSDK(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkInitSDK(methodCall.toJsonString(), SDKListener(channel: self.channel))
|
||||
callBack(result)
|
||||
callBack(result,Open_im_sdkInitSDK(ConnListener(channel: self.channel), methodCall[string: "operationID"], methodCall.toJsonString()))
|
||||
}
|
||||
|
||||
func login(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkLogin(methodCall[string: "uid"], methodCall[string: "token"], BaseCallback(result: result))
|
||||
Open_im_sdkLogin(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "uid"], methodCall[string: "token"])
|
||||
}
|
||||
|
||||
func logout(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkLogout(BaseCallback(result: result))
|
||||
Open_im_sdkLogout(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func getLoginStatus(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
callBack(result, Open_im_sdkGetLoginStatus())
|
||||
}
|
||||
|
||||
// func getLoginUid(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
// callBack(result, Open_im_sdkGetLoginUser())
|
||||
// }
|
||||
|
||||
func getUsersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkGetUsersInfo(methodCall[jsonString: "uidList"], BaseCallback(result: result))
|
||||
func wakeUp(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkWakeUp(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func setSelfInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkSetSelfInfo(methodCall.toJsonString(), BaseCallback(result: result))
|
||||
}
|
||||
|
||||
func forceSyncLoginUerInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkForceSyncLoginUerInfo()
|
||||
callBack(result)
|
||||
}
|
||||
|
||||
func setSdkLog(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkSetSdkLog(methodCall[int32: "sdkLog"])
|
||||
}
|
||||
// func forceReConn(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
// Open_im_sdkForceReConn()
|
||||
// callBack(result)
|
||||
// }
|
||||
}
|
||||
|
||||
public class SDKListener: NSObject, Open_im_sdkIMSDKListenerProtocol {
|
||||
public class ConnListener: NSObject, Open_im_sdk_callbackOnConnListenerProtocol {
|
||||
private let channel:FlutterMethodChannel
|
||||
|
||||
init(channel:FlutterMethodChannel) {
|
||||
self.channel = channel
|
||||
}
|
||||
|
||||
public func onConnectFailed(_ errCode: Int, errMsg: String?) {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onConnectFailed", errCode: errCode, errMsg: errMsg, data: nil)
|
||||
public func onConnectFailed(_ errCode: Int32, errMsg: String?) {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onConnectFailed", errCode: errCode, errMsg: errMsg, data: nil)
|
||||
}
|
||||
|
||||
|
||||
public func onConnectSuccess() {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onConnectSuccess", errCode: nil, errMsg: nil, data: nil)
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onConnectSuccess", errCode: nil, errMsg: nil, data: nil)
|
||||
}
|
||||
|
||||
public func onConnecting() {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onConnecting", errCode: nil, errMsg: nil, data: nil)
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onConnecting", errCode: nil, errMsg: nil, data: nil)
|
||||
}
|
||||
|
||||
public func onKickedOffline() {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onKickedOffline", errCode: nil, errMsg: nil, data: nil)
|
||||
}
|
||||
|
||||
public func onSelfInfoUpdated(_ userInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onSelfInfoUpdated", errCode: nil, errMsg: nil, data: userInfo)
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onKickedOffline", errCode: nil, errMsg: nil, data: nil)
|
||||
}
|
||||
|
||||
public func onUserTokenExpired() {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "initSDKListener", type: "onUserTokenExpired", errCode: nil, errMsg: nil, data: nil)
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "connectListener", type: "onUserTokenExpired", errCode: nil, errMsg: nil, data: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,21 @@
|
||||
//
|
||||
// MessageManager.swift
|
||||
// Runner
|
||||
//
|
||||
// Created by z1u24 on 2021/6/29.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
public class MessageManager: BaseServiceManager {
|
||||
private let KEY_ID: String = "id"
|
||||
private var listeners: [String: AdvancedMsgListener] = [:]
|
||||
// private var listeners: [String: AdvancedMsgListener] = [:]
|
||||
|
||||
public override func registerHandlers() {
|
||||
super.registerHandlers()
|
||||
|
||||
self["addAdvancedMsgListener"] = addAdvancedMsgListener
|
||||
self["removeAdvancedMsgListener"] = removeAdvancedMsgListener
|
||||
self["setAdvancedMsgListener"] = setAdvancedMsgListener
|
||||
self["sendMessage"] = sendMessage
|
||||
self["getHistoryMessageList"] = getHistoryMessageList
|
||||
self["revokeMessage"] = revokeMessage
|
||||
self["deleteMessageFromLocalStorage"] = deleteMessageFromLocalStorage
|
||||
self["deleteMessages"] = deleteMessages
|
||||
self["insertSingleMessageToLocalStorage"] = insertSingleMessageToLocalStorage
|
||||
self["findMessages"] = findMessages
|
||||
self["insertGroupMessageToLocalStorage"] = insertGroupMessageToLocalStorage
|
||||
self["markC2CMessageAsRead"] = markC2CMessageAsRead
|
||||
self["markGroupMessageAsRead"] = markGroupMessageAsRead
|
||||
self["typingStatusUpdate"] = typingStatusUpdate
|
||||
self["createTextMessage"] = createTextMessage
|
||||
self["createTextAtMessage"] = createTextAtMessage
|
||||
@@ -35,237 +26,253 @@ public class MessageManager: BaseServiceManager {
|
||||
self["createVideoMessage"] = createVideoMessage
|
||||
self["createVideoMessageFromFullPath"] = createVideoMessageFromFullPath
|
||||
self["createFileMessage"] = createFileMessage
|
||||
self["createFileMessageFromFullPath"] = createFileMessageFromFullPath
|
||||
self["createMergerMessage"] = createMergerMessage
|
||||
self["createForwardMessage"] = createForwardMessage
|
||||
self["createLocationMessage"] = createLocationMessage
|
||||
self["createCustomMessage"] = createCustomMessage
|
||||
self["createQuoteMessage"] = createQuoteMessage
|
||||
self["createCardMessage"] = createCardMessage
|
||||
self["forceSyncMsg"] = forceSyncMsg
|
||||
self["createFaceMessage"] = createFaceMessage
|
||||
self["clearC2CHistoryMessage"] = clearC2CHistoryMessage
|
||||
self["clearGroupHistoryMessage"] = clearGroupHistoryMessage
|
||||
self["searchLocalMessages"] = searchLocalMessages
|
||||
self["deleteMessageFromLocalAndSvr"] = deleteMessageFromLocalAndSvr
|
||||
self["deleteAllMsgFromLocal"] = deleteAllMsgFromLocal
|
||||
self["deleteAllMsgFromLocalAndSvr"] = deleteAllMsgFromLocalAndSvr
|
||||
self["markMessageAsReadByConID"] = markMessageAsReadByConID
|
||||
self["clearC2CHistoryMessageFromLocalAndSvr"] = clearC2CHistoryMessageFromLocalAndSvr
|
||||
self["clearGroupHistoryMessageFromLocalAndSvr"] = clearGroupHistoryMessageFromLocalAndSvr
|
||||
self["getHistoryMessageListReverse"] = getHistoryMessageListReverse
|
||||
}
|
||||
|
||||
func addAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
func setAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let key = methodCall[string: KEY_ID]
|
||||
if listeners[key] == nil {
|
||||
let lis = AdvancedMsgListener(channel: channel, id: key)
|
||||
listeners[key] = lis
|
||||
Open_im_sdkAddAdvancedMsgListener(lis)
|
||||
print("=================add msg listener======\n\(lis)")
|
||||
}
|
||||
callBack(result)
|
||||
}
|
||||
|
||||
func removeAdvancedMsgListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let key = methodCall[string: KEY_ID]
|
||||
if let lis = listeners[key] {
|
||||
listeners[key] = nil
|
||||
// Open_im_sdkRemoveAdvancedMsgListener(lis)
|
||||
}
|
||||
let lis = AdvancedMsgListener(channel: channel, id: key)
|
||||
Open_im_sdkSetAdvancedMsgListener(lis)
|
||||
callBack(result)
|
||||
}
|
||||
|
||||
func sendMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let sendMsgProgressListener: SendMsgProgressListener = SendMsgProgressListener(channel: channel,result: result,methodCall: methodCall)
|
||||
// sendMsgProgressListener.setCall(methodCall: methodCall)
|
||||
// sendMsgProgressListener.setResult(result: result)
|
||||
print("===============sendMessage===============")
|
||||
Open_im_sdkSendMessage(sendMsgProgressListener, methodCall[jsonString: "message"], methodCall[string: "userID"],
|
||||
methodCall[string: "groupID"], methodCall[bool: "onlineUserOnly"])
|
||||
Open_im_sdkSendMessage(sendMsgProgressListener, methodCall[string: "operationID"], methodCall[jsonString: "message"], methodCall[string: "userID"],
|
||||
methodCall[string: "groupID"], methodCall[jsonString: "offlinePushInfo"])
|
||||
}
|
||||
|
||||
func getHistoryMessageList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetHistoryMessageList(BaseCallback(result: result), methodCall.toJsonString())
|
||||
Open_im_sdkGetHistoryMessageList(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
func revokeMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkRevokeMessage(BaseCallback(result: result), methodCall.toJsonString())
|
||||
Open_im_sdkRevokeMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
func deleteMessageFromLocalStorage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkDeleteMessageFromLocalStorage(BaseCallback(result: result), methodCall.toJsonString())
|
||||
Open_im_sdkDeleteMessageFromLocalStorage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
// deprecated
|
||||
func deleteMessages(methodCall: FlutterMethodCall, result: FlutterResult){
|
||||
}
|
||||
|
||||
func insertSingleMessageToLocalStorage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkInsertSingleMessageToLocalStorage(BaseCallback(result: result), methodCall[jsonString: "message"],
|
||||
Open_im_sdkInsertSingleMessageToLocalStorage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "message"],
|
||||
methodCall[string: "receiverID"], methodCall[string: "senderID"])
|
||||
}
|
||||
|
||||
func findMessages(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkFindMessages(BaseCallback(result: result), methodCall[jsonString: "messageIDList"])
|
||||
func insertGroupMessageToLocalStorage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkInsertGroupMessageToLocalStorage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "message"],
|
||||
methodCall[string: "groupID"], methodCall[string: "senderID"])
|
||||
}
|
||||
|
||||
func markC2CMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkMarkC2CMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"], methodCall[jsonString: "messageIDList"])
|
||||
}
|
||||
|
||||
func markC2CMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkMarkC2CMessageAsRead(BaseCallback(result: result), methodCall[string: "userID"], methodCall[jsonString: "messageIDList"])
|
||||
func markGroupMessageAsRead(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkMarkGroupMessageAsRead(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"], methodCall[jsonString: "messageIDList"])
|
||||
}
|
||||
|
||||
func typingStatusUpdate(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkTypingStatusUpdate(methodCall[string: "userID"], methodCall[string: "typing"])
|
||||
callBack(result)
|
||||
Open_im_sdkTypingStatusUpdate(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"], methodCall[string: "msgTip"])
|
||||
}
|
||||
|
||||
|
||||
func createTextMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateTextMessage(methodCall[string: "text"]))
|
||||
callBack(result, Open_im_sdkCreateTextMessage(methodCall[string: "operationID"], methodCall[string: "text"]))
|
||||
}
|
||||
|
||||
func createTextAtMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateTextAtMessage(methodCall[string: "text"], methodCall[jsonString: "atUserList"]))
|
||||
callBack(result, Open_im_sdkCreateTextAtMessage(methodCall[string: "operationID"], methodCall[string: "text"],
|
||||
methodCall[jsonString: "atUserIDList"], methodCall[jsonString: "atUserInfoList"], methodCall[jsonString: "quoteMessage"]))
|
||||
}
|
||||
|
||||
func createImageMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateImageMessage(methodCall[string: "imagePath"]))
|
||||
callBack(result, Open_im_sdkCreateImageMessage(methodCall[string: "operationID"], methodCall[string: "imagePath"]))
|
||||
}
|
||||
|
||||
func createImageMessageFromFullPath(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateImageMessageFromFullPath(methodCall[string: "imagePath"]))
|
||||
callBack(result, Open_im_sdkCreateImageMessageFromFullPath(methodCall[string: "operationID"], methodCall[string: "imagePath"]))
|
||||
}
|
||||
|
||||
func createSoundMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateSoundMessage(methodCall[string: "soundPath"], methodCall[int64: "duration"]))
|
||||
callBack(result, Open_im_sdkCreateSoundMessage(methodCall[string: "operationID"], methodCall[string: "soundPath"], methodCall[int64: "duration"]))
|
||||
}
|
||||
|
||||
func createSoundMessageFromFullPath(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateSoundMessageFromFullPath(methodCall[string: "soundPath"], methodCall[int64: "duration"]))
|
||||
callBack(result, Open_im_sdkCreateSoundMessageFromFullPath(methodCall[string: "operationID"], methodCall[string: "soundPath"], methodCall[int64: "duration"]))
|
||||
}
|
||||
|
||||
func createVideoMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let prama = Open_im_sdkCreateVideoMessage(methodCall[string: "videoPath"], methodCall[string: "videoType"],
|
||||
let prama = Open_im_sdkCreateVideoMessage(methodCall[string: "operationID"], methodCall[string: "videoPath"], methodCall[string: "videoType"],
|
||||
methodCall[int64: "duration"], methodCall[string: "snapshotPath"])
|
||||
callBack(result, prama)
|
||||
}
|
||||
|
||||
func createVideoMessageFromFullPath(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let prama = Open_im_sdkCreateVideoMessageFromFullPath(methodCall[string: "videoPath"], methodCall[string: "videoType"],
|
||||
methodCall[int64: "duration"], methodCall[string: "snapshotPath"])
|
||||
let prama = Open_im_sdkCreateVideoMessageFromFullPath(methodCall[string: "operationID"], methodCall[string: "videoPath"], methodCall[string: "videoType"],
|
||||
methodCall[int64: "duration"], methodCall[string: "snapshotPath"])
|
||||
callBack(result, prama)
|
||||
}
|
||||
|
||||
func createFileMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateFileMessage(methodCall[string: "filePath"], methodCall[string: "fileName"]))
|
||||
callBack(result, Open_im_sdkCreateFileMessage(methodCall[string: "operationID"], methodCall[string: "filePath"], methodCall[string: "fileName"]))
|
||||
}
|
||||
|
||||
func createFileMessageFromFullPath(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateFileMessageFromFullPath(methodCall[string: "filePath"], methodCall[string: "fileName"]))
|
||||
}
|
||||
|
||||
|
||||
func createFileMessageFromFullPath(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateFileMessageFromFullPath(methodCall[string: "operationID"], methodCall[string: "filePath"], methodCall[string: "fileName"]))
|
||||
}
|
||||
|
||||
func createMergerMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let prama = Open_im_sdkCreateMergerMessage(methodCall[jsonString: "messageList"], methodCall[string: "title"],
|
||||
let prama = Open_im_sdkCreateMergerMessage(methodCall[string: "operationID"], methodCall[jsonString: "messageList"], methodCall[string: "title"],
|
||||
methodCall[jsonString: "summaryList"])
|
||||
callBack(result, prama)
|
||||
}
|
||||
|
||||
func createForwardMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateForwardMessage(methodCall[jsonString: "message"]))
|
||||
callBack(result, Open_im_sdkCreateForwardMessage(methodCall[string: "operationID"], methodCall[jsonString: "message"]))
|
||||
}
|
||||
|
||||
func createLocationMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let prama = Open_im_sdkCreateLocationMessage(methodCall[string: "description"],
|
||||
let prama = Open_im_sdkCreateLocationMessage(methodCall[string: "operationID"], methodCall[string: "description"],
|
||||
methodCall[double: "longitude"], methodCall[double: "latitude"])
|
||||
callBack(result, prama)
|
||||
}
|
||||
|
||||
func createCustomMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let prama = Open_im_sdkCreateCustomMessage(methodCall[string: "data"],
|
||||
let prama = Open_im_sdkCreateCustomMessage(methodCall[string: "operationID"], methodCall[string: "data"],
|
||||
methodCall[string: "extension"], methodCall[string: "description"])
|
||||
callBack(result, prama)
|
||||
}
|
||||
|
||||
func createQuoteMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
let prama = Open_im_sdkCreateQuoteMessage(methodCall[string: "quoteText"], methodCall[jsonString: "quoteMessage"])
|
||||
let prama = Open_im_sdkCreateQuoteMessage(methodCall[string: "operationID"], methodCall[string: "quoteText"], methodCall[jsonString: "quoteMessage"])
|
||||
callBack(result, prama)
|
||||
}
|
||||
|
||||
func createCardMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateCardMessage(methodCall[jsonString: "cardMessage"]))
|
||||
callBack(result, Open_im_sdkCreateCardMessage(methodCall[string: "operationID"], methodCall[jsonString: "cardMessage"]))
|
||||
}
|
||||
|
||||
func forceSyncMsg(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkForceSyncMsg()
|
||||
callBack(result)
|
||||
|
||||
func createFaceMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
callBack(result, Open_im_sdkCreateFaceMessage(methodCall[string: "operationID"], methodCall[int: "index"], methodCall[string: "data"]))
|
||||
}
|
||||
|
||||
|
||||
func clearC2CHistoryMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkClearC2CHistoryMessage(BaseCallback(result: result), methodCall[string: "userID"])
|
||||
Open_im_sdkClearC2CHistoryMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"])
|
||||
}
|
||||
|
||||
|
||||
func clearGroupHistoryMessage(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkClearGroupHistoryMessage(BaseCallback(result: result), methodCall[string: "groupID"])
|
||||
Open_im_sdkClearGroupHistoryMessage(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
|
||||
}
|
||||
|
||||
func searchLocalMessages(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSearchLocalMessages(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "filter"])
|
||||
}
|
||||
|
||||
func deleteMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkDeleteMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
public class SendMsgProgressListener: NSObject, Open_im_sdkSendMsgCallBackProtocol {
|
||||
func deleteAllMsgFromLocal(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkDeleteAllMsgFromLocal(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func deleteAllMsgFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkDeleteAllMsgFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func markMessageAsReadByConID(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkMarkMessageAsReadByConID(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "conversationID"], methodCall[jsonString: "messageIDList"])
|
||||
}
|
||||
|
||||
func clearC2CHistoryMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkClearC2CHistoryMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "userID"])
|
||||
}
|
||||
|
||||
func clearGroupHistoryMessageFromLocalAndSvr(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkClearGroupHistoryMessageFromLocalAndSvr(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[string: "groupID"])
|
||||
}
|
||||
|
||||
func getHistoryMessageListReverse(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkGetHistoryMessageListReverse(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
public class SendMsgProgressListener: NSObject, Open_im_sdk_callbackSendMsgCallBackProtocol {
|
||||
private let channel: FlutterMethodChannel
|
||||
private let result: FlutterResult
|
||||
private let call: FlutterMethodCall
|
||||
|
||||
|
||||
init(channel: FlutterMethodChannel, result: @escaping FlutterResult, methodCall: FlutterMethodCall) {
|
||||
self.channel = channel
|
||||
self.result = result
|
||||
self.call = methodCall
|
||||
}
|
||||
|
||||
// func setResult(result: @escaping FlutterResult){
|
||||
// self.result = result
|
||||
// }
|
||||
//
|
||||
// func setCall(methodCall: FlutterMethodCall){
|
||||
// self.call = methodCall
|
||||
// }
|
||||
|
||||
public func onError(_ errCode: Int, errMsg: String?) {
|
||||
print("=================onError============\nerrcode:\(errCode),errMsg:\(errMsg!)")
|
||||
|
||||
public func onError(_ errCode: Int32, errMsg: String?) {
|
||||
DispatchQueue.main.async { self.result(FlutterError(code: "\(errCode)", message: errMsg, details: nil)) }
|
||||
}
|
||||
|
||||
|
||||
public func onProgress(_ progress: Int) {
|
||||
// guard let call = call else {
|
||||
// return
|
||||
// }
|
||||
var values: [String: Any] = [:]
|
||||
print("=================onProgress============\nprogress:\(progress)")
|
||||
let message = call[dict: "message"]
|
||||
values["clientMsgID"] = message["clientMsgID"]
|
||||
values["progress"] = progress
|
||||
CommonUtil.emitEvent(channel: channel, method: "msgSendProgressListener", type: "onProgress", errCode: nil, errMsg: nil, data: values)
|
||||
}
|
||||
|
||||
|
||||
public func onSuccess(_ data: String?) {
|
||||
print("=================onSuccess============\nsuccess:\(data!)")
|
||||
DispatchQueue.main.async { self.result(data) }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class AdvancedMsgListener: NSObject, Open_im_sdkOnAdvancedMsgListenerProtocol {
|
||||
|
||||
public class AdvancedMsgListener: NSObject, Open_im_sdk_callbackOnAdvancedMsgListenerProtocol {
|
||||
private let channel: FlutterMethodChannel
|
||||
private let id: String
|
||||
|
||||
// private var values: [String: Any] = [:]
|
||||
|
||||
|
||||
init(channel: FlutterMethodChannel, id: String) {
|
||||
self.channel = channel
|
||||
self.id = id
|
||||
// values["id"] = id
|
||||
}
|
||||
|
||||
|
||||
public func onRecvC2CReadReceipt(_ msgReceiptList: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["id"] = id
|
||||
values["haveReadMessage"] = msgReceiptList
|
||||
values["c2cMessageReadReceipt"] = msgReceiptList
|
||||
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["groupMessageReadReceipt"] = groupMsgReceiptList
|
||||
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvGroupReadReceipt", errCode: nil, errMsg: nil, data: values)
|
||||
}
|
||||
|
||||
public func onRecvMessageRevoked(_ msgId: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["id"] = id
|
||||
values["revokedMessage"] = msgId
|
||||
CommonUtil.emitEvent(channel: channel, method: "advancedMsgListener", type: "onRecvMessageRevoked", errCode: nil, errMsg: nil, data: values)
|
||||
}
|
||||
|
||||
|
||||
public func onRecvNewMessage(_ message: String?) {
|
||||
var values: [String: Any] = [:]
|
||||
values["id"] = id
|
||||
|
||||
86
ios/Classes/Module/SignalingManager.swift
Normal file
86
ios/Classes/Module/SignalingManager.swift
Normal file
@@ -0,0 +1,86 @@
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
public class SignalingManager: BaseServiceManager {
|
||||
|
||||
public override func registerHandlers() {
|
||||
super.registerHandlers()
|
||||
self["setSignalingListener"] = setSignalingListener
|
||||
self["signalingInvite"] = signalingInvite
|
||||
self["signalingInviteInGroup"] = signalingInviteInGroup
|
||||
self["signalingAccept"] = signalingAccept
|
||||
self["signalingReject"] = signalingReject
|
||||
self["signalingCancel"] = signalingCancel
|
||||
self["signalingHungUp"] = signalingHungUp
|
||||
}
|
||||
|
||||
func setSignalingListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetSignalingListener(SignalingListener(channel: channel))
|
||||
callBack(result)
|
||||
}
|
||||
|
||||
func signalingInvite(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSignalingInvite(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"])
|
||||
}
|
||||
|
||||
func signalingInviteInGroup(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSignalingInviteInGroup(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"])
|
||||
}
|
||||
|
||||
func signalingAccept(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSignalingAccept(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"])
|
||||
}
|
||||
|
||||
func signalingReject(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSignalingReject(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"])
|
||||
}
|
||||
|
||||
func signalingCancel(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSignalingCancel(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"])
|
||||
}
|
||||
|
||||
func signalingHungUp(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSignalingHungUp(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "signalingInfo"])
|
||||
}
|
||||
}
|
||||
public class SignalingListener: NSObject, Open_im_sdk_callbackOnSignalingListenerProtocol {
|
||||
|
||||
private let channel:FlutterMethodChannel
|
||||
|
||||
init(channel:FlutterMethodChannel) {
|
||||
self.channel = channel
|
||||
}
|
||||
|
||||
public func onInvitationCancelled(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInvitationCancelled", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onInvitationTimeout(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInvitationTimeout", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onInviteeAccepted(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeAccepted", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onInviteeAccepted(byOtherDevice s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeAcceptedByOtherDevice", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onInviteeRejected(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeRejected", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onInviteeRejected(byOtherDevice s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onInviteeRejectedByOtherDevice", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onReceiveNewInvitation(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onReceiveNewInvitation", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
public func onHangUp(_ s: String?) {
|
||||
CommonUtil.emitEvent(channel: channel, method: "signalingListener", type: "onHangUp", errCode: nil, errMsg: nil, data: s)
|
||||
}
|
||||
|
||||
}
|
||||
43
ios/Classes/Module/UserManager.swift
Normal file
43
ios/Classes/Module/UserManager.swift
Normal file
@@ -0,0 +1,43 @@
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
public class UserManager: BaseServiceManager {
|
||||
|
||||
public override func registerHandlers() {
|
||||
super.registerHandlers()
|
||||
self["setUserListener"] = setUserListener
|
||||
self["getUsersInfo"] = getUsersInfo
|
||||
self["setSelfInfo"] = setSelfInfo
|
||||
self["getSelfUserInfo"] = getSelfUserInfo
|
||||
}
|
||||
|
||||
func setUserListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetUserListener(UserListener(channel: channel))
|
||||
callBack(result)
|
||||
}
|
||||
|
||||
func getUsersInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkGetUsersInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[jsonString: "uidList"])
|
||||
}
|
||||
|
||||
func setSelfInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkSetSelfInfo(BaseCallback(result: result), methodCall[string: "operationID"], methodCall.toJsonString())
|
||||
}
|
||||
|
||||
func getSelfUserInfo(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkGetSelfUserInfo(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
}
|
||||
|
||||
public class UserListener: NSObject, Open_im_sdk_callbackOnUserListenerProtocol {
|
||||
|
||||
private let channel:FlutterMethodChannel
|
||||
|
||||
init(channel:FlutterMethodChannel) {
|
||||
self.channel = channel
|
||||
}
|
||||
|
||||
public func onSelfInfoUpdated(_ userInfo: String?) {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "userListener", type: "onSelfInfoUpdated", errCode: nil, errMsg: nil, data: userInfo)
|
||||
}
|
||||
}
|
||||
44
ios/Classes/Module/WorkMomentsManager.swift
Normal file
44
ios/Classes/Module/WorkMomentsManager.swift
Normal file
@@ -0,0 +1,44 @@
|
||||
import Foundation
|
||||
import OpenIMCore
|
||||
|
||||
public class WorkMomentsManager: BaseServiceManager {
|
||||
|
||||
public override func registerHandlers() {
|
||||
super.registerHandlers()
|
||||
self["setWorkMomentsListener"] = setWorkMomentsListener
|
||||
self["getWorkMomentsUnReadCount"] = getWorkMomentsUnReadCount
|
||||
self["getWorkMomentsNotification"] = getWorkMomentsNotification
|
||||
self["clearWorkMomentsNotification"] = clearWorkMomentsNotification
|
||||
}
|
||||
|
||||
func setWorkMomentsListener(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||
Open_im_sdkSetWorkMomentsListener(WorkMomentsListener(channel: channel))
|
||||
callBack(result)
|
||||
}
|
||||
|
||||
func getWorkMomentsUnReadCount(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkGetWorkMomentsUnReadCount(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
|
||||
func getWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkGetWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"], methodCall[int: "offset"], methodCall[int: "count"])
|
||||
}
|
||||
|
||||
func clearWorkMomentsNotification(methodCall: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||
Open_im_sdkClearWorkMomentsNotification(BaseCallback(result: result), methodCall[string: "operationID"])
|
||||
}
|
||||
}
|
||||
|
||||
public class WorkMomentsListener: NSObject, Open_im_sdk_callbackOnWorkMomentsListenerProtocol {
|
||||
|
||||
private let channel:FlutterMethodChannel
|
||||
|
||||
init(channel:FlutterMethodChannel) {
|
||||
self.channel = channel
|
||||
}
|
||||
|
||||
public func onRecvNewNotification() {
|
||||
CommonUtil.emitEvent(channel: self.channel, method: "workMomentsListener", type: "OnRecvNewNotification", errCode: nil, errMsg: nil, data: nil)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,12 +2,14 @@ import Flutter
|
||||
import UIKit
|
||||
|
||||
public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
|
||||
|
||||
let imManager: IMMananger
|
||||
let conversationManager: ConversationManager
|
||||
let friendshipManager: FriendshipManager
|
||||
let messageManager: MessageManager
|
||||
let groupManager: GroupManager
|
||||
let userManger: UserManager
|
||||
let signalingManager: SignalingManager
|
||||
let workMomentsManager: WorkMomentsManager
|
||||
|
||||
init(channel: FlutterMethodChannel) {
|
||||
self.imManager = IMMananger(channel: channel)
|
||||
@@ -15,6 +17,9 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
|
||||
self.friendshipManager = FriendshipManager(channel: channel)
|
||||
self.messageManager = MessageManager(channel: channel)
|
||||
self.groupManager = GroupManager(channel: channel)
|
||||
self.userManger = UserManager(channel: channel)
|
||||
self.signalingManager = SignalingManager(channel: channel)
|
||||
self.workMomentsManager = WorkMomentsManager(channel: channel)
|
||||
}
|
||||
|
||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||
@@ -36,6 +41,12 @@ public class SwiftFlutterOpenimSdkPlugin: NSObject, FlutterPlugin {
|
||||
friendshipManager.handleMethod(call: call, result: result)
|
||||
case "groupManager":
|
||||
groupManager.handleMethod(call: call, result: result)
|
||||
case "userManager":
|
||||
userManger.handleMethod(call: call, result: result)
|
||||
case "signalingManager":
|
||||
signalingManager.handleMethod(call: call, result: result)
|
||||
case "workMomentsManager":
|
||||
workMomentsManager.handleMethod(call: call, result: result)
|
||||
default:
|
||||
print("Handle ManagerName Error: \(managerName) not found")
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// open_im_sdk/open_im_sdk
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __OpenIMCore_FRAMEWORK_H__
|
||||
#define __OpenIMCore_FRAMEWORK_H__
|
||||
|
||||
#include "Open_im_sdk.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,29 +0,0 @@
|
||||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,35 +0,0 @@
|
||||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
framework module "OpenIMCore" {
|
||||
header "ref.h"
|
||||
header "Open_im_sdk.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "OpenIMCore.h"
|
||||
|
||||
export *
|
||||
}
|
||||
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -17,7 +17,9 @@ A new Flutter project.
|
||||
s.dependency 'Flutter'
|
||||
s.platform = :ios, '8.0'
|
||||
|
||||
s.vendored_frameworks = 'Framework/*.framework'
|
||||
s.dependency 'OpenIMSDKCore','2.0.8'
|
||||
s.static_framework = true
|
||||
# s.vendored_frameworks = 'Framework/*.framework'
|
||||
# Flutter.framework does not contain a i386 slice.
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386 arm64' }
|
||||
s.swift_version = '5.0'
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
library flutter_openim_sdk;
|
||||
|
||||
export 'src/enum/conversation_type.dart';
|
||||
export 'src/enum/group_role.dart';
|
||||
export 'src/enum/group_at_type.dart';
|
||||
export 'src/enum/group_role_level.dart';
|
||||
export 'src/enum/im_platform.dart';
|
||||
export 'src/enum/listener_type.dart';
|
||||
export 'src/enum/message_status.dart';
|
||||
export 'src/enum/message_type.dart';
|
||||
export 'src/listener/advanced_msg_listener.dart';
|
||||
export 'src/listener/connect_listener.dart';
|
||||
export 'src/listener/conversation_listener.dart';
|
||||
export 'src/listener/friendship_listener.dart';
|
||||
export 'src/listener/group_listener.dart';
|
||||
export 'src/listener/impl/advanced_msg_listener.dart';
|
||||
export 'src/listener/impl/conversation_listener.dart';
|
||||
export 'src/listener/impl/friendship_listener.dart';
|
||||
export 'src/listener/impl/group_listener.dart';
|
||||
export 'src/listener/impl/init_sdk_listener.dart';
|
||||
export 'src/listener/impl/msg_send_progress_listener.dart';
|
||||
export 'src/listener/init_sdk_listener.dart';
|
||||
export 'src/listener/msg_send_progress_listener.dart';
|
||||
export 'src/listener/signaling_listener.dart';
|
||||
export 'src/listener/user_listener.dart';
|
||||
export 'src/listener/workmoments_listener.dart';
|
||||
export 'src/manager/im_conversation_manager.dart';
|
||||
export 'src/manager/im_friendship_manager.dart';
|
||||
export 'src/manager/im_group_manager.dart';
|
||||
@@ -25,8 +23,15 @@ export 'src/manager/im_manager.dart';
|
||||
export 'src/manager/im_message_manager.dart';
|
||||
export 'src/manager/im_offline_push_manager.dart';
|
||||
export 'src/manager/im_signaling_manager.dart';
|
||||
export 'src/manager/im_user_manager.dart';
|
||||
export 'src/manager/im_workmoments_manager.dart';
|
||||
export 'src/models/conversation_info.dart';
|
||||
export 'src/models/group_info.dart';
|
||||
export 'src/models/message.dart';
|
||||
export 'src/models/notification_info.dart';
|
||||
export 'src/models/search_info.dart';
|
||||
export 'src/models/signaling_info.dart';
|
||||
export 'src/models/user_info.dart';
|
||||
export 'src/models/workmoments_info.dart';
|
||||
export 'src/openim.dart';
|
||||
export 'src/utils.dart';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
class ConversationType {
|
||||
static const single_chat = 1;
|
||||
static const group_chat = 2;
|
||||
static const single = 1;
|
||||
static const group = 2;
|
||||
static const notification = 4;
|
||||
}
|
||||
|
||||
6
lib/src/enum/group_at_type.dart
Normal file
6
lib/src/enum/group_at_type.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
class GroupAtType {
|
||||
static const atNormal = 0;
|
||||
static const atMe = 1;
|
||||
static const atAll = 2;
|
||||
static const atAllAtMe = 3;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
class GroupRole {
|
||||
static const member = 0;
|
||||
static const owner = 1;
|
||||
static const admin = 2;
|
||||
}
|
||||
7
lib/src/enum/group_role_level.dart
Normal file
7
lib/src/enum/group_role_level.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
/// 1 ordinary member, 2 group owners, 3 administrators
|
||||
/// 1普通成员, 2群主,3管理员
|
||||
class GroupRoleLevel {
|
||||
static const member = 1;
|
||||
static const owner = 2;
|
||||
static const admin = 3;
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
class ListenerType {
|
||||
static const simpleMsgListener = 'simpleMsgListener';
|
||||
static const initSDKListener = 'initSDKListener';
|
||||
static const groupListener = 'groupListener';
|
||||
static const advancedMsgListener = 'advancedMsgListener';
|
||||
static const conversationListener = 'conversationListener';
|
||||
static const friendListener = 'friendListener';
|
||||
static const signalingListener = 'signalingListener';
|
||||
static const msgSendProgressListener = "msgSendProgressListener";
|
||||
static final simpleMsgListener = 'simpleMsgListener';
|
||||
static final connectListener = 'connectListener';
|
||||
static final userListener = 'userListener';
|
||||
static final groupListener = 'groupListener';
|
||||
static final advancedMsgListener = 'advancedMsgListener';
|
||||
static final conversationListener = 'conversationListener';
|
||||
static final friendListener = 'friendListener';
|
||||
static final signalingListener = 'signalingListener';
|
||||
static final msgSendProgressListener = "msgSendProgressListener";
|
||||
static final workMomentsListener = "workMomentsListener";
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ class MessageType {
|
||||
static const file = 105;
|
||||
static const at_text = 106;
|
||||
static const merger = 107;
|
||||
// static const forward = 108;
|
||||
static const card = 108;
|
||||
static const location = 109;
|
||||
static const custom = 110;
|
||||
@@ -15,26 +14,55 @@ class MessageType {
|
||||
static const has_read_receipt = 112;
|
||||
static const typing = 113;
|
||||
static const quote = 114;
|
||||
static const custom_face = 115;
|
||||
|
||||
///
|
||||
static const accept_friend = 201;
|
||||
static const add_friend = 202;
|
||||
static const refuse_friend_application = 203;
|
||||
static const set_self_info = 204;
|
||||
static const revoke_message = 205;
|
||||
static const c2c_message_as_read = 206;
|
||||
static const notificationBegin = 1000;
|
||||
|
||||
static const kick_online = 303;
|
||||
static const friendNotificationBegin = 1200;
|
||||
static const friendApplicationApprovedNotification = 1201;
|
||||
static const friendApplicationRejectedNotification = 1202;
|
||||
static const friendApplicationNotification = 1203;
|
||||
static const friendAddedNotification = 1204;
|
||||
static const friendDeletedNotification = 1205;
|
||||
static const friendRemarkSetNotification = 1206;
|
||||
static const blackAddedNotification = 1207;
|
||||
static const blackDeletedNotification = 1208;
|
||||
static const friendNotificationEnd = 1299;
|
||||
|
||||
///
|
||||
static const transfer_group_owner = 501;
|
||||
static const create_group = 502;
|
||||
// static const create_group = 503;
|
||||
static const join_group = 504;
|
||||
static const quit_group = 505;
|
||||
static const set_group_info = 506;
|
||||
static const accept_group_application = 507;
|
||||
static const refuse_group_application = 508;
|
||||
static const kick_group_member = 509;
|
||||
static const invited_user_to_group = 510;
|
||||
static const conversationChangeNotification = 1300;
|
||||
|
||||
static const userNotificationBegin = 1301;
|
||||
static const userInfoUpdatedNotification = 1303;
|
||||
static const userNotificationEnd = 1399;
|
||||
|
||||
static const oaNotification = 1400;
|
||||
|
||||
static const groupNotificationBegin = 1500;
|
||||
static const groupCreatedNotification = 1501;
|
||||
static const groupInfoSetNotification = 1502;
|
||||
static const joinGroupApplicationNotification = 1503;
|
||||
static const memberQuitNotification = 1504;
|
||||
static const groupApplicationAcceptedNotification = 1505;
|
||||
static const groupApplicationRejectedNotification = 1506;
|
||||
static const groupOwnerTransferredNotification = 1507;
|
||||
static const memberKickedNotification = 1508;
|
||||
static const memberInvitedNotification = 1509;
|
||||
static const memberEnterNotification = 1510;
|
||||
static const dismissGroupNotification = 1511;
|
||||
static const groupNotificationEnd = 1599;
|
||||
|
||||
static const groupMemberMutedNotification = 1512;
|
||||
static const groupMemberCancelMutedNotification = 1513;
|
||||
static const groupMutedNotification = 1514;
|
||||
static const groupCancelMutedNotification = 1515;
|
||||
static const groupMemberInfoChangedNotification = 1516;
|
||||
|
||||
static const signalingNotificationBegin = 1600;
|
||||
static const signalingNotification = 1601;
|
||||
static const signalingNotificationEnd = 1699;
|
||||
|
||||
static const burnAfterReadingNotification = 1701;
|
||||
|
||||
static const notificationEnd = 2000;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,40 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
abstract class AdvancedMsgListener {
|
||||
/// Uniquely identifies
|
||||
final String id;
|
||||
class OnAdvancedMsgListener {
|
||||
/// Message read receipt
|
||||
Function(List<ReadReceiptInfo> list)? onRecvC2CMessageReadReceipt;
|
||||
|
||||
AdvancedMsgListener() : id = "id_${DateTime.now().microsecondsSinceEpoch}";
|
||||
Function(List<ReadReceiptInfo> list)? onRecvGroupMessageReadReceipt;
|
||||
|
||||
/// A friend revoked a message
|
||||
Function(String msgId)? onRecvMessageRevoked;
|
||||
|
||||
/// Receive new message
|
||||
void recvNewMessage(Message msg);
|
||||
Function(Message msg)? onRecvNewMessage;
|
||||
|
||||
/// Message read receipt
|
||||
void recvC2CReadReceipt(List<HaveReadInfo> list);
|
||||
/// Uniquely identifies
|
||||
String id;
|
||||
|
||||
/// A friend withdrew a message
|
||||
void recvMessageRevoked(String msgId);
|
||||
OnAdvancedMsgListener({
|
||||
this.onRecvC2CMessageReadReceipt,
|
||||
this.onRecvGroupMessageReadReceipt,
|
||||
this.onRecvMessageRevoked,
|
||||
this.onRecvNewMessage,
|
||||
}) : id = "id_${DateTime.now().microsecondsSinceEpoch}";
|
||||
|
||||
void recvC2CMessageReadReceipt(List<ReadReceiptInfo> list) {
|
||||
onRecvC2CMessageReadReceipt?.call(list);
|
||||
}
|
||||
|
||||
void recvGroupMessageReadReceipt(List<ReadReceiptInfo> list) {
|
||||
onRecvGroupMessageReadReceipt?.call(list);
|
||||
}
|
||||
|
||||
void recvMessageRevoked(String msgId) {
|
||||
onRecvMessageRevoked?.call(msgId);
|
||||
}
|
||||
|
||||
void recvNewMessage(Message msg) {
|
||||
onRecvNewMessage?.call(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,45 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OnInitSDKListener extends InitSDKListener {
|
||||
class OnConnectListener {
|
||||
/// SDK failed to connect to the server
|
||||
Function(int? code, String? errorMsg)? onConnectFailed;
|
||||
|
||||
/// SDK has successfully connected to the server
|
||||
Function()? onConnectSuccess;
|
||||
|
||||
/// SDK is connecting to the server
|
||||
Function()? onConnecting;
|
||||
|
||||
/// The current user is kicked offline.
|
||||
/// At this time, the UI can prompt the user and call IMManager's login() function to log in again.
|
||||
Function()? onKickedOffline;
|
||||
Function(UserInfo info)? onSelfInfoUpdated;
|
||||
|
||||
/// Ticket expired when online.
|
||||
/// At this time, you need to generate a new userSig and call IMManager's login() function to log in again
|
||||
Function()? onUserSigExpired;
|
||||
|
||||
OnInitSDKListener({
|
||||
OnConnectListener({
|
||||
this.onConnectFailed,
|
||||
this.onConnectSuccess,
|
||||
this.onConnecting,
|
||||
this.onKickedOffline,
|
||||
this.onSelfInfoUpdated,
|
||||
this.onUserSigExpired,
|
||||
});
|
||||
|
||||
@override
|
||||
void connectFailed(int? code, String? errorMsg) {
|
||||
if (null != onConnectFailed) onConnectFailed!(code, errorMsg);
|
||||
}
|
||||
|
||||
@override
|
||||
void connectSuccess() {
|
||||
if (null != onConnectSuccess) onConnectSuccess!();
|
||||
}
|
||||
|
||||
@override
|
||||
void connecting() {
|
||||
if (null != onConnecting) onConnecting!.call();
|
||||
}
|
||||
|
||||
@override
|
||||
void kickedOffline() {
|
||||
if (null != onKickedOffline) onKickedOffline!();
|
||||
}
|
||||
|
||||
@override
|
||||
void selfInfoUpdated(UserInfo info) {
|
||||
if (null != onSelfInfoUpdated) onSelfInfoUpdated!(info);
|
||||
}
|
||||
|
||||
@override
|
||||
void userSigExpired() {
|
||||
if (null != onUserSigExpired) onUserSigExpired!();
|
||||
}
|
||||
@@ -1,15 +1,44 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
abstract class ConversationListener {
|
||||
void conversationChanged(List<ConversationInfo> list);
|
||||
class OnConversationListener {
|
||||
Function(List<ConversationInfo> list)? onConversationChanged;
|
||||
Function(List<ConversationInfo> list)? onNewConversation;
|
||||
Function(int count)? onTotalUnreadMessageCountChanged;
|
||||
Function()? onSyncServerFailed;
|
||||
Function()? onSyncServerFinish;
|
||||
Function()? onSyncServerStart;
|
||||
|
||||
void newConversation(List<ConversationInfo> list);
|
||||
OnConversationListener({
|
||||
this.onConversationChanged,
|
||||
this.onNewConversation,
|
||||
this.onTotalUnreadMessageCountChanged,
|
||||
this.onSyncServerFailed,
|
||||
this.onSyncServerFinish,
|
||||
this.onSyncServerStart,
|
||||
});
|
||||
|
||||
void syncServerFailed();
|
||||
void conversationChanged(List<ConversationInfo> list) {
|
||||
if (onConversationChanged != null) onConversationChanged!(list);
|
||||
}
|
||||
|
||||
void syncServerFinish();
|
||||
void newConversation(List<ConversationInfo> list) {
|
||||
if (onNewConversation != null) onNewConversation!(list);
|
||||
}
|
||||
|
||||
void syncServerStart();
|
||||
void syncServerFailed() {
|
||||
if (onSyncServerFailed != null) onSyncServerFailed!();
|
||||
}
|
||||
|
||||
void totalUnreadMessageCountChanged(int i);
|
||||
void syncServerFinish() {
|
||||
if (onSyncServerFinish != null) onSyncServerFinish!();
|
||||
}
|
||||
|
||||
void syncServerStart() {
|
||||
if (onSyncServerStart != null) onSyncServerStart!();
|
||||
}
|
||||
|
||||
void totalUnreadMessageCountChanged(int i) {
|
||||
if (onTotalUnreadMessageCountChanged != null)
|
||||
onTotalUnreadMessageCountChanged!(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,61 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
abstract class FriendshipListener {
|
||||
void blackListAdd(UserInfo u);
|
||||
class OnFriendshipListener {
|
||||
Function(FriendApplicationInfo i)? onFriendApplicationAdded;
|
||||
Function(FriendApplicationInfo i)? onFriendApplicationDeleted;
|
||||
Function(FriendApplicationInfo i)? onFriendApplicationAccepted;
|
||||
Function(FriendApplicationInfo i)? onFriendApplicationRejected;
|
||||
Function(FriendInfo i)? onFriendAdded;
|
||||
Function(FriendInfo i)? onFriendDeleted;
|
||||
Function(FriendInfo i)? onFriendInfoChanged;
|
||||
Function(BlacklistInfo i)? onBlacklistAdded;
|
||||
Function(BlacklistInfo i)? onBlacklistDeleted;
|
||||
|
||||
void blackListDeleted(UserInfo u);
|
||||
OnFriendshipListener({
|
||||
this.onBlacklistAdded,
|
||||
this.onBlacklistDeleted,
|
||||
this.onFriendAdded,
|
||||
this.onFriendApplicationAccepted,
|
||||
this.onFriendApplicationAdded,
|
||||
this.onFriendApplicationDeleted,
|
||||
this.onFriendApplicationRejected,
|
||||
this.onFriendDeleted,
|
||||
this.onFriendInfoChanged,
|
||||
});
|
||||
|
||||
void friendApplicationListAccept(UserInfo u);
|
||||
void blacklistAdded(BlacklistInfo u) {
|
||||
onBlacklistAdded?.call(u);
|
||||
}
|
||||
|
||||
void friendApplicationListAdded(UserInfo u);
|
||||
void blacklistDeleted(BlacklistInfo u) {
|
||||
onBlacklistDeleted?.call(u);
|
||||
}
|
||||
|
||||
void friendApplicationListDeleted(UserInfo u);
|
||||
void friendAdded(FriendInfo u) {
|
||||
onFriendAdded?.call(u);
|
||||
}
|
||||
|
||||
void friendApplicationListReject(UserInfo u);
|
||||
void friendApplicationAccepted(FriendApplicationInfo u) {
|
||||
onFriendApplicationAccepted?.call(u);
|
||||
}
|
||||
|
||||
void friendInfoChanged(UserInfo u);
|
||||
void friendApplicationAdded(FriendApplicationInfo u) {
|
||||
onFriendApplicationAdded?.call(u);
|
||||
}
|
||||
|
||||
void friendListAdded(UserInfo u);
|
||||
void friendApplicationDeleted(FriendApplicationInfo u) {
|
||||
onFriendApplicationDeleted?.call(u);
|
||||
}
|
||||
|
||||
void friendListDeleted(UserInfo u);
|
||||
void friendApplicationRejected(FriendApplicationInfo u) {
|
||||
onFriendApplicationRejected?.call(u);
|
||||
}
|
||||
|
||||
void friendDeleted(FriendInfo u) {
|
||||
onFriendDeleted?.call(u);
|
||||
}
|
||||
|
||||
void friendInfoChanged(FriendInfo u) {
|
||||
onFriendInfoChanged?.call(u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,67 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
abstract class GroupListener {
|
||||
void memberEnter(String groupId, List<GroupMembersInfo> list);
|
||||
class OnGroupListener {
|
||||
Function(GroupApplicationInfo info)? onGroupApplicationAccepted;
|
||||
Function(GroupApplicationInfo info)? onGroupApplicationAdded;
|
||||
Function(GroupApplicationInfo info)? onGroupApplicationDeleted;
|
||||
Function(GroupApplicationInfo info)? onGroupApplicationRejected;
|
||||
Function(GroupInfo info)? onGroupInfoChanged;
|
||||
Function(GroupMembersInfo info)? onGroupMemberAdded;
|
||||
Function(GroupMembersInfo info)? onGroupMemberDeleted;
|
||||
Function(GroupMembersInfo info)? onGroupMemberInfoChanged;
|
||||
Function(GroupInfo info)? onJoinedGroupAdded;
|
||||
Function(GroupInfo info)? onJoinedGroupDeleted;
|
||||
|
||||
void memberLeave(String groupId, GroupMembersInfo info);
|
||||
OnGroupListener({
|
||||
this.onGroupApplicationAccepted,
|
||||
this.onGroupApplicationAdded,
|
||||
this.onGroupApplicationDeleted,
|
||||
this.onGroupApplicationRejected,
|
||||
this.onGroupInfoChanged,
|
||||
this.onGroupMemberAdded,
|
||||
this.onGroupMemberDeleted,
|
||||
this.onGroupMemberInfoChanged,
|
||||
this.onJoinedGroupAdded,
|
||||
this.onJoinedGroupDeleted,
|
||||
});
|
||||
|
||||
void memberInvited(
|
||||
String groupId, GroupMembersInfo opUser, List<GroupMembersInfo> list);
|
||||
void groupApplicationAccepted(GroupApplicationInfo info) {
|
||||
onGroupApplicationAccepted?.call(info);
|
||||
}
|
||||
|
||||
void memberKicked(
|
||||
String groupId, GroupMembersInfo opUser, List<GroupMembersInfo> list);
|
||||
void groupApplicationAdded(GroupApplicationInfo info) {
|
||||
onGroupApplicationAdded?.call(info);
|
||||
}
|
||||
|
||||
void groupCreated(String groupId);
|
||||
void groupApplicationDeleted(GroupApplicationInfo info) {
|
||||
onGroupApplicationDeleted?.call(info);
|
||||
}
|
||||
|
||||
void groupInfoChanged(String groupId, GroupInfo info);
|
||||
void groupApplicationRejected(GroupApplicationInfo info) {
|
||||
onGroupApplicationRejected?.call(info);
|
||||
}
|
||||
|
||||
void receiveJoinApplication(
|
||||
String groupId, GroupMembersInfo info, String opReason);
|
||||
void groupInfoChanged(GroupInfo info) {
|
||||
onGroupInfoChanged?.call(info);
|
||||
}
|
||||
|
||||
void applicationProcessed(String groupId, GroupMembersInfo opUser,
|
||||
int agreeOrReject, String opReason);
|
||||
void groupMemberAdded(GroupMembersInfo info) {
|
||||
onGroupMemberAdded?.call(info);
|
||||
}
|
||||
|
||||
void groupMemberDeleted(GroupMembersInfo info) {
|
||||
onGroupMemberDeleted?.call(info);
|
||||
}
|
||||
|
||||
void groupMemberInfoChanged(GroupMembersInfo info) {
|
||||
onGroupMemberInfoChanged?.call(info);
|
||||
}
|
||||
|
||||
void joinedGroupAdded(GroupInfo info) {
|
||||
onJoinedGroupAdded?.call(info);
|
||||
}
|
||||
|
||||
void joinedGroupDeleted(GroupInfo info) {
|
||||
onJoinedGroupDeleted?.call(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OnAdvancedMsgListener extends AdvancedMsgListener {
|
||||
Function(List<HaveReadInfo> list)? onRecvC2CReadReceipt;
|
||||
Function(String msgId)? onRecvMessageRevoked;
|
||||
Function(Message msg)? onRecvNewMessage;
|
||||
|
||||
OnAdvancedMsgListener({
|
||||
this.onRecvC2CReadReceipt,
|
||||
this.onRecvMessageRevoked,
|
||||
this.onRecvNewMessage,
|
||||
});
|
||||
|
||||
@override
|
||||
void recvC2CReadReceipt(List<HaveReadInfo> list) {
|
||||
if (null != onRecvC2CReadReceipt) onRecvC2CReadReceipt!(list);
|
||||
}
|
||||
|
||||
@override
|
||||
void recvMessageRevoked(String msgId) {
|
||||
if (null != onRecvMessageRevoked) onRecvMessageRevoked!(msgId);
|
||||
}
|
||||
|
||||
@override
|
||||
void recvNewMessage(Message msg) {
|
||||
if (null != onRecvNewMessage) onRecvNewMessage!(msg);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OnConversationListener extends ConversationListener {
|
||||
Function(List<ConversationInfo> list)? onConversationChanged;
|
||||
Function(List<ConversationInfo> list)? onNewConversation;
|
||||
Function(int count)? onTotalUnreadMessageCountChanged;
|
||||
Function()? onSyncServerFailed;
|
||||
Function()? onSyncServerFinish;
|
||||
Function()? onSyncServerStart;
|
||||
|
||||
OnConversationListener({
|
||||
this.onConversationChanged,
|
||||
this.onNewConversation,
|
||||
this.onTotalUnreadMessageCountChanged,
|
||||
this.onSyncServerFailed,
|
||||
this.onSyncServerFinish,
|
||||
this.onSyncServerStart,
|
||||
});
|
||||
|
||||
@override
|
||||
void conversationChanged(List<ConversationInfo> list) {
|
||||
if (onConversationChanged != null) onConversationChanged!(list);
|
||||
}
|
||||
|
||||
@override
|
||||
void newConversation(List<ConversationInfo> list) {
|
||||
if (onNewConversation != null) onNewConversation!(list);
|
||||
}
|
||||
|
||||
@override
|
||||
void syncServerFailed() {
|
||||
if (onSyncServerFailed != null) onSyncServerFailed!();
|
||||
}
|
||||
|
||||
@override
|
||||
void syncServerFinish() {
|
||||
if (onSyncServerFinish != null) onSyncServerFinish!();
|
||||
}
|
||||
|
||||
@override
|
||||
void syncServerStart() {
|
||||
if (onSyncServerStart != null) onSyncServerStart!();
|
||||
}
|
||||
|
||||
@override
|
||||
void totalUnreadMessageCountChanged(int i) {
|
||||
if (onTotalUnreadMessageCountChanged != null)
|
||||
onTotalUnreadMessageCountChanged!(i);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OnFriendshipListener extends FriendshipListener {
|
||||
Function(UserInfo u)? onBlackListAdd;
|
||||
Function(UserInfo u)? onBlackListDeleted;
|
||||
Function(UserInfo u)? onFriendApplicationListAccept;
|
||||
Function(UserInfo u)? onFriendApplicationListAdded;
|
||||
Function(UserInfo u)? onFriendApplicationListDeleted;
|
||||
Function(UserInfo u)? onFriendApplicationListReject;
|
||||
Function(UserInfo u)? onFriendInfoChanged;
|
||||
Function(UserInfo u)? onFriendListAdded;
|
||||
Function(UserInfo u)? onFriendListDeleted;
|
||||
|
||||
OnFriendshipListener({
|
||||
this.onBlackListAdd,
|
||||
this.onBlackListDeleted,
|
||||
this.onFriendApplicationListAccept,
|
||||
this.onFriendApplicationListAdded,
|
||||
this.onFriendApplicationListDeleted,
|
||||
this.onFriendApplicationListReject,
|
||||
this.onFriendInfoChanged,
|
||||
this.onFriendListAdded,
|
||||
this.onFriendListDeleted,
|
||||
});
|
||||
|
||||
@override
|
||||
void blackListAdd(UserInfo u) {
|
||||
if (null != onBlackListAdd) onBlackListAdd!(u);
|
||||
}
|
||||
|
||||
@override
|
||||
void blackListDeleted(UserInfo u) {
|
||||
if (null != onBlackListDeleted) onBlackListDeleted!(u);
|
||||
}
|
||||
|
||||
@override
|
||||
void friendApplicationListAccept(UserInfo u) {
|
||||
if (null != onFriendApplicationListAccept)
|
||||
onFriendApplicationListAccept!(u);
|
||||
}
|
||||
|
||||
@override
|
||||
void friendApplicationListAdded(UserInfo u) {
|
||||
if (null != onFriendApplicationListAdded) onFriendApplicationListAdded!(u);
|
||||
}
|
||||
|
||||
@override
|
||||
void friendApplicationListDeleted(UserInfo u) {
|
||||
if (null != onFriendApplicationListDeleted)
|
||||
onFriendApplicationListDeleted!(u);
|
||||
}
|
||||
|
||||
@override
|
||||
void friendApplicationListReject(UserInfo u) {
|
||||
if (null != onFriendApplicationListReject)
|
||||
onFriendApplicationListReject!(u);
|
||||
}
|
||||
|
||||
@override
|
||||
void friendInfoChanged(UserInfo u) {
|
||||
if (null != onFriendInfoChanged) onFriendInfoChanged!(u);
|
||||
}
|
||||
|
||||
@override
|
||||
void friendListAdded(UserInfo u) {
|
||||
if (null != onFriendListAdded) onFriendListAdded!(u);
|
||||
}
|
||||
|
||||
@override
|
||||
void friendListDeleted(UserInfo u) {
|
||||
if (null != onFriendListDeleted) onFriendListDeleted!(u);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OnGroupListener extends GroupListener {
|
||||
Function(String groupId, GroupMembersInfo opUser, int agreeOrReject,
|
||||
String opReason)? onApplicationProcessed;
|
||||
Function(String groupId)? onGroupCreated;
|
||||
Function(String groupId, GroupInfo info)? onGroupInfoChanged;
|
||||
Function(String groupId, List<GroupMembersInfo> list)? onMemberEnter;
|
||||
Function(
|
||||
String groupId, GroupMembersInfo opUser, List<GroupMembersInfo> list)?
|
||||
onMemberInvited;
|
||||
Function(
|
||||
String groupId, GroupMembersInfo opUser, List<GroupMembersInfo> list)?
|
||||
onMemberKicked;
|
||||
Function(String groupId, GroupMembersInfo info)? onMemberLeave;
|
||||
Function(String groupId, GroupMembersInfo info, String opReason)?
|
||||
onReceiveJoinApplication;
|
||||
|
||||
OnGroupListener({
|
||||
this.onApplicationProcessed,
|
||||
this.onGroupCreated,
|
||||
this.onGroupInfoChanged,
|
||||
this.onMemberEnter,
|
||||
this.onMemberInvited,
|
||||
this.onMemberKicked,
|
||||
this.onMemberLeave,
|
||||
this.onReceiveJoinApplication,
|
||||
});
|
||||
|
||||
@override
|
||||
void applicationProcessed(String groupId, GroupMembersInfo opUser,
|
||||
int agreeOrReject, String opReason) {
|
||||
if (null != onApplicationProcessed)
|
||||
onApplicationProcessed!(groupId, opUser, agreeOrReject, opReason);
|
||||
}
|
||||
|
||||
@override
|
||||
void groupCreated(String groupId) {
|
||||
if (null != onGroupCreated) onGroupCreated!(groupId);
|
||||
}
|
||||
|
||||
@override
|
||||
void groupInfoChanged(String groupId, GroupInfo info) {
|
||||
if (null != onGroupInfoChanged) onGroupInfoChanged!(groupId, info);
|
||||
}
|
||||
|
||||
@override
|
||||
void memberEnter(String groupId, List<GroupMembersInfo> list) {
|
||||
if (null != onMemberEnter) onMemberEnter!(groupId, list);
|
||||
}
|
||||
|
||||
@override
|
||||
void memberInvited(
|
||||
String groupId, GroupMembersInfo opUser, List<GroupMembersInfo> list) {
|
||||
if (null != onMemberInvited) onMemberInvited!(groupId, opUser, list);
|
||||
}
|
||||
|
||||
@override
|
||||
void memberKicked(
|
||||
String groupId, GroupMembersInfo opUser, List<GroupMembersInfo> list) {
|
||||
if (null != onMemberKicked) onMemberKicked!(groupId, opUser, list);
|
||||
}
|
||||
|
||||
@override
|
||||
void memberLeave(String groupId, GroupMembersInfo info) {
|
||||
if (null != onMemberLeave) onMemberLeave!(groupId, info);
|
||||
}
|
||||
|
||||
@override
|
||||
void receiveJoinApplication(
|
||||
String groupId, GroupMembersInfo info, String opReason) {
|
||||
if (null != onReceiveJoinApplication)
|
||||
onReceiveJoinApplication!(groupId, info, opReason);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OnMsgSendProgressListener extends MsgSendProgressListener {
|
||||
Function(String msgID, int progress)? onProgress;
|
||||
|
||||
OnMsgSendProgressListener({this.onProgress});
|
||||
|
||||
void progress(String msgID, int progress) {
|
||||
if (null != onProgress) onProgress!(msgID, progress);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
abstract class InitSDKListener {
|
||||
/// SDK is connecting to the server
|
||||
void connecting();
|
||||
|
||||
/// SDK has successfully connected to the server
|
||||
void connectSuccess();
|
||||
|
||||
/// SDK failed to connect to the server
|
||||
void connectFailed(int? code, String? errorMsg);
|
||||
|
||||
/// The current user is kicked offline.
|
||||
/// At this time, the UI can prompt the user and call IMManager's login() function to log in again.
|
||||
void kickedOffline();
|
||||
|
||||
/// Ticket expired when online.
|
||||
/// At this time, you need to generate a new userSig and call IMManager's login() function to log in again
|
||||
void userSigExpired();
|
||||
|
||||
/// The information of the logged-in user has been updated
|
||||
void selfInfoUpdated(UserInfo info);
|
||||
}
|
||||
@@ -1,3 +1,9 @@
|
||||
abstract class MsgSendProgressListener {
|
||||
void progress(String msgID, int progress);
|
||||
class OnMsgSendProgressListener {
|
||||
Function(String clientMsgID, int progress)? onProgress;
|
||||
|
||||
OnMsgSendProgressListener({this.onProgress});
|
||||
|
||||
void progress(String clientMsgID, int progress) {
|
||||
if (null != onProgress) onProgress!(clientMsgID, progress);
|
||||
}
|
||||
}
|
||||
|
||||
63
lib/src/listener/signaling_listener.dart
Normal file
63
lib/src/listener/signaling_listener.dart
Normal file
@@ -0,0 +1,63 @@
|
||||
import 'package:flutter_openim_sdk/src/models/signaling_info.dart';
|
||||
|
||||
class OnSignalingListener {
|
||||
final Function(SignalingInfo info)? onInvitationCancelled;
|
||||
final Function(SignalingInfo info)? onInvitationTimeout;
|
||||
final Function(SignalingInfo info)? onInviteeAccepted;
|
||||
final Function(SignalingInfo info)? onInviteeRejected;
|
||||
final Function(SignalingInfo info)? onReceiveNewInvitation;
|
||||
final Function(SignalingInfo info)? onInviteeRejectedByOtherDevice;
|
||||
final Function(SignalingInfo info)? onInviteeAcceptedByOtherDevice;
|
||||
final Function(SignalingInfo info)? onHangup;
|
||||
|
||||
OnSignalingListener({
|
||||
this.onInvitationCancelled,
|
||||
this.onInvitationTimeout,
|
||||
this.onInviteeAccepted,
|
||||
this.onInviteeRejected,
|
||||
this.onReceiveNewInvitation,
|
||||
this.onInviteeAcceptedByOtherDevice,
|
||||
this.onInviteeRejectedByOtherDevice,
|
||||
this.onHangup,
|
||||
});
|
||||
|
||||
/// 被邀请者收到:邀请者取消音视频通话
|
||||
void invitationCancelled(SignalingInfo info) {
|
||||
onInvitationCancelled?.call(info);
|
||||
}
|
||||
|
||||
/// 邀请者收到:被邀请者超时未接通
|
||||
void invitationTimeout(SignalingInfo info) {
|
||||
onInvitationTimeout?.call(info);
|
||||
}
|
||||
|
||||
/// 邀请者收到:被邀请者同意音视频通话
|
||||
void inviteeAccepted(SignalingInfo info) {
|
||||
onInviteeAccepted?.call(info);
|
||||
}
|
||||
|
||||
/// 邀请者收到:被邀请者拒绝音视频通话
|
||||
void inviteeRejected(SignalingInfo info) {
|
||||
onInviteeRejected?.call(info);
|
||||
}
|
||||
|
||||
/// 被邀请者收到:音视频通话邀请
|
||||
void receiveNewInvitation(SignalingInfo info) {
|
||||
onReceiveNewInvitation?.call(info);
|
||||
}
|
||||
|
||||
/// 被邀请者(其他端)收到:比如被邀请者在手机拒接,在pc上会收到此回调
|
||||
void inviteeAcceptedByOtherDevice(SignalingInfo info) {
|
||||
onInviteeAcceptedByOtherDevice?.call(info);
|
||||
}
|
||||
|
||||
/// 被邀请者(其他端)收到:比如被邀请者在手机拒接,在pc上会收到此回调
|
||||
void inviteeRejectedByOtherDevice(SignalingInfo info) {
|
||||
onInviteeRejectedByOtherDevice?.call(info);
|
||||
}
|
||||
|
||||
/// 被挂断
|
||||
void hangup(SignalingInfo info) {
|
||||
onHangup?.call(info);
|
||||
}
|
||||
}
|
||||
12
lib/src/listener/user_listener.dart
Normal file
12
lib/src/listener/user_listener.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class OnUserListener {
|
||||
/// The information of the logged-in user has been updated
|
||||
Function(UserInfo info)? onSelfInfoUpdated;
|
||||
|
||||
OnUserListener({this.onSelfInfoUpdated});
|
||||
|
||||
void selfInfoUpdated(UserInfo info) {
|
||||
onSelfInfoUpdated?.call(info);
|
||||
}
|
||||
}
|
||||
9
lib/src/listener/workmoments_listener.dart
Normal file
9
lib/src/listener/workmoments_listener.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
class OnWorkMomentsListener {
|
||||
Function()? onRecvNewNotification;
|
||||
|
||||
OnWorkMomentsListener({this.onRecvNewNotification});
|
||||
|
||||
void recvNewNotification() {
|
||||
onRecvNewNotification?.call();
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,38 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
///
|
||||
///
|
||||
class ConversationManager {
|
||||
MethodChannel _channel;
|
||||
late ConversationListener conversationListener;
|
||||
late OnConversationListener listener;
|
||||
|
||||
ConversationManager(this._channel);
|
||||
|
||||
/// Observe conversation changes
|
||||
/// 会话监听
|
||||
Future setConversationListener(ConversationListener listener) {
|
||||
this.conversationListener = listener;
|
||||
Future setConversationListener(OnConversationListener listener) {
|
||||
this.listener = listener;
|
||||
return _channel.invokeMethod('setConversationListener', _buildParam({}));
|
||||
}
|
||||
|
||||
/// Get all conversations
|
||||
/// 获取所有会话
|
||||
Future<List<ConversationInfo>> getAllConversationList() => _channel
|
||||
.invokeMethod('getAllConversationList', _buildParam({}))
|
||||
.then((value) => _toList(value));
|
||||
Future<List<ConversationInfo>> getAllConversationList(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getAllConversationList',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
|
||||
|
||||
/// Paging to get conversation
|
||||
/// 分页获取会话, [offset]下次获取开始index
|
||||
/// 分页获取会话
|
||||
Future<List<ConversationInfo>> getConversationListSplit({
|
||||
int offset = 0,
|
||||
int count = 20,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -36,18 +40,21 @@ class ConversationManager {
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toList(value));
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
|
||||
|
||||
/// Get a single conversation info
|
||||
/// [sourceID] if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID
|
||||
/// [sessionType] if it is a single chat, it value is 1. if it is a group chat, it value is 2
|
||||
/// 获取单个会话
|
||||
/// [sourceID]如果是单聊值传用户id,如果是群聊值传组id
|
||||
/// [sessionType]如果是单聊值传1,如果是群聊值传2
|
||||
Future<ConversationInfo> getSingleConversation({
|
||||
/// Get a conversation, if it doesn't exist it will be created automatically
|
||||
/// [sourceID] if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID
|
||||
/// [sessionType] if it is a single chat, it value is 1. if it is a group chat, it value is 2
|
||||
/// 获取一个会话,如果不存在会自动创建
|
||||
/// [sourceID] 如果是单聊值传用户ID,如果是群聊值传组ID
|
||||
/// [sessionType] 如果是单聊值传1,如果是群聊值传2
|
||||
Future<ConversationInfo> getOneConversation({
|
||||
required String sourceID,
|
||||
required int sessionType,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -55,89 +62,105 @@ class ConversationManager {
|
||||
_buildParam({
|
||||
"sourceID": sourceID,
|
||||
"sessionType": sessionType,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => ConversationInfo.fromJson(map)));
|
||||
|
||||
/// Get conversation list by id list
|
||||
/// 获取多个会话
|
||||
Future<List<ConversationInfo>> getMultipleConversation({
|
||||
required List<String> conversationIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getMultipleConversation',
|
||||
_buildParam({
|
||||
"conversationIDList": conversationIDList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toList(value));
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => ConversationInfo.fromJson(map)));
|
||||
|
||||
/// Delete conversation by id
|
||||
/// 删除会话
|
||||
Future deleteConversation({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'deleteConversation',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
}))
|
||||
.then((value) => _printValue(value));
|
||||
_channel.invokeMethod(
|
||||
'deleteConversation',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Set draft
|
||||
/// 设置会话草稿
|
||||
Future setConversationDraft({
|
||||
required String conversationID,
|
||||
required String draftText,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'setConversationDraft',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"draftText": draftText,
|
||||
}))
|
||||
.then((value) => _printValue(value));
|
||||
_channel.invokeMethod(
|
||||
'setConversationDraft',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"draftText": draftText,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Pinned conversation
|
||||
/// 置顶会话
|
||||
Future pinConversation({
|
||||
required String conversationID,
|
||||
required bool isPinned,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'pinConversation',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isPinned": isPinned,
|
||||
}))
|
||||
.then((value) => _printValue(value));
|
||||
|
||||
/// Mark single chat messages as read
|
||||
/// 标记单聊已读
|
||||
Future<dynamic> markSingleMessageHasRead({required String userID}) =>
|
||||
_channel.invokeMethod(
|
||||
'markSingleMessageHasRead', _buildParam({'userID': userID}));
|
||||
'pinConversation',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isPinned": isPinned,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
// Future<dynamic> markSingleMessageHasRead({required String userID}) =>
|
||||
// _channel.invokeMethod(
|
||||
// 'markSingleMessageHasRead', _buildParam({'userID': userID}));
|
||||
|
||||
/// Mark group chat messages as read
|
||||
/// 标记群聊已读
|
||||
Future<dynamic> markGroupMessageHasRead({required String groupID}) =>
|
||||
Future<dynamic> markGroupMessageHasRead({
|
||||
required String groupID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'markGroupMessageHasRead', _buildParam({'groupID': groupID}));
|
||||
'markGroupMessageHasRead',
|
||||
_buildParam({
|
||||
'groupID': groupID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Get the total number of unread messages
|
||||
/// 获取未读消息总数
|
||||
Future<dynamic> getTotalUnreadMsgCount() =>
|
||||
_channel.invokeMethod('getTotalUnreadMsgCount', _buildParam({}));
|
||||
Future<dynamic> getTotalUnreadMsgCount({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'getTotalUnreadMsgCount',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Query conversation id
|
||||
/// [sourceID] : if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID
|
||||
/// [sessionType] : if it is a single chat, it value is 1. if it is a group chat, it value is 2
|
||||
/// [sourceID] if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID
|
||||
/// [sessionType] if it is a single chat, it value is 1. if it is a group chat, it value is 2
|
||||
/// 查询会话id
|
||||
/// [sourceID]如果是单聊值传用户id,如果是群聊值传组id
|
||||
/// [sessionType]如果是单聊值传1,如果是群聊值传2
|
||||
Future<dynamic> getConversationID({
|
||||
/// [sourceID] 如果是单聊值传用户ID,如果是群聊值传组ID
|
||||
/// [sessionType] 如果是单聊值传1,如果是群聊值传2
|
||||
Future<dynamic> getConversationIDBySessionType({
|
||||
required String sourceID,
|
||||
required int sessionType,
|
||||
}) =>
|
||||
@@ -149,18 +172,20 @@ class ConversationManager {
|
||||
}));
|
||||
|
||||
/// Message Do Not Disturb
|
||||
/// [status] 1: Do not receive messages, 2: Do not notify when messages are received; 0: Normal
|
||||
/// [status] 0: Normal. 1: Do not receive messages. 2: Do not notify when messages are received.
|
||||
/// 消息免打扰设置
|
||||
/// [status] 1:不接受消息;2:接受在线消息不接受离线消息;3:正常
|
||||
/// [status] 0:正常;1:不接受消息;2:接受在线消息不接受离线消息;
|
||||
Future<dynamic> setConversationRecvMessageOpt({
|
||||
required List<String> conversationIDList,
|
||||
required int status,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setConversationRecvMessageOpt',
|
||||
_buildParam({
|
||||
"conversationIDList": conversationIDList,
|
||||
"status": status,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Message Do Not Disturb
|
||||
@@ -168,26 +193,85 @@ class ConversationManager {
|
||||
/// 查询免打扰状态
|
||||
Future<List<dynamic>> getConversationRecvMessageOpt({
|
||||
required List<String> conversationIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getConversationRecvMessageOpt',
|
||||
_buildParam({
|
||||
"conversationIDList": conversationIDList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _formatJson(value));
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
/// burn after reading
|
||||
/// 阅后即焚
|
||||
Future<dynamic> setOneConversationPrivateChat({
|
||||
required String conversationID,
|
||||
required bool isPrivate,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setOneConversationPrivateChat',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"isPrivate": isPrivate,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Delete conversation from local and service
|
||||
/// 删除会话
|
||||
Future<dynamic> deleteConversationFromLocalAndSvr({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteConversationFromLocalAndSvr',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Delete conversation from local
|
||||
/// 删除会话
|
||||
Future<dynamic> deleteAllConversationFromLocal({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteAllConversationFromLocal',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Reset group converstaion at type
|
||||
/// 重置at标准位
|
||||
Future<dynamic> resetConversationGroupAtType({
|
||||
required String conversationID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'resetConversationGroupAtType',
|
||||
_buildParam({
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Get @ all member tag
|
||||
/// 查询at所有人标识
|
||||
Future<dynamic> getAtAllTag() =>
|
||||
_channel.invokeMethod('getAtAllTag', _buildParam({}));
|
||||
|
||||
/// Custom sort for conversation list
|
||||
/// 会话列表自定义排序规则
|
||||
/// 会话列表自定义排序规则。
|
||||
List<ConversationInfo> simpleSort(List<ConversationInfo> list) => list
|
||||
..sort((a, b) {
|
||||
if ((a.isPinned == 1 && b.isPinned == 1) ||
|
||||
(a.isPinned != 1 && b.isPinned != 1)) {
|
||||
int aCompare = a.draftTimestamp! > a.latestMsgSendTime!
|
||||
? a.draftTimestamp!
|
||||
if ((a.isPinned == true && b.isPinned == true) ||
|
||||
(a.isPinned != true && b.isPinned != true)) {
|
||||
int aCompare = a.draftTextTime! > a.latestMsgSendTime!
|
||||
? a.draftTextTime!
|
||||
: a.latestMsgSendTime!;
|
||||
int bCompare = b.draftTimestamp! > b.latestMsgSendTime!
|
||||
? b.draftTimestamp!
|
||||
int bCompare = b.draftTextTime! > b.latestMsgSendTime!
|
||||
? b.draftTextTime!
|
||||
: b.latestMsgSendTime!;
|
||||
if (aCompare > bCompare) {
|
||||
return -1;
|
||||
@@ -196,7 +280,7 @@ class ConversationManager {
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else if (a.isPinned == 1 && b.isPinned != 1) {
|
||||
} else if (a.isPinned == true && b.isPinned != true) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
@@ -207,19 +291,4 @@ class ConversationManager {
|
||||
param["ManagerName"] = "conversationManager";
|
||||
return param;
|
||||
}
|
||||
|
||||
static List<ConversationInfo> _toList(String? value) {
|
||||
var list = _formatJson(value);
|
||||
if (null == list) return <ConversationInfo>[];
|
||||
return (list as List).map((e) => ConversationInfo.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
static ConversationInfo _toObj(String value) =>
|
||||
ConversationInfo.fromJson(_formatJson(value));
|
||||
|
||||
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||
|
||||
static String _printValue(value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,136 +1,207 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class FriendshipManager {
|
||||
MethodChannel _channel;
|
||||
late FriendshipListener friendshipListener;
|
||||
late OnFriendshipListener listener;
|
||||
|
||||
FriendshipManager(this._channel);
|
||||
|
||||
/// Set up a friend relationship listener
|
||||
/// 好友关系监听
|
||||
Future setFriendshipListener(FriendshipListener listener) {
|
||||
this.friendshipListener = listener;
|
||||
Future setFriendshipListener(OnFriendshipListener listener) {
|
||||
this.listener = listener;
|
||||
return _channel.invokeMethod('setFriendListener', _buildParam({}));
|
||||
}
|
||||
|
||||
/// Get friend info by user id
|
||||
/// 查询好友信息
|
||||
Future<List<UserInfo>> getFriendsInfo({required List<String> uidList}) =>
|
||||
Future<List<UserInfo>> getFriendsInfo({
|
||||
required List<String> uidList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod('getFriendsInfo', _buildParam({"uidList": uidList}))
|
||||
.then((value) => _toList(value));
|
||||
.invokeMethod(
|
||||
'getFriendsInfo',
|
||||
_buildParam({
|
||||
"uidList": uidList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
|
||||
|
||||
/// Send an friend application
|
||||
/// 发送一个好友请求
|
||||
Future<dynamic> addFriend({required String uid, required String reason}) =>
|
||||
Future<dynamic> addFriend({
|
||||
required String uid,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'addFriend', _buildParam({"uid": uid, "reqMessage": reason}));
|
||||
'addFriend',
|
||||
_buildParam({
|
||||
"toUserID": uid,
|
||||
"reqMsg": reason,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Get all friend application, sent to you by others
|
||||
/// 获取所有好友申请
|
||||
Future<List<UserInfo>> getFriendApplicationList() => _channel
|
||||
.invokeMethod('getFriendApplicationList', _buildParam({}))
|
||||
.then((value) => _toList(value));
|
||||
/// Get someone's request to add me as a friend
|
||||
/// 获取别人加我为好友的申请
|
||||
Future<List<FriendApplicationInfo>> getRecvFriendApplicationList(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getRecvFriendApplicationList',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
|
||||
|
||||
/// Get friend requests from me
|
||||
/// 获取我发出的好友申请
|
||||
Future<List<FriendApplicationInfo>> getSendFriendApplicationList(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getSendFriendApplicationList',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (v) => FriendApplicationInfo.fromJson(v)));
|
||||
|
||||
/// Find all friends including those who have been added to the blacklist
|
||||
/// 获取好友列表包含已拉入黑名单的好友
|
||||
Future<List<UserInfo>> getFriendList() => _channel
|
||||
.invokeMethod('getFriendList', _buildParam({}))
|
||||
.then((value) => _toList(value));
|
||||
Future<List<UserInfo>> getFriendList({String? operationID}) => _channel
|
||||
.invokeMethod(
|
||||
'getFriendList',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
|
||||
|
||||
/// Find all friends including those who have been added to the blacklist
|
||||
/// 获取好友列表
|
||||
Future<List<dynamic>> getFriendListMap() => _channel
|
||||
.invokeMethod('getFriendList', _buildParam({}))
|
||||
.then((value) => _toListMap(value));
|
||||
|
||||
/// Modify friend information, only [comment] can be modified
|
||||
/// 设置好友备注
|
||||
Future<dynamic> setFriendInfo(
|
||||
{required String uid, required String comment}) =>
|
||||
_channel.invokeMethod(
|
||||
'setFriendInfo',
|
||||
Future<List<dynamic>> getFriendListMap({String? operationID}) => _channel
|
||||
.invokeMethod(
|
||||
'getFriendList',
|
||||
_buildParam({
|
||||
'uid': uid,
|
||||
'comment': comment,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
/// Modify friend remark name
|
||||
/// 设置好友备注
|
||||
Future<dynamic> setFriendRemark({
|
||||
required String uid,
|
||||
required String remark,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setFriendRemark',
|
||||
_buildParam({
|
||||
'toUserID': uid,
|
||||
'remark': remark,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Add friends to blacklist
|
||||
/// 加入黑名单
|
||||
Future<dynamic> addToBlackList({required String uid}) =>
|
||||
_channel.invokeMethod('addToBlackList', _buildParam({"uid": uid}));
|
||||
Future<dynamic> addBlacklist({
|
||||
required String uid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'addBlacklist',
|
||||
_buildParam({
|
||||
"uid": uid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Find all blacklist
|
||||
/// 获取黑名单列表
|
||||
Future<List<UserInfo>> getBlackList() => _channel
|
||||
.invokeMethod('getBlackList', _buildParam({}))
|
||||
.then((value) => _toList(value));
|
||||
Future<List<UserInfo>> getBlacklist({String? operationID}) => _channel
|
||||
.invokeMethod(
|
||||
'getBlacklist',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
|
||||
|
||||
/// Remove from blacklist
|
||||
/// 从黑名单移除
|
||||
Future<dynamic> deleteFromBlackList({required String uid}) =>
|
||||
_channel.invokeMethod('deleteFromBlackList', _buildParam({"uid": uid}));
|
||||
Future<dynamic> removeBlacklist({
|
||||
required String uid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'removeBlacklist',
|
||||
_buildParam({
|
||||
"uid": uid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Determine if there is a friendship by userId
|
||||
/// 检查友好关系
|
||||
Future<List<UserInfo>> checkFriend(List<String> uidList) => _channel
|
||||
.invokeMethod('checkFriend', _buildParam({'uidList': uidList}))
|
||||
.then((value) => _toList(value));
|
||||
Future<List<FriendshipInfo>> checkFriend({
|
||||
required List<String> uidList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'checkFriend',
|
||||
_buildParam({
|
||||
'uidList': uidList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (v) => FriendshipInfo.fromJson(v)));
|
||||
|
||||
/// Dissolve friendship from friend list
|
||||
/// 删除好友
|
||||
Future<dynamic> deleteFromFriendList({required String uid}) =>
|
||||
_channel.invokeMethod('deleteFromFriendList', _buildParam({"uid": uid}));
|
||||
Future<dynamic> deleteFriend({
|
||||
required String uid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteFriend',
|
||||
_buildParam({
|
||||
"uid": uid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Accept application of be friend
|
||||
/// 接受好友请求
|
||||
Future<dynamic> acceptFriendApplication({required String uid}) => _channel
|
||||
.invokeMethod('acceptFriendApplication', _buildParam({"uid": uid}));
|
||||
Future<dynamic> acceptFriendApplication({
|
||||
required String uid,
|
||||
String? handleMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'acceptFriendApplication',
|
||||
_buildParam({
|
||||
"toUserID": uid,
|
||||
"handleMsg": handleMsg,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Refuse application of be friend
|
||||
/// 拒绝好友请求
|
||||
Future<dynamic> refuseFriendApplication({required String uid}) => _channel
|
||||
.invokeMethod('refuseFriendApplication', _buildParam({"uid": uid}));
|
||||
|
||||
///
|
||||
// Future<dynamic> forceSyncFriendApplication() {
|
||||
// return _channel.invokeMethod('forceSyncFriendApplication', _buildParam({}));
|
||||
// }
|
||||
|
||||
///
|
||||
// Future<dynamic> forceSyncFriend() {
|
||||
// return _channel.invokeMethod('forceSyncFriend', _buildParam({}));
|
||||
// }
|
||||
|
||||
///
|
||||
// Future<dynamic> forceSyncBlackList() {
|
||||
// return _channel.invokeMethod('forceSyncBlackList', _buildParam({}));
|
||||
// }
|
||||
Future<dynamic> refuseFriendApplication({
|
||||
required String uid,
|
||||
String? handleMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'refuseFriendApplication',
|
||||
_buildParam({
|
||||
"toUserID": uid,
|
||||
"handleMsg": handleMsg,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "friendshipManager";
|
||||
return param;
|
||||
}
|
||||
|
||||
static List<UserInfo> _toList(String? value) {
|
||||
var list = _formatJson(value);
|
||||
if (null == list) return <UserInfo>[];
|
||||
return (list as List).map((e) => UserInfo.fromJson(e)).toList();
|
||||
}
|
||||
|
||||
static List<dynamic> _toListMap(String? value) {
|
||||
var list = _formatJson(value);
|
||||
return list;
|
||||
}
|
||||
|
||||
// static UserInfo _toObj(String value) => UserInfo.fromJson(_formatJson(value));
|
||||
|
||||
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||
|
||||
static String _printValue(value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/src/listener/group_listener.dart';
|
||||
import 'package:flutter_openim_sdk/src/models/group_info.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class GroupManager {
|
||||
MethodChannel _channel;
|
||||
late GroupListener groupListener;
|
||||
late OnGroupListener listener;
|
||||
|
||||
GroupManager(this._channel);
|
||||
|
||||
/// Set up group relationship monitoring
|
||||
/// 组关系监听
|
||||
Future setGroupListener(GroupListener listener) {
|
||||
this.groupListener = listener;
|
||||
Future setGroupListener(OnGroupListener listener) {
|
||||
this.listener = listener;
|
||||
return _channel.invokeMethod('setGroupListener', _buildParam({}));
|
||||
}
|
||||
|
||||
@@ -23,6 +20,7 @@ class GroupManager {
|
||||
required String groupId,
|
||||
required List<String> uidList,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -31,10 +29,10 @@ class GroupManager {
|
||||
'gid': groupId,
|
||||
'reason': reason,
|
||||
'uidList': uidList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => (_formatJson(value) as List)
|
||||
.map((e) => GroupInviteResult.fromJson(e))
|
||||
.toList());
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
|
||||
|
||||
/// Remove member from group
|
||||
/// 移除组成员
|
||||
@@ -42,6 +40,7 @@ class GroupManager {
|
||||
required String groupId,
|
||||
required List<String> uidList,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -50,16 +49,17 @@ class GroupManager {
|
||||
'gid': groupId,
|
||||
'reason': reason,
|
||||
'uidList': uidList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => (_formatJson(value) as List)
|
||||
.map((e) => GroupInviteResult.fromJson(e))
|
||||
.toList());
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupInviteResult.fromJson(map)));
|
||||
|
||||
/// Get group member's info
|
||||
/// 查询组成员资料
|
||||
Future<List<GroupMembersInfo>> getGroupMembersInfo({
|
||||
required String groupId,
|
||||
required List<String> uidList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -67,19 +67,19 @@ class GroupManager {
|
||||
_buildParam({
|
||||
'gid': groupId,
|
||||
'uidList': uidList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => (_formatJson(value) as List)
|
||||
.map((e) => GroupMembersInfo.fromJson(e))
|
||||
.toList());
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
|
||||
|
||||
/// Get the list of group members
|
||||
/// [filter] 0: all user, 1: group owner, 2: administrator
|
||||
/// [next] begin index, pull and fill 0 for the first time
|
||||
/// 获取组成员列表
|
||||
Future<GroupMembersList> getGroupMemberList({
|
||||
/// 分页获取组成员列表
|
||||
Future<List<GroupMembersInfo>> getGroupMemberList({
|
||||
required String groupId,
|
||||
int filter = 0,
|
||||
int next = 0,
|
||||
int offset = 0,
|
||||
int count = 0,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -87,16 +87,21 @@ class GroupManager {
|
||||
_buildParam({
|
||||
'gid': groupId,
|
||||
'filter': filter,
|
||||
'next': next,
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => GroupMembersList.fromJson(_formatJson(value)));
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupMembersInfo.fromJson(map)));
|
||||
|
||||
/// Get the list of group members
|
||||
/// 获取组成员列表
|
||||
Future<dynamic> getGroupMemberListMap({
|
||||
/// 分页获取组成员列表
|
||||
Future<List<dynamic>> getGroupMemberListMap({
|
||||
required String groupId,
|
||||
int filter = 0,
|
||||
int next = 0,
|
||||
int offset = 0,
|
||||
int count = 0,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -104,49 +109,71 @@ class GroupManager {
|
||||
_buildParam({
|
||||
'gid': groupId,
|
||||
'filter': filter,
|
||||
'next': next,
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _formatJson(value));
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
/// Find all groups you have joined
|
||||
/// 查询已加入的组列表
|
||||
Future<List<GroupInfo>> getJoinedGroupList() => _channel
|
||||
.invokeMethod('getJoinedGroupList', _buildParam({}))
|
||||
.then((value) => (_formatJson(value) as List)
|
||||
.map((e) => GroupInfo.fromJson(e))
|
||||
.toList());
|
||||
Future<List<GroupInfo>> getJoinedGroupList({String? operationID}) => _channel
|
||||
.invokeMethod(
|
||||
'getJoinedGroupList',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
|
||||
|
||||
/// Find all groups you have joined
|
||||
/// 查询已加入的组列表
|
||||
Future<List<dynamic>> getJoinedGroupListMap() => _channel
|
||||
.invokeMethod('getJoinedGroupList', _buildParam({}))
|
||||
.then((value) => _formatJson(value));
|
||||
Future<List<dynamic>> getJoinedGroupListMap({String? operationID}) => _channel
|
||||
.invokeMethod(
|
||||
'getJoinedGroupList',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toListMap(value));
|
||||
|
||||
/// Check if you are a member of the group
|
||||
/// 检查是否已加入组
|
||||
Future<bool> isJoinedGroup({required String gid}) => getJoinedGroupList()
|
||||
.then((list) => list.where((e) => e.groupID == gid).length > 0);
|
||||
Future<bool> isJoinedGroup({
|
||||
required String gid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
getJoinedGroupList(
|
||||
operationID: Utils.checkOperationID(operationID),
|
||||
).then((list) => list.where((e) => e.groupID == gid).length > 0);
|
||||
|
||||
/// Create a group
|
||||
/// 创建一个组
|
||||
Future<dynamic> createGroup({
|
||||
Future<GroupInfo> createGroup({
|
||||
String? groupName,
|
||||
String? notification,
|
||||
String? introduction,
|
||||
String? faceUrl,
|
||||
int? groupType,
|
||||
String? ex,
|
||||
required List<GroupMemberRole> list,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'createGroup',
|
||||
_buildParam({
|
||||
'gInfo': {
|
||||
"groupName": groupName,
|
||||
"notification": notification,
|
||||
"introduction": introduction,
|
||||
"faceUrl": faceUrl,
|
||||
},
|
||||
'memberList': list.map((e) => e.toJson()).toList()
|
||||
}));
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createGroup',
|
||||
_buildParam({
|
||||
'gInfo': {
|
||||
"groupName": groupName,
|
||||
"notification": notification,
|
||||
"introduction": introduction,
|
||||
"faceURL": faceUrl,
|
||||
"groupType": groupType,
|
||||
"ex": ex,
|
||||
},
|
||||
'memberList': list.map((e) => e.toJson()).toList(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then(
|
||||
(value) => Utils.toObj(value, (map) => GroupInfo.fromJson(map)));
|
||||
|
||||
/// Edit group information
|
||||
/// 编辑组资料
|
||||
@@ -156,53 +183,66 @@ class GroupManager {
|
||||
String? notification,
|
||||
String? introduction,
|
||||
String? faceUrl,
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupInfo',
|
||||
_buildParam({
|
||||
"gid": groupID,
|
||||
'gInfo': {
|
||||
"groupID": groupID,
|
||||
// "groupID": groupID,
|
||||
"groupName": groupName,
|
||||
"notification": notification,
|
||||
"introduction": introduction,
|
||||
"faceUrl": faceUrl,
|
||||
"faceURL": faceUrl,
|
||||
"ex": ex,
|
||||
},
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Find group information by group id
|
||||
/// 查询组信息
|
||||
Future<List<GroupInfo>> getGroupsInfo({
|
||||
required List<String> gidList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod('getGroupsInfo', _buildParam({'gidList': gidList}))
|
||||
.then((value) {
|
||||
List list = _formatJson(value);
|
||||
return list.map((e) => GroupInfo.fromJson(e)).toList();
|
||||
});
|
||||
.invokeMethod(
|
||||
'getGroupsInfo',
|
||||
_buildParam({
|
||||
'gidList': gidList,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then(
|
||||
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
|
||||
|
||||
/// Apply to join the group
|
||||
/// 申请加入组,需要通过管理员同意。
|
||||
Future<dynamic> joinGroup({
|
||||
required String gid,
|
||||
String? reason,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'joinGroup',
|
||||
_buildParam({
|
||||
'gid': gid,
|
||||
'reason': reason,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Leave group
|
||||
/// 退出组
|
||||
Future<dynamic> quitGroup({
|
||||
required String gid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'quitGroup',
|
||||
_buildParam({
|
||||
'gid': gid,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Give group permissions to others
|
||||
@@ -210,74 +250,165 @@ class GroupManager {
|
||||
Future<dynamic> transferGroupOwner({
|
||||
required String gid,
|
||||
required String uid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'transferGroupOwner',
|
||||
_buildParam({
|
||||
'gid': gid,
|
||||
'uid': uid,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Get the list of applications
|
||||
/// 获取所有进组申请
|
||||
Future<GroupApplicationList> getGroupApplicationList() => _channel
|
||||
.invokeMethod('getGroupApplicationList', _buildParam({}))
|
||||
.then((value) => GroupApplicationList.fromJson(_formatJson(value)));
|
||||
/// As the group owner or administrator, get the list of received group members' applications to join the group.
|
||||
/// 作为群主或者管理员,获取收到的群成员申请进群列表。
|
||||
Future<List<GroupApplicationInfo>> getRecvGroupApplicationList(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getRecvGroupApplicationList',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
|
||||
|
||||
/// Get the record of the group membership application issued by yourself
|
||||
/// 获取自己发出的入群申请记录
|
||||
Future<List<GroupApplicationInfo>> getSendGroupApplicationList(
|
||||
{String? operationID}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getSendGroupApplicationList',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => GroupApplicationInfo.fromJson(map)));
|
||||
|
||||
/// Accept group application
|
||||
/// 同意进组申请
|
||||
/// 管理员或者群主同意某人进入某群
|
||||
Future<dynamic> acceptGroupApplication({
|
||||
required GroupApplicationInfo info,
|
||||
required String reason,
|
||||
required String gid,
|
||||
required String uid,
|
||||
String? handleMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'acceptGroupApplication',
|
||||
_buildParam({
|
||||
'application': info.toJson(),
|
||||
'reason': reason,
|
||||
'gid': gid,
|
||||
'uid': uid,
|
||||
'handleMsg': handleMsg,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Refuse group application
|
||||
/// 拒绝进组申请
|
||||
/// 管理员或者群主拒绝某人进入某群
|
||||
Future<dynamic> refuseGroupApplication({
|
||||
required GroupApplicationInfo info,
|
||||
required String reason,
|
||||
required String gid,
|
||||
required String uid,
|
||||
String? handleMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'refuseGroupApplication',
|
||||
_buildParam({
|
||||
'application': info.toJson(),
|
||||
'reason': reason,
|
||||
'gid': gid,
|
||||
'uid': uid,
|
||||
'handleMsg': handleMsg,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
///
|
||||
// Future forceSyncApplyGroupRequest() {
|
||||
// return _channel.invokeMethod('forceSyncApplyGroupRequest', _buildParam({}));
|
||||
// }
|
||||
/// Dissmiss group
|
||||
/// 解散群
|
||||
Future<dynamic> dismissGroup({
|
||||
required String groupID,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'dismissGroup',
|
||||
_buildParam({
|
||||
'gid': groupID,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
///
|
||||
// Future forceSyncGroupRequest() {
|
||||
// return _channel.invokeMethod('forceSyncGroupRequest', _buildParam({}));
|
||||
// }
|
||||
/// Enable group mute
|
||||
/// 开启群禁言
|
||||
Future<dynamic> changeGroupMute({
|
||||
required String groupID,
|
||||
required bool mute,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'changeGroupMute',
|
||||
_buildParam({
|
||||
'gid': groupID,
|
||||
'mute': mute,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
///
|
||||
// Future forceSyncJoinedGroup() {
|
||||
// return _channel.invokeMethod('forceSyncJoinedGroup', _buildParam({}));
|
||||
// }
|
||||
/// Mute group members
|
||||
/// 禁言群成员
|
||||
Future<dynamic> changeGroupMemberMute({
|
||||
required String groupID,
|
||||
required String userID,
|
||||
int seconds = 0,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'changeGroupMemberMute',
|
||||
_buildParam({
|
||||
'gid': groupID,
|
||||
'uid': userID,
|
||||
'seconds': seconds,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
///
|
||||
// Future forceSyncJoinedGroupMember() {
|
||||
// return _channel.invokeMethod('forceSyncJoinedGroupMember', _buildParam({}));
|
||||
// }
|
||||
/// Set group user nickname
|
||||
/// 设置群成员昵称
|
||||
Future<dynamic> setGroupMemberNickname({
|
||||
required String groupID,
|
||||
required String userID,
|
||||
String? groupNickname,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setGroupMemberNickname',
|
||||
_buildParam({
|
||||
'gid': groupID,
|
||||
'uid': userID,
|
||||
'groupNickname': groupNickname ?? '',
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Search group
|
||||
/// 查询群
|
||||
/// [keywordList] 搜索关键词,目前仅支持一个关键词搜索,不能为空
|
||||
/// [isSearchGroupID] 是否以关键词搜索群ID(注:两个不可以同时为false),为空默认false
|
||||
/// [isSearchGroupName] 是否以关键词搜索群名字,为空默认false
|
||||
Future<List<GroupInfo>> searchGroups({
|
||||
List<String> keywordList = const [],
|
||||
bool isSearchGroupID = false,
|
||||
bool isSearchGroupName = false,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'searchGroups',
|
||||
_buildParam({
|
||||
'searchParam': {
|
||||
'keywordList': keywordList,
|
||||
'isSearchGroupID': isSearchGroupID,
|
||||
'isSearchGroupName': isSearchGroupName,
|
||||
},
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then(
|
||||
(value) => Utils.toList(value, (map) => GroupInfo.fromJson(map)));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "groupManager";
|
||||
return param;
|
||||
}
|
||||
|
||||
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||
|
||||
static String _printValue(value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -10,13 +9,15 @@ class IMManager {
|
||||
late FriendshipManager friendshipManager;
|
||||
late MessageManager messageManager;
|
||||
late GroupManager groupManager;
|
||||
late UserManager userManager;
|
||||
|
||||
// late OfflinePushManager offlinePushManager;
|
||||
// late SignalingManager signalingManager;
|
||||
late InitSDKListener _initSDKListener;
|
||||
late SignalingManager signalingManager;
|
||||
late WorkMomentsManager workMomentsManager;
|
||||
|
||||
late OnConnectListener _connectListener;
|
||||
late String uid;
|
||||
late UserInfo uInfo;
|
||||
bool isInitialized = false;
|
||||
bool isLogined = false;
|
||||
|
||||
IMManager(this._channel) {
|
||||
@@ -24,8 +25,10 @@ class IMManager {
|
||||
friendshipManager = FriendshipManager(_channel);
|
||||
messageManager = MessageManager(_channel);
|
||||
groupManager = GroupManager(_channel);
|
||||
userManager = UserManager(_channel);
|
||||
// offlinePushManager = OfflinePushManager(_channel);
|
||||
// signalingManager = SignalingManager(_channel);
|
||||
signalingManager = SignalingManager(_channel);
|
||||
workMomentsManager = WorkMomentsManager(_channel);
|
||||
_addNativeCallback(_channel);
|
||||
}
|
||||
|
||||
@@ -33,112 +36,87 @@ class IMManager {
|
||||
_channel.setMethodCallHandler((call) {
|
||||
try {
|
||||
log('Flutter : $call');
|
||||
if (call.method == ListenerType.initSDKListener) {
|
||||
if (call.method == ListenerType.connectListener) {
|
||||
String type = call.arguments['type'];
|
||||
switch (type) {
|
||||
case 'onConnectFailed':
|
||||
int? errCode = call.arguments['errCode'];
|
||||
String? errMsg = call.arguments['errMsg'];
|
||||
_connectListener.connectFailed(errCode, errMsg);
|
||||
break;
|
||||
case 'onConnecting':
|
||||
_connectListener.connecting();
|
||||
break;
|
||||
case 'onConnectSuccess':
|
||||
_connectListener.connectSuccess();
|
||||
break;
|
||||
case 'onKickedOffline':
|
||||
_connectListener.kickedOffline();
|
||||
break;
|
||||
case 'onUserSigExpired':
|
||||
_connectListener.userSigExpired();
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.userListener) {
|
||||
String type = call.arguments['type'];
|
||||
dynamic data = call.arguments['data'];
|
||||
switch (type) {
|
||||
case 'onSelfInfoUpdated':
|
||||
uInfo = UserInfo.fromJson(_formatJson(data));
|
||||
_initSDKListener.selfInfoUpdated(uInfo);
|
||||
break;
|
||||
case 'onConnectFailed':
|
||||
int? errCode = call.arguments['errCode'];
|
||||
String? errMsg = call.arguments['errMsg'];
|
||||
_initSDKListener.connectFailed(errCode, errMsg);
|
||||
break;
|
||||
case 'onConnecting':
|
||||
_initSDKListener.connecting();
|
||||
break;
|
||||
case 'onConnectSuccess':
|
||||
_initSDKListener.connectSuccess();
|
||||
break;
|
||||
case 'onKickedOffline':
|
||||
_initSDKListener.kickedOffline();
|
||||
break;
|
||||
case 'onUserSigExpired':
|
||||
_initSDKListener.userSigExpired();
|
||||
uInfo = Utils.toObj(data, (map) => UserInfo.fromJson(map));
|
||||
userManager.listener.selfInfoUpdated(uInfo);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.groupListener) {
|
||||
var args = call.arguments;
|
||||
String type = args['type'];
|
||||
Map<dynamic, dynamic> map = args['data'];
|
||||
String type = call.arguments['type'];
|
||||
dynamic data = call.arguments['data'];
|
||||
switch (type) {
|
||||
case 'onMemberEnter':
|
||||
groupManager.groupListener.memberEnter(
|
||||
map['groupId'],
|
||||
(_formatJson(map['memberList']) as List)
|
||||
.map((e) => GroupMembersInfo.fromJson(e))
|
||||
.toList(),
|
||||
);
|
||||
case 'onGroupApplicationAccepted':
|
||||
final i = Utils.toObj(
|
||||
data, (map) => GroupApplicationInfo.fromJson(map));
|
||||
groupManager.listener.groupApplicationAccepted(i);
|
||||
break;
|
||||
case 'onMemberLeave':
|
||||
groupManager.groupListener.memberLeave(
|
||||
map['groupId'],
|
||||
GroupMembersInfo.fromJson(_formatJson(map['member'])),
|
||||
);
|
||||
case 'onGroupApplicationAdded':
|
||||
final i = Utils.toObj(
|
||||
data, (map) => GroupApplicationInfo.fromJson(map));
|
||||
groupManager.listener.groupApplicationAdded(i);
|
||||
break;
|
||||
case 'onMemberInvited':
|
||||
groupManager.groupListener.memberInvited(
|
||||
map['groupId'],
|
||||
GroupMembersInfo.fromJson(_formatJson(map['opUser'])),
|
||||
(_formatJson(map['memberList']) as List)
|
||||
.map((e) => GroupMembersInfo.fromJson(e))
|
||||
.toList(),
|
||||
);
|
||||
case 'onGroupApplicationDeleted':
|
||||
final i = Utils.toObj(
|
||||
data, (map) => GroupApplicationInfo.fromJson(map));
|
||||
groupManager.listener.groupApplicationDeleted(i);
|
||||
break;
|
||||
case 'onMemberKicked':
|
||||
groupManager.groupListener.memberKicked(
|
||||
map['groupId'],
|
||||
GroupMembersInfo.fromJson(_formatJson(map['opUser'])),
|
||||
(_formatJson(map['memberList']) as List)
|
||||
.map((e) => GroupMembersInfo.fromJson(e))
|
||||
.toList(),
|
||||
);
|
||||
break;
|
||||
case 'onGroupCreated':
|
||||
groupManager.groupListener.groupCreated(
|
||||
map['groupId'],
|
||||
);
|
||||
case 'onGroupApplicationRejected':
|
||||
final i = Utils.toObj(
|
||||
data, (map) => GroupApplicationInfo.fromJson(map));
|
||||
groupManager.listener.groupApplicationRejected(i);
|
||||
break;
|
||||
case 'onGroupInfoChanged':
|
||||
groupManager.groupListener.groupInfoChanged(
|
||||
map['groupId'],
|
||||
GroupInfo.fromJson(_formatJson(map['groupInfo'])),
|
||||
);
|
||||
final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map));
|
||||
groupManager.listener.groupInfoChanged(i);
|
||||
break;
|
||||
case 'onReceiveJoinApplication':
|
||||
groupManager.groupListener.receiveJoinApplication(
|
||||
map['groupId'],
|
||||
GroupMembersInfo.fromJson(_formatJson(map['member'])),
|
||||
map['opReason'],
|
||||
);
|
||||
case 'onGroupMemberAdded':
|
||||
final i =
|
||||
Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
|
||||
groupManager.listener.groupMemberAdded(i);
|
||||
break;
|
||||
case 'onApplicationProcessed':
|
||||
groupManager.groupListener.applicationProcessed(
|
||||
map['groupId'],
|
||||
GroupMembersInfo.fromJson(_formatJson(map['opUser'])),
|
||||
map['agreeOrReject'],
|
||||
map['opReason'],
|
||||
);
|
||||
case 'onGroupMemberDeleted':
|
||||
final i =
|
||||
Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
|
||||
groupManager.listener.groupMemberDeleted(i);
|
||||
break;
|
||||
case 'onGroupMemberInfoChanged':
|
||||
final i =
|
||||
Utils.toObj(data, (map) => GroupMembersInfo.fromJson(map));
|
||||
groupManager.listener.groupMemberInfoChanged(i);
|
||||
break;
|
||||
case 'onJoinedGroupAdded':
|
||||
final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map));
|
||||
groupManager.listener.joinedGroupAdded(i);
|
||||
break;
|
||||
case 'onJoinedGroupDeleted':
|
||||
final i = Utils.toObj(data, (map) => GroupInfo.fromJson(map));
|
||||
groupManager.listener.joinedGroupDeleted(i);
|
||||
break;
|
||||
// case 'onMemberInfoChanged':
|
||||
// break;
|
||||
// case 'onGroupDismissed':
|
||||
// break;
|
||||
// case 'onGroupRecycled':
|
||||
// break;
|
||||
//
|
||||
// case 'onGrantAdministrator':
|
||||
// break;
|
||||
// case 'onRevokeAdministrator':
|
||||
// break;
|
||||
// case 'onQuitFromGroup':
|
||||
// break;
|
||||
// case 'onReceiveRESTCustomData':
|
||||
// break;
|
||||
// case 'onGroupAttributeChanged':
|
||||
// break;
|
||||
}
|
||||
} else if (call.method == ListenerType.advancedMsgListener) {
|
||||
var type = call.arguments['type'];
|
||||
@@ -146,30 +124,24 @@ class IMManager {
|
||||
switch (type) {
|
||||
case 'onRecvNewMessage':
|
||||
var value = call.arguments['data']['newMessage'];
|
||||
var msg = Message.fromJson(_formatJson(value));
|
||||
for (var listener in messageManager.advancedMsgListeners) {
|
||||
if (listener.id == id) {
|
||||
listener.recvNewMessage(msg);
|
||||
}
|
||||
}
|
||||
final msg = Utils.toObj(value, (map) => Message.fromJson(map));
|
||||
messageManager.msgListener.recvNewMessage(msg);
|
||||
break;
|
||||
case 'onRecvMessageRevoked':
|
||||
var value = call.arguments['data']['revokedMessage'];
|
||||
for (var listener in messageManager.advancedMsgListeners) {
|
||||
if (listener.id == id) {
|
||||
listener.recvMessageRevoked(value);
|
||||
}
|
||||
}
|
||||
var msgID = call.arguments['data']['revokedMessage'];
|
||||
messageManager.msgListener.recvMessageRevoked(msgID);
|
||||
break;
|
||||
case 'onRecvC2CReadReceipt':
|
||||
var value = call.arguments['data']['haveReadMessage'];
|
||||
var l = _formatJson(value) as List;
|
||||
var list = l.map((e) => HaveReadInfo.fromJson(e)).toList();
|
||||
for (var listener in messageManager.advancedMsgListeners) {
|
||||
if (listener.id == id) {
|
||||
listener.recvC2CReadReceipt(list);
|
||||
}
|
||||
}
|
||||
var value = call.arguments['data']['c2cMessageReadReceipt'];
|
||||
var list =
|
||||
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
|
||||
messageManager.msgListener.recvC2CMessageReadReceipt(list);
|
||||
break;
|
||||
case 'onRecvGroupReadReceipt':
|
||||
var value = call.arguments['data']['groupMessageReadReceipt'];
|
||||
var list =
|
||||
Utils.toList(value, (map) => ReadReceiptInfo.fromJson(map));
|
||||
messageManager.msgListener.recvGroupMessageReadReceipt(list);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.msgSendProgressListener) {
|
||||
@@ -190,80 +162,117 @@ class IMManager {
|
||||
dynamic data = call.arguments['data'];
|
||||
switch (type) {
|
||||
case 'onSyncServerStart':
|
||||
conversationManager.conversationListener.syncServerStart();
|
||||
conversationManager.listener.syncServerStart();
|
||||
break;
|
||||
case 'onSyncServerFinish':
|
||||
conversationManager.conversationListener.syncServerFinish();
|
||||
conversationManager.listener.syncServerFinish();
|
||||
break;
|
||||
|
||||
case 'onSyncServerFailed':
|
||||
conversationManager.conversationListener.syncServerFailed();
|
||||
conversationManager.listener.syncServerFailed();
|
||||
break;
|
||||
case 'onNewConversation':
|
||||
List<ConversationInfo> list = List.empty(growable: true);
|
||||
if (null != data) {
|
||||
list = (_formatJson(data) as List)
|
||||
.map((e) => ConversationInfo.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
conversationManager.conversationListener.newConversation(list);
|
||||
var list =
|
||||
Utils.toList(data, (map) => ConversationInfo.fromJson(map));
|
||||
conversationManager.listener.newConversation(list);
|
||||
break;
|
||||
case 'onConversationChanged':
|
||||
List<ConversationInfo> list = List.empty(growable: true);
|
||||
if (null != data) {
|
||||
list = (_formatJson(data) as List)
|
||||
.map((e) => ConversationInfo.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
conversationManager.conversationListener
|
||||
.conversationChanged(list);
|
||||
var list =
|
||||
Utils.toList(data, (map) => ConversationInfo.fromJson(map));
|
||||
conversationManager.listener.conversationChanged(list);
|
||||
break;
|
||||
case 'onTotalUnreadMessageCountChanged':
|
||||
conversationManager.conversationListener
|
||||
conversationManager.listener
|
||||
.totalUnreadMessageCountChanged(data ?? 0);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.friendListener) {
|
||||
String type = call.arguments['type'];
|
||||
dynamic data = call.arguments['data'];
|
||||
UserInfo u = UserInfo.fromJson(_formatJson(data));
|
||||
|
||||
switch (type) {
|
||||
case 'onBlackListAdd':
|
||||
friendshipManager.friendshipListener.blackListAdd(u);
|
||||
case 'onBlacklistAdded':
|
||||
final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map));
|
||||
friendshipManager.listener.blacklistAdded(u);
|
||||
break;
|
||||
case 'onBlackListDeleted':
|
||||
friendshipManager.friendshipListener.blackListDeleted(u);
|
||||
case 'onBlacklistDeleted':
|
||||
final u = Utils.toObj(data, (map) => BlacklistInfo.fromJson(map));
|
||||
friendshipManager.listener.blacklistDeleted(u);
|
||||
break;
|
||||
case 'onFriendApplicationListAccept':
|
||||
friendshipManager.friendshipListener
|
||||
.friendApplicationListAccept(u);
|
||||
case 'onFriendApplicationAccepted':
|
||||
final u = Utils.toObj(
|
||||
data, (map) => FriendApplicationInfo.fromJson(map));
|
||||
friendshipManager.listener.friendApplicationAccepted(u);
|
||||
break;
|
||||
case 'onFriendApplicationListAdded':
|
||||
friendshipManager.friendshipListener
|
||||
.friendApplicationListAdded(u);
|
||||
case 'onFriendApplicationAdded':
|
||||
final u = Utils.toObj(
|
||||
data, (map) => FriendApplicationInfo.fromJson(map));
|
||||
friendshipManager.listener.friendApplicationAdded(u);
|
||||
break;
|
||||
case 'onFriendApplicationListDeleted':
|
||||
friendshipManager.friendshipListener
|
||||
.friendApplicationListDeleted(u);
|
||||
case 'onFriendApplicationDeleted':
|
||||
final u = Utils.toObj(
|
||||
data, (map) => FriendApplicationInfo.fromJson(map));
|
||||
friendshipManager.listener.friendApplicationDeleted(u);
|
||||
break;
|
||||
case 'onFriendApplicationListReject':
|
||||
friendshipManager.friendshipListener
|
||||
.friendApplicationListReject(u);
|
||||
case 'onFriendApplicationRejected':
|
||||
final u = Utils.toObj(
|
||||
data, (map) => FriendApplicationInfo.fromJson(map));
|
||||
friendshipManager.listener.friendApplicationRejected(u);
|
||||
break;
|
||||
case 'onFriendInfoChanged':
|
||||
friendshipManager.friendshipListener.friendInfoChanged(u);
|
||||
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
|
||||
friendshipManager.listener.friendInfoChanged(u);
|
||||
break;
|
||||
case 'onFriendListAdded':
|
||||
friendshipManager.friendshipListener.friendListAdded(u);
|
||||
case 'onFriendAdded':
|
||||
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
|
||||
friendshipManager.listener.friendAdded(u);
|
||||
break;
|
||||
case 'onFriendListDeleted':
|
||||
friendshipManager.friendshipListener.friendListDeleted(u);
|
||||
case 'onFriendDeleted':
|
||||
final u = Utils.toObj(data, (map) => FriendInfo.fromJson(map));
|
||||
friendshipManager.listener.friendDeleted(u);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.signalingListener) {
|
||||
String type = call.arguments['type'];
|
||||
dynamic data = call.arguments['data'];
|
||||
final u = Utils.toObj(data, (map) => SignalingInfo.fromJson(map));
|
||||
switch (type) {
|
||||
case 'onInvitationCancelled':
|
||||
signalingManager.listener.invitationCancelled(u);
|
||||
break;
|
||||
case 'onInvitationTimeout':
|
||||
signalingManager.listener.invitationTimeout(u);
|
||||
break;
|
||||
case 'onInviteeAccepted':
|
||||
signalingManager.listener.inviteeAccepted(u);
|
||||
break;
|
||||
case 'onInviteeRejected':
|
||||
signalingManager.listener.inviteeRejected(u);
|
||||
break;
|
||||
case 'onReceiveNewInvitation':
|
||||
signalingManager.listener.receiveNewInvitation(u);
|
||||
break;
|
||||
case 'onInviteeAcceptedByOtherDevice':
|
||||
signalingManager.listener.inviteeAcceptedByOtherDevice(u);
|
||||
break;
|
||||
case 'onInviteeRejectedByOtherDevice':
|
||||
signalingManager.listener.inviteeRejectedByOtherDevice(u);
|
||||
break;
|
||||
case 'onHangUp':
|
||||
signalingManager.listener.hangup(u);
|
||||
break;
|
||||
}
|
||||
} else if (call.method == ListenerType.workMomentsListener) {
|
||||
String type = call.arguments['type'];
|
||||
switch (type) {
|
||||
case 'OnRecvNewNotification':
|
||||
workMomentsManager.listener.recvNewNotification();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
print(
|
||||
"回调失败了,数据类型异常。$err ${call.method} ${call.arguments['type']} ${call.arguments['data']}");
|
||||
"回调失败了。$err ${call.method} ${call.arguments['type']} ${call.arguments['data']}");
|
||||
}
|
||||
return Future.value(null);
|
||||
});
|
||||
@@ -271,62 +280,77 @@ class IMManager {
|
||||
|
||||
/// Initialize SDK
|
||||
///
|
||||
/// [platform] Refer to [IMPlatform]
|
||||
/// [ipApi] Api server ip address
|
||||
/// [ipWs] WebSocket ip address
|
||||
/// [dbPath] Data storage directory
|
||||
/// [platform] platform number [IMPlatform]
|
||||
/// [apiAddr] api server ip address
|
||||
/// [wsAddr] webSocket ip address
|
||||
/// [dataDir] data storage directory
|
||||
///
|
||||
/// 初始化SDK
|
||||
/// [platform] 平台编号[IMPlatform]
|
||||
/// [ipApi] SDK api地址
|
||||
/// [ipWs] SDK websocket地址
|
||||
/// [dbPath] SDK数据库存储目录
|
||||
///
|
||||
/// [platform] 平台编号[IMPlatform]
|
||||
/// [apiAddr] SDK api地址
|
||||
/// [wsAddr] SDK websocket地址
|
||||
/// [dataDir] SDK数据库存储目录
|
||||
Future<dynamic> initSDK({
|
||||
required int platform,
|
||||
required String ipApi,
|
||||
required String ipWs,
|
||||
required String dbPath,
|
||||
required InitSDKListener listener,
|
||||
required String apiAddr,
|
||||
required String wsAddr,
|
||||
required String dataDir,
|
||||
required OnConnectListener listener,
|
||||
int logLevel = 6,
|
||||
String objectStorage = 'cos',
|
||||
String? operationID,
|
||||
}) {
|
||||
_initSDKListener = listener;
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'initSDK',
|
||||
_buildParam(
|
||||
{
|
||||
"platform": platform,
|
||||
"ipApi": ipApi,
|
||||
"ipWs": ipWs,
|
||||
"dbDir": dbPath
|
||||
},
|
||||
))
|
||||
.then((value) => isInitialized = true);
|
||||
_connectListener = listener;
|
||||
return _channel.invokeMethod(
|
||||
'initSDK',
|
||||
_buildParam(
|
||||
{
|
||||
"platform": platform,
|
||||
"api_addr": apiAddr,
|
||||
"ws_addr": wsAddr,
|
||||
"data_dir": dataDir,
|
||||
"log_level": logLevel,
|
||||
"object_storage": objectStorage,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
@deprecated
|
||||
Future<dynamic> unInitSDK() {
|
||||
return _channel.invokeMethod('unInitSDK', _buildParam({})).then((value) {
|
||||
isInitialized = false;
|
||||
return value;
|
||||
});
|
||||
return _channel.invokeMethod('unInitSDK', _buildParam({}));
|
||||
}
|
||||
|
||||
/// Login sdk
|
||||
/// 登录
|
||||
Future<UserInfo> login({required String uid, required String token}) async {
|
||||
this.uid = uid;
|
||||
Future<UserInfo> login({
|
||||
required String uid,
|
||||
required String token,
|
||||
String? operationID,
|
||||
}) async {
|
||||
await _channel.invokeMethod(
|
||||
'login',
|
||||
_buildParam({'uid': uid, 'token': token}),
|
||||
_buildParam({
|
||||
'uid': uid,
|
||||
'token': token,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}),
|
||||
);
|
||||
this.isLogined = true;
|
||||
this.uInfo = (await getUsersInfo([uid])).first;
|
||||
this.uid = uid;
|
||||
this.uInfo = await userManager.getSelfUserInfo();
|
||||
return uInfo;
|
||||
}
|
||||
|
||||
/// Logout sdk
|
||||
/// 登出
|
||||
Future<dynamic> logout() async {
|
||||
var value = await _channel.invokeMethod('logout', _buildParam({}));
|
||||
Future<dynamic> logout({String? operationID}) async {
|
||||
var value = await _channel.invokeMethod(
|
||||
'logout',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
this.isLogined = false;
|
||||
return value;
|
||||
}
|
||||
@@ -337,65 +361,21 @@ class IMManager {
|
||||
|
||||
/// Current user id
|
||||
/// 获取当前登录用户id
|
||||
Future<String> getLoginUid() async => uid;
|
||||
Future<String> getLoginUserID() async => uid;
|
||||
|
||||
/// Current user info
|
||||
/// 获取当前登录用户信息
|
||||
Future<UserInfo> getLoginUserInfo() async => uInfo;
|
||||
|
||||
/// Modify current user info
|
||||
/// 修改当前登录用户资料
|
||||
Future<String?> setSelfInfo(
|
||||
{String? name,
|
||||
String? icon,
|
||||
int? gender,
|
||||
String? mobile,
|
||||
String? birth,
|
||||
String? email,
|
||||
String? ex}) =>
|
||||
_channel.invokeMethod(
|
||||
'setSelfInfo',
|
||||
_buildParam({
|
||||
'uid': uid,
|
||||
'name': name,
|
||||
'icon': icon,
|
||||
'gender': gender,
|
||||
'mobile': mobile,
|
||||
'birth': birth,
|
||||
'email': email,
|
||||
'ex': ex,
|
||||
}));
|
||||
|
||||
/// Query user information
|
||||
/// 查询用户信息
|
||||
Future<List<UserInfo>> getUsersInfo(List<String> uidList) => _channel
|
||||
.invokeMethod('getUsersInfo', _buildParam({'uidList': uidList}))
|
||||
.then((value) => _toList(value));
|
||||
|
||||
///
|
||||
Future enabledSDKLog({required bool enabled}) => _channel.invokeMethod(
|
||||
'setSdkLog', _buildParam({'sdkLog': enabled ? 0 : 1}));
|
||||
|
||||
///
|
||||
Future<dynamic> forceSyncLoginUerInfo(List<String> uidList) =>
|
||||
_channel.invokeMethod('forceSyncLoginUerInfo', _buildParam({}));
|
||||
|
||||
///
|
||||
// Future<dynamic> forceReConn() {
|
||||
// return _channel.invokeMethod('forceReConn', _buildParam({}));
|
||||
// }
|
||||
/// wakeup
|
||||
Future wakeUp({String? operationID}) => _channel.invokeMethod(
|
||||
'wakeUp',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "imManager";
|
||||
return param;
|
||||
}
|
||||
|
||||
static List<UserInfo> _toList(String value) =>
|
||||
(_formatJson(value) as List).map((e) => UserInfo.fromJson(e)).toList();
|
||||
|
||||
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||
|
||||
static String _printValue(value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,22 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class MessageManager {
|
||||
MethodChannel _channel;
|
||||
List<AdvancedMsgListener> advancedMsgListeners = List.empty(growable: true);
|
||||
MsgSendProgressListener? msgSendProgressListener;
|
||||
|
||||
// List<AdvancedMsgListener> advancedMsgListeners = List.empty(growable: true);
|
||||
OnMsgSendProgressListener? msgSendProgressListener;
|
||||
late OnAdvancedMsgListener msgListener;
|
||||
|
||||
MessageManager(this._channel);
|
||||
|
||||
/// Add a message listener
|
||||
/// Set a message listener
|
||||
/// 消息监听
|
||||
Future addAdvancedMsgListener(AdvancedMsgListener listener) {
|
||||
advancedMsgListeners.add(listener);
|
||||
Future setAdvancedMsgListener(OnAdvancedMsgListener listener) {
|
||||
this.msgListener = listener;
|
||||
// advancedMsgListeners.add(listener);
|
||||
return _channel.invokeMethod(
|
||||
'addAdvancedMsgListener',
|
||||
_buildParam({
|
||||
'id': listener.id,
|
||||
}));
|
||||
}
|
||||
|
||||
/// Remove a message listener
|
||||
@deprecated
|
||||
Future removeAdvancedMsgListener(AdvancedMsgListener listener) {
|
||||
advancedMsgListeners.remove(listener);
|
||||
return _channel.invokeMethod(
|
||||
'removeAdvancedMsgListener',
|
||||
'setAdvancedMsgListener',
|
||||
_buildParam({
|
||||
'id': listener.id,
|
||||
}));
|
||||
@@ -34,7 +24,7 @@ class MessageManager {
|
||||
|
||||
/// Set up message sending progress monitoring
|
||||
/// 消息发送进度监听
|
||||
void setMsgSendProgressListener(MsgSendProgressListener listener) {
|
||||
void setMsgSendProgressListener(OnMsgSendProgressListener listener) {
|
||||
msgSendProgressListener = listener;
|
||||
}
|
||||
|
||||
@@ -43,64 +33,89 @@ class MessageManager {
|
||||
/// 发送消息
|
||||
/// [userID]接收消息的用户id
|
||||
/// [groupID]接收消息的组id
|
||||
Future<dynamic> sendMessage({
|
||||
/// [offlinePushInfo]离线消息显示内容
|
||||
Future<Message> sendMessage({
|
||||
required Message message,
|
||||
required OfflinePushInfo offlinePushInfo,
|
||||
String? userID,
|
||||
String? groupID,
|
||||
bool onlineUserOnly = false,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'sendMessage',
|
||||
_buildParam({
|
||||
'message': message.toJson(),
|
||||
'userID': userID ?? '',
|
||||
'groupID': groupID ?? '',
|
||||
'onlineUserOnly': onlineUserOnly,
|
||||
})) /*.then((value) => _toObj(value))*/;
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'sendMessage',
|
||||
_buildParam({
|
||||
'message': message.toJson(),
|
||||
'offlinePushInfo': offlinePushInfo.toJson(),
|
||||
'userID': userID ?? '',
|
||||
'groupID': groupID ?? '',
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Find all history message
|
||||
/// 获取聊天记录
|
||||
/// [userID]接收消息的用户id
|
||||
/// [conversationID] 会话id,查询通知是可用
|
||||
/// [groupID]接收消息的组id
|
||||
Future<List<Message>> getHistoryMessageList({
|
||||
String? userID,
|
||||
String? groupID,
|
||||
String? conversationID,
|
||||
Message? startMsg,
|
||||
int? count,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getHistoryMessageList',
|
||||
_buildParam({
|
||||
'userID': userID ?? '',
|
||||
'startMsg': startMsg?.toJson() /*?? {}*/,
|
||||
'groupID': groupID ?? '',
|
||||
'conversationID': conversationID ?? '',
|
||||
'startClientMsgID': startMsg?.clientMsgID ?? '',
|
||||
'count': count ?? 10,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toList(value));
|
||||
.then((value) => Utils.toList(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Revoke the sent information
|
||||
/// 撤回消息
|
||||
Future revokeMessage({required Message message}) =>
|
||||
_channel.invokeMethod('revokeMessage', _buildParam(message.toJson()));
|
||||
Future revokeMessage({
|
||||
required Message message,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'revokeMessage',
|
||||
_buildParam(message.toJson()
|
||||
..addAll({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
})));
|
||||
|
||||
/// Delete message
|
||||
/// 删除消息
|
||||
Future deleteMessageFromLocalStorage({required Message message}) =>
|
||||
Future deleteMessageFromLocalStorage({
|
||||
required Message message,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteMessageFromLocalStorage', _buildParam(message.toJson()));
|
||||
'deleteMessageFromLocalStorage',
|
||||
_buildParam(message.toJson()
|
||||
..addAll({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
})));
|
||||
|
||||
///
|
||||
@deprecated
|
||||
Future deleteMessages({required List<Message> msgList}) =>
|
||||
_channel.invokeMethod('deleteMessages',
|
||||
_buildParam({"msgList": msgList.map((e) => e.toJson()).toList()}));
|
||||
// Future deleteMessages({required List<Message> msgList}) =>
|
||||
// _channel.invokeMethod('deleteMessages',
|
||||
// _buildParam({"msgList": msgList.map((e) => e.toJson()).toList()}));
|
||||
|
||||
///
|
||||
Future insertSingleMessageToLocalStorage({
|
||||
String? receiverID,
|
||||
String? senderID,
|
||||
Message? message,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'insertSingleMessageToLocalStorage',
|
||||
@@ -108,108 +123,182 @@ class MessageManager {
|
||||
"message": message?.toJson(),
|
||||
"receiverID": receiverID,
|
||||
"senderID": senderID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
///
|
||||
Future insertGroupMessageToLocalStorage({
|
||||
String? groupID,
|
||||
String? senderID,
|
||||
Message? message,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'insertGroupMessageToLocalStorage',
|
||||
_buildParam({
|
||||
"message": message?.toJson(),
|
||||
"groupID": groupID,
|
||||
"senderID": senderID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Query the message according to the message id
|
||||
Future findMessages({required List<String> messageIDList}) =>
|
||||
_channel.invokeMethod(
|
||||
'findMessages',
|
||||
_buildParam({
|
||||
"messageIDList": messageIDList,
|
||||
}));
|
||||
// Future findMessages({required List<String> messageIDList}) =>
|
||||
// _channel.invokeMethod(
|
||||
// 'findMessages',
|
||||
// _buildParam({
|
||||
// "messageIDList": messageIDList,
|
||||
// }));
|
||||
|
||||
/// Mark c2c message as read
|
||||
/// 标记c2c消息已读
|
||||
Future markC2CMessageAsRead({
|
||||
required String userID,
|
||||
required List<String> messageIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'markC2CMessageAsRead',
|
||||
_buildParam({
|
||||
"messageIDList": messageIDList,
|
||||
"userID": userID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Mark group message as read
|
||||
/// 标记群聊消息已读
|
||||
Future markGroupMessageAsRead({
|
||||
required String groupID,
|
||||
required List<String> messageIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'markGroupMessageAsRead',
|
||||
_buildParam({
|
||||
"messageIDList": messageIDList,
|
||||
"groupID": groupID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Typing
|
||||
/// 正在输入提示
|
||||
Future typingStatusUpdate({
|
||||
required String userID,
|
||||
bool typing = false,
|
||||
String? msgTip,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'typingStatusUpdate',
|
||||
_buildParam({
|
||||
"typing": typing ? 'yes' : 'no',
|
||||
"msgTip": msgTip,
|
||||
"userID": userID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Create text message
|
||||
/// 创建文本消息
|
||||
Future<Message> createTextMessage({required String text}) => _channel
|
||||
.invokeMethod('createTextMessage', _buildParam({'text': text}))
|
||||
.then((value) => _toObj(value));
|
||||
Future<Message> createTextMessage({
|
||||
required String text,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createTextMessage',
|
||||
_buildParam({
|
||||
'text': text,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create @ message
|
||||
/// 创建@消息
|
||||
Future<Message> createTextAtMessage({
|
||||
required String text,
|
||||
required List<String> atUidList,
|
||||
required List<String> atUserIDList,
|
||||
List<AtUserInfo> atUserInfoList = const [],
|
||||
Message? quoteMessage,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createTextAtMessage',
|
||||
_buildParam({
|
||||
'text': text,
|
||||
'atUserList': atUidList,
|
||||
'atUserIDList': atUserIDList,
|
||||
'atUserInfoList': atUserInfoList.map((e) => e.toJson()).toList(),
|
||||
'quoteMessage': quoteMessage?.toJson(),
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}),
|
||||
)
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create picture message
|
||||
/// 创建图片消息
|
||||
Future<Message> createImageMessage({required String imagePath}) => _channel
|
||||
.invokeMethod(
|
||||
'createImageMessage',
|
||||
_buildParam({'imagePath': imagePath}),
|
||||
)
|
||||
.then((value) => _toObj(value));
|
||||
Future<Message> createImageMessage({
|
||||
required String imagePath,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createImageMessage',
|
||||
_buildParam({
|
||||
'imagePath': imagePath,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}),
|
||||
)
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create picture message
|
||||
/// 创建图片消息
|
||||
Future<Message> createImageMessageFromFullPath({required String imagePath}) =>
|
||||
Future<Message> createImageMessageFromFullPath({
|
||||
required String imagePath,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createImageMessageFromFullPath',
|
||||
_buildParam({'imagePath': imagePath}),
|
||||
_buildParam({
|
||||
'imagePath': imagePath,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}),
|
||||
)
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create sound message
|
||||
/// 创建语音消息
|
||||
Future<Message> createSoundMessage({
|
||||
required String soundPath,
|
||||
required int duration,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createSoundMessage',
|
||||
_buildParam({'soundPath': soundPath, "duration": duration}),
|
||||
_buildParam({
|
||||
'soundPath': soundPath,
|
||||
"duration": duration,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}),
|
||||
)
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create sound message
|
||||
/// 创建语音消息
|
||||
Future<Message> createSoundMessageFromFullPath({
|
||||
required String soundPath,
|
||||
required int duration,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createSoundMessageFromFullPath',
|
||||
_buildParam({'soundPath': soundPath, "duration": duration}),
|
||||
_buildParam({
|
||||
'soundPath': soundPath,
|
||||
"duration": duration,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}),
|
||||
)
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create video message
|
||||
/// 创建视频消息
|
||||
@@ -218,6 +307,7 @@ class MessageManager {
|
||||
required String videoType,
|
||||
required int duration,
|
||||
required String snapshotPath,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -227,8 +317,9 @@ class MessageManager {
|
||||
'videoType': videoType,
|
||||
'duration': duration,
|
||||
'snapshotPath': snapshotPath,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create video message
|
||||
/// 创建视频消息
|
||||
@@ -237,6 +328,7 @@ class MessageManager {
|
||||
required String videoType,
|
||||
required int duration,
|
||||
required String snapshotPath,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -246,14 +338,16 @@ class MessageManager {
|
||||
'videoType': videoType,
|
||||
'duration': duration,
|
||||
'snapshotPath': snapshotPath,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create file message
|
||||
/// 创建文件消息
|
||||
Future<Message> createFileMessage({
|
||||
required String filePath,
|
||||
required String fileName,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
@@ -261,8 +355,9 @@ class MessageManager {
|
||||
_buildParam({
|
||||
'filePath': filePath,
|
||||
'fileName': fileName,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
}
|
||||
|
||||
/// Create file message
|
||||
@@ -270,6 +365,7 @@ class MessageManager {
|
||||
Future<Message> createFileMessageFromFullPath({
|
||||
required String filePath,
|
||||
required String fileName,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -277,8 +373,9 @@ class MessageManager {
|
||||
_buildParam({
|
||||
'filePath': filePath,
|
||||
'fileName': fileName,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create merger message
|
||||
/// 创建合并消息
|
||||
@@ -286,6 +383,7 @@ class MessageManager {
|
||||
required List<Message> messageList,
|
||||
required String title,
|
||||
required List<String> summaryList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -294,19 +392,24 @@ class MessageManager {
|
||||
'messageList': messageList.map((e) => e.toJson()).toList(),
|
||||
'title': title,
|
||||
'summaryList': summaryList,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create forward message
|
||||
/// 创建转发消息
|
||||
Future<Message> createForwardMessage({required Message message}) {
|
||||
Future<Message> createForwardMessage({
|
||||
required Message message,
|
||||
String? operationID,
|
||||
}) {
|
||||
return _channel
|
||||
.invokeMethod(
|
||||
'createForwardMessage',
|
||||
_buildParam({
|
||||
'message': message.toJson(),
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
}
|
||||
|
||||
/// Create location message
|
||||
@@ -315,6 +418,7 @@ class MessageManager {
|
||||
required double latitude,
|
||||
required double longitude,
|
||||
required String description,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -323,8 +427,9 @@ class MessageManager {
|
||||
'latitude': latitude,
|
||||
'longitude': longitude,
|
||||
'description': description,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create custom message
|
||||
/// 创建自定义消息
|
||||
@@ -332,6 +437,7 @@ class MessageManager {
|
||||
required String data,
|
||||
required String extension,
|
||||
required String description,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -340,14 +446,16 @@ class MessageManager {
|
||||
'data': data,
|
||||
'extension': extension,
|
||||
'description': description,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create quote message
|
||||
/// 创建引用消息
|
||||
Future<Message> createQuoteMessage({
|
||||
required String text,
|
||||
required Message quoteMsg,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
@@ -355,50 +463,217 @@ class MessageManager {
|
||||
_buildParam({
|
||||
'quoteText': text,
|
||||
'quoteMessage': quoteMsg.toJson(),
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create card message
|
||||
/// 创建卡片消息
|
||||
Future<Message> createCardMessage({
|
||||
required Map<String, dynamic> data,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createCardMessage',
|
||||
_buildParam({
|
||||
'cardMessage': data,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => _toObj(value));
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Create custom emoji message
|
||||
/// 创建自定义表情消息
|
||||
/// [index] The position of the emoji, such as the position emoji(表情的位置,如位置表情)
|
||||
/// [data] Other data, such as url expressions(其他数据,如url表情)
|
||||
Future<Message> createFaceMessage({
|
||||
int index = -1,
|
||||
String? data,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'createFaceMessage',
|
||||
_buildParam({
|
||||
'index': index,
|
||||
'data': data,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||
|
||||
/// Clear all c2c history message
|
||||
/// 清空单聊消息记录
|
||||
Future<dynamic> clearC2CHistoryMessage({required String uid}) => _channel
|
||||
.invokeMethod('clearC2CHistoryMessage', _buildParam({"userID": uid}));
|
||||
Future<dynamic> clearC2CHistoryMessage({
|
||||
required String uid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearC2CHistoryMessage',
|
||||
_buildParam({
|
||||
"userID": uid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Clear all group history
|
||||
/// 清空组消息记录
|
||||
Future<dynamic> clearGroupHistoryMessage({required String gid}) => _channel
|
||||
.invokeMethod('clearGroupHistoryMessage', _buildParam({"groupID": gid}));
|
||||
Future<dynamic> clearGroupHistoryMessage({
|
||||
required String gid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearGroupHistoryMessage',
|
||||
_buildParam({
|
||||
"groupID": gid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
///
|
||||
// void forceSyncMsg() {
|
||||
// _channel.invokeMethod('forceSyncMsg', _buildParam({}));
|
||||
// }
|
||||
/// Search local message
|
||||
/// 搜索消息
|
||||
/// [conversationID] 根据会话查询,如果是全局搜索传null
|
||||
/// [keywordList]搜索关键词列表,目前仅支持一个关键词搜索
|
||||
/// [keywordListMatchType]关键词匹配模式,1代表与,2代表或,暂时未用
|
||||
/// [senderUserIDList]指定消息发送的uid列表 暂时未用
|
||||
/// [messageTypeList]消息类型列表
|
||||
/// [searchTimePosition]搜索的起始时间点。默认为0即代表从现在开始搜索。UTC 时间戳,单位:秒
|
||||
/// [searchTimePeriod]从起始时间点开始的过去时间范围,单位秒。默认为0即代表不限制时间范围,传24x60x60代表过去一天
|
||||
/// [pageIndex]当前页数
|
||||
/// [count]每页数量
|
||||
Future<SearchResult> searchLocalMessages({
|
||||
String? conversationID,
|
||||
List<String> keywordList = const [],
|
||||
int keywordListMatchType = 0,
|
||||
List<String> senderUserIDList = const [],
|
||||
List<int> messageTypeList = const [],
|
||||
int searchTimePosition = 0,
|
||||
int searchTimePeriod = 0,
|
||||
int pageIndex = 1,
|
||||
int count = 40,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'searchLocalMessages',
|
||||
_buildParam({
|
||||
'filter': {
|
||||
'conversationID': conversationID,
|
||||
'keywordList': keywordList,
|
||||
'keywordListMatchType': keywordListMatchType,
|
||||
'senderUserIDList': senderUserIDList,
|
||||
'messageTypeList': messageTypeList,
|
||||
'searchTimePosition': searchTimePosition,
|
||||
'searchTimePeriod': searchTimePeriod,
|
||||
'pageIndex': pageIndex,
|
||||
'count': count,
|
||||
},
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => SearchResult.fromJson(map)));
|
||||
|
||||
/// Delete message from local and service
|
||||
/// 删除消息
|
||||
Future<dynamic> deleteMessageFromLocalAndSvr({
|
||||
required Message message,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteMessageFromLocalAndSvr',
|
||||
_buildParam(message.toJson()
|
||||
..addAll({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
})));
|
||||
|
||||
/// Delete all message from local
|
||||
/// 删除所有消息
|
||||
Future<dynamic> deleteAllMsgFromLocal({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteAllMsgFromLocal',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Delete all message from service
|
||||
/// 删除所有消息
|
||||
Future<dynamic> deleteAllMsgFromLocalAndSvr({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'deleteAllMsgFromLocalAndSvr',
|
||||
_buildParam({
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Mark conversation message as read
|
||||
/// 标记消息已读
|
||||
Future markMessageAsReadByConID({
|
||||
required String conversationID,
|
||||
required List<String> messageIDList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'markMessageAsReadByConID',
|
||||
_buildParam({
|
||||
"messageIDList": messageIDList,
|
||||
"conversationID": conversationID,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Clear all c2c history message
|
||||
/// 清空单聊消息记录
|
||||
Future<dynamic> clearC2CHistoryMessageFromLocalAndSvr({
|
||||
required String uid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearC2CHistoryMessageFromLocalAndSvr',
|
||||
_buildParam({
|
||||
"userID": uid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Clear all group history
|
||||
/// 清空组消息记录
|
||||
Future<dynamic> clearGroupHistoryMessageFromLocalAndSvr({
|
||||
required String gid,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearGroupHistoryMessageFromLocalAndSvr',
|
||||
_buildParam({
|
||||
"groupID": gid,
|
||||
"operationID": Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// Find all history message
|
||||
/// 获取聊天记录
|
||||
/// [userID]接收消息的用户id
|
||||
/// [conversationID] 会话id
|
||||
/// [groupID]接收消息的组id
|
||||
Future<List<Message>> getHistoryMessageListReverse({
|
||||
String? userID,
|
||||
String? groupID,
|
||||
String? conversationID,
|
||||
Message? startMsg,
|
||||
int? count,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getHistoryMessageListReverse',
|
||||
_buildParam({
|
||||
'userID': userID ?? '',
|
||||
'groupID': groupID ?? '',
|
||||
'conversationID': conversationID ?? '',
|
||||
'startClientMsgID': startMsg?.clientMsgID ?? '',
|
||||
'count': count ?? 10,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (map) => Message.fromJson(map)));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "messageManager";
|
||||
return param;
|
||||
}
|
||||
|
||||
static List<Message> _toList(String value) =>
|
||||
(_formatJson(value) as List).map((e) => Message.fromJson(e)).toList();
|
||||
|
||||
static Message _toObj(String value) => Message.fromJson(_formatJson(value));
|
||||
|
||||
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||
|
||||
static String _printValue(value) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,102 @@
|
||||
// import 'package:flutter/services.dart';
|
||||
//
|
||||
// class SignalingManager {
|
||||
// MethodChannel _channel;
|
||||
//
|
||||
// SignalingManager(this._channel);
|
||||
// }
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../flutter_openim_sdk.dart';
|
||||
|
||||
class SignalingManager {
|
||||
MethodChannel _channel;
|
||||
late OnSignalingListener listener;
|
||||
|
||||
SignalingManager(this._channel);
|
||||
|
||||
/// 信令监听
|
||||
Future setSignalingListener(OnSignalingListener listener) {
|
||||
this.listener = listener;
|
||||
return _channel.invokeMethod('setSignalingListener', _buildParam({}));
|
||||
}
|
||||
|
||||
/// 邀请个人加入音视频
|
||||
Future<SignalingCertificate> signalingInvite({
|
||||
required SignalingInfo info,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'signalingInvite',
|
||||
_buildParam({
|
||||
'signalingInfo': info.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => SignalingCertificate.fromJson(map)));
|
||||
|
||||
/// 邀请群里某些人加入音视频
|
||||
Future<SignalingCertificate> signalingInviteInGroup({
|
||||
required SignalingInfo info,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'signalingInviteInGroup',
|
||||
_buildParam({
|
||||
'signalingInfo': info.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => SignalingCertificate.fromJson(map)));
|
||||
|
||||
/// 同意某人音视频邀请
|
||||
Future<SignalingCertificate> signalingAccept({
|
||||
required SignalingInfo info,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'signalingAccept',
|
||||
_buildParam({
|
||||
'signalingInfo': info.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => SignalingCertificate.fromJson(map)));
|
||||
|
||||
/// 拒绝某人音视频邀请
|
||||
Future<dynamic> signalingReject({
|
||||
required SignalingInfo info,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'signalingReject',
|
||||
_buildParam({
|
||||
'signalingInfo': info.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 邀请者取消音视频通话
|
||||
Future<dynamic> signalingCancel({
|
||||
required SignalingInfo info,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'signalingCancel',
|
||||
_buildParam({
|
||||
'signalingInfo': info.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
/// 挂断
|
||||
Future<dynamic> signalingHungUp({
|
||||
required SignalingInfo info,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'signalingHungUp',
|
||||
_buildParam({
|
||||
'signalingInfo': info.toJson(),
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "signalingManager";
|
||||
return param;
|
||||
}
|
||||
}
|
||||
|
||||
77
lib/src/manager/im_user_manager.dart
Normal file
77
lib/src/manager/im_user_manager.dart
Normal file
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class UserManager {
|
||||
MethodChannel _channel;
|
||||
late OnUserListener listener;
|
||||
|
||||
UserManager(this._channel);
|
||||
|
||||
/// Observe user info changes
|
||||
/// 用户资料改变监听
|
||||
Future setUserListener(OnUserListener listener) {
|
||||
this.listener = listener;
|
||||
return _channel.invokeMethod('setUserListener', _buildParam({}));
|
||||
}
|
||||
|
||||
/// Query user information
|
||||
/// 获取用户资料
|
||||
Future<List<UserInfo>> getUsersInfo({
|
||||
required List<String> uidList,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getUsersInfo',
|
||||
_buildParam({
|
||||
'uidList': uidList,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toList(value, (v) => UserInfo.fromJson(v)));
|
||||
|
||||
/// Get the information of the currently logged in user
|
||||
/// 获取当前登录用户的信息
|
||||
Future<UserInfo> getSelfUserInfo({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getSelfUserInfo',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => UserInfo.fromJson(map)));
|
||||
|
||||
/// Modify current user info
|
||||
/// 修改当前登录用户资料
|
||||
Future<String?> setSelfInfo({
|
||||
String? nickname,
|
||||
String? faceURL,
|
||||
int? gender,
|
||||
int? appMangerLevel,
|
||||
String? phoneNumber,
|
||||
int? birth,
|
||||
String? email,
|
||||
String? ex,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'setSelfInfo',
|
||||
_buildParam({
|
||||
// 'userID': userID,
|
||||
'nickname': nickname,
|
||||
'faceURL': faceURL,
|
||||
'gender': gender,
|
||||
'appMangerLevel': appMangerLevel,
|
||||
'phoneNumber': phoneNumber,
|
||||
'birth': birth,
|
||||
'email': email,
|
||||
'ex': ex,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "userManager";
|
||||
return param;
|
||||
}
|
||||
}
|
||||
59
lib/src/manager/im_workmoments_manager.dart
Normal file
59
lib/src/manager/im_workmoments_manager.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class WorkMomentsManager {
|
||||
MethodChannel _channel;
|
||||
late OnWorkMomentsListener listener;
|
||||
|
||||
WorkMomentsManager(this._channel);
|
||||
|
||||
/// Observe work moments changes
|
||||
Future setWorkMomentsListener(OnWorkMomentsListener listener) {
|
||||
this.listener = listener;
|
||||
return _channel.invokeMethod('setWorkMomentsListener', _buildParam({}));
|
||||
}
|
||||
|
||||
/// Get work moments unread count
|
||||
Future<int> getWorkMomentsUnReadCount({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getWorkMomentsUnReadCount',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) => Utils.toObj(value, (map) => map['unreadCount']));
|
||||
|
||||
/// Get work moments notification list
|
||||
Future<List<WorkMomentsInfo>> getWorkMomentsNotification({
|
||||
required int offset,
|
||||
required int count,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'getWorkMomentsNotification',
|
||||
_buildParam({
|
||||
'offset': offset,
|
||||
'count': count,
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toList(value, (map) => WorkMomentsInfo.fromJson(map)));
|
||||
|
||||
/// Clear work moments notification
|
||||
Future clearWorkMomentsNotification({
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'clearWorkMomentsNotification',
|
||||
_buildParam({
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "workMomentsManager";
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -10,44 +10,46 @@ class ConversationInfo {
|
||||
String? userID;
|
||||
String? groupID;
|
||||
String? showName;
|
||||
String? faceUrl;
|
||||
String? faceURL;
|
||||
int? recvMsgOpt;
|
||||
int? unreadCount;
|
||||
int? groupAtType;
|
||||
Message? latestMsg;
|
||||
int? latestMsgSendTime;
|
||||
String? draftText;
|
||||
int? draftTimestamp;
|
||||
int? draftTextTime;
|
||||
bool? isPinned;
|
||||
bool? isPrivateChat;
|
||||
String? ext;
|
||||
bool? isNotInGroup;
|
||||
|
||||
/// pinned value is 1
|
||||
dynamic isPinned;
|
||||
|
||||
ConversationInfo(
|
||||
{required this.conversationID,
|
||||
this.conversationType,
|
||||
this.userID,
|
||||
this.groupID,
|
||||
this.showName,
|
||||
this.faceUrl,
|
||||
this.recvMsgOpt,
|
||||
this.unreadCount,
|
||||
this.latestMsg,
|
||||
this.latestMsgSendTime,
|
||||
this.draftText,
|
||||
this.draftTimestamp,
|
||||
this.isPinned});
|
||||
ConversationInfo({
|
||||
required this.conversationID,
|
||||
this.conversationType,
|
||||
this.userID,
|
||||
this.groupID,
|
||||
this.showName,
|
||||
this.faceURL,
|
||||
this.recvMsgOpt,
|
||||
this.unreadCount,
|
||||
this.latestMsg,
|
||||
this.latestMsgSendTime,
|
||||
this.draftText,
|
||||
this.draftTextTime,
|
||||
this.isPrivateChat,
|
||||
this.isPinned,
|
||||
this.isNotInGroup,
|
||||
});
|
||||
|
||||
ConversationInfo.fromJson(Map<String, dynamic> json)
|
||||
: conversationID = json['conversationID'] {
|
||||
// conversationID = json['conversationID'];
|
||||
conversationType = json['conversationType'];
|
||||
userID = json['userID'];
|
||||
groupID = json['groupID'];
|
||||
showName = json['showName'];
|
||||
faceUrl = json['faceUrl'];
|
||||
faceURL = json['faceURL'];
|
||||
recvMsgOpt = json['recvMsgOpt'];
|
||||
unreadCount = json['unreadCount'];
|
||||
// latestMsg = json['latestMsg'];
|
||||
// if (null != json['latestMsg']) {
|
||||
try {
|
||||
if (json['latestMsg'] is String) {
|
||||
latestMsg = Message.fromJson(jsonDecode(json['latestMsg']));
|
||||
@@ -55,38 +57,39 @@ class ConversationInfo {
|
||||
latestMsg = Message.fromJson(json['latestMsg']);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
// }
|
||||
|
||||
latestMsgSendTime = json['latestMsgSendTime'];
|
||||
draftText = json['draftText'];
|
||||
draftTimestamp = json['draftTimestamp'];
|
||||
draftTextTime = json['draftTextTime'];
|
||||
isPinned = json['isPinned'];
|
||||
isPrivateChat = json['isPrivateChat'];
|
||||
isNotInGroup = json['isNotInGroup'];
|
||||
groupAtType = json['groupAtType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['conversationID'] = this.conversationID;
|
||||
data['conversationType'] = this.conversationType;
|
||||
data['userID'] = this.userID;
|
||||
data['groupID'] = this.groupID;
|
||||
data['showName'] = this.showName;
|
||||
data['faceUrl'] = this.faceUrl;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['recvMsgOpt'] = this.recvMsgOpt;
|
||||
data['unreadCount'] = this.unreadCount;
|
||||
data['latestMsg'] = this.latestMsg?.toJson();
|
||||
data['latestMsgSendTime'] = this.latestMsgSendTime;
|
||||
data['draftText'] = this.draftText;
|
||||
data['draftTimestamp'] = this.draftTimestamp;
|
||||
data['draftTextTime'] = this.draftTextTime;
|
||||
data['isPinned'] = this.isPinned;
|
||||
data['isPrivateChat'] = this.isPrivateChat;
|
||||
data['isNotInGroup'] = this.isNotInGroup;
|
||||
data['groupAtType'] = this.groupAtType;
|
||||
return data;
|
||||
}
|
||||
|
||||
bool get isSingleChat => conversationType == ConversationType.single_chat;
|
||||
bool get isSingleChat => conversationType == ConversationType.single;
|
||||
|
||||
bool get isGroupChat => conversationType == ConversationType.group_chat;
|
||||
|
||||
bool get isTop => isPinned == 1;
|
||||
bool get isGroupChat => conversationType == ConversationType.group;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
|
||||
@@ -3,249 +3,265 @@ class GroupInfo {
|
||||
String? groupName;
|
||||
String? notification;
|
||||
String? introduction;
|
||||
String? faceUrl;
|
||||
String? ownerId;
|
||||
String? faceURL;
|
||||
String? ownerUserID;
|
||||
int? createTime;
|
||||
int? memberCount;
|
||||
|
||||
GroupInfo(
|
||||
{required this.groupID,
|
||||
this.groupName,
|
||||
this.notification,
|
||||
this.introduction,
|
||||
this.faceUrl,
|
||||
this.ownerId,
|
||||
this.createTime,
|
||||
this.memberCount});
|
||||
/// ok = 0 blocked = 1 Dismissed = 2 Muted = 3
|
||||
int? status;
|
||||
String? creatorUserID;
|
||||
int? groupType;
|
||||
String? ex;
|
||||
|
||||
GroupInfo({
|
||||
required this.groupID,
|
||||
this.groupName,
|
||||
this.notification,
|
||||
this.introduction,
|
||||
this.faceURL,
|
||||
this.ownerUserID,
|
||||
this.createTime,
|
||||
this.memberCount,
|
||||
this.status,
|
||||
this.creatorUserID,
|
||||
this.groupType,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
GroupInfo.fromJson(Map<String, dynamic> json) : groupID = json['groupID'] {
|
||||
/*groupID = json['groupID'];*/
|
||||
groupName = json['groupName'];
|
||||
notification = json['notification'];
|
||||
introduction = json['introduction'];
|
||||
faceUrl = json['faceUrl'];
|
||||
ownerId = json['ownerId'];
|
||||
faceURL = json['faceURL'];
|
||||
ownerUserID = json['ownerUserID'];
|
||||
createTime = json['createTime'];
|
||||
memberCount = json['memberCount'];
|
||||
status = json['status'];
|
||||
creatorUserID = json['creatorUserID'];
|
||||
groupType = json['groupType'];
|
||||
ex = json['ex'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['groupID'] = this.groupID;
|
||||
data['groupName'] = this.groupName;
|
||||
data['notification'] = this.notification;
|
||||
data['introduction'] = this.introduction;
|
||||
data['faceUrl'] = this.faceUrl;
|
||||
data['ownerId'] = this.ownerId;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['ownerUserID'] = this.ownerUserID;
|
||||
data['createTime'] = this.createTime;
|
||||
data['memberCount'] = this.memberCount;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupMembersList {
|
||||
int? nextSeq;
|
||||
List<GroupMembersInfo>? data;
|
||||
|
||||
GroupMembersList({this.nextSeq, this.data});
|
||||
|
||||
GroupMembersList.fromJson(Map<String, dynamic> json) {
|
||||
nextSeq = json['nextSeq'];
|
||||
if (json['data'] is List) {
|
||||
data = (json['data'] as List)
|
||||
.map((e) => GroupMembersInfo.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['nextSeq'] = this.nextSeq;
|
||||
if (this.data != null) {
|
||||
data['data'] = this.data!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['status'] = this.status;
|
||||
data['creatorUserID'] = this.creatorUserID;
|
||||
data['groupType'] = this.groupType;
|
||||
data['ex'] = this.ex;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupMembersInfo {
|
||||
String? groupID;
|
||||
String? userId;
|
||||
int? role;
|
||||
String? userID;
|
||||
String? nickname;
|
||||
String? faceURL;
|
||||
int? roleLevel;
|
||||
int? joinTime;
|
||||
String? nickName;
|
||||
String? faceUrl;
|
||||
dynamic ext;
|
||||
int? joinSource;
|
||||
String? operatorUserID;
|
||||
String? ext;
|
||||
int? muteEndTime;
|
||||
int? appMangerLevel;
|
||||
|
||||
GroupMembersInfo({
|
||||
this.groupID,
|
||||
this.userId,
|
||||
this.role,
|
||||
this.userID,
|
||||
this.roleLevel,
|
||||
this.joinTime,
|
||||
this.nickName,
|
||||
this.faceUrl,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.ext,
|
||||
this.joinSource,
|
||||
this.operatorUserID,
|
||||
this.muteEndTime,
|
||||
this.appMangerLevel,
|
||||
});
|
||||
|
||||
GroupMembersInfo.fromJson(Map<String, dynamic> json) {
|
||||
groupID = json['groupID'];
|
||||
userId = json['userId'];
|
||||
role = json['role'];
|
||||
userID = json['userID'];
|
||||
roleLevel = json['roleLevel'];
|
||||
joinTime = json['joinTime'];
|
||||
nickName = json['nickName'];
|
||||
faceUrl = json['faceUrl'];
|
||||
nickname = json['nickname'];
|
||||
faceURL = json['faceURL'];
|
||||
ext = json['ext'];
|
||||
joinSource = json['joinSource'];
|
||||
operatorUserID = json['operatorUserID'];
|
||||
muteEndTime = json['muteEndTime'];
|
||||
appMangerLevel = json['appMangerLevel'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['groupID'] = this.groupID;
|
||||
data['userId'] = this.userId;
|
||||
data['role'] = this.role;
|
||||
data['userID'] = this.userID;
|
||||
data['roleLevel'] = this.roleLevel;
|
||||
data['joinTime'] = this.joinTime;
|
||||
data['nickName'] = this.nickName;
|
||||
data['faceUrl'] = this.faceUrl;
|
||||
data['nickname'] = this.nickname;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['ext'] = this.ext;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupInviteResult {
|
||||
String? uid;
|
||||
int? result;
|
||||
|
||||
GroupInviteResult({this.uid, this.result});
|
||||
|
||||
GroupInviteResult.fromJson(Map<String, dynamic> json) {
|
||||
uid = json['uid'];
|
||||
result = json['result'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['uid'] = this.uid;
|
||||
data['result'] = this.result;
|
||||
data['joinSource'] = this.joinSource;
|
||||
data['operatorUserID'] = this.operatorUserID;
|
||||
data['muteEndTime'] = this.muteEndTime;
|
||||
data['appMangerLevel'] = this.appMangerLevel;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupMemberRole {
|
||||
String? uid;
|
||||
int? setRole;
|
||||
String? userID;
|
||||
|
||||
GroupMemberRole({this.uid, this.setRole});
|
||||
/// 1 ordinary member, 2 group owners, 3 administrators
|
||||
/// 1普通成员, 2群主,3管理员
|
||||
int? roleLevel;
|
||||
|
||||
GroupMemberRole({this.userID, this.roleLevel = 1});
|
||||
|
||||
GroupMemberRole.fromJson(Map<String, dynamic> json) {
|
||||
uid = json['uid'];
|
||||
setRole = json['setRole'];
|
||||
userID = json['userID'];
|
||||
roleLevel = json['roleLevel'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['uid'] = this.uid;
|
||||
data['setRole'] = this.setRole;
|
||||
final data = Map<String, dynamic>();
|
||||
data['userID'] = this.userID;
|
||||
data['roleLevel'] = this.roleLevel;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupApplicationInfo {
|
||||
String? id;
|
||||
String? groupID;
|
||||
String? fromUserID;
|
||||
String? toUserID;
|
||||
int? flag; //INIT = 0, REFUSE = -1, AGREE = 1
|
||||
String? groupName;
|
||||
String? notification;
|
||||
String? introduction;
|
||||
String? groupFaceURL;
|
||||
int? createTime;
|
||||
int? status;
|
||||
String? creatorUserID;
|
||||
int? groupType;
|
||||
String? ownerUserID;
|
||||
int? memberCount;
|
||||
String? userID;
|
||||
String? nickname;
|
||||
String? userFaceURL;
|
||||
int? gender;
|
||||
|
||||
/// REFUSE = -1, AGREE = 1
|
||||
/// -1:拒绝,1:同意
|
||||
int? handleResult;
|
||||
String? reqMsg;
|
||||
String? handledMsg;
|
||||
int? createTime;
|
||||
String? fromUserNickName;
|
||||
String? toUserNickName;
|
||||
String? fromUserFaceURL;
|
||||
String? toUserFaceURL;
|
||||
String? handledUser;
|
||||
int? type; //APPLICATION = 0, INVITE = 1
|
||||
int? handleStatus; //UNHANDLED = 0, BY_OTHER = 1, BY_SELF = 2
|
||||
int? handleResult; //REFUSE = 0, AGREE = 1
|
||||
int? reqTime;
|
||||
String? handleUserID;
|
||||
int? handledTime;
|
||||
String? ex;
|
||||
|
||||
GroupApplicationInfo(
|
||||
{this.id,
|
||||
this.groupID,
|
||||
this.fromUserID,
|
||||
this.toUserID,
|
||||
this.flag,
|
||||
this.reqMsg,
|
||||
this.handledMsg,
|
||||
this.createTime,
|
||||
this.fromUserNickName,
|
||||
this.toUserNickName,
|
||||
this.fromUserFaceURL,
|
||||
this.toUserFaceURL,
|
||||
this.handledUser,
|
||||
this.type,
|
||||
this.handleStatus,
|
||||
this.handleResult});
|
||||
GroupApplicationInfo({
|
||||
this.groupID,
|
||||
this.groupName,
|
||||
this.notification,
|
||||
this.introduction,
|
||||
this.groupFaceURL,
|
||||
this.createTime,
|
||||
this.status,
|
||||
this.creatorUserID,
|
||||
this.groupType,
|
||||
this.ownerUserID,
|
||||
this.memberCount,
|
||||
this.userID,
|
||||
this.nickname,
|
||||
this.userFaceURL,
|
||||
this.gender,
|
||||
this.handleResult,
|
||||
this.reqMsg,
|
||||
this.handledMsg,
|
||||
this.reqTime,
|
||||
this.handleUserID,
|
||||
this.handledTime,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
GroupApplicationInfo.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
groupID = json['groupID'];
|
||||
fromUserID = json['fromUserID'];
|
||||
toUserID = json['toUserID'];
|
||||
flag = json['flag'];
|
||||
groupName = json['groupName'];
|
||||
notification = json['notification'];
|
||||
introduction = json['introduction'];
|
||||
groupFaceURL = json['groupFaceURL'];
|
||||
createTime = json['createTime'];
|
||||
status = json['status'];
|
||||
creatorUserID = json['creatorUserID'];
|
||||
groupType = json['groupType'];
|
||||
ownerUserID = json['ownerUserID'];
|
||||
memberCount = json['memberCount'];
|
||||
userID = json['userID'];
|
||||
nickname = json['nickname'];
|
||||
userFaceURL = json['userFaceURL'];
|
||||
gender = json['gender'];
|
||||
handleResult = json['handleResult'];
|
||||
reqMsg = json['reqMsg'];
|
||||
handledMsg = json['handledMsg'];
|
||||
createTime = json['createTime'];
|
||||
fromUserNickName = json['fromUserNickName'];
|
||||
toUserNickName = json['toUserNickName'];
|
||||
fromUserFaceURL = json['fromUserFaceURL'];
|
||||
toUserFaceURL = json['toUserFaceURL'];
|
||||
handledUser = json['handledUser'];
|
||||
type = json['type'];
|
||||
handleStatus = json['handleStatus'];
|
||||
handleResult = json['handleResult'];
|
||||
reqTime = json['reqTime'];
|
||||
handleUserID = json['handleUserID'];
|
||||
handledTime = json['handledTime'];
|
||||
ex = json['ex'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
final data = Map<String, dynamic>();
|
||||
data['groupID'] = this.groupID;
|
||||
data['fromUserID'] = this.fromUserID;
|
||||
data['toUserID'] = this.toUserID;
|
||||
data['flag'] = this.flag;
|
||||
data['groupName'] = this.groupName;
|
||||
data['notification'] = this.notification;
|
||||
data['introduction'] = this.introduction;
|
||||
data['groupFaceURL'] = this.groupFaceURL;
|
||||
data['createTime'] = this.createTime;
|
||||
data['status'] = this.status;
|
||||
data['creatorUserID'] = this.creatorUserID;
|
||||
data['groupType'] = this.groupType;
|
||||
data['ownerUserID'] = this.ownerUserID;
|
||||
data['memberCount'] = this.memberCount;
|
||||
data['userID'] = this.userID;
|
||||
data['nickname'] = this.nickname;
|
||||
data['userFaceURL'] = this.userFaceURL;
|
||||
data['gender'] = this.gender;
|
||||
data['handleResult'] = this.handleResult;
|
||||
data['reqMsg'] = this.reqMsg;
|
||||
data['handledMsg'] = this.handledMsg;
|
||||
data['createTime'] = this.createTime;
|
||||
data['fromUserNickName'] = this.fromUserNickName;
|
||||
data['toUserNickName'] = this.toUserNickName;
|
||||
data['fromUserFaceURL'] = this.fromUserFaceURL;
|
||||
data['toUserFaceURL'] = this.toUserFaceURL;
|
||||
data['handledUser'] = this.handledUser;
|
||||
data['type'] = this.type;
|
||||
data['handleStatus'] = this.handleStatus;
|
||||
data['handleResult'] = this.handleResult;
|
||||
data['reqTime'] = this.reqTime;
|
||||
data['handleUserID'] = this.handleUserID;
|
||||
data['handledTime'] = this.handledTime;
|
||||
data['ex'] = this.ex;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupApplicationList {
|
||||
int? count;
|
||||
List<GroupApplicationInfo>? user;
|
||||
class GroupInviteResult {
|
||||
String? userID;
|
||||
int? result;
|
||||
|
||||
GroupApplicationList({this.count, this.user});
|
||||
GroupInviteResult({this.userID, this.result});
|
||||
|
||||
GroupApplicationList.fromJson(Map<String, dynamic> json) {
|
||||
count = json['count'];
|
||||
if (json['user'] is List) {
|
||||
user = (json['user'] as List)
|
||||
.map((e) => GroupApplicationInfo.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
GroupInviteResult.fromJson(Map<String, dynamic> json) {
|
||||
userID = json['userID'];
|
||||
result = json['result'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['count'] = this.count;
|
||||
if (this.user != null) {
|
||||
data['user'] = this.user!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
final data = Map<String, dynamic>();
|
||||
data['userID'] = this.userID;
|
||||
data['result'] = this.result;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ class Message {
|
||||
String? serverMsgID;
|
||||
int? createTime;
|
||||
int? sendTime;
|
||||
|
||||
/// [ConversationType]
|
||||
int? sessionType;
|
||||
String? sendID;
|
||||
String? recvID;
|
||||
int? msgFrom;
|
||||
@@ -10,21 +13,20 @@ class Message {
|
||||
/// [MessageType]
|
||||
int? contentType;
|
||||
int? platformID;
|
||||
List<String>? forceList;
|
||||
String? senderNickName;
|
||||
String? senderNickname;
|
||||
String? senderFaceUrl;
|
||||
String? groupID;
|
||||
String? content;
|
||||
int? seq;
|
||||
bool? isRead;
|
||||
int? hasReadTime;
|
||||
|
||||
/// [MessageStatus]
|
||||
int? status;
|
||||
String? remark;
|
||||
OfflinePushInfo? offlinePush;
|
||||
String? attachedInfo;
|
||||
String? ex;
|
||||
dynamic ext;
|
||||
|
||||
/// [ConversationType]
|
||||
int? sessionType;
|
||||
PictureElem? pictureElem;
|
||||
SoundElem? soundElem;
|
||||
VideoElem? videoElem;
|
||||
@@ -34,28 +36,33 @@ class Message {
|
||||
CustomElem? customElem;
|
||||
QuoteElem? quoteElem;
|
||||
MergeElem? mergeElem;
|
||||
NotificationElem? notificationElem;
|
||||
FaceElem? faceElem;
|
||||
AttachedInfoElem? attachedInfoElem;
|
||||
|
||||
Message({
|
||||
this.clientMsgID,
|
||||
this.serverMsgID,
|
||||
this.createTime,
|
||||
this.sendTime,
|
||||
this.sessionType,
|
||||
this.sendID,
|
||||
this.recvID,
|
||||
this.msgFrom,
|
||||
this.contentType,
|
||||
this.platformID,
|
||||
this.forceList,
|
||||
this.senderNickName,
|
||||
this.senderNickname,
|
||||
this.senderFaceUrl,
|
||||
this.groupID,
|
||||
this.content,
|
||||
this.seq,
|
||||
this.isRead,
|
||||
this.hasReadTime,
|
||||
this.status,
|
||||
this.remark,
|
||||
this.offlinePush,
|
||||
this.attachedInfo,
|
||||
this.ex,
|
||||
this.ext,
|
||||
this.sessionType,
|
||||
this.pictureElem,
|
||||
this.soundElem,
|
||||
this.videoElem,
|
||||
@@ -65,10 +72,12 @@ class Message {
|
||||
this.customElem,
|
||||
this.quoteElem,
|
||||
this.mergeElem,
|
||||
this.notificationElem,
|
||||
this.faceElem,
|
||||
this.attachedInfoElem,
|
||||
});
|
||||
|
||||
Message.fromJson(
|
||||
Map<String, dynamic> json) /* : clientMsgID = json['clientMsgID']*/ {
|
||||
Message.fromJson(Map<String, dynamic> json) {
|
||||
clientMsgID = json['clientMsgID'];
|
||||
serverMsgID = json['serverMsgID'];
|
||||
createTime = json['createTime'];
|
||||
@@ -78,17 +87,18 @@ class Message {
|
||||
msgFrom = json['msgFrom'];
|
||||
contentType = json['contentType'];
|
||||
platformID = json['platformID'];
|
||||
if (json['forceList'] is List) {
|
||||
forceList = (json['forceList'] as List).map((e) => '$e').toList();
|
||||
}
|
||||
senderNickName = json['senderNickName'];
|
||||
senderNickname = json['senderNickname'];
|
||||
senderFaceUrl = json['senderFaceUrl'];
|
||||
groupID = json['groupID'];
|
||||
content = json['content'];
|
||||
seq = json['seq'];
|
||||
isRead = json['isRead'];
|
||||
status = json['status'];
|
||||
remark = json['remark'];
|
||||
offlinePush = json['offlinePush'] != null
|
||||
? OfflinePushInfo.fromJson(json['offlinePush'])
|
||||
: null;
|
||||
attachedInfo = json['attachedInfo'];
|
||||
ex = json['ex'];
|
||||
ext = json['ext'];
|
||||
sessionType = json['sessionType'];
|
||||
pictureElem = json['pictureElem'] != null
|
||||
@@ -116,10 +126,19 @@ class Message {
|
||||
mergeElem = json['mergeElem'] != null
|
||||
? MergeElem.fromJson(json['mergeElem'])
|
||||
: null;
|
||||
notificationElem = json['notificationElem'] != null
|
||||
? NotificationElem.fromJson(json['notificationElem'])
|
||||
: null;
|
||||
faceElem =
|
||||
json['faceElem'] != null ? FaceElem.fromJson(json['faceElem']) : null;
|
||||
attachedInfoElem = json['attachedInfoElem'] != null
|
||||
? AttachedInfoElem.fromJson(json['attachedInfoElem'])
|
||||
: null;
|
||||
hasReadTime = json['hasReadTime'] ?? attachedInfoElem?.hasReadTime;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['clientMsgID'] = this.clientMsgID;
|
||||
data['serverMsgID'] = this.serverMsgID;
|
||||
data['createTime'] = this.createTime;
|
||||
@@ -129,15 +148,17 @@ class Message {
|
||||
data['msgFrom'] = this.msgFrom;
|
||||
data['contentType'] = this.contentType;
|
||||
data['platformID'] = this.platformID;
|
||||
data['forceList'] = this.forceList;
|
||||
data['senderNickName'] = this.senderNickName;
|
||||
data['senderNickname'] = this.senderNickname;
|
||||
data['senderFaceUrl'] = this.senderFaceUrl;
|
||||
data['groupID'] = this.groupID;
|
||||
data['content'] = this.content;
|
||||
data['seq'] = this.seq;
|
||||
data['isRead'] = this.isRead;
|
||||
data['hasReadTime'] = this.hasReadTime;
|
||||
data['status'] = this.status;
|
||||
data['remark'] = this.remark;
|
||||
data['offlinePush'] = this.offlinePush?.toJson();
|
||||
data['attachedInfo'] = this.attachedInfo;
|
||||
data['ex'] = this.ex;
|
||||
data['ext'] = this.ext;
|
||||
data['sessionType'] = this.sessionType;
|
||||
data['pictureElem'] = this.pictureElem?.toJson();
|
||||
@@ -149,6 +170,9 @@ class Message {
|
||||
data['customElem'] = this.customElem?.toJson();
|
||||
data['quoteElem'] = this.quoteElem?.toJson();
|
||||
data['mergeElem'] = this.mergeElem?.toJson();
|
||||
data['notificationElem'] = this.notificationElem?.toJson();
|
||||
data['faceElem'] = this.faceElem?.toJson();
|
||||
data['attachedInfoElem'] = this.attachedInfoElem?.toJson();
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -161,6 +185,43 @@ class Message {
|
||||
|
||||
@override
|
||||
int get hashCode => clientMsgID.hashCode;
|
||||
|
||||
void update(Message message) {
|
||||
if (this != message) return;
|
||||
serverMsgID = message.serverMsgID;
|
||||
createTime = message.createTime;
|
||||
sendTime = message.sendTime;
|
||||
sendID = message.sendID;
|
||||
recvID = message.recvID;
|
||||
msgFrom = message.msgFrom;
|
||||
contentType = message.contentType;
|
||||
platformID = message.platformID;
|
||||
senderNickname = message.senderNickname;
|
||||
senderFaceUrl = message.senderFaceUrl;
|
||||
groupID = message.groupID;
|
||||
content = message.content;
|
||||
seq = message.seq;
|
||||
isRead = message.isRead;
|
||||
hasReadTime = message.hasReadTime;
|
||||
status = message.status;
|
||||
offlinePush = message.offlinePush;
|
||||
attachedInfo = message.attachedInfo;
|
||||
ex = message.ex;
|
||||
ext = message.ext;
|
||||
sessionType = message.sessionType;
|
||||
pictureElem = message.pictureElem;
|
||||
soundElem = message.soundElem;
|
||||
videoElem = message.videoElem;
|
||||
fileElem = message.fileElem;
|
||||
atElem = message.atElem;
|
||||
locationElem = message.locationElem;
|
||||
customElem = message.customElem;
|
||||
quoteElem = message.quoteElem;
|
||||
mergeElem = message.mergeElem;
|
||||
notificationElem = message.notificationElem;
|
||||
faceElem = message.faceElem;
|
||||
attachedInfoElem = message.attachedInfoElem;
|
||||
}
|
||||
}
|
||||
|
||||
class PictureElem {
|
||||
@@ -189,7 +250,7 @@ class PictureElem {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['sourcePath'] = this.sourcePath;
|
||||
if (this.sourcePicture != null) {
|
||||
data['sourcePicture'] = this.sourcePicture?.toJson();
|
||||
@@ -205,7 +266,7 @@ class PictureElem {
|
||||
}
|
||||
|
||||
class PictureInfo {
|
||||
String? uuID;
|
||||
String? uuid;
|
||||
String? type;
|
||||
int? size;
|
||||
int? width;
|
||||
@@ -213,10 +274,10 @@ class PictureInfo {
|
||||
String? url;
|
||||
|
||||
PictureInfo(
|
||||
{this.uuID, this.type, this.size, this.width, this.height, this.url});
|
||||
{this.uuid, this.type, this.size, this.width, this.height, this.url});
|
||||
|
||||
PictureInfo.fromJson(Map<String, dynamic> json) {
|
||||
uuID = json['uuID'];
|
||||
uuid = json['uuid'];
|
||||
type = json['type'];
|
||||
size = json['size'];
|
||||
width = json['width'];
|
||||
@@ -225,8 +286,8 @@ class PictureInfo {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['uuID'] = this.uuID;
|
||||
final data = Map<String, dynamic>();
|
||||
data['uuid'] = this.uuid;
|
||||
data['type'] = this.type;
|
||||
data['size'] = this.size;
|
||||
data['width'] = this.width;
|
||||
@@ -237,21 +298,21 @@ class PictureInfo {
|
||||
}
|
||||
|
||||
class SoundElem {
|
||||
String? uuID;
|
||||
String? uuid;
|
||||
String? soundPath;
|
||||
String? sourceUrl;
|
||||
int? dataSize;
|
||||
int? duration;
|
||||
|
||||
SoundElem(
|
||||
{this.uuID,
|
||||
{this.uuid,
|
||||
this.soundPath,
|
||||
this.sourceUrl,
|
||||
this.dataSize,
|
||||
this.duration});
|
||||
|
||||
SoundElem.fromJson(Map<String, dynamic> json) {
|
||||
uuID = json['uuID'];
|
||||
uuid = json['uuid'];
|
||||
soundPath = json['soundPath'];
|
||||
sourceUrl = json['sourceUrl'];
|
||||
dataSize = json['dataSize'];
|
||||
@@ -259,8 +320,8 @@ class SoundElem {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['uuID'] = this.uuID;
|
||||
final data = Map<String, dynamic>();
|
||||
data['uuid'] = this.uuid;
|
||||
data['soundPath'] = this.soundPath;
|
||||
data['sourceUrl'] = this.sourceUrl;
|
||||
data['dataSize'] = this.dataSize;
|
||||
@@ -313,7 +374,7 @@ class VideoElem {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['videoPath'] = this.videoPath;
|
||||
data['videoUUID'] = this.videoUUID;
|
||||
data['videoUrl'] = this.videoUrl;
|
||||
@@ -332,26 +393,26 @@ class VideoElem {
|
||||
|
||||
class FileElem {
|
||||
String? filePath;
|
||||
String? uuID;
|
||||
String? uuid;
|
||||
String? sourceUrl;
|
||||
String? fileName;
|
||||
int? fileSize;
|
||||
|
||||
FileElem(
|
||||
{this.filePath, this.uuID, this.sourceUrl, this.fileName, this.fileSize});
|
||||
{this.filePath, this.uuid, this.sourceUrl, this.fileName, this.fileSize});
|
||||
|
||||
FileElem.fromJson(Map<String, dynamic> json) {
|
||||
filePath = json['filePath'];
|
||||
uuID = json['uuID'];
|
||||
uuid = json['uuid'];
|
||||
sourceUrl = json['sourceUrl'];
|
||||
fileName = json['fileName'];
|
||||
fileSize = json['fileSize'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['filePath'] = this.filePath;
|
||||
data['uuID'] = this.uuID;
|
||||
data['uuid'] = this.uuid;
|
||||
data['sourceUrl'] = this.sourceUrl;
|
||||
data['fileName'] = this.fileName;
|
||||
data['fileSize'] = this.fileSize;
|
||||
@@ -363,8 +424,16 @@ class AtElem {
|
||||
String? text;
|
||||
List<String>? atUserList;
|
||||
bool? isAtSelf;
|
||||
List<AtUserInfo>? atUsersInfo;
|
||||
Message? quoteMessage;
|
||||
|
||||
AtElem({this.text, this.atUserList, this.isAtSelf});
|
||||
AtElem({
|
||||
this.text,
|
||||
this.atUserList,
|
||||
this.isAtSelf,
|
||||
this.atUsersInfo,
|
||||
this.quoteMessage,
|
||||
});
|
||||
|
||||
AtElem.fromJson(Map<String, dynamic> json) {
|
||||
text = json['text'];
|
||||
@@ -372,13 +441,23 @@ class AtElem {
|
||||
atUserList = (json['atUserList'] as List).map((e) => '$e').toList();
|
||||
}
|
||||
isAtSelf = json['isAtSelf'];
|
||||
if (json['atUsersInfo'] is List) {
|
||||
atUsersInfo = (json['atUsersInfo'] as List)
|
||||
.map((e) => AtUserInfo.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
quoteMessage = null != json['quoteMessage']
|
||||
? Message.fromJson(json['quoteMessage'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['text'] = this.text;
|
||||
data['atUserList'] = this.atUserList;
|
||||
data['isAtSelf'] = this.isAtSelf;
|
||||
data['atUsersInfo'] = this.atUsersInfo?.map((e) => e.toJson()).toList();
|
||||
data['quoteMessage'] = this.quoteMessage?.toJson();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -406,7 +485,7 @@ class LocationElem {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['description'] = this.description;
|
||||
data['longitude'] = this.longitude;
|
||||
data['latitude'] = this.latitude;
|
||||
@@ -428,7 +507,7 @@ class CustomElem {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['data'] = this.data;
|
||||
data['extension'] = this.extension;
|
||||
data['description'] = this.description;
|
||||
@@ -450,7 +529,7 @@ class QuoteElem {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['text'] = this.text;
|
||||
data['quoteMessage'] = this.quoteMessage?.toJson();
|
||||
return data;
|
||||
@@ -477,7 +556,7 @@ class MergeElem {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
final data = Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
data['abstractList'] = this.abstractList;
|
||||
data['multiMessage'] = this.multiMessage?.map((e) => e.toJson()).toList();
|
||||
@@ -485,24 +564,116 @@ class MergeElem {
|
||||
}
|
||||
}
|
||||
|
||||
class HaveReadInfo {
|
||||
String? uid;
|
||||
class NotificationElem {
|
||||
String? detail;
|
||||
String? defaultTips;
|
||||
|
||||
NotificationElem({this.detail, this.defaultTips});
|
||||
|
||||
NotificationElem.fromJson(Map<String, dynamic> json) {
|
||||
detail = json['detail'];
|
||||
defaultTips = json['defaultTips'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['detail'] = this.detail;
|
||||
data['defaultTips'] = this.defaultTips;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class FaceElem {
|
||||
int? index;
|
||||
String? data;
|
||||
|
||||
FaceElem({this.index, this.data});
|
||||
|
||||
FaceElem.fromJson(Map<String, dynamic> json) {
|
||||
index = json['index'];
|
||||
data = json['data'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['index'] = this.index;
|
||||
data['data'] = this.data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class AttachedInfoElem {
|
||||
GroupHasReadInfo? groupHasReadInfo;
|
||||
|
||||
/// 单聊有效
|
||||
bool? isPrivateChat;
|
||||
int? hasReadTime;
|
||||
|
||||
AttachedInfoElem({
|
||||
this.groupHasReadInfo,
|
||||
this.isPrivateChat,
|
||||
this.hasReadTime,
|
||||
});
|
||||
|
||||
AttachedInfoElem.fromJson(Map<String, dynamic> json) {
|
||||
groupHasReadInfo = json['groupHasReadInfo'] == null
|
||||
? null
|
||||
: GroupHasReadInfo.fromJson(json['groupHasReadInfo']);
|
||||
isPrivateChat = json['isPrivateChat'];
|
||||
hasReadTime = json['hasReadTime'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['groupHasReadInfo'] = this.groupHasReadInfo?.toJson();
|
||||
data['isPrivateChat'] = this.isPrivateChat;
|
||||
data['hasReadTime'] = this.hasReadTime;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GroupHasReadInfo {
|
||||
List<String>? hasReadUserIDList;
|
||||
int? hasReadCount;
|
||||
|
||||
GroupHasReadInfo.fromJson(Map<String, dynamic> json) {
|
||||
if (json['hasReadUserIDList'] == null) {
|
||||
hasReadUserIDList = <String>[];
|
||||
} else {
|
||||
hasReadUserIDList = (json['hasReadUserIDList'] as List).cast<String>();
|
||||
}
|
||||
hasReadCount = json['hasReadCount'] ?? 0;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['hasReadUserIDList'] = this.hasReadUserIDList;
|
||||
data['hasReadCount'] = this.hasReadCount;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ReadReceiptInfo {
|
||||
String? userID;
|
||||
String? groupID;
|
||||
List<String>? msgIDList;
|
||||
int? readTime;
|
||||
int? msgFrom;
|
||||
int? contentType;
|
||||
int? sessionType;
|
||||
|
||||
HaveReadInfo(
|
||||
{this.uid,
|
||||
ReadReceiptInfo(
|
||||
{this.userID,
|
||||
this.groupID,
|
||||
this.msgIDList,
|
||||
this.readTime,
|
||||
this.msgFrom,
|
||||
this.contentType,
|
||||
this.sessionType});
|
||||
|
||||
HaveReadInfo.fromJson(Map<String, dynamic> json) {
|
||||
uid = json['uid'];
|
||||
ReadReceiptInfo.fromJson(Map<String, dynamic> json) {
|
||||
userID = json['uid'] ?? json['userID'];
|
||||
groupID = json['groupID'];
|
||||
if (json['msgIDList'] is List) {
|
||||
msgIDList = (json['msgIDList'] as List).map((e) => '$e').toList();
|
||||
}
|
||||
@@ -513,8 +684,8 @@ class HaveReadInfo {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['uid'] = this.uid;
|
||||
final data = Map<String, dynamic>();
|
||||
data['userID'] = this.userID;
|
||||
data['msgIDList'] = this.msgIDList;
|
||||
data['readTime'] = this.readTime;
|
||||
data['msgFrom'] = this.msgFrom;
|
||||
@@ -523,3 +694,51 @@ class HaveReadInfo {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class OfflinePushInfo {
|
||||
String? title;
|
||||
String? desc;
|
||||
String? ex;
|
||||
String? iOSPushSound;
|
||||
bool? iOSBadgeCount;
|
||||
|
||||
OfflinePushInfo(
|
||||
{this.title, this.desc, this.ex, this.iOSPushSound, this.iOSBadgeCount});
|
||||
|
||||
OfflinePushInfo.fromJson(Map<String, dynamic> json) {
|
||||
title = json['title'];
|
||||
desc = json['desc'];
|
||||
ex = json['ex'];
|
||||
iOSPushSound = json['iOSPushSound'];
|
||||
iOSBadgeCount = json['iOSBadgeCount'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['title'] = this.title;
|
||||
data['desc'] = this.desc;
|
||||
data['ex'] = this.ex;
|
||||
data['iOSPushSound'] = this.iOSPushSound;
|
||||
data['iOSBadgeCount'] = this.iOSBadgeCount;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class AtUserInfo {
|
||||
String? atUserID;
|
||||
String? groupNickname;
|
||||
|
||||
AtUserInfo({this.atUserID, this.groupNickname});
|
||||
|
||||
AtUserInfo.fromJson(Map<String, dynamic> json) {
|
||||
atUserID = json['atUserID'];
|
||||
groupNickname = json['groupNickname'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['atUserID'] = this.atUserID;
|
||||
data['groupNickname'] = this.groupNickname;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
403
lib/src/models/notification_info.dart
Normal file
403
lib/src/models/notification_info.dart
Normal file
@@ -0,0 +1,403 @@
|
||||
import '../../flutter_openim_sdk.dart';
|
||||
|
||||
/// OA notification
|
||||
/// oa 通知
|
||||
class OANotification {
|
||||
String? notificationName;
|
||||
String? notificationFaceURL;
|
||||
int? notificationType;
|
||||
String? text;
|
||||
String? externalUrl;
|
||||
|
||||
/// Notification Mix Type
|
||||
/// 0: Plain text notification
|
||||
/// 1: Text+picture notification
|
||||
/// 2: Text+video notification
|
||||
/// 3: Text+file notification
|
||||
/// 0:纯文字通知 1:文字+图片通知 2:文字+视频通知 3:文字+文件通知
|
||||
int? mixType;
|
||||
PictureElem? pictureElem;
|
||||
SoundElem? soundElem;
|
||||
VideoElem? videoElem;
|
||||
FileElem? fileElem;
|
||||
String? ex;
|
||||
|
||||
OANotification(
|
||||
{this.notificationName,
|
||||
this.notificationFaceURL,
|
||||
this.notificationType,
|
||||
this.text,
|
||||
this.externalUrl,
|
||||
this.mixType,
|
||||
this.pictureElem,
|
||||
this.soundElem,
|
||||
this.videoElem,
|
||||
this.fileElem,
|
||||
this.ex});
|
||||
|
||||
OANotification.fromJson(Map<String, dynamic> json) {
|
||||
notificationName = json['notificationName'];
|
||||
notificationFaceURL = json['notificationFaceURL'];
|
||||
notificationType = json['notificationType'];
|
||||
text = json['text'];
|
||||
externalUrl = json['externalUrl'];
|
||||
mixType = json['mixType'];
|
||||
pictureElem = json['pictureElem'] != null
|
||||
? PictureElem.fromJson(json['pictureElem'])
|
||||
: null;
|
||||
soundElem = json['soundElem'] != null
|
||||
? SoundElem.fromJson(json['soundElem'])
|
||||
: null;
|
||||
videoElem = json['videoElem'] != null
|
||||
? VideoElem.fromJson(json['videoElem'])
|
||||
: null;
|
||||
fileElem =
|
||||
json['fileElem'] != null ? FileElem.fromJson(json['fileElem']) : null;
|
||||
ex = json['ex'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['notificationName'] = this.notificationName;
|
||||
data['notificationFaceURL'] = this.notificationFaceURL;
|
||||
data['notificationType'] = this.notificationType;
|
||||
data['text'] = this.text;
|
||||
data['externalUrl'] = this.externalUrl;
|
||||
data['mixType'] = this.mixType;
|
||||
if (this.pictureElem != null) {
|
||||
data['pictureElem'] = this.pictureElem!.toJson();
|
||||
}
|
||||
if (this.soundElem != null) {
|
||||
data['soundElem'] = this.soundElem!.toJson();
|
||||
}
|
||||
if (this.videoElem != null) {
|
||||
data['videoElem'] = this.videoElem!.toJson();
|
||||
}
|
||||
if (this.fileElem != null) {
|
||||
data['fileElem'] = this.fileElem!.toJson();
|
||||
}
|
||||
data['ex'] = this.ex;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Group common notification
|
||||
class GroupNotification {
|
||||
GroupInfo? group;
|
||||
GroupMembersInfo? opUser;
|
||||
GroupMembersInfo? groupOwnerUser;
|
||||
List<GroupMembersInfo>? memberList;
|
||||
|
||||
GroupNotification({
|
||||
this.group,
|
||||
this.opUser,
|
||||
this.groupOwnerUser,
|
||||
this.memberList,
|
||||
});
|
||||
|
||||
GroupNotification.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
groupOwnerUser = json['groupOwnerUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['groupOwnerUser'])
|
||||
: null;
|
||||
if (json['memberList'] != null) {
|
||||
memberList = <GroupMembersInfo>[];
|
||||
json['memberList'].forEach((v) {
|
||||
memberList!.add(GroupMembersInfo.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.group != null) {
|
||||
data['group'] = this.group!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.groupOwnerUser != null) {
|
||||
data['groupOwnerUser'] = this.groupOwnerUser!.toJson();
|
||||
}
|
||||
if (this.memberList != null) {
|
||||
data['memberList'] = this.memberList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// User is invited to the group notification
|
||||
/// 用户被邀请进群通知
|
||||
class InvitedJoinGroupNotification {
|
||||
GroupInfo? group;
|
||||
GroupMembersInfo? opUser;
|
||||
List<GroupMembersInfo>? invitedUserList;
|
||||
|
||||
InvitedJoinGroupNotification({this.group, this.opUser, this.invitedUserList});
|
||||
|
||||
InvitedJoinGroupNotification.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
if (json['invitedUserList'] != null) {
|
||||
invitedUserList = <GroupMembersInfo>[];
|
||||
json['invitedUserList'].forEach((v) {
|
||||
invitedUserList!.add(GroupMembersInfo.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.group != null) {
|
||||
data['group'] = this.group!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.invitedUserList != null) {
|
||||
data['invitedUserList'] =
|
||||
this.invitedUserList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Group kicked member notification
|
||||
/// 组踢出成员通知
|
||||
class KickedGroupMemeberNotification {
|
||||
GroupInfo? group;
|
||||
GroupMembersInfo? opUser;
|
||||
List<GroupMembersInfo>? kickedUserList;
|
||||
|
||||
KickedGroupMemeberNotification(
|
||||
{this.group, this.opUser, this.kickedUserList});
|
||||
|
||||
KickedGroupMemeberNotification.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
if (json['kickedUserList'] != null) {
|
||||
kickedUserList = <GroupMembersInfo>[];
|
||||
json['kickedUserList'].forEach((v) {
|
||||
kickedUserList!.add(GroupMembersInfo.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.group != null) {
|
||||
data['group'] = this.group!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.kickedUserList != null) {
|
||||
data['kickedUserList'] =
|
||||
this.kickedUserList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Exit group notification
|
||||
/// 退出群通知
|
||||
class QuitGroupNotification {
|
||||
GroupInfo? group;
|
||||
GroupMembersInfo? quitUser;
|
||||
|
||||
QuitGroupNotification({this.group, this.quitUser});
|
||||
|
||||
QuitGroupNotification.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
|
||||
quitUser = json['quitUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['quitUser'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.group != null) {
|
||||
data['group'] = this.group!.toJson();
|
||||
}
|
||||
if (this.quitUser != null) {
|
||||
data['quitUser'] = this.quitUser!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Enter group notification
|
||||
/// 进群通知
|
||||
class EnterGroupNotification {
|
||||
GroupInfo? group;
|
||||
GroupMembersInfo? entrantUser;
|
||||
|
||||
EnterGroupNotification({this.group, this.entrantUser});
|
||||
|
||||
EnterGroupNotification.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
|
||||
entrantUser = json['entrantUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['entrantUser'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.group != null) {
|
||||
data['group'] = this.group!.toJson();
|
||||
}
|
||||
if (this.entrantUser != null) {
|
||||
data['quitUser'] = this.entrantUser!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Group rights transfer noticication
|
||||
/// 群权转让通知
|
||||
class GroupRightsTransferNoticication {
|
||||
GroupInfo? group;
|
||||
GroupMembersInfo? opUser;
|
||||
GroupMembersInfo? newGroupOwner;
|
||||
|
||||
GroupRightsTransferNoticication({
|
||||
this.group,
|
||||
this.opUser,
|
||||
this.newGroupOwner,
|
||||
});
|
||||
|
||||
GroupRightsTransferNoticication.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
newGroupOwner = json['newGroupOwner'] != null
|
||||
? GroupMembersInfo.fromJson(json['newGroupOwner'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.group != null) {
|
||||
data['group'] = this.group!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.newGroupOwner != null) {
|
||||
data['newGroupOwner'] = this.newGroupOwner!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Mute member notification
|
||||
/// 禁言成员通知
|
||||
class MuteMemberNotification {
|
||||
GroupInfo? group;
|
||||
GroupMembersInfo? opUser;
|
||||
GroupMembersInfo? mutedUser;
|
||||
int? mutedSeconds;
|
||||
|
||||
MuteMemberNotification({
|
||||
this.group,
|
||||
this.opUser,
|
||||
this.mutedUser,
|
||||
this.mutedSeconds,
|
||||
});
|
||||
|
||||
MuteMemberNotification.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
mutedUser = json['mutedUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['mutedUser'])
|
||||
: null;
|
||||
mutedSeconds = json['mutedSeconds'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.group != null) {
|
||||
data['group'] = this.group!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.mutedUser != null) {
|
||||
data['mutedUser'] = this.mutedUser!.toJson();
|
||||
}
|
||||
data['mutedSeconds'] = this.mutedSeconds;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Burn after reading notification
|
||||
/// 阅后即焚通知
|
||||
class BurnAfterReadingNotification {
|
||||
String? recvID;
|
||||
String? sendID;
|
||||
bool? isPrivate;
|
||||
|
||||
BurnAfterReadingNotification({this.recvID, this.sendID, this.isPrivate});
|
||||
|
||||
BurnAfterReadingNotification.fromJson(Map<String, dynamic> json) {
|
||||
recvID = json['recvID'];
|
||||
sendID = json['sendID'];
|
||||
isPrivate = json['isPrivate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['recvID'] = this.recvID;
|
||||
data['sendID'] = this.sendID;
|
||||
data['isPrivate'] = this.isPrivate;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// Group member info changed notification
|
||||
/// 禁言成员通知
|
||||
class GroupMemberInfoChangedNotification {
|
||||
GroupInfo? group;
|
||||
GroupMembersInfo? opUser;
|
||||
GroupMembersInfo? changedUser;
|
||||
|
||||
GroupMemberInfoChangedNotification({
|
||||
this.group,
|
||||
this.opUser,
|
||||
this.changedUser,
|
||||
});
|
||||
|
||||
GroupMemberInfoChangedNotification.fromJson(Map<String, dynamic> json) {
|
||||
group = json['group'] != null ? GroupInfo.fromJson(json['group']) : null;
|
||||
opUser = json['opUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['opUser'])
|
||||
: null;
|
||||
changedUser = json['changedUser'] != null
|
||||
? GroupMembersInfo.fromJson(json['changedUser'])
|
||||
: null;
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
if (this.group != null) {
|
||||
data['group'] = this.group!.toJson();
|
||||
}
|
||||
if (this.opUser != null) {
|
||||
data['opUser'] = this.opUser!.toJson();
|
||||
}
|
||||
if (this.changedUser != null) {
|
||||
data['changedUser'] = this.changedUser!.toJson();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
74
lib/src/models/search_info.dart
Normal file
74
lib/src/models/search_info.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class SearchResult {
|
||||
/// 获取到的总的消息数量
|
||||
int? totalCount;
|
||||
List<SearchResultItems>? searchResultItems;
|
||||
|
||||
SearchResult({this.totalCount, this.searchResultItems});
|
||||
|
||||
SearchResult.fromJson(Map<String, dynamic> json) {
|
||||
totalCount = json['totalCount'];
|
||||
if (json['searchResultItems'] != null) {
|
||||
searchResultItems = <SearchResultItems>[];
|
||||
json['searchResultItems'].forEach((v) {
|
||||
searchResultItems!.add(SearchResultItems.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['totalCount'] = this.totalCount;
|
||||
if (this.searchResultItems != null) {
|
||||
data['searchResultItems'] =
|
||||
this.searchResultItems!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class SearchResultItems {
|
||||
/// 会话ID
|
||||
String? conversationID;
|
||||
|
||||
/// 会话类型1单聊,2群聊,3,超级大群,4通知会话
|
||||
int? conversationType;
|
||||
String? showName;
|
||||
String? faceURL;
|
||||
|
||||
/// 搜索到的这个会话下的消息数量
|
||||
int? messageCount;
|
||||
|
||||
/// [Message]的列表
|
||||
List<Message>? messageList;
|
||||
|
||||
SearchResultItems({this.conversationID, this.messageCount, this.messageList});
|
||||
|
||||
SearchResultItems.fromJson(Map<String, dynamic> json) {
|
||||
conversationID = json['conversationID'];
|
||||
conversationType = json['conversationType'];
|
||||
showName = json['showName'];
|
||||
faceURL = json['faceURL'];
|
||||
messageCount = json['messageCount'];
|
||||
if (json['messageList'] != null) {
|
||||
messageList = <Message>[];
|
||||
json['messageList'].forEach((v) {
|
||||
messageList!.add(Message.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['conversationID'] = this.conversationID;
|
||||
data['conversationType'] = this.conversationType;
|
||||
data['showName'] = this.showName;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['messageCount'] = this.messageCount;
|
||||
if (this.messageList != null) {
|
||||
data['messageList'] = this.messageList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
98
lib/src/models/signaling_info.dart
Normal file
98
lib/src/models/signaling_info.dart
Normal file
@@ -0,0 +1,98 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class SignalingInfo {
|
||||
String? opUserID;
|
||||
InvitationInfo? invitation;
|
||||
OfflinePushInfo? offlinePushInfo;
|
||||
|
||||
SignalingInfo({
|
||||
this.opUserID,
|
||||
this.invitation,
|
||||
this.offlinePushInfo,
|
||||
});
|
||||
|
||||
SignalingInfo.fromJson(Map<String, dynamic> json) {
|
||||
opUserID = json['opUserID'];
|
||||
invitation = json['invitation'] == null
|
||||
? null
|
||||
: InvitationInfo.fromJson(json['invitation']);
|
||||
offlinePushInfo = json['offlinePushInfo'] == null
|
||||
? null
|
||||
: OfflinePushInfo.fromJson(json['offlinePushInfo']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['opUserID'] = this.opUserID;
|
||||
data['invitation'] = this.invitation?.toJson();
|
||||
data['offlinePushInfo'] = this.offlinePushInfo?.toJson();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class InvitationInfo {
|
||||
String? inviterUserID; //邀请者UserID
|
||||
List<String>? inviteeUserIDList; //被邀请者UserID列表,如果是单聊只有一个元素
|
||||
String? groupID; //如果是单聊,为""
|
||||
String? roomID; //房间ID,必须唯一,可以不设置。
|
||||
int? timeout; //邀请超时时间(秒)
|
||||
String? mediaType; //video 或者audio
|
||||
int? sessionType; //1为单聊,2为群聊
|
||||
int? platformID; //和之前定义一致
|
||||
|
||||
InvitationInfo(
|
||||
{this.inviterUserID,
|
||||
this.inviteeUserIDList,
|
||||
this.groupID,
|
||||
this.roomID,
|
||||
this.timeout,
|
||||
this.mediaType,
|
||||
this.sessionType,
|
||||
this.platformID});
|
||||
|
||||
InvitationInfo.fromJson(Map<String, dynamic> json) {
|
||||
inviterUserID = json['inviterUserID'];
|
||||
inviteeUserIDList = json['inviteeUserIDList'].cast<String>();
|
||||
groupID = json['groupID'];
|
||||
roomID = json['roomID'];
|
||||
timeout = json['timeout'];
|
||||
mediaType = json['mediaType'];
|
||||
sessionType = json['sessionType'];
|
||||
platformID = json['platformID'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['inviterUserID'] = this.inviterUserID;
|
||||
data['inviteeUserIDList'] = this.inviteeUserIDList;
|
||||
data['groupID'] = this.groupID;
|
||||
data['roomID'] = this.roomID;
|
||||
data['timeout'] = this.timeout;
|
||||
data['mediaType'] = this.mediaType;
|
||||
data['sessionType'] = this.sessionType;
|
||||
data['platformID'] = this.platformID;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class SignalingCertificate {
|
||||
String? token;
|
||||
String? roomID;
|
||||
String? liveURL;
|
||||
|
||||
SignalingCertificate({this.token, this.roomID, this.liveURL});
|
||||
|
||||
SignalingCertificate.fromJson(Map<String, dynamic> json) {
|
||||
token = json['token'];
|
||||
roomID = json['roomID'];
|
||||
liveURL = json['liveURL'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['token'] = this.token;
|
||||
data['roomID'] = this.roomID;
|
||||
data['liveURL'] = this.liveURL;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,91 +1,412 @@
|
||||
/// Is a friend not in the blacklist
|
||||
/// 是好友不在黑名单
|
||||
/// Not a friend on the blacklist
|
||||
/// 不是好友在黑名单
|
||||
/// Not a friend is not on the blacklist
|
||||
/// 不是好友不在黑名单
|
||||
class UserInfo {
|
||||
String uid;
|
||||
String? name;
|
||||
String? icon;
|
||||
String? userID;
|
||||
String? nickname;
|
||||
String? faceURL;
|
||||
int? gender;
|
||||
String? mobile;
|
||||
String? birth;
|
||||
String? phoneNumber;
|
||||
int? birth;
|
||||
String? email;
|
||||
String? ex;
|
||||
String? comment;
|
||||
int? isInBlackList;
|
||||
String? reqMessage;
|
||||
String? applyTime;
|
||||
int? flag;
|
||||
int? createTime;
|
||||
String? remark;
|
||||
|
||||
UserInfo(
|
||||
{required this.uid,
|
||||
this.name,
|
||||
this.icon,
|
||||
this.gender,
|
||||
this.mobile,
|
||||
this.birth,
|
||||
this.email,
|
||||
this.ex,
|
||||
this.comment,
|
||||
this.isInBlackList,
|
||||
this.reqMessage,
|
||||
this.applyTime,
|
||||
this.flag});
|
||||
/// User's public profile(用户公开的资料)
|
||||
PublicUserInfo? publicInfo;
|
||||
|
||||
UserInfo.fromJson(Map<String, dynamic> json) : uid = json['uid'] {
|
||||
name = json['name'];
|
||||
icon = json['icon'];
|
||||
/// Only friends can view information(好友才能查看的资料)
|
||||
FriendInfo? friendInfo;
|
||||
|
||||
/// blacklist information(黑名单资料)
|
||||
BlacklistInfo? blackInfo;
|
||||
|
||||
bool? isFriendship;
|
||||
|
||||
bool? isBlacklist;
|
||||
|
||||
UserInfo({
|
||||
this.publicInfo,
|
||||
this.friendInfo,
|
||||
this.blackInfo,
|
||||
this.isFriendship,
|
||||
this.isBlacklist,
|
||||
//
|
||||
this.userID,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.phoneNumber,
|
||||
this.birth,
|
||||
this.gender,
|
||||
this.email,
|
||||
this.ex,
|
||||
this.createTime,
|
||||
this.remark,
|
||||
});
|
||||
|
||||
// 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) {
|
||||
publicInfo = json['publicInfo'] != null
|
||||
? PublicUserInfo.fromJson(json['publicInfo'])
|
||||
: null;
|
||||
friendInfo = json['friendInfo'] != null
|
||||
? FriendInfo.fromJson(json['friendInfo'])
|
||||
: null;
|
||||
blackInfo = json['blackInfo'] != null
|
||||
? BlacklistInfo.fromJson(json['blackInfo'])
|
||||
: null;
|
||||
//
|
||||
isFriendship = friendInfo != null;
|
||||
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'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['publicInfo'] = this.publicInfo?.toJson();
|
||||
data['friendInfo'] = this.friendInfo?.toJson();
|
||||
data['blackInfo'] = this.blackInfo?.toJson();
|
||||
//
|
||||
data['isFriendship'] = this.isFriendship;
|
||||
data['isBlacklist'] = this.isBlacklist;
|
||||
data['userID'] = this.userID;
|
||||
data['nickname'] = this.nickname;
|
||||
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['createTime'] = this.createTime;
|
||||
data['remark'] = this.remark;
|
||||
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!;
|
||||
|
||||
static String? _isNull(String? value) {
|
||||
if (value == null || value.trim().isEmpty) return null;
|
||||
return value;
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserInfo &&
|
||||
runtimeType == other.runtimeType &&
|
||||
userID == other.userID;
|
||||
|
||||
@override
|
||||
int get hashCode => userID.hashCode;
|
||||
}
|
||||
|
||||
class PublicUserInfo {
|
||||
String? userID;
|
||||
String? nickname;
|
||||
String? faceURL;
|
||||
int? gender;
|
||||
int? appMangerLevel;
|
||||
String? ex;
|
||||
|
||||
PublicUserInfo({
|
||||
this.userID,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.gender,
|
||||
this.appMangerLevel,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
PublicUserInfo.fromJson(Map<String, dynamic> json) {
|
||||
userID = json['userID'];
|
||||
nickname = json['nickname'];
|
||||
faceURL = json['faceURL'];
|
||||
gender = json['gender'];
|
||||
mobile = json['mobile'];
|
||||
appMangerLevel = json['appMangerLevel'];
|
||||
ex = json['ex'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['userID'] = this.userID;
|
||||
data['nickname'] = this.nickname;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['gender'] = this.gender;
|
||||
data['appMangerLevel'] = this.appMangerLevel;
|
||||
data['ex'] = this.ex;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class FriendInfo {
|
||||
String? userID;
|
||||
String? nickname;
|
||||
String? faceURL;
|
||||
int? gender;
|
||||
String? phoneNumber;
|
||||
int? birth;
|
||||
String? email;
|
||||
String? remark;
|
||||
String? ex;
|
||||
int? createTime;
|
||||
int? addSource;
|
||||
String? operatorUserID;
|
||||
|
||||
FriendInfo({
|
||||
this.userID,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.gender,
|
||||
this.phoneNumber,
|
||||
this.birth,
|
||||
this.email,
|
||||
this.remark,
|
||||
this.ex,
|
||||
this.createTime,
|
||||
this.addSource,
|
||||
this.operatorUserID,
|
||||
});
|
||||
|
||||
FriendInfo.fromJson(Map<String, dynamic> json) {
|
||||
// ownerUserID = json['ownerUserID'];
|
||||
userID = json['userID'];
|
||||
remark = json['remark'];
|
||||
createTime = json['createTime'];
|
||||
addSource = json['addSource'];
|
||||
operatorUserID = json['operatorUserID'];
|
||||
nickname = json['nickname'];
|
||||
faceURL = json['faceURL'];
|
||||
gender = json['gender'];
|
||||
phoneNumber = json['phoneNumber'];
|
||||
birth = json['birth'];
|
||||
email = json['email'];
|
||||
ex = json['ex'];
|
||||
comment = json['comment'];
|
||||
isInBlackList = json['isInBlackList'];
|
||||
reqMessage = json['reqMessage'];
|
||||
applyTime = json['applyTime'];
|
||||
flag = json['flag'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
// data['ownerUserID'] = this.ownerUserID;
|
||||
data['userID'] = this.userID;
|
||||
data['remark'] = this.remark;
|
||||
data['createTime'] = this.createTime;
|
||||
data['addSource'] = this.addSource;
|
||||
data['operatorUserID'] = this.operatorUserID;
|
||||
data['nickname'] = this.nickname;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['gender'] = this.gender;
|
||||
data['phoneNumber'] = this.phoneNumber;
|
||||
data['birth'] = this.birth;
|
||||
data['email'] = this.email;
|
||||
data['ex'] = this.ex;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class BlacklistInfo {
|
||||
String? userID;
|
||||
String? nickname;
|
||||
String? faceURL;
|
||||
int? gender;
|
||||
int? createTime;
|
||||
int? addSource;
|
||||
String? operatorUserID;
|
||||
String? ex;
|
||||
|
||||
BlacklistInfo({
|
||||
this.userID,
|
||||
this.nickname,
|
||||
this.faceURL,
|
||||
this.gender,
|
||||
this.createTime,
|
||||
this.addSource,
|
||||
this.operatorUserID,
|
||||
this.ex,
|
||||
});
|
||||
|
||||
BlacklistInfo.fromJson(Map<String, dynamic> json) {
|
||||
userID = json['userID'];
|
||||
nickname = json['nickname'];
|
||||
faceURL = json['faceURL'];
|
||||
gender = json['gender'];
|
||||
createTime = json['createTime'];
|
||||
addSource = json['addSource'];
|
||||
operatorUserID = json['operatorUserID'];
|
||||
ex = json['ex'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['userID'] = this.userID;
|
||||
data['nickname'] = this.nickname;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['gender'] = this.gender;
|
||||
data['createTime'] = this.createTime;
|
||||
data['addSource'] = this.addSource;
|
||||
data['operatorUserID'] = this.operatorUserID;
|
||||
data['ex'] = this.ex;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class FriendshipInfo {
|
||||
String? userID;
|
||||
|
||||
/// 1 means friend (and not blacklist)
|
||||
/// 1表示好友(并且不是黑名单)
|
||||
int? result;
|
||||
|
||||
FriendshipInfo({this.userID, this.result});
|
||||
|
||||
FriendshipInfo.fromJson(Map<String, dynamic> json) {
|
||||
userID = json['userID'];
|
||||
result = json['result'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['uid'] = this.uid;
|
||||
data['name'] = this.name;
|
||||
data['icon'] = this.icon;
|
||||
data['gender'] = this.gender;
|
||||
data['mobile'] = this.mobile;
|
||||
data['birth'] = this.birth;
|
||||
data['email'] = this.email;
|
||||
data['userID'] = this.userID;
|
||||
data['result'] = this.result;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class FriendApplicationInfo {
|
||||
String? fromUserID;
|
||||
String? fromNickname;
|
||||
String? fromFaceURL;
|
||||
int? fromGender;
|
||||
String? toUserID;
|
||||
String? toNickname;
|
||||
String? toFaceURL;
|
||||
int? toGender;
|
||||
int? handleResult;
|
||||
String? reqMsg;
|
||||
int? createTime;
|
||||
String? handlerUserID;
|
||||
String? handleMsg;
|
||||
int? handleTime;
|
||||
String? ex;
|
||||
|
||||
FriendApplicationInfo(
|
||||
{this.fromUserID,
|
||||
this.fromNickname,
|
||||
this.fromFaceURL,
|
||||
this.fromGender,
|
||||
this.toUserID,
|
||||
this.toNickname,
|
||||
this.toFaceURL,
|
||||
this.toGender,
|
||||
this.handleResult,
|
||||
this.reqMsg,
|
||||
this.createTime,
|
||||
this.handlerUserID,
|
||||
this.handleMsg,
|
||||
this.handleTime,
|
||||
this.ex});
|
||||
|
||||
FriendApplicationInfo.fromJson(Map<String, dynamic> json) {
|
||||
fromUserID = json['fromUserID'];
|
||||
fromNickname = json['fromNickname'];
|
||||
fromFaceURL = json['fromFaceURL'];
|
||||
fromGender = json['fromGender'];
|
||||
toUserID = json['toUserID'];
|
||||
toNickname = json['toNickname'];
|
||||
toFaceURL = json['toFaceURL'];
|
||||
toGender = json['toGender'];
|
||||
handleResult = json['handleResult'];
|
||||
reqMsg = json['reqMsg'];
|
||||
createTime = json['createTime'];
|
||||
handlerUserID = json['handlerUserID'];
|
||||
handleMsg = json['handleMsg'];
|
||||
handleTime = json['handleTime'];
|
||||
ex = json['ex'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['fromUserID'] = this.fromUserID;
|
||||
data['fromNickname'] = this.fromNickname;
|
||||
data['fromFaceURL'] = this.fromFaceURL;
|
||||
data['fromGender'] = this.fromGender;
|
||||
data['toUserID'] = this.toUserID;
|
||||
data['toNickname'] = this.toNickname;
|
||||
data['toFaceURL'] = this.toFaceURL;
|
||||
data['toGender'] = this.toGender;
|
||||
data['handleResult'] = this.handleResult;
|
||||
data['reqMsg'] = this.reqMsg;
|
||||
data['createTime'] = this.createTime;
|
||||
data['handlerUserID'] = this.handlerUserID;
|
||||
data['handleMsg'] = this.handleMsg;
|
||||
data['handleTime'] = this.handleTime;
|
||||
data['ex'] = this.ex;
|
||||
data['comment'] = this.comment;
|
||||
data['isInBlackList'] = this.isInBlackList;
|
||||
data['reqMessage'] = this.reqMessage;
|
||||
data['applyTime'] = this.applyTime;
|
||||
data['flag'] = this.flag;
|
||||
return data;
|
||||
}
|
||||
|
||||
String getShowName() {
|
||||
if (null != comment && comment!.trim().isNotEmpty) {
|
||||
return comment!;
|
||||
} else if (null != name && name!.trim().isNotEmpty) {
|
||||
return name!;
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
|
||||
bool get isMan => gender == 1;
|
||||
|
||||
bool get isWoman => gender == 2;
|
||||
|
||||
/// blacklist
|
||||
bool get isBlocked => isInBlackList == 1;
|
||||
|
||||
/// friend application waiting handle
|
||||
bool get isWaitingHandle => flag == 0;
|
||||
bool get isWaitingHandle => handleResult == 0;
|
||||
|
||||
/// friend application agreed
|
||||
bool get isAgreed => flag == 1;
|
||||
bool get isAgreed => handleResult == 1;
|
||||
|
||||
/// friend application rejected
|
||||
bool get isRejected => flag == -1;
|
||||
|
||||
/// exist friendship
|
||||
bool get isFriendship => isAgreed;
|
||||
bool get isRejected => handleResult == -1;
|
||||
}
|
||||
|
||||
56
lib/src/models/workmoments_info.dart
Normal file
56
lib/src/models/workmoments_info.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
class WorkMomentsInfo {
|
||||
int? notificationMsgType;
|
||||
String? replyUserName;
|
||||
String? replyUserID;
|
||||
String? content;
|
||||
String? contentID;
|
||||
String? workMomentID;
|
||||
String? userID;
|
||||
String? userName;
|
||||
String? faceURL;
|
||||
String? workMomentContent;
|
||||
int? createTime;
|
||||
|
||||
WorkMomentsInfo(
|
||||
{this.notificationMsgType,
|
||||
this.replyUserName,
|
||||
this.replyUserID,
|
||||
this.content,
|
||||
this.contentID,
|
||||
this.workMomentID,
|
||||
this.userID,
|
||||
this.userName,
|
||||
this.faceURL,
|
||||
this.workMomentContent,
|
||||
this.createTime});
|
||||
|
||||
WorkMomentsInfo.fromJson(Map<String, dynamic> json) {
|
||||
notificationMsgType = json['notificationMsgType'];
|
||||
replyUserName = json['replyUserName'];
|
||||
replyUserID = json['replyUserID'];
|
||||
content = json['content'];
|
||||
contentID = json['contentID'];
|
||||
workMomentID = json['workMomentID'];
|
||||
userID = json['userID'];
|
||||
userName = json['userName'];
|
||||
faceURL = json['faceURL'];
|
||||
workMomentContent = json['workMomentContent'];
|
||||
createTime = json['createTime'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['notificationMsgType'] = this.notificationMsgType;
|
||||
data['replyUserName'] = this.replyUserName;
|
||||
data['replyUserID'] = this.replyUserID;
|
||||
data['content'] = this.content;
|
||||
data['contentID'] = this.contentID;
|
||||
data['workMomentID'] = this.workMomentID;
|
||||
data['userID'] = this.userID;
|
||||
data['userName'] = this.userName;
|
||||
data['faceURL'] = this.faceURL;
|
||||
data['workMomentContent'] = this.workMomentContent;
|
||||
data['createTime'] = this.createTime;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
16
lib/src/utils.dart
Normal file
16
lib/src/utils.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Utils {
|
||||
static List<T> toList<T>(String value, T f(Map<String, dynamic> map)) =>
|
||||
(_formatJson(value) as List).map((e) => f(e)).toList();
|
||||
|
||||
static T toObj<T>(String value, T f(Map<String, dynamic> map)) =>
|
||||
f(_formatJson(value));
|
||||
|
||||
static List<dynamic> toListMap(String value) => _formatJson(value);
|
||||
|
||||
static dynamic _formatJson(String value) => jsonDecode(value);
|
||||
|
||||
static String checkOperationID(String? obj) =>
|
||||
obj ?? DateTime.now().millisecondsSinceEpoch.toString();
|
||||
}
|
||||
@@ -67,6 +67,13 @@ packages:
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.12.11"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -127,7 +134,7 @@ packages:
|
||||
name: test_api
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "0.4.3"
|
||||
version: "0.4.8"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: flutter_openim_sdk
|
||||
description: An instant messaging plug-in that supports Android and IOS. And the server is also all open source.
|
||||
version: 1.1.1
|
||||
version: 2.0.0+6
|
||||
homepage: https://www.rentsoft.cn
|
||||
repository: https://github.com/OpenIMSDK/Open-IM-SDK-Flutter
|
||||
|
||||
|
||||
@@ -1,41 +1,5 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
/* const MethodChannel channel = MethodChannel('flutter_openim_sdk');
|
||||
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
setUp(() {
|
||||
channel.setMockMethodCallHandler((MethodCall methodCall) async {
|
||||
return '42';
|
||||
});
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
channel.setMockMethodCallHandler(null);
|
||||
});
|
||||
|
||||
test('getPlatformVersion', () async {});*/
|
||||
|
||||
// Message m1 = new Message(clientMsgID: '1', content: 'c1');
|
||||
// Message m2 = new Message(clientMsgID: '2', content: 'c2');
|
||||
// Message m3 = new Message(clientMsgID: '3', content: 'c3');
|
||||
// Message m4 = new Message(clientMsgID: '3', content: 'c4');
|
||||
// List list = List.of([m1, m2, m3]);
|
||||
//
|
||||
// print(list.contains(m4));
|
||||
// print(m1 == m4);
|
||||
// print(m2 == m4);
|
||||
// print(m3 == m4);
|
||||
// var input = "1234 @abc @bbc @hha 开什么玩笑";
|
||||
// RegExp exp = new RegExp(r"(@\w+) ");
|
||||
// final ms = exp.allMatches(input);
|
||||
// for (Match m in ms) {
|
||||
// String match = m.group(0)??'';
|
||||
// print('====$match ${m.start} ${m.end}');
|
||||
// }
|
||||
|
||||
// DateTime now = DateTime.now();
|
||||
// print('${now.millisecond}');
|
||||
// print('${now.microsecondsSinceEpoch}');
|
||||
// print('${now.millisecondsSinceEpoch}');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user