parent
b71cd22dce
commit
4c43d54a1a
@ -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; |
||||||
|
|
||||||
|
OnAdvancedMsgListener({ |
||||||
|
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); |
||||||
|
} |
||||||
|
|
||||||
/// A friend withdrew a message |
void recvNewMessage(Message msg) { |
||||||
void recvMessageRevoked(String msgId); |
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 newConversation(List<ConversationInfo> list) { |
||||||
|
if (onNewConversation != null) onNewConversation!(list); |
||||||
|
} |
||||||
|
|
||||||
void syncServerStart(); |
void syncServerFailed() { |
||||||
|
if (onSyncServerFailed != null) onSyncServerFailed!(); |
||||||
|
} |
||||||
|
|
||||||
void totalUnreadMessageCountChanged(int i); |
void syncServerFinish() { |
||||||
|
if (onSyncServerFinish != null) onSyncServerFinish!(); |
||||||
|
} |
||||||
|
|
||||||
|
void syncServerStart() { |
||||||
|
if (onSyncServerStart != null) onSyncServerStart!(); |
||||||
|
} |
||||||
|
|
||||||
|
void totalUnreadMessageCountChanged(int i) { |
||||||
|
if (onTotalUnreadMessageCountChanged != null) |
||||||
|
onTotalUnreadMessageCountChanged!(i); |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -1,21 +1,61 @@ |
|||||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart'; |
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; |
||||||
void friendApplicationDeleted(FriendApplicationInfo u); |
Function(FriendApplicationInfo i)? onFriendApplicationAccepted; |
||||||
|
Function(FriendApplicationInfo i)? onFriendApplicationRejected; |
||||||
void friendApplicationAccepted(FriendApplicationInfo u); |
Function(FriendInfo i)? onFriendAdded; |
||||||
|
Function(FriendInfo i)? onFriendDeleted; |
||||||
void friendApplicationRejected(FriendApplicationInfo u); |
Function(FriendInfo i)? onFriendInfoChanged; |
||||||
|
Function(BlacklistInfo i)? onBlacklistAdded; |
||||||
void friendAdded(FriendInfo u); |
Function(BlacklistInfo i)? onBlacklistDeleted; |
||||||
|
|
||||||
void friendDeleted(FriendInfo u); |
OnFriendshipListener({ |
||||||
|
this.onBlacklistAdded, |
||||||
void friendInfoChanged(FriendInfo u); |
this.onBlacklistDeleted, |
||||||
|
this.onFriendAdded, |
||||||
void blacklistAdded(BlacklistInfo u); |
this.onFriendApplicationAccepted, |
||||||
|
this.onFriendApplicationAdded, |
||||||
void blacklistDeleted(BlacklistInfo u); |
this.onFriendApplicationDeleted, |
||||||
|
this.onFriendApplicationRejected, |
||||||
|
this.onFriendDeleted, |
||||||
|
this.onFriendInfoChanged, |
||||||
|
}); |
||||||
|
|
||||||
|
void blacklistAdded(BlacklistInfo u) { |
||||||
|
onBlacklistAdded?.call(u); |
||||||
|
} |
||||||
|
|
||||||
|
void blacklistDeleted(BlacklistInfo u) { |
||||||
|
onBlacklistDeleted?.call(u); |
||||||
|
} |
||||||
|
|
||||||
|
void friendAdded(FriendInfo u) { |
||||||
|
onFriendAdded?.call(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) { |
||||||
|
onGroupApplicationAdded?.call(info); |
||||||
|
} |
||||||
|
|
||||||
void groupApplicationAdded(GroupApplicationInfo info); |
void groupApplicationDeleted(GroupApplicationInfo info) { |
||||||
|
onGroupApplicationDeleted?.call(info); |
||||||
|
} |
||||||
|
|
||||||
void groupApplicationDeleted(GroupApplicationInfo info); |
void groupApplicationRejected(GroupApplicationInfo info) { |
||||||
|
onGroupApplicationRejected?.call(info); |
||||||
|
} |
||||||
|
|
||||||
void groupInfoChanged(GroupInfo info); |
void groupInfoChanged(GroupInfo info) { |
||||||
|
onGroupInfoChanged?.call(info); |
||||||
|
} |
||||||
|
|
||||||
void groupMemberInfoChanged(GroupMembersInfo info); |
void groupMemberAdded(GroupMembersInfo info) { |
||||||
|
onGroupMemberAdded?.call(info); |
||||||
|
} |
||||||
|
|
||||||
void groupApplicationAccepted(GroupApplicationInfo info); |
void groupMemberDeleted(GroupMembersInfo info) { |
||||||
|
onGroupMemberDeleted?.call(info); |
||||||
|
} |
||||||
|
|
||||||
void groupApplicationRejected(GroupApplicationInfo 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); |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -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(); |
|
||||||
} |
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue