[Modify]
This commit is contained in:
parent
470bbb960e
commit
1e87794ec5
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,3 +1,5 @@
|
|||||||
|
## 0.0.8+1
|
||||||
|
|
||||||
## 0.0.8
|
## 0.0.8
|
||||||
Upgrade sdk to 0.0.14 </br>
|
Upgrade sdk to 0.0.14 </br>
|
||||||
Sending a message adds a retry mechanism
|
Sending a message adds a retry mechanism
|
||||||
@ -7,7 +9,7 @@ Sending a message adds a retry mechanism
|
|||||||
2. Modify the type of conversation manager input parameter sessionType to int
|
2. Modify the type of conversation manager input parameter sessionType to int
|
||||||
|
|
||||||
## 0.0.6
|
## 0.0.6
|
||||||
fix bug
|
Fix bug
|
||||||
|
|
||||||
## 0.0.5
|
## 0.0.5
|
||||||
Upgrade sdk </br>
|
Upgrade sdk </br>
|
||||||
@ -18,8 +20,8 @@ fix message error bug
|
|||||||
Replace the input parameters of the createCustomMessage method from Uint8List to Map
|
Replace the input parameters of the createCustomMessage method from Uint8List to Map
|
||||||
|
|
||||||
## 0.0.3
|
## 0.0.3
|
||||||
upgrade sdk </br>
|
Upgrade sdk </br>
|
||||||
fix bug </br>
|
Fix bug </br>
|
||||||
|
|
||||||
## 0.0.2
|
## 0.0.2
|
||||||
1. Move the markSingleMessageHasRead, markGroupMessageHasRead and getTotalUnreadMsgCount methods from the MessageManager class to the ConversationManager class. </br>
|
1. Move the markSingleMessageHasRead, markGroupMessageHasRead and getTotalUnreadMsgCount methods from the MessageManager class to the ConversationManager class. </br>
|
||||||
@ -28,4 +30,4 @@ fix bug </br>
|
|||||||
|
|
||||||
## 0.0.1
|
## 0.0.1
|
||||||
|
|
||||||
initial release.
|
Initial release.
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
class ListenerType {
|
class ListenerType {
|
||||||
static const simpleMsgListener = 'simpleMsgListener';
|
static const simpleMsgListener = 'simpleMsgListener';
|
||||||
|
|
||||||
static const initSDKListener = 'initSDKListener';
|
static const initSDKListener = 'initSDKListener';
|
||||||
|
|
||||||
static const groupListener = 'groupListener';
|
static const groupListener = 'groupListener';
|
||||||
|
|
||||||
static const advancedMsgListener = 'advancedMsgListener';
|
static const advancedMsgListener = 'advancedMsgListener';
|
||||||
|
|
||||||
static const conversationListener = 'conversationListener';
|
static const conversationListener = 'conversationListener';
|
||||||
|
|
||||||
static const friendListener = 'friendListener';
|
static const friendListener = 'friendListener';
|
||||||
|
|
||||||
static const signalingListener = 'signalingListener';
|
static const signalingListener = 'signalingListener';
|
||||||
|
|
||||||
static const msgSendProgressListener = "msgSendProgressListener";
|
static const msgSendProgressListener = "msgSendProgressListener";
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,17 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|||||||
|
|
||||||
|
|
||||||
abstract class AdvancedMsgListener {
|
abstract class AdvancedMsgListener {
|
||||||
/// listener uniquely identifies
|
/// Uniquely identifies
|
||||||
final String id;
|
final String id;
|
||||||
|
|
||||||
AdvancedMsgListener() : id = "id_${DateTime.now().microsecondsSinceEpoch}";
|
AdvancedMsgListener() : id = "id_${DateTime.now().microsecondsSinceEpoch}";
|
||||||
|
|
||||||
|
/// Receive new message
|
||||||
void recvNewMessage(Message msg);
|
void recvNewMessage(Message msg);
|
||||||
|
|
||||||
|
/// Message read receipt
|
||||||
void recvC2CReadReceipt(List<HaveReadInfo> list);
|
void recvC2CReadReceipt(List<HaveReadInfo> list);
|
||||||
|
|
||||||
|
/// A friend withdrew a message
|
||||||
void recvMessageRevoked(String msgId);
|
void recvMessageRevoked(String msgId);
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,23 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||||
|
|
||||||
abstract class InitSDKListener {
|
abstract class InitSDKListener {
|
||||||
/// SDK 正在连接到服务器
|
/// SDK is connecting to the server
|
||||||
void connecting();
|
void connecting();
|
||||||
|
|
||||||
/// SDK 已经成功连接到服务器
|
/// SDK has successfully connected to the server
|
||||||
void connectSuccess();
|
void connectSuccess();
|
||||||
|
|
||||||
/// SDK 连接服务器失败
|
/// SDK failed to connect to the server
|
||||||
void connectFailed(int? code, String? errorMsg);
|
void connectFailed(int? code, String? errorMsg);
|
||||||
|
|
||||||
/// 当前用户被踢下线,此时可以 UI 提示用户,并再次调用 IMManager 的 login() 函数重新登录。
|
/// 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();
|
void kickedOffline();
|
||||||
|
|
||||||
/// 在线时票据过期:此时您需要生成新的 userSig 并再次调用 IMManager 的 login() 函数重新登录
|
/// 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();
|
void userSigExpired();
|
||||||
|
|
||||||
/// 登录用户的资料发生了更新
|
/// The information of the logged-in user has been updated
|
||||||
void selfInfoUpdated(UserInfo info);
|
void selfInfoUpdated(UserInfo info);
|
||||||
}
|
}
|
||||||
|
@ -11,22 +11,20 @@ class ConversationManager {
|
|||||||
|
|
||||||
ConversationManager(this._channel);
|
ConversationManager(this._channel);
|
||||||
|
|
||||||
/// listener[ConversationListener],Observe conversation changes
|
/// Observe conversation changes
|
||||||
///
|
|
||||||
Future setConversationListener(ConversationListener listener) {
|
Future setConversationListener(ConversationListener listener) {
|
||||||
this.conversationListener = listener;
|
this.conversationListener = listener;
|
||||||
return _channel.invokeMethod('setConversationListener', _buildParam({}));
|
return _channel.invokeMethod('setConversationListener', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get all conversations
|
/// Get all conversations
|
||||||
///
|
|
||||||
Future<List<ConversationInfo>> getAllConversationList() => _channel
|
Future<List<ConversationInfo>> getAllConversationList() => _channel
|
||||||
.invokeMethod('getAllConversationList', _buildParam({}))
|
.invokeMethod('getAllConversationList', _buildParam({}))
|
||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
|
|
||||||
/// sourceID: if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID
|
/// Get a single conversation info
|
||||||
/// 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
|
||||||
Future<ConversationInfo> getSingleConversation({
|
Future<ConversationInfo> getSingleConversation({
|
||||||
required String sourceID,
|
required String sourceID,
|
||||||
required int sessionType,
|
required int sessionType,
|
||||||
@ -40,8 +38,7 @@ class ConversationManager {
|
|||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
|
|
||||||
/// get conversation list by id list
|
/// Get conversation list by id list
|
||||||
///
|
|
||||||
Future<List<ConversationInfo>> getMultipleConversation({
|
Future<List<ConversationInfo>> getMultipleConversation({
|
||||||
required List<String> conversationIDList,
|
required List<String> conversationIDList,
|
||||||
}) =>
|
}) =>
|
||||||
@ -53,8 +50,7 @@ class ConversationManager {
|
|||||||
}))
|
}))
|
||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
|
|
||||||
/// delete conversation by id
|
/// Delete conversation by id
|
||||||
///
|
|
||||||
Future deleteConversation({
|
Future deleteConversation({
|
||||||
required String conversationID,
|
required String conversationID,
|
||||||
}) =>
|
}) =>
|
||||||
@ -66,8 +62,7 @@ class ConversationManager {
|
|||||||
}))
|
}))
|
||||||
.then((value) => _printValue(value));
|
.then((value) => _printValue(value));
|
||||||
|
|
||||||
/// set draft
|
/// Set draft
|
||||||
///
|
|
||||||
Future setConversationDraft({
|
Future setConversationDraft({
|
||||||
required String conversationID,
|
required String conversationID,
|
||||||
required String draftText,
|
required String draftText,
|
||||||
@ -81,8 +76,7 @@ class ConversationManager {
|
|||||||
}))
|
}))
|
||||||
.then((value) => _printValue(value));
|
.then((value) => _printValue(value));
|
||||||
|
|
||||||
/// pinned conversation
|
/// Pinned conversation
|
||||||
///
|
|
||||||
Future pinConversation({
|
Future pinConversation({
|
||||||
required String conversationID,
|
required String conversationID,
|
||||||
required bool isPinned,
|
required bool isPinned,
|
||||||
@ -96,27 +90,26 @@ class ConversationManager {
|
|||||||
}))
|
}))
|
||||||
.then((value) => _printValue(value));
|
.then((value) => _printValue(value));
|
||||||
|
|
||||||
///
|
/// Mark single chat messages as read
|
||||||
/// @params userID: receiver's userID
|
|
||||||
Future<dynamic> markSingleMessageHasRead({required String userID}) {
|
Future<dynamic> markSingleMessageHasRead({required String userID}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'markSingleMessageHasRead', _buildParam({'userID': userID}));
|
'markSingleMessageHasRead', _buildParam({'userID': userID}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Mark group chat messages as read
|
||||||
Future<dynamic> markGroupMessageHasRead({required String groupID}) {
|
Future<dynamic> markGroupMessageHasRead({required String groupID}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'markGroupMessageHasRead', _buildParam({'groupID': groupID}));
|
'markGroupMessageHasRead', _buildParam({'groupID': groupID}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Get the total number of unread messages
|
||||||
Future<dynamic> getTotalUnreadMsgCount() {
|
Future<dynamic> getTotalUnreadMsgCount() {
|
||||||
return _channel.invokeMethod('getTotalUnreadMsgCount', _buildParam({}));
|
return _channel.invokeMethod('getTotalUnreadMsgCount', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// sourceID: if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID
|
/// Query conversation id
|
||||||
/// 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
|
||||||
Future<dynamic> getConversationID({
|
Future<dynamic> getConversationID({
|
||||||
required String sourceID,
|
required String sourceID,
|
||||||
required int sessionType,
|
required int sessionType,
|
||||||
|
@ -9,52 +9,47 @@ class FriendshipManager {
|
|||||||
|
|
||||||
FriendshipManager(this._channel);
|
FriendshipManager(this._channel);
|
||||||
|
|
||||||
/// listener[FriendshipListener]
|
/// Set up a friend relationship listener
|
||||||
///
|
|
||||||
Future setFriendshipListener(FriendshipListener listener) {
|
Future setFriendshipListener(FriendshipListener listener) {
|
||||||
this.friendshipListener = listener;
|
this.friendshipListener = listener;
|
||||||
return _channel.invokeMethod('setFriendListener', _buildParam({}));
|
return _channel.invokeMethod('setFriendListener', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get friend info by userid
|
/// Get friend info by user id
|
||||||
///
|
|
||||||
Future<List<UserInfo>> getFriendsInfo({required List<String> uidList}) {
|
Future<List<UserInfo>> getFriendsInfo({required List<String> uidList}) {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('getFriendsInfo', _buildParam({"uidList": uidList}))
|
.invokeMethod('getFriendsInfo', _buildParam({"uidList": uidList}))
|
||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// send an friend application
|
/// Send an friend application
|
||||||
///
|
|
||||||
Future<dynamic> addFriend({required String uid, required String reason}) {
|
Future<dynamic> addFriend({required String uid, required String reason}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'addFriend', _buildParam({"uid": uid, "reqMessage": reason}));
|
'addFriend', _buildParam({"uid": uid, "reqMessage": reason}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get all friend application
|
/// Get all friend application, sent to you by others
|
||||||
/// including those initiated by you and sent to you by others
|
|
||||||
Future<List<UserInfo>> getFriendApplicationList() {
|
Future<List<UserInfo>> getFriendApplicationList() {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('getFriendApplicationList', _buildParam({}))
|
.invokeMethod('getFriendApplicationList', _buildParam({}))
|
||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find all friends
|
/// Find all friends including those who have been added to the blacklist
|
||||||
///
|
|
||||||
Future<List<UserInfo>> getFriendList() {
|
Future<List<UserInfo>> getFriendList() {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('getFriendList', _buildParam({}))
|
.invokeMethod('getFriendList', _buildParam({}))
|
||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Find all friends including those who have been added to the blacklist
|
||||||
Future<List<dynamic>> getFriendListMap() {
|
Future<List<dynamic>> getFriendListMap() {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('getFriendList', _buildParam({}))
|
.invokeMethod('getFriendList', _buildParam({}))
|
||||||
.then((value) => _toListMap(value));
|
.then((value) => _toListMap(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// modify friend information, only [comment] can be modified
|
/// Modify friend information, only [comment] can be modified
|
||||||
///
|
|
||||||
Future<dynamic> setFriendInfo(
|
Future<dynamic> setFriendInfo(
|
||||||
{required String uid, required String comment}) {
|
{required String uid, required String comment}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
@ -65,63 +60,54 @@ class FriendshipManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// add to blacklist
|
/// Add friends to blacklist
|
||||||
///
|
|
||||||
Future<dynamic> addToBlackList({required String uid}) {
|
Future<dynamic> addToBlackList({required String uid}) {
|
||||||
return _channel.invokeMethod('addToBlackList', _buildParam({"uid": uid}));
|
return _channel.invokeMethod('addToBlackList', _buildParam({"uid": uid}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find all blacklist
|
/// Find all blacklist
|
||||||
///
|
|
||||||
Future<List<UserInfo>> getBlackList() {
|
Future<List<UserInfo>> getBlackList() {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('getBlackList', _buildParam({}))
|
.invokeMethod('getBlackList', _buildParam({}))
|
||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// remove from blacklist
|
/// Remove from blacklist
|
||||||
///
|
|
||||||
Future<dynamic> deleteFromBlackList({required String uid}) {
|
Future<dynamic> deleteFromBlackList({required String uid}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'deleteFromBlackList', _buildParam({"uid": uid}));
|
'deleteFromBlackList', _buildParam({"uid": uid}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// determine if there is a friendship by userId
|
/// Determine if there is a friendship by userId
|
||||||
///
|
|
||||||
Future<List<UserInfo>> checkFriend(List<String> uidList) {
|
Future<List<UserInfo>> checkFriend(List<String> uidList) {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('checkFriend', _buildParam({'uidList': uidList}))
|
.invokeMethod('checkFriend', _buildParam({'uidList': uidList}))
|
||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dissolve friendship from friend list
|
/// Dissolve friendship from friend list
|
||||||
///
|
|
||||||
Future<dynamic> deleteFromFriendList({required String uid}) {
|
Future<dynamic> deleteFromFriendList({required String uid}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'deleteFromFriendList', _buildParam({"uid": uid}));
|
'deleteFromFriendList', _buildParam({"uid": uid}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// accept application of be friend
|
/// Accept application of be friend
|
||||||
///
|
|
||||||
Future<dynamic> acceptFriendApplication({required String uid}) {
|
Future<dynamic> acceptFriendApplication({required String uid}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'acceptFriendApplication', _buildParam({"uid": uid}));
|
'acceptFriendApplication', _buildParam({"uid": uid}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// refuse application of be friend
|
/// Refuse application of be friend
|
||||||
///
|
|
||||||
Future<dynamic> refuseFriendApplication({required String uid}) {
|
Future<dynamic> refuseFriendApplication({required String uid}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'refuseFriendApplication', _buildParam({"uid": uid}));
|
'refuseFriendApplication', _buildParam({"uid": uid}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
///
|
///
|
||||||
Future<dynamic> forceSyncFriendApplication() {
|
Future<dynamic> forceSyncFriendApplication() {
|
||||||
return _channel.invokeMethod('forceSyncFriendApplication', _buildParam({}));
|
return _channel.invokeMethod('forceSyncFriendApplication', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
|
||||||
///
|
///
|
||||||
Future<dynamic> forceSyncFriend() {
|
Future<dynamic> forceSyncFriend() {
|
||||||
return _channel.invokeMethod('forceSyncFriend', _buildParam({}));
|
return _channel.invokeMethod('forceSyncFriend', _buildParam({}));
|
||||||
|
@ -10,14 +10,13 @@ class GroupManager {
|
|||||||
|
|
||||||
GroupManager(this._channel);
|
GroupManager(this._channel);
|
||||||
|
|
||||||
/// listener[GroupListener]
|
/// Set up group relationship monitoring
|
||||||
Future setGroupListener(GroupListener listener) {
|
Future setGroupListener(GroupListener listener) {
|
||||||
this.groupListener = listener;
|
this.groupListener = listener;
|
||||||
return _channel.invokeMethod('setGroupListener', _buildParam({}));
|
return _channel.invokeMethod('setGroupListener', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// invite friends into the group
|
/// Invite friends into the group
|
||||||
///
|
|
||||||
Future<List<GroupInviteResult>> inviteUserToGroup({
|
Future<List<GroupInviteResult>> inviteUserToGroup({
|
||||||
required String groupId,
|
required String groupId,
|
||||||
required List<String> uidList,
|
required List<String> uidList,
|
||||||
@ -36,7 +35,7 @@ class GroupManager {
|
|||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// remove member from group
|
/// Remove member from group
|
||||||
Future<List<GroupInviteResult>> kickGroupMember({
|
Future<List<GroupInviteResult>> kickGroupMember({
|
||||||
required String groupId,
|
required String groupId,
|
||||||
required List<String> uidList,
|
required List<String> uidList,
|
||||||
@ -55,7 +54,7 @@ class GroupManager {
|
|||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// get group member's info
|
/// Get group member's info
|
||||||
Future<List<GroupMembersInfo>> getGroupMembersInfo({
|
Future<List<GroupMembersInfo>> getGroupMembersInfo({
|
||||||
required String groupId,
|
required String groupId,
|
||||||
required List<String> uidList,
|
required List<String> uidList,
|
||||||
@ -72,8 +71,9 @@ class GroupManager {
|
|||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// filter 0: all user, 1: group owner, 2: administrator
|
/// Get the list of group members
|
||||||
/// begin index, pull and fill 0 for the first time
|
/// [filter] 0: all user, 1: group owner, 2: administrator
|
||||||
|
/// [next] begin index, pull and fill 0 for the first time
|
||||||
Future<GroupMembersList> getGroupMemberList({
|
Future<GroupMembersList> getGroupMemberList({
|
||||||
required String groupId,
|
required String groupId,
|
||||||
int filter = 0,
|
int filter = 0,
|
||||||
@ -90,8 +90,7 @@ class GroupManager {
|
|||||||
.then((value) => GroupMembersList.fromJson(_formatJson(value)));
|
.then((value) => GroupMembersList.fromJson(_formatJson(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter 0: all user, 1: group owner, 2: administrator
|
/// Get the list of group members
|
||||||
/// begin index, pull and fill 0 for the first time
|
|
||||||
Future<dynamic> getGroupMemberListMap({
|
Future<dynamic> getGroupMemberListMap({
|
||||||
required String groupId,
|
required String groupId,
|
||||||
int filter = 0,
|
int filter = 0,
|
||||||
@ -108,7 +107,7 @@ class GroupManager {
|
|||||||
.then((value) => _formatJson(value));
|
.then((value) => _formatJson(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find all groups you have joined
|
/// Find all groups you have joined
|
||||||
Future<List<GroupInfo>> getJoinedGroupList() {
|
Future<List<GroupInfo>> getJoinedGroupList() {
|
||||||
return _channel.invokeMethod('getJoinedGroupList', _buildParam({})).then(
|
return _channel.invokeMethod('getJoinedGroupList', _buildParam({})).then(
|
||||||
(value) => (_formatJson(value) as List)
|
(value) => (_formatJson(value) as List)
|
||||||
@ -116,21 +115,20 @@ class GroupManager {
|
|||||||
.toList());
|
.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find all groups you have joined
|
/// Find all groups you have joined
|
||||||
Future<List<dynamic>> getJoinedGroupListMap() {
|
Future<List<dynamic>> getJoinedGroupListMap() {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('getJoinedGroupList', _buildParam({}))
|
.invokeMethod('getJoinedGroupList', _buildParam({}))
|
||||||
.then((value) => _formatJson(value));
|
.then((value) => _formatJson(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// check
|
/// Check if you are a member of the group
|
||||||
Future<bool> isJoinedGroup({required String gid}) {
|
Future<bool> isJoinedGroup({required String gid}) {
|
||||||
return getJoinedGroupList()
|
return getJoinedGroupList()
|
||||||
.then((list) => list.where((e) => e.groupID == gid).length > 0);
|
.then((list) => list.where((e) => e.groupID == gid).length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// create a group
|
/// Create a group
|
||||||
/// @params list[List<GroupMemberRole>]: Group members you invited
|
|
||||||
Future<dynamic> createGroup({
|
Future<dynamic> createGroup({
|
||||||
String? groupName,
|
String? groupName,
|
||||||
String? notification,
|
String? notification,
|
||||||
@ -173,7 +171,7 @@ class GroupManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find group information by group id
|
/// Find group information by group id
|
||||||
Future<List<GroupInfo>> getGroupsInfo({
|
Future<List<GroupInfo>> getGroupsInfo({
|
||||||
required List<String> gidList,
|
required List<String> gidList,
|
||||||
}) {
|
}) {
|
||||||
@ -198,7 +196,7 @@ class GroupManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Leave group
|
||||||
Future<dynamic> quitGroup({
|
Future<dynamic> quitGroup({
|
||||||
required String gid,
|
required String gid,
|
||||||
}) {
|
}) {
|
||||||
@ -222,14 +220,14 @@ class GroupManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Get the list of applications
|
||||||
Future<GroupApplicationList> getGroupApplicationList() {
|
Future<GroupApplicationList> getGroupApplicationList() {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('getGroupApplicationList', _buildParam({}))
|
.invokeMethod('getGroupApplicationList', _buildParam({}))
|
||||||
.then((value) => GroupApplicationList.fromJson(_formatJson(value)));
|
.then((value) => GroupApplicationList.fromJson(_formatJson(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Accept group application
|
||||||
Future<dynamic> acceptGroupApplication({
|
Future<dynamic> acceptGroupApplication({
|
||||||
required GroupApplicationInfo info,
|
required GroupApplicationInfo info,
|
||||||
required String reason,
|
required String reason,
|
||||||
@ -242,7 +240,7 @@ class GroupManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Refuse group application
|
||||||
Future<dynamic> refuseGroupApplication({
|
Future<dynamic> refuseGroupApplication({
|
||||||
required GroupApplicationInfo info,
|
required GroupApplicationInfo info,
|
||||||
required String reason,
|
required String reason,
|
||||||
|
@ -265,12 +265,12 @@ class IMManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// init sdk
|
/// Initialize SDK
|
||||||
///
|
///
|
||||||
/// @params platform[IMPlatform]
|
/// [platform] Refer to [IMPlatform]
|
||||||
/// @params ipApi: api server ip address
|
/// [ipApi] Api server ip address
|
||||||
/// @params ipWs: websocket ip address
|
/// [ipWs] WebSocket ip address
|
||||||
/// @params dbPath: data storage directory
|
/// [dbPath] Data storage directory
|
||||||
Future<dynamic> initSDK({
|
Future<dynamic> initSDK({
|
||||||
required int platform,
|
required int platform,
|
||||||
required String ipApi,
|
required String ipApi,
|
||||||
@ -290,13 +290,10 @@ class IMManager {
|
|||||||
"dbDir": dbPath
|
"dbDir": dbPath
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
.then((value) {
|
.then((value) => isInitialized = true);
|
||||||
isInitialized = true;
|
|
||||||
return value;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
@deprecated
|
||||||
Future<dynamic> unInitSDK() {
|
Future<dynamic> unInitSDK() {
|
||||||
return _channel.invokeMethod('unInitSDK', _buildParam({})).then((value) {
|
return _channel.invokeMethod('unInitSDK', _buildParam({})).then((value) {
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
@ -304,8 +301,7 @@ class IMManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// login sdk
|
/// Login sdk
|
||||||
///
|
|
||||||
Future<UserInfo> login({required String uid, required String token}) async {
|
Future<UserInfo> login({required String uid, required String token}) async {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
await _channel.invokeMethod(
|
await _channel.invokeMethod(
|
||||||
@ -316,7 +312,7 @@ class IMManager {
|
|||||||
return uInfo;
|
return uInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Logout sdk
|
||||||
Future<dynamic> logout() {
|
Future<dynamic> logout() {
|
||||||
return _channel.invokeMethod('logout', _buildParam({}));
|
return _channel.invokeMethod('logout', _buildParam({}));
|
||||||
}
|
}
|
||||||
@ -326,18 +322,18 @@ class IMManager {
|
|||||||
return _channel.invokeMethod<int>('getLoginStatus', _buildParam({}));
|
return _channel.invokeMethod<int>('getLoginStatus', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Current user id
|
||||||
Future<String?> getLoginUid() {
|
Future<String?> getLoginUid() {
|
||||||
return Future.value(uid);
|
return Future.value(uid);
|
||||||
// return _channel.invokeMethod<String>('getLoginUid', _buildParam({}));
|
// return _channel.invokeMethod<String>('getLoginUid', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Current user info
|
||||||
Future<UserInfo> getLoginUserInfo() {
|
Future<UserInfo> getLoginUserInfo() {
|
||||||
return Future.value(uInfo);
|
return Future.value(uInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Modify current user info
|
||||||
Future<String?> setSelfInfo(
|
Future<String?> setSelfInfo(
|
||||||
{required String uid,
|
{required String uid,
|
||||||
String? name,
|
String? name,
|
||||||
@ -362,7 +358,7 @@ class IMManager {
|
|||||||
// .then((value) => UserInfo.fromJson(value));
|
// .then((value) => UserInfo.fromJson(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Query user information
|
||||||
Future<List<UserInfo>> getUsersInfo(List<String> uidList) {
|
Future<List<UserInfo>> getUsersInfo(List<String> uidList) {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('getUsersInfo', _buildParam({'uidList': uidList}))
|
.invokeMethod('getUsersInfo', _buildParam({'uidList': uidList}))
|
||||||
|
@ -10,7 +10,7 @@ class MessageManager {
|
|||||||
|
|
||||||
MessageManager(this._channel);
|
MessageManager(this._channel);
|
||||||
|
|
||||||
///
|
/// Add a message listener
|
||||||
Future addAdvancedMsgListener(AdvancedMsgListener listener) {
|
Future addAdvancedMsgListener(AdvancedMsgListener listener) {
|
||||||
advancedMsgListeners.add(listener);
|
advancedMsgListeners.add(listener);
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
@ -20,7 +20,7 @@ class MessageManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Remove a message listener
|
||||||
Future removeAdvancedMsgListener(AdvancedMsgListener listener) {
|
Future removeAdvancedMsgListener(AdvancedMsgListener listener) {
|
||||||
advancedMsgListeners.remove(listener);
|
advancedMsgListeners.remove(listener);
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
@ -30,13 +30,13 @@ class MessageManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Set up message sending progress monitoring
|
||||||
void setMsgSendProgressListener(MsgSendProgressListener listener) {
|
void setMsgSendProgressListener(MsgSendProgressListener listener) {
|
||||||
msgSendProgressListener = listener;
|
msgSendProgressListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// send a message to user or to group
|
/// Send a message to user or to group
|
||||||
/// userID: receiver's user ID
|
/// [userID] receiver's user ID
|
||||||
Future<dynamic> sendMessage({
|
Future<dynamic> sendMessage({
|
||||||
required Message message,
|
required Message message,
|
||||||
String? userID,
|
String? userID,
|
||||||
@ -54,8 +54,7 @@ class MessageManager {
|
|||||||
/*.then((value) => _toObj(value))*/;
|
/*.then((value) => _toObj(value))*/;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// find all history message
|
/// Find all history message
|
||||||
/// userID: the user id of the chat partner
|
|
||||||
Future<List<Message>> getHistoryMessageList({
|
Future<List<Message>> getHistoryMessageList({
|
||||||
String? userID,
|
String? userID,
|
||||||
String? groupID,
|
String? groupID,
|
||||||
@ -74,13 +73,13 @@ class MessageManager {
|
|||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// revoke the sent information
|
/// Revoke the sent information
|
||||||
Future revokeMessage({required Message message}) {
|
Future revokeMessage({required Message message}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'revokeMessage', _buildParam(message.toJson()));
|
'revokeMessage', _buildParam(message.toJson()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// delete message
|
/// Delete message
|
||||||
Future deleteMessageFromLocalStorage({required Message message}) {
|
Future deleteMessageFromLocalStorage({required Message message}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'deleteMessageFromLocalStorage', _buildParam(message.toJson()));
|
'deleteMessageFromLocalStorage', _buildParam(message.toJson()));
|
||||||
@ -94,8 +93,6 @@ class MessageManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @params userID: receiver's user ID
|
|
||||||
/// @params sender: current user ID
|
|
||||||
Future insertSingleMessageToLocalStorage({
|
Future insertSingleMessageToLocalStorage({
|
||||||
String? receiver,
|
String? receiver,
|
||||||
String? sender,
|
String? sender,
|
||||||
@ -110,7 +107,7 @@ class MessageManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Query the message according to the message id
|
||||||
Future findMessages({required List<String> messageIDList}) {
|
Future findMessages({required List<String> messageIDList}) {
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
'findMessages',
|
'findMessages',
|
||||||
@ -119,8 +116,7 @@ class MessageManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Mark c2c message as read
|
||||||
/// @params userID: receiver's user ID
|
|
||||||
Future markC2CMessageAsRead({
|
Future markC2CMessageAsRead({
|
||||||
required String userID,
|
required String userID,
|
||||||
required List<String> messageIDList,
|
required List<String> messageIDList,
|
||||||
@ -133,9 +129,7 @@ class MessageManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Typing
|
||||||
/// @params userID: receiver's user ID
|
|
||||||
/// @params status: default no
|
|
||||||
Future typingStatusUpdate({
|
Future typingStatusUpdate({
|
||||||
required String userID,
|
required String userID,
|
||||||
bool typing = false,
|
bool typing = false,
|
||||||
@ -148,14 +142,14 @@ class MessageManager {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create text message
|
||||||
Future<Message> createTextMessage({required String text}) {
|
Future<Message> createTextMessage({required String text}) {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod('createTextMessage', _buildParam({'text': text}))
|
.invokeMethod('createTextMessage', _buildParam({'text': text}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create @ message
|
||||||
Future<Message> createTextAtMessage({
|
Future<Message> createTextAtMessage({
|
||||||
required String text,
|
required String text,
|
||||||
required List<String> atUidList,
|
required List<String> atUidList,
|
||||||
@ -171,7 +165,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create picture message
|
||||||
Future<Message> createImageMessage({required String imagePath}) {
|
Future<Message> createImageMessage({required String imagePath}) {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
@ -181,7 +175,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create picture message
|
||||||
Future<Message> createImageMessageFromFullPath({required String imagePath}) {
|
Future<Message> createImageMessageFromFullPath({required String imagePath}) {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
@ -191,7 +185,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create sound message
|
||||||
Future<Message> createSoundMessage({
|
Future<Message> createSoundMessage({
|
||||||
required String soundPath,
|
required String soundPath,
|
||||||
required int duration,
|
required int duration,
|
||||||
@ -204,7 +198,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create sound message
|
||||||
Future<Message> createSoundMessageFromFullPath({
|
Future<Message> createSoundMessageFromFullPath({
|
||||||
required String soundPath,
|
required String soundPath,
|
||||||
required int duration,
|
required int duration,
|
||||||
@ -217,7 +211,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create video message
|
||||||
Future<Message> createVideoMessage({
|
Future<Message> createVideoMessage({
|
||||||
required String videoPath,
|
required String videoPath,
|
||||||
required String videoType,
|
required String videoType,
|
||||||
@ -236,7 +230,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create video message
|
||||||
Future<Message> createVideoMessageFromFullPath({
|
Future<Message> createVideoMessageFromFullPath({
|
||||||
required String videoPath,
|
required String videoPath,
|
||||||
required String videoType,
|
required String videoType,
|
||||||
@ -255,7 +249,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create file message
|
||||||
Future<Message> createFileMessage({
|
Future<Message> createFileMessage({
|
||||||
required String filePath,
|
required String filePath,
|
||||||
required String fileName,
|
required String fileName,
|
||||||
@ -270,7 +264,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create merger message
|
||||||
Future<Message> createMergerMessage({
|
Future<Message> createMergerMessage({
|
||||||
required List<Message> messageList,
|
required List<Message> messageList,
|
||||||
required String title,
|
required String title,
|
||||||
@ -287,7 +281,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create forward message
|
||||||
Future<Message> createForwardMessage({required Message message}) {
|
Future<Message> createForwardMessage({required Message message}) {
|
||||||
return _channel
|
return _channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
@ -298,7 +292,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create location message
|
||||||
Future<Message> createLocationMessage({
|
Future<Message> createLocationMessage({
|
||||||
required double latitude,
|
required double latitude,
|
||||||
required double longitude,
|
required double longitude,
|
||||||
@ -315,7 +309,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create custom message
|
||||||
Future<Message> createCustomMessage({
|
Future<Message> createCustomMessage({
|
||||||
required String data,
|
required String data,
|
||||||
required String extension,
|
required String extension,
|
||||||
@ -332,7 +326,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
/// Create quote message
|
||||||
Future<Message> createQuoteMessage({
|
Future<Message> createQuoteMessage({
|
||||||
required String text,
|
required String text,
|
||||||
required Message quoteMsg,
|
required Message quoteMsg,
|
||||||
@ -347,6 +341,7 @@ class MessageManager {
|
|||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create card message
|
||||||
Future<Message> createCardMessage({
|
Future<Message> createCardMessage({
|
||||||
required Map<String, dynamic> data,
|
required Map<String, dynamic> data,
|
||||||
}) {
|
}) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user