Fix bug
This commit is contained in:
parent
862bf46ace
commit
51667e19d7
252
README.md
252
README.md
@ -96,7 +96,7 @@ A flutter im plugin for android and ios.
|
|||||||
|
|
||||||
```
|
```
|
||||||
OpenIM.iMManager.login(uid: uid, token: token).then((value){
|
OpenIM.iMManager.login(uid: uid, token: token).then((value){
|
||||||
// login successful
|
// login success
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -104,40 +104,18 @@ A flutter im plugin for android and ios.
|
|||||||
|
|
||||||
```
|
```
|
||||||
OpenIM.iMManager.conversationManager.getAllConversationList().then((list) {
|
OpenIM.iMManager.conversationManager.getAllConversationList().then((list) {
|
||||||
// Return to the conversation list
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 6,Get contact list
|
#### 6,Get friend list
|
||||||
|
|
||||||
```
|
```
|
||||||
OpenIM.iMManager.friendshipManager.getFriendList().then((list) {
|
OpenIM.iMManager.friendshipManager.getFriendList().then((list) {
|
||||||
// Return to friends list
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 7,Get chat history
|
#### 7,Get chat history
|
||||||
|
|
||||||
```
|
|
||||||
List<Message> chatMsgList = List.empty(growable: true);
|
|
||||||
|
|
||||||
/// Custom message listener, the arrival of a new message will trigger the onNewMessage method callback
|
|
||||||
class CustomAdvancedMsgListener extends AdvancedMsgListener {
|
|
||||||
final ValueChanged<Message>? onNewMessage;
|
|
||||||
|
|
||||||
CustomAdvancedMsgListener({
|
|
||||||
this.onNewMessage,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onRecvNewMessage(Message msg) {
|
|
||||||
if (null != onNewMessage) onNewMessage!(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
- History news
|
|
||||||
|
|
||||||
```
|
```
|
||||||
// If userID is not null and groupID is null, get a single chat message list
|
// 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
|
// If the userID is null and the groupID is not null, get a group chat message list
|
||||||
@ -145,38 +123,12 @@ class CustomAdvancedMsgListener extends AdvancedMsgListener {
|
|||||||
userID: uid,//User id
|
userID: uid,//User id
|
||||||
startMsg: startMsg,//Last message, take chatMsgList[0]
|
startMsg: startMsg,//Last message, take chatMsgList[0]
|
||||||
groupID: gid,//Group id
|
groupID: gid,//Group id
|
||||||
count: 12,//Page Size
|
count: count,//Page Size
|
||||||
)
|
)
|
||||||
.then((list) => chatMsgList.addAll(list));
|
.then((list){});
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- New news
|
|
||||||
|
|
||||||
```
|
|
||||||
// Create a message listener
|
|
||||||
// After entering the chat page, you need to listen for new messages and then render the UI
|
|
||||||
// Each chat window has a unique uid (user id) or gid (group id)
|
|
||||||
// Determine whether the received message belongs to the current window according to uid or gid
|
|
||||||
var msgListener = CustomAdvancedMsgListener(onNewMessage: (message) {
|
|
||||||
// If the sender user id is equal to the user id of the current chat page,
|
|
||||||
// or the group id is equal to the current group id of the current chat page
|
|
||||||
if (message.sendID == uid || message.groupID == gid) {
|
|
||||||
if (!chatMsgList.contains(message)) {
|
|
||||||
// New message in current chat page
|
|
||||||
chatMsgList.add(event.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add message listener
|
|
||||||
OpenIM.iMManager.messageManager.addAdvancedMsgListener(msgListener);
|
|
||||||
|
|
||||||
// Remove message monitoring
|
|
||||||
// After adding a message listener, if the page disposes, please remove the listener
|
|
||||||
// OpenIM.iMManager.messageManager.removeAdvancedMsgListener(msgListener);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 8,Send a message
|
#### 8,Send a message
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -191,9 +143,7 @@ OpenIM.iMManager.messageManager.sendMessage(
|
|||||||
userID: uid, // Single chat value is not null
|
userID: uid, // Single chat value is not null
|
||||||
groupID: gid, // The group chat value is not null
|
groupID: gid, // The group chat value is not null
|
||||||
).then((v) {
|
).then((v) {
|
||||||
// Sent successfully
|
|
||||||
}).catchError((e){
|
}).catchError((e){
|
||||||
// Failed to send
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -218,70 +168,82 @@ OpenIM.iMManager.logout();
|
|||||||
| getLoginUserInfo | Current user information |
|
| getLoginUserInfo | Current user information |
|
||||||
| setSelfInfo | Modify current user information |
|
| setSelfInfo | Modify current user information |
|
||||||
| getUsersInfo | Get user information by user id |
|
| getUsersInfo | Get user information by user id |
|
||||||
| forceReConn | Force reconnection |
|
| enabledSDKLog | Setup sdk log |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### OpenIM.iMManager.conversationManager
|
#### OpenIM.iMManager.conversationManager
|
||||||
|
|
||||||
| method | description |
|
| method | description |
|
||||||
| ----------------------- | --------------------------- |
|
| ----------------------------- | --------------------------------------- |
|
||||||
| setConversationListener | Listener |
|
| setConversationListener | Listener |
|
||||||
| getAllConversationList | Get all conversation |
|
| getAllConversationList | Get all conversation |
|
||||||
| getSingleConversation | Get a single conversation |
|
| getSingleConversation | Get single conversation |
|
||||||
| getMultipleConversation | Get multiple conversation |
|
| getMultipleConversation | Get multiple conversation |
|
||||||
| deleteConversation | Delete conversation |
|
| deleteConversation | Delete conversation |
|
||||||
| setConversationDraft | Set conversation draftText |
|
| setConversationDraft | Set conversation draftText |
|
||||||
| pinConversation | Top conversation |
|
| 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
|
#### OpenIM.iMManager.friendshipManager
|
||||||
|
|
||||||
| method | description |
|
| method | description |
|
||||||
| ------------------------ | --------------------------- |
|
| ------------------------ | ------------------------------------------------------------ |
|
||||||
| setFriendshipListener | Listener |
|
| setFriendshipListener | Listener |
|
||||||
| getFriendsInfo | Get friend information |
|
| getFriendsInfo | Get friend information |
|
||||||
| addFriend | Add friends |
|
| addFriend | Send an friend application |
|
||||||
| getFriendApplicationList | Get friend application list |
|
| getFriendApplicationList | Get all friend application, sent to you by others |
|
||||||
| getFriendList | Get friends list |
|
| getFriendList | Find all friends including those who have been added to the blacklist |
|
||||||
| setFriendInfo | Edit friend notes |
|
| setFriendInfo | Modify friend information, only comment can be modified |
|
||||||
| addToBlackList | Add to blacklist |
|
| addToBlackList | Add to blacklist |
|
||||||
| getBlackList | Get blacklist list |
|
| getBlackList | Get blacklist list |
|
||||||
| deleteFromBlackList | Remove from blacklist |
|
| deleteFromBlackList | Remove from blacklist |
|
||||||
| checkFriend | Check friendship |
|
| checkFriend | Check friendship |
|
||||||
| deleteFromFriendList | Remove friend |
|
| deleteFromFriendList | Remove friend |
|
||||||
| acceptFriendApplication | Accept friend application |
|
| acceptFriendApplication | Accept friend application |
|
||||||
| refuseFriendApplication | Reject friend application |
|
| refuseFriendApplication | Reject friend application |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### OpenIM.iMManager.messageManager
|
#### OpenIM.iMManager.messageManager
|
||||||
|
|
||||||
| method | description |
|
| method | description |
|
||||||
| ------------------------------------------- | --------------------------------- |
|
| --------------------------------- | --------------------------------- |
|
||||||
| addAdvancedMsgListener | Add message listener |
|
| addAdvancedMsgListener | Add message listener |
|
||||||
| removeAdvancedMsgListener | Remove message listener |
|
| setMsgSendProgressListener | Message sending progress listener |
|
||||||
| setMsgSendProgressListener | Message sending progress listener |
|
| sendMessage | Send a message |
|
||||||
| sendMessage | Send a message |
|
| getHistoryMessageList | Get history news |
|
||||||
| getHistoryMessageList | Get history news |
|
| revokeMessage | Revoke message |
|
||||||
| revokeMessage | Revoke message |
|
| deleteMessageFromLocalStorage | Delete message |
|
||||||
| deleteMessageFromLocalStorage | Delete message |
|
| insertSingleMessageToLocalStorage | Insert message |
|
||||||
| insertSingleMessageToLocalStorage | Insert message |
|
| findMessages | Query the message by id |
|
||||||
| findMessages | Query the message by id |
|
| markC2CMessageAsRead | Mark c2c message as read |
|
||||||
| markSingleMessageHasRead | Mark single chat messages as read |
|
| typingStatusUpdate | Typing prompt |
|
||||||
| markGroupMessageHasRead | Mark group chat messages as read |
|
| createTextMessage | Create text message |
|
||||||
| <font color=red>markC2CMessageAsRead</font> | Mark c2c message as read |
|
| createTextAtMessage | Create @ message |
|
||||||
| <font color=red>typingStatusUpdate</font> | Typing prompt |
|
| createImageMessage | Create picture message |
|
||||||
| createTextMessage | Create text message |
|
| createImageMessageFromFullPath | Create picture message |
|
||||||
| createTextAtMessage | Create @ message |
|
| createSoundMessage | Create voice message |
|
||||||
| createImageMessage | Create picture message |
|
| createSoundMessageFromFullPath | Create voice message |
|
||||||
| createSoundMessage | Create voice message |
|
| createVideoMessage | Create video message |
|
||||||
| createVideoMessage | Create video message |
|
| createVideoMessageFromFullPath | Create video message |
|
||||||
| createFileMessage | Create file message |
|
| createFileMessage | Create file message |
|
||||||
| createMergerMessage | Create merge message |
|
| createFileMessageFromFullPath | Create file message |
|
||||||
| createForwardMessage | Create a forwarded message |
|
| createMergerMessage | Create merge message |
|
||||||
| getTotalUnreadMsgCount | Get unread message count |
|
| 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 |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -297,11 +259,91 @@ OpenIM.iMManager.logout();
|
|||||||
| getJoinedGroupList | Get joined groups |
|
| getJoinedGroupList | Get joined groups |
|
||||||
| isJoinedGroup | Check you have joined the group |
|
| isJoinedGroup | Check you have joined the group |
|
||||||
| createGroup | Create a group |
|
| createGroup | Create a group |
|
||||||
| setGroupInfo | Set group information |
|
| setGroupInfo | Edit group information |
|
||||||
| getGroupsInfo | Get group information |
|
| getGroupsInfo | Get group information |
|
||||||
| joinGroup | Join group |
|
| joinGroup | Join group |
|
||||||
| quitGroup | Exit group |
|
| quitGroup | Exit group |
|
||||||
| transferGroupOwner | Group permission transfer |
|
| transferGroupOwner | Group permission transfer |
|
||||||
| getGroupApplicationList | Get group application list |
|
| getGroupApplicationList | Get group application list |
|
||||||
| acceptGroupApplication | Accept group invitation |
|
| acceptGroupApplication | Accept group invitation |
|
||||||
| refuseGroupApplication | Decline 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;
|
||||||
|
```
|
||||||
|
|
||||||
|
IM 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 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 send status
|
||||||
|
|
||||||
|
```
|
||||||
|
static const sending = 1;
|
||||||
|
static const succeeded = 2;
|
||||||
|
static const failed = 3;
|
||||||
|
static const deleted = 4;
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ class MessageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Remove a message listener
|
/// Remove a message listener
|
||||||
|
@deprecated
|
||||||
Future removeAdvancedMsgListener(AdvancedMsgListener listener) {
|
Future removeAdvancedMsgListener(AdvancedMsgListener listener) {
|
||||||
advancedMsgListeners.remove(listener);
|
advancedMsgListeners.remove(listener);
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user