From 1af1ecfbb916923a0249fcf11467232c8f8ade18 Mon Sep 17 00:00:00 2001 From: cpdl Date: Wed, 7 May 2025 11:27:33 +0800 Subject: [PATCH] no message --- example/lib/main.dart | 3 + windows/src/common/services/ChannelManager.h | 81 +++-- .../src/common/services/ConversationManager.h | 131 ++++---- windows/src/common/services/FriendManager.h | 110 ++++--- windows/src/common/services/GroupManager.h | 177 ++++++----- windows/src/common/services/MessageManager.h | 285 +++++++++--------- windows/src/common/services/UserManager.cpp | 238 ++++++++------- windows/src/common/services/UserManager.h | 63 ++-- 8 files changed, 550 insertions(+), 538 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index cd75dd9..2a28b63 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -30,6 +30,9 @@ class _MyAppState extends State { listener: OnConnectListener()) .then((value) { print('SDK initialized successfully'); + + OpenIM.iMManager.userManager.setUserListener(OnUserListener()); + OpenIM.iMManager .login( userID: "3e8b8fb2ecd8414db50838d9f7bcb19d", diff --git a/windows/src/common/services/ChannelManager.h b/windows/src/common/services/ChannelManager.h index 834f45e..212d84c 100644 --- a/windows/src/common/services/ChannelManager.h +++ b/windows/src/common/services/ChannelManager.h @@ -8,49 +8,48 @@ class ChannelManagerService : public FLTService { - - public: - ChannelManagerService(); - void onMethodCalled( - const std::string &method, - const flutter::EncodableMap *arguments, - std::shared_ptr> result); +public: + ChannelManagerService(); - // Method handlers - void setChannelListener( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getChannelMembersInfo( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getChannelMemberList( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getChannelsInfo( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void joinChannel( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void quitChannel( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void changeChannelMute( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void changeChannelMemberMute( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void isJoinChannel( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getUsersInChannel( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); + virtual void onMethodCalled( + const std::string& method, const flutter::EncodableMap* arguments, + std::shared_ptr> result) + override; - private: - std::string m_serviceName; - }; + // Method handlers + void setChannelListener( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getChannelMembersInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getChannelMemberList( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getChannelsInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void joinChannel( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void quitChannel( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void changeChannelMute( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void changeChannelMemberMute( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void isJoinChannel( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getUsersInChannel( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + + +}; #endif // CHANNEL_MANAGER_SERVICE_H \ No newline at end of file diff --git a/windows/src/common/services/ConversationManager.h b/windows/src/common/services/ConversationManager.h index 8eaaff7..6229892 100644 --- a/windows/src/common/services/ConversationManager.h +++ b/windows/src/common/services/ConversationManager.h @@ -6,77 +6,76 @@ #include #include -class ConversationManagerService: public FLTService { +class ConversationManagerService : public FLTService { public: - ConversationManagerService(); + ConversationManagerService(); - void onMethodCalled( - const std::string& method, - const flutter::EncodableMap* arguments, - std::shared_ptr> result); + virtual void onMethodCalled( + const std::string& method, const flutter::EncodableMap* arguments, + std::shared_ptr> result) + override; + + // Method handlers + void setConversationListener( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getAllConversationList( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getConversationListSplit( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getOneConversation( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getMultipleConversation( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void setConversationDraft( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void hideConversation( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void markConversationMessageAsRead( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getTotalUnreadMsgCount( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getConversationIDBySessionType( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void clearConversationAndDeleteAllMsg( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void deleteConversationAndDeleteAllMsg( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getAtAllTag( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void hideAllConversations( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void searchConversation( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void changeInputStates( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getInputStates( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void setConversation( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void searchConversations( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); - // Method handlers - void setConversationListener( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getAllConversationList( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getConversationListSplit( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getOneConversation( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getMultipleConversation( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void setConversationDraft( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void hideConversation( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void markConversationMessageAsRead( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getTotalUnreadMsgCount( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getConversationIDBySessionType( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void clearConversationAndDeleteAllMsg( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void deleteConversationAndDeleteAllMsg( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getAtAllTag( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void hideAllConversations( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void searchConversation( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void changeInputStates( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getInputStates( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void setConversation( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void searchConversations( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); -private: - std::string m_serviceName; }; #endif // CONVERSATION_MANAGER_SERVICE_H \ No newline at end of file diff --git a/windows/src/common/services/FriendManager.h b/windows/src/common/services/FriendManager.h index 0ebaaa5..f82f026 100644 --- a/windows/src/common/services/FriendManager.h +++ b/windows/src/common/services/FriendManager.h @@ -10,65 +10,63 @@ class FriendshipManagerService : public FLTService { public: - FriendshipManagerService(); + FriendshipManagerService(); - void onMethodCalled( - const std::string &method, - const flutter::EncodableMap *arguments, - std::shared_ptr> result); + virtual void onMethodCalled( + const std::string& method, const flutter::EncodableMap* arguments, + std::shared_ptr> result) + override; - // Method handlers - void setFriendListener( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getFriendsInfo( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void addFriend( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getFriendApplicationListAsRecipient( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getFriendApplicationListAsApplicant( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getFriendList( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getFriendListPage( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void addBlacklist( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getBlacklist( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void removeBlacklist( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void checkFriend( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void deleteFriend( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void acceptFriendApplication( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void refuseFriendApplication( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void searchFriends( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void updateFriends( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); + // Method handlers + void setFriendListener( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getFriendsInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void addFriend( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getFriendApplicationListAsRecipient( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getFriendApplicationListAsApplicant( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getFriendList( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getFriendListPage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void addBlacklist( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getBlacklist( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void removeBlacklist( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void checkFriend( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void deleteFriend( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void acceptFriendApplication( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void refuseFriendApplication( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void searchFriends( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void updateFriends( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); -private: - std::string m_serviceName; }; #endif // FRIENDSHIP_MANAGER_SERVICE_H \ No newline at end of file diff --git a/windows/src/common/services/GroupManager.h b/windows/src/common/services/GroupManager.h index 4c546df..b2a439e 100644 --- a/windows/src/common/services/GroupManager.h +++ b/windows/src/common/services/GroupManager.h @@ -10,98 +10,97 @@ class GroupManagerService : public FLTService { public: - GroupManagerService(); + GroupManagerService(); - void onMethodCalled( - const std::string &method, - const flutter::EncodableMap *arguments, - std::shared_ptr> result); + virtual void onMethodCalled( + const std::string& method, const flutter::EncodableMap* arguments, + std::shared_ptr> result) + override; + + // Method handlers + void setGroupListener( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void inviteUserToGroup( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void kickGroupMember( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getGroupMembersInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getGroupMemberList( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getJoinedGroupList( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getJoinedGroupListPage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createGroup( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void setGroupInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getGroupsInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void joinGroup( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void quitGroup( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void transferGroupOwner( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getGroupApplicationListAsRecipient( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getGroupApplicationListAsApplicant( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void acceptGroupApplication( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void refuseGroupApplication( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void dismissGroup( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void changeGroupMute( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void changeGroupMemberMute( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void searchGroups( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getGroupMemberListByJoinTimeFilter( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getGroupMemberOwnerAndAdmin( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void searchGroupMembers( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void setGroupMemberInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void isJoinGroup( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getUsersInGroup( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); - // Method handlers - void setGroupListener( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void inviteUserToGroup( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void kickGroupMember( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getGroupMembersInfo( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getGroupMemberList( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getJoinedGroupList( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getJoinedGroupListPage( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void createGroup( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void setGroupInfo( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getGroupsInfo( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void joinGroup( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void quitGroup( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void transferGroupOwner( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getGroupApplicationListAsRecipient( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getGroupApplicationListAsApplicant( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void acceptGroupApplication( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void refuseGroupApplication( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void dismissGroup( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void changeGroupMute( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void changeGroupMemberMute( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void searchGroups( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getGroupMemberListByJoinTimeFilter( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getGroupMemberOwnerAndAdmin( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void searchGroupMembers( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void setGroupMemberInfo( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void isJoinGroup( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); - void getUsersInGroup( - const flutter::EncodableMap *arguments, - std::shared_ptr> result); -private: - std::string m_serviceName; }; #endif // GROUP_MANAGER_SERVICE_H \ No newline at end of file diff --git a/windows/src/common/services/MessageManager.h b/windows/src/common/services/MessageManager.h index 9115ff1..b925120 100644 --- a/windows/src/common/services/MessageManager.h +++ b/windows/src/common/services/MessageManager.h @@ -8,152 +8,151 @@ class MessageManagerService : public FLTService { public: - MessageManagerService(); + MessageManagerService(); - void onMethodCalled( - const std::string& method, - const flutter::EncodableMap* arguments, - std::shared_ptr> result); + virtual void onMethodCalled( + const std::string& method, const flutter::EncodableMap* arguments, + std::shared_ptr> result) + override; + + // Method handlers + void setAdvancedMsgListener( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void sendMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void revokeMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void editMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void deleteMessageFromLocalStorage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void deleteMessageFromLocalAndSvr( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void deleteAllMsgFromLocal( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void deleteAllMsgFromLocalAndSvr( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void insertSingleMessageToLocalStorage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void insertGroupMessageToLocalStorage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void markMessagesAsReadByMsgID( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void typingStatusUpdate( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createTextMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createTextAtMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createImageMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createImageMessageFromFullPath( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createSoundMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createSoundMessageFromFullPath( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createVideoMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createVideoMessageFromFullPath( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createFileMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createFileMessageFromFullPath( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createMergerMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createForwardMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createLocationMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createCustomMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createQuoteMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createCardMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createFaceMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createAdvancedTextMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createAdvancedQuoteMessage( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void searchLocalMessages( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void clearConversationAndDeleteAllMsg( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getAdvancedHistoryMessageList( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getAdvancedHistoryMessageListReverse( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void findMessageList( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void setMessageLocalEx( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void setAppBadge( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void sendMessageNotOss( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createImageMessageByURL( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createSoundMessageByURL( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createVideoMessageByURL( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void createFileMessageByURL( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void fetchSurroundingMessages( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void setCustomBusinessListener( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); - // Method handlers - void setAdvancedMsgListener( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void sendMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void revokeMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void editMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void deleteMessageFromLocalStorage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void deleteMessageFromLocalAndSvr( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void deleteAllMsgFromLocal( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void deleteAllMsgFromLocalAndSvr( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void insertSingleMessageToLocalStorage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void insertGroupMessageToLocalStorage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void markMessagesAsReadByMsgID( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void typingStatusUpdate( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createTextMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createTextAtMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createImageMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createImageMessageFromFullPath( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createSoundMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createSoundMessageFromFullPath( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createVideoMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createVideoMessageFromFullPath( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createFileMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createFileMessageFromFullPath( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createMergerMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createForwardMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createLocationMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createCustomMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createQuoteMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createCardMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createFaceMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createAdvancedTextMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createAdvancedQuoteMessage( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void searchLocalMessages( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void clearConversationAndDeleteAllMsg( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getAdvancedHistoryMessageList( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getAdvancedHistoryMessageListReverse( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void findMessageList( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void setMessageLocalEx( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void setAppBadge( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void sendMessageNotOss( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createImageMessageByURL( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createSoundMessageByURL( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createVideoMessageByURL( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void createFileMessageByURL( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void fetchSurroundingMessages( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void setCustomBusinessListener( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); -private: - std::string m_serviceName; }; #endif // MESSAGE_MANAGER_SERVICE_H \ No newline at end of file diff --git a/windows/src/common/services/UserManager.cpp b/windows/src/common/services/UserManager.cpp index 005137a..127b890 100644 --- a/windows/src/common/services/UserManager.cpp +++ b/windows/src/common/services/UserManager.cpp @@ -6,144 +6,160 @@ #include "Listen.h" UserManagerService::UserManagerService() { - m_serviceName = "userManager"; + m_serviceName = "userManager"; } void UserManagerService::onMethodCalled( - const std::string& method, - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (method == "setUserListener") { - setUserListener(arguments, result); - } else if (method == "getUsersInfo") { - getUsersInfo(arguments, result); - } else if (method == "setSelfInfo") { - setSelfInfo(arguments, result); - } else if (method == "getSelfUserInfo") { - getSelfUserInfo(arguments, result); - } else if (method == "subscribeUsersStatus") { - subscribeUsersStatus(arguments, result); - } else if (method == "unsubscribeUsersStatus") { - unsubscribeUsersStatus(arguments, result); - } else if (method == "getSubscribeUsersStatus") { - getSubscribeUsersStatus(arguments, result); - } else if (method == "getUserStatus") { - getUserStatus(arguments, result); - } else { - result->NotImplemented(); - } + const std::string& method, + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (method == "setUserListener") { + setUserListener(arguments, result); + } + else if (method == "getUsersInfo") { + getUsersInfo(arguments, result); + } + else if (method == "setSelfInfo") { + setSelfInfo(arguments, result); + } + else if (method == "getSelfUserInfo") { + getSelfUserInfo(arguments, result); + } + else if (method == "subscribeUsersStatus") { + subscribeUsersStatus(arguments, result); + } + else if (method == "unsubscribeUsersStatus") { + unsubscribeUsersStatus(arguments, result); + } + else if (method == "getSubscribeUsersStatus") { + getSubscribeUsersStatus(arguments, result); + } + else if (method == "getUserStatus") { + getUserStatus(arguments, result); + } + else { + result->NotImplemented(); + } } void UserManagerService::setUserListener( - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (arguments) { - set_user_listener(NewUserListenCallBack()); - result->Success(flutter::EncodableValue()); - } else { - result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); - } + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (arguments) { + set_user_listener(NewUserListenCallBack()); + result->Success(flutter::EncodableValue()); + } + else { + result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); + } } void UserManagerService::getUsersInfo( - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (arguments) { - auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); - auto userIDList = zego_value_get_string(arguments->at(flutter::EncodableValue("userIDList"))); - char* operationID_cs = const_cast(operationID.c_str()); - char* userIDList_cs = const_cast(userIDList.c_str()); - - get_users_info(NewBaseCallBack(result), operationID_cs, userIDList_cs); - } else { - result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); - } + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (arguments) { + auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); + auto userIDList = zego_value_get_string(arguments->at(flutter::EncodableValue("userIDList"))); + char* operationID_cs = const_cast(operationID.c_str()); + char* userIDList_cs = const_cast(userIDList.c_str()); + + get_users_info(NewBaseCallBack(result), operationID_cs, userIDList_cs); + } + else { + result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); + } } void UserManagerService::setSelfInfo( - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (arguments) { - auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); - auto userInfo = map_2_json(*arguments); - char* operationID_cs = const_cast(operationID.c_str()); - char* userInfo_cs = const_cast(userInfo.c_str()); - - set_self_info(NewBaseCallBack(result), operationID_cs, userInfo_cs); - } else { - result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); - } + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (arguments) { + auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); + auto userInfo = map_2_json(*arguments); + char* operationID_cs = const_cast(operationID.c_str()); + char* userInfo_cs = const_cast(userInfo.c_str()); + + set_self_info(NewBaseCallBack(result), operationID_cs, userInfo_cs); + } + else { + result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); + } } void UserManagerService::getSelfUserInfo( - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (arguments) { - auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); - char* operationID_cs = const_cast(operationID.c_str()); - - get_self_user_info(NewBaseCallBack(result), operationID_cs); - } else { - result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); - } + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (arguments) { + auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); + char* operationID_cs = const_cast(operationID.c_str()); + + get_self_user_info(NewBaseCallBack(result), operationID_cs); + } + else { + result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); + } } void UserManagerService::subscribeUsersStatus( - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (arguments) { - auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); - auto userIDs = zego_value_get_string(arguments->at(flutter::EncodableValue("userIDs"))); - char* operationID_cs = const_cast(operationID.c_str()); - char* userIDs_cs = const_cast(userIDs.c_str()); - - subscribe_users_status(NewBaseCallBack(result), operationID_cs, userIDs_cs); - } else { - result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); - } + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (arguments) { + auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); + auto userIDs = zego_value_get_string(arguments->at(flutter::EncodableValue("userIDs"))); + char* operationID_cs = const_cast(operationID.c_str()); + char* userIDs_cs = const_cast(userIDs.c_str()); + + subscribe_users_status(NewBaseCallBack(result), operationID_cs, userIDs_cs); + } + else { + result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); + } } void UserManagerService::unsubscribeUsersStatus( - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (arguments) { - auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); - auto userIDs = zego_value_get_string(arguments->at(flutter::EncodableValue("userIDs"))); - char* operationID_cs = const_cast(operationID.c_str()); - char* userIDs_cs = const_cast(userIDs.c_str()); - - unsubscribe_users_status(NewBaseCallBack(result), operationID_cs, userIDs_cs); - } else { - result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); - } + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (arguments) { + auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); + auto userIDs = zego_value_get_string(arguments->at(flutter::EncodableValue("userIDs"))); + char* operationID_cs = const_cast(operationID.c_str()); + char* userIDs_cs = const_cast(userIDs.c_str()); + + unsubscribe_users_status(NewBaseCallBack(result), operationID_cs, userIDs_cs); + } + else { + result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); + } } void UserManagerService::getSubscribeUsersStatus( - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (arguments) { - auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); - char* operationID_cs = const_cast(operationID.c_str()); - - get_subscribe_users_status(NewBaseCallBack(result), operationID_cs); - } else { - result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); - } + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (arguments) { + auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); + char* operationID_cs = const_cast(operationID.c_str()); + + get_subscribe_users_status(NewBaseCallBack(result), operationID_cs); + } + else { + result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); + } } void UserManagerService::getUserStatus( - const flutter::EncodableMap* arguments, - std::shared_ptr> result) { - if (arguments) { - auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); - auto userIDs = zego_value_get_string(arguments->at(flutter::EncodableValue("userIDs"))); - char* operationID_cs = const_cast(operationID.c_str()); - char* userIDs_cs = const_cast(userIDs.c_str()); - - get_user_status(NewBaseCallBack(result), operationID_cs, userIDs_cs); - } else { - result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); - } + const flutter::EncodableMap* arguments, + std::shared_ptr> result) { + if (arguments) { + auto operationID = zego_value_get_string(arguments->at(flutter::EncodableValue("operationID"))); + auto userIDs = zego_value_get_string(arguments->at(flutter::EncodableValue("userIDs"))); + char* operationID_cs = const_cast(operationID.c_str()); + char* userIDs_cs = const_cast(userIDs.c_str()); + + get_user_status(NewBaseCallBack(result), operationID_cs, userIDs_cs); + } + else { + result->Error("INVALID_ARGUMENT", "Arguments cannot be null"); + } } diff --git a/windows/src/common/services/UserManager.h b/windows/src/common/services/UserManager.h index 14d5c76..ded212c 100644 --- a/windows/src/common/services/UserManager.h +++ b/windows/src/common/services/UserManager.h @@ -9,41 +9,40 @@ class UserManagerService : public FLTService { public: - UserManagerService(); + UserManagerService(); - void onMethodCalled( - const std::string& method, - const flutter::EncodableMap* arguments, - std::shared_ptr> result); + virtual void onMethodCalled( + const std::string& method, const flutter::EncodableMap* arguments, + std::shared_ptr> result) + override; + + // Method handlers + void setUserListener( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getUsersInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void setSelfInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getSelfUserInfo( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void subscribeUsersStatus( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void unsubscribeUsersStatus( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getSubscribeUsersStatus( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); + void getUserStatus( + const flutter::EncodableMap* arguments, + std::shared_ptr> result); - // Method handlers - void setUserListener( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getUsersInfo( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void setSelfInfo( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getSelfUserInfo( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void subscribeUsersStatus( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void unsubscribeUsersStatus( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getSubscribeUsersStatus( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); - void getUserStatus( - const flutter::EncodableMap* arguments, - std::shared_ptr> result); -private: - std::string m_serviceName; }; #endif // USER_MANAGER_SERVICE_H \ No newline at end of file