Upgrade
This commit is contained in:
parent
603188d98a
commit
0fbfc70ef1
@ -1,3 +1,9 @@
|
|||||||
|
## 1.0.8
|
||||||
|
|
||||||
|
1.Upgrade sdk to 1.4.4. </br>
|
||||||
|
2.New and changed conversation return changed data and no longer return all data. </br>
|
||||||
|
3.New conversation paging method.
|
||||||
|
|
||||||
## 1.0.7
|
## 1.0.7
|
||||||
|
|
||||||
Upgrade sdk to 1.3.4 </br>
|
Upgrade sdk to 1.3.4 </br>
|
||||||
|
@ -51,5 +51,5 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'io.openim:client-sdk:1.3.4@aar'
|
implementation 'io.openim:client-sdk:1.4.4@aar'
|
||||||
}
|
}
|
@ -16,13 +16,13 @@ public class BaseListener implements Base {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(long l, String s) {
|
public void onError(long l, String s) {
|
||||||
Log.e("F-OpenIMSD(callback)", s);
|
// Log.e("F-OpenIMSD(callback)", s);
|
||||||
CommonUtil.runMainThreadReturnError(result, l, s, null);
|
CommonUtil.runMainThreadReturnError(result, l, s, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(String s) {
|
public void onSuccess(String s) {
|
||||||
Log.i("F-OpenIMSDK(callback)", s);
|
// Log.i("F-OpenIMSDK(callback)", s);
|
||||||
CommonUtil.runMainThreadReturn(result, s);
|
CommonUtil.runMainThreadReturn(result, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,12 @@ public class ConversationManager extends BaseManager {
|
|||||||
Open_im_sdk.getAllConversationList(new BaseListener(result));
|
Open_im_sdk.getAllConversationList(new BaseListener(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getConversationListSplit(MethodCall methodCall, MethodChannel.Result result) {
|
||||||
|
Open_im_sdk.getConversationListSplit(new BaseListener(result),
|
||||||
|
int2long(methodCall, "offset"),
|
||||||
|
int2long(methodCall, "count"));
|
||||||
|
}
|
||||||
|
|
||||||
public void getOneConversation(MethodCall methodCall, MethodChannel.Result result) {
|
public void getOneConversation(MethodCall methodCall, MethodChannel.Result result) {
|
||||||
Open_im_sdk.getOneConversation(
|
Open_im_sdk.getOneConversation(
|
||||||
value(methodCall, "sourceID"),
|
value(methodCall, "sourceID"),
|
||||||
|
@ -15,6 +15,7 @@ public class ConversationManager: BaseServiceManager {
|
|||||||
|
|
||||||
self["setConversationListener"] = setConversationListener
|
self["setConversationListener"] = setConversationListener
|
||||||
self["getAllConversationList"] = getAllConversationList
|
self["getAllConversationList"] = getAllConversationList
|
||||||
|
self["getConversationListSplit"] = getConversationListSplit
|
||||||
self["getOneConversation"] = getOneConversation
|
self["getOneConversation"] = getOneConversation
|
||||||
self["getMultipleConversation"] = getMultipleConversation
|
self["getMultipleConversation"] = getMultipleConversation
|
||||||
self["deleteConversation"] = deleteConversation
|
self["deleteConversation"] = deleteConversation
|
||||||
@ -36,7 +37,11 @@ public class ConversationManager: BaseServiceManager {
|
|||||||
func getAllConversationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
func getAllConversationList(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||||
Open_im_sdkGetAllConversationList(BaseCallback(result: result))
|
Open_im_sdkGetAllConversationList(BaseCallback(result: result))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getConversationListSplit(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||||
|
Open_im_sdkGetConversationListSplit(BaseCallback(result: result), methodCall[int: "offset"], methodCall[int: "count"])
|
||||||
|
}
|
||||||
|
|
||||||
func getOneConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
func getOneConversation(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||||
Open_im_sdkGetOneConversation(methodCall[string: "sourceID"], methodCall[int: "sessionType"], BaseCallback(result: result))
|
Open_im_sdkGetOneConversation(methodCall[string: "sourceID"], methodCall[int: "sessionType"], BaseCallback(result: result))
|
||||||
}
|
}
|
||||||
@ -75,7 +80,7 @@ public class ConversationManager: BaseServiceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
func setConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||||
Open_im_sdkSetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[jsonString: "conversationIDList"], Int(methodCall[int64: "status"]))
|
Open_im_sdkSetConversationRecvMessageOpt(BaseCallback(result: result), methodCall[jsonString: "conversationIDList"], methodCall[int: "status"])
|
||||||
}
|
}
|
||||||
|
|
||||||
func getConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
func getConversationRecvMessageOpt(methodCall: FlutterMethodCall, result: @escaping FlutterResult){
|
||||||
|
@ -941,6 +941,7 @@
|
|||||||
- (void)getBlackList:(id<Open_im_sdkBase> _Nullable)callback;
|
- (void)getBlackList:(id<Open_im_sdkBase> _Nullable)callback;
|
||||||
// skipped method UserRelated.GetCh with unsupported parameter or return types
|
// skipped method UserRelated.GetCh with unsupported parameter or return types
|
||||||
|
|
||||||
|
- (void)getConversationListSplit:(id<Open_im_sdkBase> _Nullable)callback offset:(long)offset count:(long)count;
|
||||||
- (void)getConversationRecvMessageOpt:(id<Open_im_sdkBase> _Nullable)callback conversationIDList:(NSString* _Nullable)conversationIDList;
|
- (void)getConversationRecvMessageOpt:(id<Open_im_sdkBase> _Nullable)callback conversationIDList:(NSString* _Nullable)conversationIDList;
|
||||||
- (void)getFriendApplicationList:(id<Open_im_sdkBase> _Nullable)callback;
|
- (void)getFriendApplicationList:(id<Open_im_sdkBase> _Nullable)callback;
|
||||||
- (void)getFriendList:(id<Open_im_sdkBase> _Nullable)callback;
|
- (void)getFriendList:(id<Open_im_sdkBase> _Nullable)callback;
|
||||||
@ -1157,8 +1158,6 @@ FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkCmdReLogin;
|
|||||||
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkCmdRefuseFriend;
|
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkCmdRefuseFriend;
|
||||||
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkCmdUnInit;
|
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkCmdUnInit;
|
||||||
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkCmdUpdateConversation;
|
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkCmdUpdateConversation;
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkConAndUnreadChange;
|
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkConChange;
|
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkCreateGroupTip;
|
FOUNDATION_EXPORT const int64_t Open_im_sdkCreateGroupTip;
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkCustom;
|
FOUNDATION_EXPORT const int64_t Open_im_sdkCustom;
|
||||||
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkDeFaultSuccessMsg;
|
FOUNDATION_EXPORT NSString* _Nonnull const Open_im_sdkDeFaultSuccessMsg;
|
||||||
@ -1207,9 +1206,13 @@ FOUNDATION_EXPORT const int64_t Open_im_sdkMsgStatusSendSuccess;
|
|||||||
* MsgStatus
|
* MsgStatus
|
||||||
*/
|
*/
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkMsgStatusSending;
|
FOUNDATION_EXPORT const int64_t Open_im_sdkMsgStatusSending;
|
||||||
|
FOUNDATION_EXPORT const int64_t Open_im_sdkNewCon;
|
||||||
|
FOUNDATION_EXPORT const int64_t Open_im_sdkNewConChange;
|
||||||
|
FOUNDATION_EXPORT const int64_t Open_im_sdkNotPinned;
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkNotRead;
|
FOUNDATION_EXPORT const int64_t Open_im_sdkNotRead;
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkNotReceiveMessage;
|
FOUNDATION_EXPORT const int64_t Open_im_sdkNotReceiveMessage;
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkPicture;
|
FOUNDATION_EXPORT const int64_t Open_im_sdkPicture;
|
||||||
|
FOUNDATION_EXPORT const int64_t Open_im_sdkPinned;
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkQuitGroupTip;
|
FOUNDATION_EXPORT const int64_t Open_im_sdkQuitGroupTip;
|
||||||
FOUNDATION_EXPORT const int64_t Open_im_sdkQuote;
|
FOUNDATION_EXPORT const int64_t Open_im_sdkQuote;
|
||||||
/**
|
/**
|
||||||
@ -1536,6 +1539,8 @@ FOUNDATION_EXPORT void Open_im_sdkGetBlackList(id<Open_im_sdkBase> _Nullable cal
|
|||||||
|
|
||||||
FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetConversationIDBySessionType(NSString* _Nullable sourceID, long sessionType);
|
FOUNDATION_EXPORT NSString* _Nonnull Open_im_sdkGetConversationIDBySessionType(NSString* _Nullable sourceID, long sessionType);
|
||||||
|
|
||||||
|
FOUNDATION_EXPORT void Open_im_sdkGetConversationListSplit(id<Open_im_sdkBase> _Nullable callback, long offset, long count);
|
||||||
|
|
||||||
FOUNDATION_EXPORT void Open_im_sdkGetConversationRecvMessageOpt(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable conversationIDList);
|
FOUNDATION_EXPORT void Open_im_sdkGetConversationRecvMessageOpt(id<Open_im_sdkBase> _Nullable callback, NSString* _Nullable conversationIDList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1686,6 +1691,8 @@ FOUNDATION_EXPORT void Open_im_sdkSetGroupInfo(NSString* _Nullable jsonGroupInfo
|
|||||||
|
|
||||||
FOUNDATION_EXPORT void Open_im_sdkSetGroupListener(id<Open_im_sdkOnGroupListener> _Nullable callback);
|
FOUNDATION_EXPORT void Open_im_sdkSetGroupListener(id<Open_im_sdkOnGroupListener> _Nullable callback);
|
||||||
|
|
||||||
|
FOUNDATION_EXPORT void Open_im_sdkSetHearbeatInterval(int32_t interval);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1 no print
|
* 1 no print
|
||||||
*/
|
*/
|
||||||
|
Binary file not shown.
@ -8,6 +8,7 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|||||||
class ConversationManager {
|
class ConversationManager {
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
late ConversationListener conversationListener;
|
late ConversationListener conversationListener;
|
||||||
|
var count = 0;
|
||||||
|
|
||||||
ConversationManager(this._channel);
|
ConversationManager(this._channel);
|
||||||
|
|
||||||
@ -22,6 +23,20 @@ class ConversationManager {
|
|||||||
.invokeMethod('getAllConversationList', _buildParam({}))
|
.invokeMethod('getAllConversationList', _buildParam({}))
|
||||||
.then((value) => _toList(value));
|
.then((value) => _toList(value));
|
||||||
|
|
||||||
|
/// Paging to get conversation
|
||||||
|
Future<List<ConversationInfo>> getConversationListSplit({
|
||||||
|
int offset = 0,
|
||||||
|
int count = 20,
|
||||||
|
}) =>
|
||||||
|
_channel
|
||||||
|
.invokeMethod(
|
||||||
|
'getConversationListSplit',
|
||||||
|
_buildParam({
|
||||||
|
'offset': offset,
|
||||||
|
'count': count,
|
||||||
|
}))
|
||||||
|
.then((value) => _toList(value));
|
||||||
|
|
||||||
/// Get a single conversation info
|
/// 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
|
/// [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
|
/// [sessionType] if it is a single chat, it value is 1. if it is a group chat, it value is 2
|
||||||
@ -91,21 +106,18 @@ class ConversationManager {
|
|||||||
.then((value) => _printValue(value));
|
.then((value) => _printValue(value));
|
||||||
|
|
||||||
/// Mark single chat messages as read
|
/// Mark single chat messages as read
|
||||||
Future<dynamic> markSingleMessageHasRead({required String userID}) {
|
Future<dynamic> markSingleMessageHasRead({required String userID}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'markSingleMessageHasRead', _buildParam({'userID': userID}));
|
'markSingleMessageHasRead', _buildParam({'userID': userID}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Mark group chat messages as read
|
/// Mark group chat messages as read
|
||||||
Future<dynamic> markGroupMessageHasRead({required String groupID}) {
|
Future<dynamic> markGroupMessageHasRead({required String groupID}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'markGroupMessageHasRead', _buildParam({'groupID': groupID}));
|
'markGroupMessageHasRead', _buildParam({'groupID': groupID}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the total number of unread messages
|
/// Get the total number of unread messages
|
||||||
Future<dynamic> getTotalUnreadMsgCount() {
|
Future<dynamic> getTotalUnreadMsgCount() =>
|
||||||
return _channel.invokeMethod('getTotalUnreadMsgCount', _buildParam({}));
|
_channel.invokeMethod('getTotalUnreadMsgCount', _buildParam({}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Query conversation id
|
/// Query conversation id
|
||||||
/// [sourceID] : if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID
|
/// [sourceID] : if it is a single chat, Its value is userID. if it is a group chat, Its value is groupID
|
||||||
@ -113,42 +125,64 @@ class ConversationManager {
|
|||||||
Future<dynamic> getConversationID({
|
Future<dynamic> getConversationID({
|
||||||
required String sourceID,
|
required String sourceID,
|
||||||
required int sessionType,
|
required int sessionType,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'getConversationIDBySessionType',
|
'getConversationIDBySessionType',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
"sourceID": sourceID,
|
"sourceID": sourceID,
|
||||||
"sessionType": sessionType,
|
"sessionType": sessionType,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Message Do Not Disturb
|
/// Message Do Not Disturb
|
||||||
/// [ status ] 1: Do not receive messages, 2: Do not notify when messages are received; 0: Normal
|
/// [ status ] 1: Do not receive messages, 2: Do not notify when messages are received; 0: Normal
|
||||||
Future<dynamic> setConversationRecvMessageOpt({
|
Future<dynamic> setConversationRecvMessageOpt({
|
||||||
required List<String> conversationIDList,
|
required List<String> conversationIDList,
|
||||||
required int status,
|
required int status,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'setConversationRecvMessageOpt',
|
'setConversationRecvMessageOpt',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
"conversationIDList": conversationIDList,
|
"conversationIDList": conversationIDList,
|
||||||
"status": status,
|
"status": status,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Message Do Not Disturb
|
/// Message Do Not Disturb
|
||||||
/// [{"conversationId":"single_13922222222","result":0}]
|
/// [{"conversationId":"single_13922222222","result":0}]
|
||||||
Future<List<dynamic>> getConversationRecvMessageOpt({
|
Future<List<dynamic>> getConversationRecvMessageOpt({
|
||||||
required List<String> conversationIDList,
|
required List<String> conversationIDList,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'getConversationRecvMessageOpt',
|
'getConversationRecvMessageOpt',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
"conversationIDList": conversationIDList,
|
"conversationIDList": conversationIDList,
|
||||||
}))
|
}))
|
||||||
.then((value) => _formatJson(value));
|
.then((value) => _formatJson(value));
|
||||||
}
|
|
||||||
|
/// 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!
|
||||||
|
: a.latestMsgSendTime!;
|
||||||
|
int bCompare = b.draftTimestamp! > b.latestMsgSendTime!
|
||||||
|
? b.draftTimestamp!
|
||||||
|
: b.latestMsgSendTime!;
|
||||||
|
if (aCompare > bCompare) {
|
||||||
|
return -1;
|
||||||
|
} else if (aCompare < bCompare) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else if (a.isPinned == 1 && b.isPinned != 1) {
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
static Map _buildParam(Map param) {
|
static Map _buildParam(Map param) {
|
||||||
param["ManagerName"] = "conversationManager";
|
param["ManagerName"] = "conversationManager";
|
||||||
@ -164,9 +198,7 @@ class ConversationManager {
|
|||||||
static ConversationInfo _toObj(String value) =>
|
static ConversationInfo _toObj(String value) =>
|
||||||
ConversationInfo.fromJson(_formatJson(value));
|
ConversationInfo.fromJson(_formatJson(value));
|
||||||
|
|
||||||
static dynamic _formatJson(value) {
|
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||||
return jsonDecode(_printValue(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
static String _printValue(value) {
|
static String _printValue(value) {
|
||||||
return value;
|
return value;
|
||||||
|
@ -16,92 +16,70 @@ class FriendshipManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get friend info by user id
|
/// Get friend info by user id
|
||||||
Future<List<UserInfo>> getFriendsInfo({required List<String> uidList}) {
|
Future<List<UserInfo>> getFriendsInfo({required List<String> uidList}) =>
|
||||||
return _channel
|
_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(
|
_channel.invokeMethod(
|
||||||
'addFriend', _buildParam({"uid": uid, "reqMessage": reason}));
|
'addFriend', _buildParam({"uid": uid, "reqMessage": reason}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Get all friend application, sent to you by others
|
/// Get all friend application, sent to you by others
|
||||||
Future<List<UserInfo>> getFriendApplicationList() {
|
Future<List<UserInfo>> getFriendApplicationList() => _channel
|
||||||
return _channel
|
.invokeMethod('getFriendApplicationList', _buildParam({}))
|
||||||
.invokeMethod('getFriendApplicationList', _buildParam({}))
|
.then((value) => _toList(value));
|
||||||
.then((value) => _toList(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Find all friends including those who have been added to the blacklist
|
/// Find all friends including those who have been added to the blacklist
|
||||||
Future<List<UserInfo>> getFriendList() {
|
Future<List<UserInfo>> getFriendList() => _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
|
/// Find all friends including those who have been added to the blacklist
|
||||||
Future<List<dynamic>> getFriendListMap() {
|
Future<List<dynamic>> getFriendListMap() => _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(
|
_channel.invokeMethod(
|
||||||
'setFriendInfo',
|
'setFriendInfo',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'uid': uid,
|
'uid': uid,
|
||||||
'comment': comment,
|
'comment': comment,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Add friends 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}));
|
_channel.invokeMethod('addToBlackList', _buildParam({"uid": uid}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Find all blacklist
|
/// Find all blacklist
|
||||||
Future<List<UserInfo>> getBlackList() {
|
Future<List<UserInfo>> getBlackList() => _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(
|
_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) => _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(
|
_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}) => _channel
|
||||||
return _channel.invokeMethod(
|
.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}) => _channel
|
||||||
return _channel.invokeMethod(
|
.invokeMethod('refuseFriendApplication', _buildParam({"uid": uid}));
|
||||||
'refuseFriendApplication', _buildParam({"uid": uid}));
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Future<dynamic> forceSyncFriendApplication() {
|
// Future<dynamic> forceSyncFriendApplication() {
|
||||||
@ -136,9 +114,7 @@ class FriendshipManager {
|
|||||||
|
|
||||||
// static UserInfo _toObj(String value) => UserInfo.fromJson(_formatJson(value));
|
// static UserInfo _toObj(String value) => UserInfo.fromJson(_formatJson(value));
|
||||||
|
|
||||||
static dynamic _formatJson(value) {
|
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||||
return jsonDecode(_printValue(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
static String _printValue(value) {
|
static String _printValue(value) {
|
||||||
return value;
|
return value;
|
||||||
|
@ -21,55 +21,52 @@ class GroupManager {
|
|||||||
required String groupId,
|
required String groupId,
|
||||||
required List<String> uidList,
|
required List<String> uidList,
|
||||||
String? reason,
|
String? reason,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'inviteUserToGroup',
|
'inviteUserToGroup',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gid': groupId,
|
'gid': groupId,
|
||||||
'reason': reason,
|
'reason': reason,
|
||||||
'uidList': uidList,
|
'uidList': uidList,
|
||||||
}))
|
}))
|
||||||
.then((value) => (_formatJson(value) as List)
|
.then((value) => (_formatJson(value) as List)
|
||||||
.map((e) => GroupInviteResult.fromJson(e))
|
.map((e) => GroupInviteResult.fromJson(e))
|
||||||
.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,
|
||||||
String? reason,
|
String? reason,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'kickGroupMember',
|
'kickGroupMember',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gid': groupId,
|
'gid': groupId,
|
||||||
'reason': reason,
|
'reason': reason,
|
||||||
'uidList': uidList,
|
'uidList': uidList,
|
||||||
}))
|
}))
|
||||||
.then((value) => (_formatJson(value) as List)
|
.then((value) => (_formatJson(value) as List)
|
||||||
.map((e) => GroupInviteResult.fromJson(e))
|
.map((e) => GroupInviteResult.fromJson(e))
|
||||||
.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,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'getGroupMembersInfo',
|
'getGroupMembersInfo',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gid': groupId,
|
'gid': groupId,
|
||||||
'uidList': uidList,
|
'uidList': uidList,
|
||||||
}))
|
}))
|
||||||
.then((value) => (_formatJson(value) as List)
|
.then((value) => (_formatJson(value) as List)
|
||||||
.map((e) => GroupMembersInfo.fromJson(e))
|
.map((e) => GroupMembersInfo.fromJson(e))
|
||||||
.toList());
|
.toList());
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the list of group members
|
/// Get the list of group members
|
||||||
/// [filter] 0: all user, 1: group owner, 2: administrator
|
/// [filter] 0: all user, 1: group owner, 2: administrator
|
||||||
@ -78,55 +75,48 @@ class GroupManager {
|
|||||||
required String groupId,
|
required String groupId,
|
||||||
int filter = 0,
|
int filter = 0,
|
||||||
int next = 0,
|
int next = 0,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'getGroupMemberList',
|
'getGroupMemberList',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gid': groupId,
|
'gid': groupId,
|
||||||
'filter': filter,
|
'filter': filter,
|
||||||
'next': next,
|
'next': next,
|
||||||
}))
|
}))
|
||||||
.then((value) => GroupMembersList.fromJson(_formatJson(value)));
|
.then((value) => GroupMembersList.fromJson(_formatJson(value)));
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the list of group members
|
/// Get the list of group members
|
||||||
Future<dynamic> getGroupMemberListMap({
|
Future<dynamic> getGroupMemberListMap({
|
||||||
required String groupId,
|
required String groupId,
|
||||||
int filter = 0,
|
int filter = 0,
|
||||||
int next = 0,
|
int next = 0,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'getGroupMemberList',
|
'getGroupMemberList',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gid': groupId,
|
'gid': groupId,
|
||||||
'filter': filter,
|
'filter': filter,
|
||||||
'next': next,
|
'next': next,
|
||||||
}))
|
}))
|
||||||
.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() => _channel
|
||||||
return _channel.invokeMethod('getJoinedGroupList', _buildParam({})).then(
|
.invokeMethod('getJoinedGroupList', _buildParam({}))
|
||||||
(value) => (_formatJson(value) as List)
|
.then((value) => (_formatJson(value) as List)
|
||||||
.map((e) => GroupInfo.fromJson(e))
|
.map((e) => GroupInfo.fromJson(e))
|
||||||
.toList());
|
.toList());
|
||||||
}
|
|
||||||
|
|
||||||
/// Find all groups you have joined
|
/// Find all groups you have joined
|
||||||
Future<List<dynamic>> getJoinedGroupListMap() {
|
Future<List<dynamic>> getJoinedGroupListMap() => _channel
|
||||||
return _channel
|
.invokeMethod('getJoinedGroupList', _buildParam({}))
|
||||||
.invokeMethod('getJoinedGroupList', _buildParam({}))
|
.then((value) => _formatJson(value));
|
||||||
.then((value) => _formatJson(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if you are a member of the group
|
/// Check if you are a member of the group
|
||||||
Future<bool> isJoinedGroup({required String gid}) {
|
Future<bool> isJoinedGroup({required String gid}) => 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
|
||||||
Future<dynamic> createGroup({
|
Future<dynamic> createGroup({
|
||||||
@ -135,20 +125,18 @@ class GroupManager {
|
|||||||
String? introduction,
|
String? introduction,
|
||||||
String? faceUrl,
|
String? faceUrl,
|
||||||
required List<GroupMemberRole> list,
|
required List<GroupMemberRole> list,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'createGroup',
|
'createGroup',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gInfo': {
|
'gInfo': {
|
||||||
"groupName": groupName,
|
"groupName": groupName,
|
||||||
"notification": notification,
|
"notification": notification,
|
||||||
"introduction": introduction,
|
"introduction": introduction,
|
||||||
"faceUrl": faceUrl,
|
"faceUrl": faceUrl,
|
||||||
},
|
},
|
||||||
'memberList': list.map((e) => e.toJson()).toList()
|
'memberList': list.map((e) => e.toJson()).toList()
|
||||||
}));
|
}));
|
||||||
/*.then((value) => _formatJson(value)['groupID'])*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Edit group information
|
/// Edit group information
|
||||||
Future<dynamic> setGroupInfo({
|
Future<dynamic> setGroupInfo({
|
||||||
@ -157,101 +145,92 @@ class GroupManager {
|
|||||||
String? notification,
|
String? notification,
|
||||||
String? introduction,
|
String? introduction,
|
||||||
String? faceUrl,
|
String? faceUrl,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'setGroupInfo',
|
'setGroupInfo',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gInfo': {
|
'gInfo': {
|
||||||
"groupID": groupID,
|
"groupID": groupID,
|
||||||
"groupName": groupName,
|
"groupName": groupName,
|
||||||
"notification": notification,
|
"notification": notification,
|
||||||
"introduction": introduction,
|
"introduction": introduction,
|
||||||
"faceUrl": faceUrl,
|
"faceUrl": faceUrl,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// 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,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod('getGroupsInfo', _buildParam({'gidList': gidList}))
|
.invokeMethod('getGroupsInfo', _buildParam({'gidList': gidList}))
|
||||||
.then((value) {
|
.then((value) {
|
||||||
List list = _formatJson(value);
|
List list = _formatJson(value);
|
||||||
return list.map((e) => GroupInfo.fromJson(e)).toList();
|
return list.map((e) => GroupInfo.fromJson(e)).toList();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
/// Apply to join the group
|
/// Apply to join the group
|
||||||
Future<dynamic> joinGroup({
|
Future<dynamic> joinGroup({
|
||||||
required String gid,
|
required String gid,
|
||||||
String? reason,
|
String? reason,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'joinGroup',
|
'joinGroup',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gid': gid,
|
'gid': gid,
|
||||||
'reason': reason,
|
'reason': reason,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Leave group
|
/// Leave group
|
||||||
Future<dynamic> quitGroup({
|
Future<dynamic> quitGroup({
|
||||||
required String gid,
|
required String gid,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'quitGroup',
|
'quitGroup',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gid': gid,
|
'gid': gid,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Give group permissions to others
|
/// Give group permissions to others
|
||||||
Future<dynamic> transferGroupOwner({
|
Future<dynamic> transferGroupOwner({
|
||||||
required String gid,
|
required String gid,
|
||||||
required String uid,
|
required String uid,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'transferGroupOwner',
|
'transferGroupOwner',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'gid': gid,
|
'gid': gid,
|
||||||
'uid': uid,
|
'uid': uid,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the list of applications
|
/// Get the list of applications
|
||||||
Future<GroupApplicationList> getGroupApplicationList() {
|
Future<GroupApplicationList> getGroupApplicationList() => _channel
|
||||||
return _channel
|
.invokeMethod('getGroupApplicationList', _buildParam({}))
|
||||||
.invokeMethod('getGroupApplicationList', _buildParam({}))
|
.then((value) => GroupApplicationList.fromJson(_formatJson(value)));
|
||||||
.then((value) => GroupApplicationList.fromJson(_formatJson(value)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Accept group application
|
/// Accept group application
|
||||||
Future<dynamic> acceptGroupApplication({
|
Future<dynamic> acceptGroupApplication({
|
||||||
required GroupApplicationInfo info,
|
required GroupApplicationInfo info,
|
||||||
required String reason,
|
required String reason,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'acceptGroupApplication',
|
'acceptGroupApplication',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'application': info.toJson(),
|
'application': info.toJson(),
|
||||||
'reason': reason,
|
'reason': reason,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Refuse group application
|
/// Refuse group application
|
||||||
Future<dynamic> refuseGroupApplication({
|
Future<dynamic> refuseGroupApplication({
|
||||||
required GroupApplicationInfo info,
|
required GroupApplicationInfo info,
|
||||||
required String reason,
|
required String reason,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'refuseGroupApplication',
|
'refuseGroupApplication',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'application': info.toJson(),
|
'application': info.toJson(),
|
||||||
'reason': reason,
|
'reason': reason,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Future forceSyncApplyGroupRequest() {
|
// Future forceSyncApplyGroupRequest() {
|
||||||
@ -278,9 +257,7 @@ class GroupManager {
|
|||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
static dynamic _formatJson(value) {
|
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||||
return jsonDecode(_printValue(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
static String _printValue(value) {
|
static String _printValue(value) {
|
||||||
return value;
|
return value;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||||
@ -31,7 +32,7 @@ class IMManager {
|
|||||||
void _addNativeCallback(MethodChannel _channel) {
|
void _addNativeCallback(MethodChannel _channel) {
|
||||||
_channel.setMethodCallHandler((call) {
|
_channel.setMethodCallHandler((call) {
|
||||||
try {
|
try {
|
||||||
print('call:$call');
|
log('Flutter : $call');
|
||||||
if (call.method == ListenerType.initSDKListener) {
|
if (call.method == ListenerType.initSDKListener) {
|
||||||
String type = call.arguments['type'];
|
String type = call.arguments['type'];
|
||||||
dynamic data = call.arguments['data'];
|
dynamic data = call.arguments['data'];
|
||||||
@ -187,7 +188,6 @@ class IMManager {
|
|||||||
} else if (call.method == ListenerType.conversationListener) {
|
} else if (call.method == ListenerType.conversationListener) {
|
||||||
String type = call.arguments['type'];
|
String type = call.arguments['type'];
|
||||||
dynamic data = call.arguments['data'];
|
dynamic data = call.arguments['data'];
|
||||||
print('type:$type data:$data');
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'onSyncServerStart':
|
case 'onSyncServerStart':
|
||||||
conversationManager.conversationListener.syncServerStart();
|
conversationManager.conversationListener.syncServerStart();
|
||||||
@ -325,63 +325,50 @@ class IMManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
Future<int?> getLoginStatus() {
|
Future<int?> getLoginStatus() =>
|
||||||
return _channel.invokeMethod<int>('getLoginStatus', _buildParam({}));
|
_channel.invokeMethod<int>('getLoginStatus', _buildParam({}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Current user id
|
/// Current user id
|
||||||
Future<String?> getLoginUid() {
|
Future<String?> getLoginUid() => Future.value(uid);
|
||||||
return Future.value(uid);
|
|
||||||
// return _channel.invokeMethod<String>('getLoginUid', _buildParam({}));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Current user info
|
/// Current user info
|
||||||
Future<UserInfo> getLoginUserInfo() {
|
Future<UserInfo> getLoginUserInfo() => Future.value(uInfo);
|
||||||
return Future.value(uInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Modify current user info
|
/// Modify current user info
|
||||||
Future<String?> setSelfInfo(
|
Future<String?> setSelfInfo(
|
||||||
{required String uid,
|
{required String uid,
|
||||||
String? name,
|
String? name,
|
||||||
String? icon,
|
String? icon,
|
||||||
int? gender,
|
int? gender,
|
||||||
String? mobile,
|
String? mobile,
|
||||||
String? birth,
|
String? birth,
|
||||||
String? email,
|
String? email,
|
||||||
String? ex}) {
|
String? ex}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'setSelfInfo',
|
'setSelfInfo',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'uid': uid,
|
'uid': uid,
|
||||||
'name': name,
|
'name': name,
|
||||||
'icon': icon,
|
'icon': icon,
|
||||||
'gender': gender,
|
'gender': gender,
|
||||||
'mobile': mobile,
|
'mobile': mobile,
|
||||||
'birth': birth,
|
'birth': birth,
|
||||||
'email': email,
|
'email': email,
|
||||||
'ex': ex,
|
'ex': ex,
|
||||||
}));
|
}));
|
||||||
// .then((value) => UserInfo.fromJson(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Query user information
|
/// Query user information
|
||||||
Future<List<UserInfo>> getUsersInfo(List<String> uidList) {
|
Future<List<UserInfo>> getUsersInfo(List<String> uidList) => _channel
|
||||||
return _channel
|
.invokeMethod('getUsersInfo', _buildParam({'uidList': uidList}))
|
||||||
.invokeMethod('getUsersInfo', _buildParam({'uidList': uidList}))
|
.then((value) => _toList(value));
|
||||||
.then((value) => _toList(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void enabledSDKLog({required bool enabled}) {
|
Future enabledSDKLog({required bool enabled}) => _channel.invokeMethod(
|
||||||
_channel.invokeMethod(
|
'setSdkLog', _buildParam({'sdkLog': enabled ? 0 : 1}));
|
||||||
'setSdkLog', _buildParam({'sdkLog': enabled ? 0 : 1}));
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
Future<dynamic> forceSyncLoginUerInfo(List<String> uidList) {
|
Future<dynamic> forceSyncLoginUerInfo(List<String> uidList) =>
|
||||||
return _channel.invokeMethod('forceSyncLoginUerInfo', _buildParam({}));
|
_channel.invokeMethod('forceSyncLoginUerInfo', _buildParam({}));
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Future<dynamic> forceReConn() {
|
// Future<dynamic> forceReConn() {
|
||||||
@ -396,9 +383,7 @@ class IMManager {
|
|||||||
static List<UserInfo> _toList(String value) =>
|
static List<UserInfo> _toList(String value) =>
|
||||||
(_formatJson(value) as List).map((e) => UserInfo.fromJson(e)).toList();
|
(_formatJson(value) as List).map((e) => UserInfo.fromJson(e)).toList();
|
||||||
|
|
||||||
static dynamic _formatJson(value) {
|
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||||
return jsonDecode(_printValue(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
static String _printValue(value) {
|
static String _printValue(value) {
|
||||||
return value;
|
return value;
|
||||||
|
@ -43,16 +43,15 @@ class MessageManager {
|
|||||||
String? userID,
|
String? userID,
|
||||||
String? groupID,
|
String? groupID,
|
||||||
bool onlineUserOnly = false,
|
bool onlineUserOnly = false,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'sendMessage',
|
'sendMessage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'message': message.toJson(),
|
'message': message.toJson(),
|
||||||
'receiver': userID ?? '',
|
'receiver': userID ?? '',
|
||||||
'groupID': groupID ?? '',
|
'groupID': groupID ?? '',
|
||||||
'onlineUserOnly': onlineUserOnly,
|
'onlineUserOnly': onlineUserOnly,
|
||||||
})) /*.then((value) => _toObj(value))*/;
|
})) /*.then((value) => _toObj(value))*/;
|
||||||
}
|
|
||||||
|
|
||||||
/// Find all history message
|
/// Find all history message
|
||||||
Future<List<Message>> getHistoryMessageList({
|
Future<List<Message>> getHistoryMessageList({
|
||||||
@ -60,157 +59,139 @@ class MessageManager {
|
|||||||
String? groupID,
|
String? groupID,
|
||||||
Message? startMsg,
|
Message? startMsg,
|
||||||
int? count,
|
int? count,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'getHistoryMessageList',
|
'getHistoryMessageList',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'userID': userID ?? '',
|
'userID': userID ?? '',
|
||||||
'startMsg': startMsg?.toJson() /*?? {}*/,
|
'startMsg': startMsg?.toJson() /*?? {}*/,
|
||||||
'groupID': groupID ?? '',
|
'groupID': groupID ?? '',
|
||||||
'count': count ?? 10,
|
'count': count ?? 10,
|
||||||
}))
|
}))
|
||||||
.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(
|
_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(
|
_channel.invokeMethod(
|
||||||
'deleteMessageFromLocalStorage', _buildParam(message.toJson()));
|
'deleteMessageFromLocalStorage', _buildParam(message.toJson()));
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
@deprecated
|
@deprecated
|
||||||
Future deleteMessages({required List<Message> msgList}) {
|
Future deleteMessages({required List<Message> msgList}) =>
|
||||||
return _channel.invokeMethod('deleteMessages',
|
_channel.invokeMethod('deleteMessages',
|
||||||
_buildParam({"msgList": msgList.map((e) => e.toJson()).toList()}));
|
_buildParam({"msgList": msgList.map((e) => e.toJson()).toList()}));
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
Future insertSingleMessageToLocalStorage({
|
Future insertSingleMessageToLocalStorage({
|
||||||
String? receiver,
|
String? receiver,
|
||||||
String? sender,
|
String? sender,
|
||||||
Message? message,
|
Message? message,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'insertSingleMessageToLocalStorage',
|
'insertSingleMessageToLocalStorage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
"userID": receiver,
|
"userID": receiver,
|
||||||
"message": message?.toJson(),
|
"message": message?.toJson(),
|
||||||
"sender": sender,
|
"sender": sender,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Query the message according to the message id
|
/// Query the message according to the message id
|
||||||
Future findMessages({required List<String> messageIDList}) {
|
Future findMessages({required List<String> messageIDList}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'findMessages',
|
'findMessages',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
"messageIDList": messageIDList,
|
"messageIDList": messageIDList,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Mark c2c message as read
|
/// Mark c2c message as read
|
||||||
Future markC2CMessageAsRead({
|
Future markC2CMessageAsRead({
|
||||||
required String userID,
|
required String userID,
|
||||||
required List<String> messageIDList,
|
required List<String> messageIDList,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'markC2CMessageAsRead',
|
'markC2CMessageAsRead',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
"messageIDList": messageIDList,
|
"messageIDList": messageIDList,
|
||||||
"userID": userID,
|
"userID": userID,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Typing
|
/// Typing
|
||||||
Future typingStatusUpdate({
|
Future typingStatusUpdate({
|
||||||
required String userID,
|
required String userID,
|
||||||
bool typing = false,
|
bool typing = false,
|
||||||
}) {
|
}) =>
|
||||||
return _channel.invokeMethod(
|
_channel.invokeMethod(
|
||||||
'typingStatusUpdate',
|
'typingStatusUpdate',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
"typing": typing ? 'yes' : 'no',
|
"typing": typing ? 'yes' : 'no',
|
||||||
"userID": userID,
|
"userID": userID,
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create text message
|
/// Create text message
|
||||||
Future<Message> createTextMessage({required String text}) {
|
Future<Message> createTextMessage({required String text}) => _channel
|
||||||
return _channel
|
.invokeMethod('createTextMessage', _buildParam({'text': text}))
|
||||||
.invokeMethod('createTextMessage', _buildParam({'text': text}))
|
.then((value) => _toObj(value));
|
||||||
.then((value) => _toObj(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create @ message
|
/// Create @ message
|
||||||
Future<Message> createTextAtMessage({
|
Future<Message> createTextAtMessage({
|
||||||
required String text,
|
required String text,
|
||||||
required List<String> atUidList,
|
required List<String> atUidList,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createTextAtMessage',
|
'createTextAtMessage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'text': text,
|
'text': text,
|
||||||
'atUserList': atUidList,
|
'atUserList': atUidList,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create picture message
|
/// Create picture message
|
||||||
Future<Message> createImageMessage({required String imagePath}) {
|
Future<Message> createImageMessage({required String imagePath}) => _channel
|
||||||
return _channel
|
.invokeMethod(
|
||||||
.invokeMethod(
|
'createImageMessage',
|
||||||
'createImageMessage',
|
_buildParam({'imagePath': imagePath}),
|
||||||
_buildParam({'imagePath': imagePath}),
|
)
|
||||||
)
|
.then((value) => _toObj(value));
|
||||||
.then((value) => _toObj(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create picture message
|
/// Create picture message
|
||||||
Future<Message> createImageMessageFromFullPath({required String imagePath}) {
|
Future<Message> createImageMessageFromFullPath({required String imagePath}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createImageMessageFromFullPath',
|
'createImageMessageFromFullPath',
|
||||||
_buildParam({'imagePath': imagePath}),
|
_buildParam({'imagePath': imagePath}),
|
||||||
)
|
)
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Create sound message
|
/// Create sound message
|
||||||
Future<Message> createSoundMessage({
|
Future<Message> createSoundMessage({
|
||||||
required String soundPath,
|
required String soundPath,
|
||||||
required int duration,
|
required int duration,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createSoundMessage',
|
'createSoundMessage',
|
||||||
_buildParam({'soundPath': soundPath, "duration": duration}),
|
_buildParam({'soundPath': soundPath, "duration": duration}),
|
||||||
)
|
)
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create sound message
|
/// Create sound message
|
||||||
Future<Message> createSoundMessageFromFullPath({
|
Future<Message> createSoundMessageFromFullPath({
|
||||||
required String soundPath,
|
required String soundPath,
|
||||||
required int duration,
|
required int duration,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createSoundMessageFromFullPath',
|
'createSoundMessageFromFullPath',
|
||||||
_buildParam({'soundPath': soundPath, "duration": duration}),
|
_buildParam({'soundPath': soundPath, "duration": duration}),
|
||||||
)
|
)
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create video message
|
/// Create video message
|
||||||
Future<Message> createVideoMessage({
|
Future<Message> createVideoMessage({
|
||||||
@ -218,18 +199,17 @@ class MessageManager {
|
|||||||
required String videoType,
|
required String videoType,
|
||||||
required int duration,
|
required int duration,
|
||||||
required String snapshotPath,
|
required String snapshotPath,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createVideoMessage',
|
'createVideoMessage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'videoPath': videoPath,
|
'videoPath': videoPath,
|
||||||
'videoType': videoType,
|
'videoType': videoType,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'snapshotPath': snapshotPath,
|
'snapshotPath': snapshotPath,
|
||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create video message
|
/// Create video message
|
||||||
Future<Message> createVideoMessageFromFullPath({
|
Future<Message> createVideoMessageFromFullPath({
|
||||||
@ -237,18 +217,17 @@ class MessageManager {
|
|||||||
required String videoType,
|
required String videoType,
|
||||||
required int duration,
|
required int duration,
|
||||||
required String snapshotPath,
|
required String snapshotPath,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createVideoMessageFromFullPath',
|
'createVideoMessageFromFullPath',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'videoPath': videoPath,
|
'videoPath': videoPath,
|
||||||
'videoType': videoType,
|
'videoType': videoType,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'snapshotPath': snapshotPath,
|
'snapshotPath': snapshotPath,
|
||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create file message
|
/// Create file message
|
||||||
Future<Message> createFileMessage({
|
Future<Message> createFileMessage({
|
||||||
@ -269,33 +248,31 @@ class MessageManager {
|
|||||||
Future<Message> createFileMessageFromFullPath({
|
Future<Message> createFileMessageFromFullPath({
|
||||||
required String filePath,
|
required String filePath,
|
||||||
required String fileName,
|
required String fileName,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createFileMessageFromFullPath',
|
'createFileMessageFromFullPath',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'filePath': filePath,
|
'filePath': filePath,
|
||||||
'fileName': fileName,
|
'fileName': fileName,
|
||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create merger message
|
/// Create merger message
|
||||||
Future<Message> createMergerMessage({
|
Future<Message> createMergerMessage({
|
||||||
required List<Message> messageList,
|
required List<Message> messageList,
|
||||||
required String title,
|
required String title,
|
||||||
required List<String> summaryList,
|
required List<String> summaryList,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createMergerMessage',
|
'createMergerMessage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'messageList': messageList.map((e) => e.toJson()).toList(),
|
'messageList': messageList.map((e) => e.toJson()).toList(),
|
||||||
'title': title,
|
'title': title,
|
||||||
'summaryList': summaryList,
|
'summaryList': summaryList,
|
||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create forward message
|
/// Create forward message
|
||||||
Future<Message> createForwardMessage({required Message message}) {
|
Future<Message> createForwardMessage({required Message message}) {
|
||||||
@ -313,79 +290,71 @@ class MessageManager {
|
|||||||
required double latitude,
|
required double latitude,
|
||||||
required double longitude,
|
required double longitude,
|
||||||
required String description,
|
required String description,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createLocationMessage',
|
'createLocationMessage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'latitude': latitude,
|
'latitude': latitude,
|
||||||
'longitude': longitude,
|
'longitude': longitude,
|
||||||
'description': description,
|
'description': description,
|
||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create custom message
|
/// Create custom message
|
||||||
Future<Message> createCustomMessage({
|
Future<Message> createCustomMessage({
|
||||||
required String data,
|
required String data,
|
||||||
required String extension,
|
required String extension,
|
||||||
required String description,
|
required String description,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createCustomMessage',
|
'createCustomMessage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'data': data,
|
'data': data,
|
||||||
'extension': extension,
|
'extension': extension,
|
||||||
'description': description,
|
'description': description,
|
||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create quote message
|
/// Create quote message
|
||||||
Future<Message> createQuoteMessage({
|
Future<Message> createQuoteMessage({
|
||||||
required String text,
|
required String text,
|
||||||
required Message quoteMsg,
|
required Message quoteMsg,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createQuoteMessage',
|
'createQuoteMessage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'quoteText': text,
|
'quoteText': text,
|
||||||
'quoteMessage': quoteMsg.toJson(),
|
'quoteMessage': quoteMsg.toJson(),
|
||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
/// Create card message
|
/// Create card message
|
||||||
Future<Message> createCardMessage({
|
Future<Message> createCardMessage({
|
||||||
required Map<String, dynamic> data,
|
required Map<String, dynamic> data,
|
||||||
}) {
|
}) =>
|
||||||
return _channel
|
_channel
|
||||||
.invokeMethod(
|
.invokeMethod(
|
||||||
'createCardMessage',
|
'createCardMessage',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
'cardMessage': data,
|
'cardMessage': data,
|
||||||
}))
|
}))
|
||||||
.then((value) => _toObj(value));
|
.then((value) => _toObj(value));
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
Future<dynamic> clearC2CHistoryMessage({required String uid}) {
|
Future<dynamic> clearC2CHistoryMessage({required String uid}) => _channel
|
||||||
return _channel.invokeMethod(
|
.invokeMethod('clearC2CHistoryMessage', _buildParam({"userID": uid}));
|
||||||
'clearC2CHistoryMessage', _buildParam({"userID": uid}));
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
Future<dynamic> clearGroupHistoryMessage({required String gid}) {
|
Future<dynamic> clearGroupHistoryMessage({required String gid}) => _channel
|
||||||
return _channel.invokeMethod(
|
.invokeMethod('clearGroupHistoryMessage', _buildParam({"groupID": gid}));
|
||||||
'clearGroupHistoryMessage', _buildParam({"groupID": gid}));
|
|
||||||
}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void forceSyncMsg() {
|
// void forceSyncMsg() {
|
||||||
_channel.invokeMethod('forceSyncMsg', _buildParam({}));
|
// _channel.invokeMethod('forceSyncMsg', _buildParam({}));
|
||||||
}
|
// }
|
||||||
|
|
||||||
static Map _buildParam(Map param) {
|
static Map _buildParam(Map param) {
|
||||||
param["ManagerName"] = "messageManager";
|
param["ManagerName"] = "messageManager";
|
||||||
@ -397,9 +366,7 @@ class MessageManager {
|
|||||||
|
|
||||||
static Message _toObj(String value) => Message.fromJson(_formatJson(value));
|
static Message _toObj(String value) => Message.fromJson(_formatJson(value));
|
||||||
|
|
||||||
static dynamic _formatJson(value) {
|
static dynamic _formatJson(value) => jsonDecode(_printValue(value));
|
||||||
return jsonDecode(_printValue(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
static String _printValue(value) {
|
static String _printValue(value) {
|
||||||
return value;
|
return value;
|
||||||
|
@ -87,4 +87,14 @@ class ConversationInfo {
|
|||||||
bool get isGroupChat => conversationType == ConversationType.group_chat;
|
bool get isGroupChat => conversationType == ConversationType.group_chat;
|
||||||
|
|
||||||
bool get isTop => isPinned == 1;
|
bool get isTop => isPinned == 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is ConversationInfo &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
conversationID == other.conversationID;
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => conversationID.hashCode;
|
||||||
}
|
}
|
||||||
|
@ -153,17 +153,14 @@ class Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) =>
|
||||||
if (other is Message) {
|
identical(this, other) ||
|
||||||
return other._id == _id;
|
other is Message &&
|
||||||
}
|
runtimeType == other.runtimeType &&
|
||||||
return false;
|
clientMsgID == other.clientMsgID;
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => super.hashCode;
|
int get hashCode => clientMsgID.hashCode;
|
||||||
|
|
||||||
String? get _id => clientMsgID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PictureElem {
|
class PictureElem {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: flutter_openim_sdk
|
name: flutter_openim_sdk
|
||||||
description: An instant messaging plug-in that supports Android and IOS. And the server is also all open source.
|
description: An instant messaging plug-in that supports Android and IOS. And the server is also all open source.
|
||||||
version: 1.0.7
|
version: 1.0.8
|
||||||
homepage: https://www.rentsoft.cn
|
homepage: https://www.rentsoft.cn
|
||||||
repository: https://github.com/OpenIMSDK/Open-IM-SDK-Flutter
|
repository: https://github.com/OpenIMSDK/Open-IM-SDK-Flutter
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user