new version sdk
This commit is contained in:
parent
b71cd22dce
commit
4c43d54a1a
@ -81,6 +81,13 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.11"
|
version: "0.12.11"
|
||||||
|
material_color_utilities:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: material_color_utilities
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -141,7 +148,7 @@ packages:
|
|||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.3"
|
version: "0.4.8"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -7,18 +7,17 @@ export 'src/enum/listener_type.dart';
|
|||||||
export 'src/enum/message_status.dart';
|
export 'src/enum/message_status.dart';
|
||||||
export 'src/enum/message_type.dart';
|
export 'src/enum/message_type.dart';
|
||||||
export 'src/listener/advanced_msg_listener.dart';
|
export 'src/listener/advanced_msg_listener.dart';
|
||||||
|
export 'src/listener/advanced_msg_listener.dart';
|
||||||
|
export 'src/listener/connect_listener.dart';
|
||||||
export 'src/listener/connect_listener.dart';
|
export 'src/listener/connect_listener.dart';
|
||||||
export 'src/listener/conversation_listener.dart';
|
export 'src/listener/conversation_listener.dart';
|
||||||
export 'src/listener/friendship_listener.dart';
|
export 'src/listener/friendship_listener.dart';
|
||||||
|
export 'src/listener/friendship_listener.dart';
|
||||||
|
export 'src/listener/group_listener.dart';
|
||||||
export 'src/listener/group_listener.dart';
|
export 'src/listener/group_listener.dart';
|
||||||
export 'src/listener/impl/advanced_msg_listener.dart';
|
|
||||||
export 'src/listener/impl/connect_listener.dart';
|
|
||||||
export 'src/listener/impl/conversation_listener.dart';
|
|
||||||
export 'src/listener/impl/friendship_listener.dart';
|
|
||||||
export 'src/listener/impl/group_listener.dart';
|
|
||||||
export 'src/listener/impl/msg_send_progress_listener.dart';
|
|
||||||
export 'src/listener/impl/user_listener.dart';
|
|
||||||
export 'src/listener/msg_send_progress_listener.dart';
|
export 'src/listener/msg_send_progress_listener.dart';
|
||||||
|
export 'src/listener/msg_send_progress_listener.dart';
|
||||||
|
export 'src/listener/user_listener.dart';
|
||||||
export 'src/listener/user_listener.dart';
|
export 'src/listener/user_listener.dart';
|
||||||
export 'src/manager/im_conversation_manager.dart';
|
export 'src/manager/im_conversation_manager.dart';
|
||||||
export 'src/manager/im_friendship_manager.dart';
|
export 'src/manager/im_friendship_manager.dart';
|
||||||
|
@ -1,17 +1,33 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||||
|
|
||||||
abstract class AdvancedMsgListener {
|
class OnAdvancedMsgListener {
|
||||||
/// Uniquely identifies
|
/// Message read receipt
|
||||||
final String id;
|
Function(List<ReadReceiptInfo> list)? onRecvC2CReadReceipt;
|
||||||
|
|
||||||
AdvancedMsgListener() : id = "id_${DateTime.now().microsecondsSinceEpoch}";
|
/// A friend revoked a message
|
||||||
|
Function(String msgId)? onRecvMessageRevoked;
|
||||||
|
|
||||||
/// Receive new message
|
/// Receive new message
|
||||||
void recvNewMessage(Message msg);
|
Function(Message msg)? onRecvNewMessage;
|
||||||
|
|
||||||
/// Message read receipt
|
/// Uniquely identifies
|
||||||
void recvC2CReadReceipt(List<ReadReceiptInfo> list);
|
String id;
|
||||||
|
|
||||||
/// A friend withdrew a message
|
OnAdvancedMsgListener({
|
||||||
void recvMessageRevoked(String msgId);
|
this.onRecvC2CReadReceipt,
|
||||||
|
this.onRecvMessageRevoked,
|
||||||
|
this.onRecvNewMessage,
|
||||||
|
}) : id = "id_${DateTime.now().microsecondsSinceEpoch}";
|
||||||
|
|
||||||
|
void recvC2CReadReceipt(List<ReadReceiptInfo> list) {
|
||||||
|
if (null != onRecvC2CReadReceipt) onRecvC2CReadReceipt!(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
void recvMessageRevoked(String msgId) {
|
||||||
|
if (null != onRecvMessageRevoked) onRecvMessageRevoked!(msgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void recvNewMessage(Message msg) {
|
||||||
|
if (null != onRecvNewMessage) onRecvNewMessage!(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,46 @@
|
|||||||
abstract class ConnectListener {
|
class OnConnectListener {
|
||||||
/// SDK is connecting to the server
|
/// SDK failed to connect to the server
|
||||||
void connecting();
|
Function(int? code, String? errorMsg)? onConnectFailed;
|
||||||
|
|
||||||
/// SDK has successfully connected to the server
|
/// SDK has successfully connected to the server
|
||||||
void connectSuccess();
|
Function()? onConnectSuccess;
|
||||||
|
|
||||||
/// SDK failed to connect to the server
|
/// SDK is connecting to the server
|
||||||
void connectFailed(int? code, String? errorMsg);
|
Function()? onConnecting;
|
||||||
|
|
||||||
/// The current user is kicked offline.
|
/// 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.
|
/// At this time, the UI can prompt the user and call IMManager's login() function to log in again.
|
||||||
void kickedOffline();
|
Function()? onKickedOffline;
|
||||||
|
|
||||||
/// Ticket expired when online.
|
/// Ticket expired when online.
|
||||||
/// At this time, you need to generate a new userSig and call IMManager's login() function to log in again
|
/// At this time, you need to generate a new userSig and call IMManager's login() function to log in again
|
||||||
void userSigExpired();
|
Function()? onUserSigExpired;
|
||||||
|
|
||||||
|
OnConnectListener({
|
||||||
|
this.onConnectFailed,
|
||||||
|
this.onConnectSuccess,
|
||||||
|
this.onConnecting,
|
||||||
|
this.onKickedOffline,
|
||||||
|
this.onUserSigExpired,
|
||||||
|
});
|
||||||
|
|
||||||
|
void connectFailed(int? code, String? errorMsg) {
|
||||||
|
if (null != onConnectFailed) onConnectFailed!(code, errorMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void connectSuccess() {
|
||||||
|
if (null != onConnectSuccess) onConnectSuccess!();
|
||||||
|
}
|
||||||
|
|
||||||
|
void connecting() {
|
||||||
|
if (null != onConnecting) onConnecting!.call();
|
||||||
|
}
|
||||||
|
|
||||||
|
void kickedOffline() {
|
||||||
|
if (null != onKickedOffline) onKickedOffline!();
|
||||||
|
}
|
||||||
|
|
||||||
|
void userSigExpired() {
|
||||||
|
if (null != onUserSigExpired) onUserSigExpired!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,44 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||||
|
|
||||||
abstract class ConversationListener {
|
class OnConversationListener {
|
||||||
void conversationChanged(List<ConversationInfo> list);
|
Function(List<ConversationInfo> list)? onConversationChanged;
|
||||||
|
Function(List<ConversationInfo> list)? onNewConversation;
|
||||||
|
Function(int count)? onTotalUnreadMessageCountChanged;
|
||||||
|
Function()? onSyncServerFailed;
|
||||||
|
Function()? onSyncServerFinish;
|
||||||
|
Function()? onSyncServerStart;
|
||||||
|
|
||||||
void newConversation(List<ConversationInfo> list);
|
OnConversationListener({
|
||||||
|
this.onConversationChanged,
|
||||||
|
this.onNewConversation,
|
||||||
|
this.onTotalUnreadMessageCountChanged,
|
||||||
|
this.onSyncServerFailed,
|
||||||
|
this.onSyncServerFinish,
|
||||||
|
this.onSyncServerStart,
|
||||||
|
});
|
||||||
|
|
||||||
void syncServerFailed();
|
void conversationChanged(List<ConversationInfo> list) {
|
||||||
|
if (onConversationChanged != null) onConversationChanged!(list);
|
||||||
void syncServerFinish();
|
}
|
||||||
|
|
||||||
void syncServerStart();
|
void newConversation(List<ConversationInfo> list) {
|
||||||
|
if (onNewConversation != null) onNewConversation!(list);
|
||||||
void totalUnreadMessageCountChanged(int i);
|
}
|
||||||
|
|
||||||
|
void syncServerFailed() {
|
||||||
|
if (onSyncServerFailed != null) onSyncServerFailed!();
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncServerFinish() {
|
||||||
|
if (onSyncServerFinish != null) onSyncServerFinish!();
|
||||||
|
}
|
||||||
|
|
||||||
|
void syncServerStart() {
|
||||||
|
if (onSyncServerStart != null) onSyncServerStart!();
|
||||||
|
}
|
||||||
|
|
||||||
|
void totalUnreadMessageCountChanged(int i) {
|
||||||
|
if (onTotalUnreadMessageCountChanged != null)
|
||||||
|
onTotalUnreadMessageCountChanged!(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,61 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||||
|
|
||||||
abstract class FriendshipListener {
|
class OnFriendshipListener {
|
||||||
void friendApplicationAdded(FriendApplicationInfo u);
|
Function(FriendApplicationInfo i)? onFriendApplicationAdded;
|
||||||
|
Function(FriendApplicationInfo i)? onFriendApplicationDeleted;
|
||||||
|
Function(FriendApplicationInfo i)? onFriendApplicationAccepted;
|
||||||
|
Function(FriendApplicationInfo i)? onFriendApplicationRejected;
|
||||||
|
Function(FriendInfo i)? onFriendAdded;
|
||||||
|
Function(FriendInfo i)? onFriendDeleted;
|
||||||
|
Function(FriendInfo i)? onFriendInfoChanged;
|
||||||
|
Function(BlacklistInfo i)? onBlacklistAdded;
|
||||||
|
Function(BlacklistInfo i)? onBlacklistDeleted;
|
||||||
|
|
||||||
void friendApplicationDeleted(FriendApplicationInfo u);
|
OnFriendshipListener({
|
||||||
|
this.onBlacklistAdded,
|
||||||
|
this.onBlacklistDeleted,
|
||||||
|
this.onFriendAdded,
|
||||||
|
this.onFriendApplicationAccepted,
|
||||||
|
this.onFriendApplicationAdded,
|
||||||
|
this.onFriendApplicationDeleted,
|
||||||
|
this.onFriendApplicationRejected,
|
||||||
|
this.onFriendDeleted,
|
||||||
|
this.onFriendInfoChanged,
|
||||||
|
});
|
||||||
|
|
||||||
void friendApplicationAccepted(FriendApplicationInfo u);
|
void blacklistAdded(BlacklistInfo u) {
|
||||||
|
onBlacklistAdded?.call(u);
|
||||||
void friendApplicationRejected(FriendApplicationInfo u);
|
}
|
||||||
|
|
||||||
void friendAdded(FriendInfo u);
|
void blacklistDeleted(BlacklistInfo u) {
|
||||||
|
onBlacklistDeleted?.call(u);
|
||||||
void friendDeleted(FriendInfo u);
|
}
|
||||||
|
|
||||||
void friendInfoChanged(FriendInfo u);
|
void friendAdded(FriendInfo u) {
|
||||||
|
onFriendAdded?.call(u);
|
||||||
void blacklistAdded(BlacklistInfo u);
|
}
|
||||||
|
|
||||||
void blacklistDeleted(BlacklistInfo u);
|
void friendApplicationAccepted(FriendApplicationInfo u) {
|
||||||
|
onFriendApplicationAccepted?.call(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
void friendApplicationAdded(FriendApplicationInfo u) {
|
||||||
|
onFriendApplicationAdded?.call(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
void friendApplicationDeleted(FriendApplicationInfo u) {
|
||||||
|
onFriendApplicationDeleted?.call(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
void friendApplicationRejected(FriendApplicationInfo u) {
|
||||||
|
onFriendApplicationRejected?.call(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
void friendDeleted(FriendInfo u) {
|
||||||
|
onFriendDeleted?.call(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
void friendInfoChanged(FriendInfo u) {
|
||||||
|
onFriendInfoChanged?.call(u);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,67 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||||
|
|
||||||
abstract class GroupListener {
|
class OnGroupListener {
|
||||||
void joinedGroupAdded(GroupInfo info);
|
Function(GroupApplicationInfo info)? onGroupApplicationAccepted;
|
||||||
|
Function(GroupApplicationInfo info)? onGroupApplicationAdded;
|
||||||
|
Function(GroupApplicationInfo info)? onGroupApplicationDeleted;
|
||||||
|
Function(GroupApplicationInfo info)? onGroupApplicationRejected;
|
||||||
|
Function(GroupInfo info)? onGroupInfoChanged;
|
||||||
|
Function(GroupMembersInfo info)? onGroupMemberAdded;
|
||||||
|
Function(GroupMembersInfo info)? onGroupMemberDeleted;
|
||||||
|
Function(GroupMembersInfo info)? onGroupMemberInfoChanged;
|
||||||
|
Function(GroupInfo info)? onJoinedGroupAdded;
|
||||||
|
Function(GroupInfo info)? onJoinedGroupDeleted;
|
||||||
|
|
||||||
void joinedGroupDeleted(GroupInfo info);
|
OnGroupListener({
|
||||||
|
this.onGroupApplicationAccepted,
|
||||||
|
this.onGroupApplicationAdded,
|
||||||
|
this.onGroupApplicationDeleted,
|
||||||
|
this.onGroupApplicationRejected,
|
||||||
|
this.onGroupInfoChanged,
|
||||||
|
this.onGroupMemberAdded,
|
||||||
|
this.onGroupMemberDeleted,
|
||||||
|
this.onGroupMemberInfoChanged,
|
||||||
|
this.onJoinedGroupAdded,
|
||||||
|
this.onJoinedGroupDeleted,
|
||||||
|
});
|
||||||
|
|
||||||
void groupMemberAdded(GroupMembersInfo info);
|
void groupApplicationAccepted(GroupApplicationInfo info) {
|
||||||
|
onGroupApplicationAccepted?.call(info);
|
||||||
void groupMemberDeleted(GroupMembersInfo info);
|
}
|
||||||
|
|
||||||
void groupApplicationAdded(GroupApplicationInfo info);
|
void groupApplicationAdded(GroupApplicationInfo info) {
|
||||||
|
onGroupApplicationAdded?.call(info);
|
||||||
void groupApplicationDeleted(GroupApplicationInfo info);
|
}
|
||||||
|
|
||||||
void groupInfoChanged(GroupInfo info);
|
void groupApplicationDeleted(GroupApplicationInfo info) {
|
||||||
|
onGroupApplicationDeleted?.call(info);
|
||||||
void groupMemberInfoChanged(GroupMembersInfo info);
|
}
|
||||||
|
|
||||||
void groupApplicationAccepted(GroupApplicationInfo info);
|
void groupApplicationRejected(GroupApplicationInfo info) {
|
||||||
|
onGroupApplicationRejected?.call(info);
|
||||||
void groupApplicationRejected(GroupApplicationInfo info);
|
}
|
||||||
|
|
||||||
|
void groupInfoChanged(GroupInfo info) {
|
||||||
|
onGroupInfoChanged?.call(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void groupMemberAdded(GroupMembersInfo info) {
|
||||||
|
onGroupMemberAdded?.call(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void groupMemberDeleted(GroupMembersInfo info) {
|
||||||
|
onGroupMemberDeleted?.call(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void groupMemberInfoChanged(GroupMembersInfo info) {
|
||||||
|
onGroupMemberInfoChanged?.call(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void joinedGroupAdded(GroupInfo info) {
|
||||||
|
onJoinedGroupAdded?.call(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void joinedGroupDeleted(GroupInfo info) {
|
||||||
|
onJoinedGroupDeleted?.call(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|
||||||
|
|
||||||
class OnAdvancedMsgListener extends AdvancedMsgListener {
|
|
||||||
Function(List<ReadReceiptInfo> list)? onRecvC2CReadReceipt;
|
|
||||||
Function(String msgId)? onRecvMessageRevoked;
|
|
||||||
Function(Message msg)? onRecvNewMessage;
|
|
||||||
|
|
||||||
OnAdvancedMsgListener({
|
|
||||||
this.onRecvC2CReadReceipt,
|
|
||||||
this.onRecvMessageRevoked,
|
|
||||||
this.onRecvNewMessage,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
void recvC2CReadReceipt(List<ReadReceiptInfo> list) {
|
|
||||||
if (null != onRecvC2CReadReceipt) onRecvC2CReadReceipt!(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void recvMessageRevoked(String msgId) {
|
|
||||||
if (null != onRecvMessageRevoked) onRecvMessageRevoked!(msgId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void recvNewMessage(Message msg) {
|
|
||||||
if (null != onRecvNewMessage) onRecvNewMessage!(msg);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|
||||||
import 'package:flutter_openim_sdk/src/listener/connect_listener.dart';
|
|
||||||
|
|
||||||
class OnConnectListener extends ConnectListener {
|
|
||||||
Function(int? code, String? errorMsg)? onConnectFailed;
|
|
||||||
Function()? onConnectSuccess;
|
|
||||||
Function()? onConnecting;
|
|
||||||
Function()? onKickedOffline;
|
|
||||||
Function()? onUserSigExpired;
|
|
||||||
|
|
||||||
OnConnectListener({
|
|
||||||
this.onConnectFailed,
|
|
||||||
this.onConnectSuccess,
|
|
||||||
this.onConnecting,
|
|
||||||
this.onKickedOffline,
|
|
||||||
this.onUserSigExpired,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
void connectFailed(int? code, String? errorMsg) {
|
|
||||||
if (null != onConnectFailed) onConnectFailed!(code, errorMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void connectSuccess() {
|
|
||||||
if (null != onConnectSuccess) onConnectSuccess!();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void connecting() {
|
|
||||||
if (null != onConnecting) onConnecting!.call();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void kickedOffline() {
|
|
||||||
if (null != onKickedOffline) onKickedOffline!();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void userSigExpired() {
|
|
||||||
if (null != onUserSigExpired) onUserSigExpired!();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|
||||||
|
|
||||||
class OnConversationListener extends ConversationListener {
|
|
||||||
Function(List<ConversationInfo> list)? onConversationChanged;
|
|
||||||
Function(List<ConversationInfo> list)? onNewConversation;
|
|
||||||
Function(int count)? onTotalUnreadMessageCountChanged;
|
|
||||||
Function()? onSyncServerFailed;
|
|
||||||
Function()? onSyncServerFinish;
|
|
||||||
Function()? onSyncServerStart;
|
|
||||||
|
|
||||||
OnConversationListener({
|
|
||||||
this.onConversationChanged,
|
|
||||||
this.onNewConversation,
|
|
||||||
this.onTotalUnreadMessageCountChanged,
|
|
||||||
this.onSyncServerFailed,
|
|
||||||
this.onSyncServerFinish,
|
|
||||||
this.onSyncServerStart,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
void conversationChanged(List<ConversationInfo> list) {
|
|
||||||
if (onConversationChanged != null) onConversationChanged!(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void newConversation(List<ConversationInfo> list) {
|
|
||||||
if (onNewConversation != null) onNewConversation!(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void syncServerFailed() {
|
|
||||||
if (onSyncServerFailed != null) onSyncServerFailed!();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void syncServerFinish() {
|
|
||||||
if (onSyncServerFinish != null) onSyncServerFinish!();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void syncServerStart() {
|
|
||||||
if (onSyncServerStart != null) onSyncServerStart!();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void totalUnreadMessageCountChanged(int i) {
|
|
||||||
if (onTotalUnreadMessageCountChanged != null)
|
|
||||||
onTotalUnreadMessageCountChanged!(i);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|
||||||
|
|
||||||
class OnFriendshipListener extends FriendshipListener {
|
|
||||||
Function(FriendApplicationInfo i)? onFriendApplicationAdded;
|
|
||||||
Function(FriendApplicationInfo i)? onFriendApplicationDeleted;
|
|
||||||
Function(FriendApplicationInfo i)? onFriendApplicationAccepted;
|
|
||||||
Function(FriendApplicationInfo i)? onFriendApplicationRejected;
|
|
||||||
Function(FriendInfo i)? onFriendAdded;
|
|
||||||
Function(FriendInfo i)? onFriendDeleted;
|
|
||||||
Function(FriendInfo i)? onFriendInfoChanged;
|
|
||||||
Function(BlacklistInfo i)? onBlacklistAdded;
|
|
||||||
Function(BlacklistInfo i)? onBlacklistDeleted;
|
|
||||||
|
|
||||||
OnFriendshipListener({
|
|
||||||
this.onBlacklistAdded,
|
|
||||||
this.onBlacklistDeleted,
|
|
||||||
this.onFriendAdded,
|
|
||||||
this.onFriendApplicationAccepted,
|
|
||||||
this.onFriendApplicationAdded,
|
|
||||||
this.onFriendApplicationDeleted,
|
|
||||||
this.onFriendApplicationRejected,
|
|
||||||
this.onFriendDeleted,
|
|
||||||
this.onFriendInfoChanged,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
void blacklistAdded(BlacklistInfo u) {
|
|
||||||
onBlacklistAdded?.call(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void blacklistDeleted(BlacklistInfo u) {
|
|
||||||
onBlacklistDeleted?.call(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void friendAdded(FriendInfo u) {
|
|
||||||
onFriendAdded?.call(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void friendApplicationAccepted(FriendApplicationInfo u) {
|
|
||||||
onFriendApplicationAccepted?.call(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void friendApplicationAdded(FriendApplicationInfo u) {
|
|
||||||
onFriendApplicationAdded?.call(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void friendApplicationDeleted(FriendApplicationInfo u) {
|
|
||||||
onFriendApplicationDeleted?.call(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void friendApplicationRejected(FriendApplicationInfo u) {
|
|
||||||
onFriendApplicationRejected?.call(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void friendDeleted(FriendInfo u) {
|
|
||||||
onFriendDeleted?.call(u);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void friendInfoChanged(FriendInfo u) {
|
|
||||||
onFriendInfoChanged?.call(u);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|
||||||
|
|
||||||
class OnGroupListener extends GroupListener {
|
|
||||||
Function(GroupApplicationInfo info)? onGroupApplicationAccepted;
|
|
||||||
Function(GroupApplicationInfo info)? onGroupApplicationAdded;
|
|
||||||
Function(GroupApplicationInfo info)? onGroupApplicationDeleted;
|
|
||||||
Function(GroupApplicationInfo info)? onGroupApplicationRejected;
|
|
||||||
Function(GroupInfo info)? onGroupInfoChanged;
|
|
||||||
Function(GroupMembersInfo info)? onGroupMemberAdded;
|
|
||||||
Function(GroupMembersInfo info)? onGroupMemberDeleted;
|
|
||||||
Function(GroupMembersInfo info)? onGroupMemberInfoChanged;
|
|
||||||
Function(GroupInfo info)? onJoinedGroupAdded;
|
|
||||||
Function(GroupInfo info)? onJoinedGroupDeleted;
|
|
||||||
|
|
||||||
OnGroupListener({
|
|
||||||
this.onGroupApplicationAccepted,
|
|
||||||
this.onGroupApplicationAdded,
|
|
||||||
this.onGroupApplicationDeleted,
|
|
||||||
this.onGroupApplicationRejected,
|
|
||||||
this.onGroupInfoChanged,
|
|
||||||
this.onGroupMemberAdded,
|
|
||||||
this.onGroupMemberDeleted,
|
|
||||||
this.onGroupMemberInfoChanged,
|
|
||||||
this.onJoinedGroupAdded,
|
|
||||||
this.onJoinedGroupDeleted,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
void groupApplicationAccepted(GroupApplicationInfo info) {
|
|
||||||
onGroupApplicationAccepted?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void groupApplicationAdded(GroupApplicationInfo info) {
|
|
||||||
onGroupApplicationAdded?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void groupApplicationDeleted(GroupApplicationInfo info) {
|
|
||||||
onGroupApplicationDeleted?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void groupApplicationRejected(GroupApplicationInfo info) {
|
|
||||||
onGroupApplicationRejected?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void groupInfoChanged(GroupInfo info) {
|
|
||||||
onGroupInfoChanged?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void groupMemberAdded(GroupMembersInfo info) {
|
|
||||||
onGroupMemberAdded?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void groupMemberDeleted(GroupMembersInfo info) {
|
|
||||||
onGroupMemberDeleted?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void groupMemberInfoChanged(GroupMembersInfo info) {
|
|
||||||
onGroupMemberInfoChanged?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void joinedGroupAdded(GroupInfo info) {
|
|
||||||
onJoinedGroupAdded?.call(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void joinedGroupDeleted(GroupInfo info) {
|
|
||||||
onJoinedGroupDeleted?.call(info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|
||||||
|
|
||||||
class OnMsgSendProgressListener extends MsgSendProgressListener {
|
|
||||||
Function(String clientMsgID, int progress)? onProgress;
|
|
||||||
|
|
||||||
OnMsgSendProgressListener({this.onProgress});
|
|
||||||
|
|
||||||
void progress(String clientMsgID, int progress) {
|
|
||||||
if (null != onProgress) onProgress!(clientMsgID, progress);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|
||||||
|
|
||||||
class OnUserListener extends UserListener {
|
|
||||||
Function(UserInfo info)? onSelfInfoUpdated;
|
|
||||||
|
|
||||||
OnUserListener({this.onSelfInfoUpdated});
|
|
||||||
|
|
||||||
@override
|
|
||||||
void selfInfoUpdated(UserInfo info) {
|
|
||||||
onSelfInfoUpdated?.call(info);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +1,9 @@
|
|||||||
abstract class MsgSendProgressListener {
|
class OnMsgSendProgressListener {
|
||||||
void progress(String clientMsgID, int progress);
|
Function(String clientMsgID, int progress)? onProgress;
|
||||||
|
|
||||||
|
OnMsgSendProgressListener({this.onProgress});
|
||||||
|
|
||||||
|
void progress(String clientMsgID, int progress) {
|
||||||
|
if (null != onProgress) onProgress!(clientMsgID, progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||||
|
|
||||||
abstract class UserListener {
|
class OnUserListener {
|
||||||
/// The information of the logged-in user has been updated
|
/// The information of the logged-in user has been updated
|
||||||
void selfInfoUpdated(UserInfo info);
|
Function(UserInfo info)? onSelfInfoUpdated;
|
||||||
|
|
||||||
|
OnUserListener({this.onSelfInfoUpdated});
|
||||||
|
|
||||||
|
void selfInfoUpdated(UserInfo info) {
|
||||||
|
onSelfInfoUpdated?.call(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|||||||
|
|
||||||
class ConversationManager {
|
class ConversationManager {
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
late ConversationListener conversationListener;
|
late OnConversationListener conversationListener;
|
||||||
|
|
||||||
ConversationManager(this._channel);
|
ConversationManager(this._channel);
|
||||||
|
|
||||||
/// Observe conversation changes
|
/// Observe conversation changes
|
||||||
/// 会话监听
|
/// 会话监听
|
||||||
Future setConversationListener(ConversationListener listener) {
|
Future setConversationListener(OnConversationListener listener) {
|
||||||
this.conversationListener = listener;
|
this.conversationListener = listener;
|
||||||
return _channel.invokeMethod('setConversationListener', _buildParam({}));
|
return _channel.invokeMethod('setConversationListener', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|||||||
|
|
||||||
class FriendshipManager {
|
class FriendshipManager {
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
late FriendshipListener friendshipListener;
|
late OnFriendshipListener friendshipListener;
|
||||||
|
|
||||||
FriendshipManager(this._channel);
|
FriendshipManager(this._channel);
|
||||||
|
|
||||||
/// Set up a friend relationship listener
|
/// Set up a friend relationship listener
|
||||||
/// 好友关系监听
|
/// 好友关系监听
|
||||||
Future setFriendshipListener(FriendshipListener listener) {
|
Future setFriendshipListener(OnFriendshipListener listener) {
|
||||||
this.friendshipListener = listener;
|
this.friendshipListener = listener;
|
||||||
return _channel.invokeMethod('setFriendListener', _buildParam({}));
|
return _channel.invokeMethod('setFriendListener', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,13 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|||||||
|
|
||||||
class GroupManager {
|
class GroupManager {
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
late GroupListener groupListener;
|
late OnGroupListener groupListener;
|
||||||
|
|
||||||
GroupManager(this._channel);
|
GroupManager(this._channel);
|
||||||
|
|
||||||
/// Set up group relationship monitoring
|
/// Set up group relationship monitoring
|
||||||
/// 组关系监听
|
/// 组关系监听
|
||||||
Future setGroupListener(GroupListener listener) {
|
Future setGroupListener(OnGroupListener listener) {
|
||||||
this.groupListener = listener;
|
this.groupListener = listener;
|
||||||
return _channel.invokeMethod('setGroupListener', _buildParam({}));
|
return _channel.invokeMethod('setGroupListener', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ class IMManager {
|
|||||||
|
|
||||||
// late OfflinePushManager offlinePushManager;
|
// late OfflinePushManager offlinePushManager;
|
||||||
// late SignalingManager signalingManager;
|
// late SignalingManager signalingManager;
|
||||||
late ConnectListener _connectListener;
|
late OnConnectListener _connectListener;
|
||||||
late String uid;
|
late String uid;
|
||||||
late UserInfo uInfo;
|
late UserInfo uInfo;
|
||||||
bool isLogined = false;
|
bool isLogined = false;
|
||||||
@ -251,7 +251,7 @@ class IMManager {
|
|||||||
required String apiAddr,
|
required String apiAddr,
|
||||||
required String wsAddr,
|
required String wsAddr,
|
||||||
required String dataDir,
|
required String dataDir,
|
||||||
required ConnectListener listener,
|
required OnConnectListener listener,
|
||||||
int logLevel = 6,
|
int logLevel = 6,
|
||||||
String? objectStorage,
|
String? objectStorage,
|
||||||
String? operationID,
|
String? operationID,
|
||||||
|
@ -5,14 +5,14 @@ class MessageManager {
|
|||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
|
|
||||||
// List<AdvancedMsgListener> advancedMsgListeners = List.empty(growable: true);
|
// List<AdvancedMsgListener> advancedMsgListeners = List.empty(growable: true);
|
||||||
MsgSendProgressListener? msgSendProgressListener;
|
OnMsgSendProgressListener? msgSendProgressListener;
|
||||||
late AdvancedMsgListener advancedMsgListener;
|
late OnAdvancedMsgListener advancedMsgListener;
|
||||||
|
|
||||||
MessageManager(this._channel);
|
MessageManager(this._channel);
|
||||||
|
|
||||||
/// Set a message listener
|
/// Set a message listener
|
||||||
/// 消息监听
|
/// 消息监听
|
||||||
Future setAdvancedMsgListener(AdvancedMsgListener listener) {
|
Future setAdvancedMsgListener(OnAdvancedMsgListener listener) {
|
||||||
this.advancedMsgListener = listener;
|
this.advancedMsgListener = listener;
|
||||||
// advancedMsgListeners.add(listener);
|
// advancedMsgListeners.add(listener);
|
||||||
return _channel.invokeMethod(
|
return _channel.invokeMethod(
|
||||||
@ -24,7 +24,7 @@ class MessageManager {
|
|||||||
|
|
||||||
/// Set up message sending progress monitoring
|
/// Set up message sending progress monitoring
|
||||||
/// 消息发送进度监听
|
/// 消息发送进度监听
|
||||||
void setMsgSendProgressListener(MsgSendProgressListener listener) {
|
void setMsgSendProgressListener(OnMsgSendProgressListener listener) {
|
||||||
msgSendProgressListener = listener;
|
msgSendProgressListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +47,14 @@ class MessageManager {
|
|||||||
'message': message.toJson(),
|
'message': message.toJson(),
|
||||||
'userID': userID ?? '',
|
'userID': userID ?? '',
|
||||||
'groupID': groupID ?? '',
|
'groupID': groupID ?? '',
|
||||||
'offlinePushInfo': offlinePushInfo?.toJson() ?? {},
|
'offlinePushInfo': offlinePushInfo?.toJson() ??
|
||||||
|
{
|
||||||
|
"title": "You have a new message",
|
||||||
|
"desc": "",
|
||||||
|
"ex": "",
|
||||||
|
"iOSPushSound": "+1",
|
||||||
|
"iOSBadgeCount": true,
|
||||||
|
},
|
||||||
'operationID': Utils.checkOperationID(operationID),
|
'operationID': Utils.checkOperationID(operationID),
|
||||||
}))
|
}))
|
||||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||||
|
@ -3,13 +3,13 @@ import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
|||||||
|
|
||||||
class UserManager {
|
class UserManager {
|
||||||
MethodChannel _channel;
|
MethodChannel _channel;
|
||||||
late UserListener userListener;
|
late OnUserListener userListener;
|
||||||
|
|
||||||
UserManager(this._channel);
|
UserManager(this._channel);
|
||||||
|
|
||||||
/// Observe user info changes
|
/// Observe user info changes
|
||||||
/// 用户资料改变监听
|
/// 用户资料改变监听
|
||||||
Future setUserListener(UserListener listener) {
|
Future setUserListener(OnUserListener listener) {
|
||||||
this.userListener = listener;
|
this.userListener = listener;
|
||||||
return _channel.invokeMethod('setUserListener', _buildParam({}));
|
return _channel.invokeMethod('setUserListener', _buildParam({}));
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,16 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
class Utils {
|
class Utils {
|
||||||
static List<T> toList<T>(String? value, T f(Map<String, dynamic> map)) {
|
static List<T> toList<T>(String value, T f(Map<String, dynamic> map)) =>
|
||||||
var list = _formatJson(value);
|
(_formatJson(value) as List).map((e) => f(e)).toList();
|
||||||
if (null == list) return <T>[];
|
|
||||||
return (list as List).map((e) => f(e)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
static T toObj<T>(String value, T f(Map<String, dynamic> map)) =>
|
static T toObj<T>(String value, T f(Map<String, dynamic> map)) =>
|
||||||
f(_formatJson(value));
|
f(_formatJson(value));
|
||||||
|
|
||||||
static List<dynamic> toListMap(String? value) => _formatJson(value) ?? [];
|
static List<dynamic> toListMap(String value) => _formatJson(value);
|
||||||
|
|
||||||
static dynamic _formatJson(String? value) {
|
static dynamic _formatJson(String value) => jsonDecode(value);
|
||||||
if (null == value) return null;
|
|
||||||
return jsonDecode(_printValue(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
static String _printValue(value) {
|
static String checkOperationID(String? obj) =>
|
||||||
return value;
|
obj ?? DateTime.now().millisecondsSinceEpoch.toString();
|
||||||
}
|
|
||||||
|
|
||||||
static String checkOperationID(String? obj) {
|
|
||||||
return obj ?? DateTime.now().millisecondsSinceEpoch.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,13 @@ packages:
|
|||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.11"
|
version: "0.12.11"
|
||||||
|
material_color_utilities:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: material_color_utilities
|
||||||
|
url: "https://pub.flutter-io.cn"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -127,7 +134,7 @@ packages:
|
|||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.flutter-io.cn"
|
url: "https://pub.flutter-io.cn"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.3"
|
version: "0.4.8"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user