15#import <Foundation/Foundation.h>
17#import "EMCommonDefs.h"
18#import "EMChatManagerDelegate.h"
19#import "EMConversation.h"
21#import "EMChatMessage.h"
22#import "EMTextMessageBody.h"
23#import "EMLocationMessageBody.h"
24#import "EMCmdMessageBody.h"
25#import "EMFileMessageBody.h"
26#import "EMImageMessageBody.h"
27#import "EMVoiceMessageBody.h"
28#import "EMVideoMessageBody.h"
29#import "EMCustomMessageBody.h"
30#import "EMCombineMessageBody.h"
31#import "EMCursorResult.h"
33#import "EMGroupMessageAck.h"
34#import "EMTranslateLanguage.h"
35#import "EMFetchServerMessagesOption.h"
36#import "EMConversationFilter.h"
45typedef NS_ENUM(NSUInteger, EMMessageFetchHistoryDirection) {
46 EMMessageFetchHistoryDirectionUp = 0,
47 EMMessageFetchHistoryDirectionDown
69#pragma mark - Delegate
85 delegateQueue:(dispatch_queue_t _Nullable)aQueue;
100#pragma mark - Conversation
144- (NSArray<
EMConversation *> * _Nullable)filterConversationsFromDB:(BOOL)cleanMemoryCache filter:(BOOL(^_Nullable)(
EMConversation * _Nonnull conversation))filter NS_SWIFT_NAME(filterConversationsFromDB(cleanMemoryCache:filter:));
190- (void)getConversationsFromServer:(
void (^_Nullable)(NSArray<
EMConversation *> * _Nullable aConversations,
EMError * _Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(4_0_0, "Use -
IEMChatManager getConversationsFromServerWithCursor:pageSize:completion");
207- (void)getConversationsFromServerByPage:(NSUInteger)pageNumber
208 pageSize:(NSUInteger)pageSize
209 completion:(
void (^_Nullable)(NSArray<
EMConversation *> * _Nullable aConversations,
EMError * _Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(4_0_0, "Use -
IEMChatManager getConversationsFromServerWithCursor:pageSize:completion");
233- (void)getConversationsFromServerWithCursor:(nullable NSString *)cursor pageSize:(UInt8)pageSize completion:(nonnull
void (^)(
EMCursorResult<
EMConversation *> * _Nullable result,
EMError * _Nullable error))completionBlock;
254- (void)getPinnedConversationsFromServerWithCursor:(nullable NSString *)cursor pageSize:(UInt8)limit completion:(nonnull
void (^)(
EMCursorResult<
EMConversation *> * _Nullable result,
EMError * _Nullable error))completionBlock;
275- (void)pinConversation:(nonnull NSString *)conversationId isPinned:(BOOL)isPinned completionBlock:(nullable
void(^)(
EMError * _Nullable error))completionBlock;
292- (
EMConversation *_Nullable)getConversationWithConvId:(NSString * _Nullable)aConversationId;
317- (
EMConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
318 type:(EMConversationType)aType
319 createIfNotExist:(BOOL)aIfCreate;
348- (
EMConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
349 type:(EMConversationType)aType
350 createIfNotExist:(BOOL)aIfCreate isThread:(BOOL)isThread;
372- (void)deleteConversation:(NSString * _Nonnull)aConversationId
373 isDeleteMessages:(BOOL)aIsDeleteMessages
374 completion:(
void (^_Nullable)(NSString * _Nullable aConversationId,
EMError *_Nullable aError))aCompletionBlock;
398 - (void)deleteServerConversation:(NSString * _Nonnull)aConversationId
399 conversationType:(EMConversationType)aConversationType
400 isDeleteServerMessages:(BOOL)aIsDeleteServerMessages
401 completion:(
void (^_Nullable)(NSString * _Nullable aConversationId,
EMError * _Nullable aError))aCompletionBlock;
423- (void)deleteConversations:(NSArray<
EMConversation *> * _Nullable)aConversations
424 isDeleteMessages:(BOOL)aIsDeleteMessages
425 completion:(
void (^_Nullable)(
EMError * _Nullable aError))aCompletionBlock;
442- (void)importConversations:(NSArray<
EMConversation *> * _Nullable)aConversations
443 completion:(
void (^ _Nullable)(
EMError * _Nullable aError))aCompletionBlock;
445#pragma mark - Message
461- (
EMChatMessage * _Nullable)getMessageWithMessageId:(NSString * _Nonnull)aMessageId;
482- (NSString * _Nullable)getMessageAttachmentPath:(NSString * _Nonnull)aConversationId;
498- (void)importMessages:(NSArray<
EMChatMessage *> * _Nonnull)aMessages
499 completion:(
void (^_Nullable)(
EMError *_Nullable aError))aCompletionBlock;
522 completion:(
void (^_Nullable)(
EMChatMessage * _Nullable aMessage,
EMError * _Nullable aError))aCompletionBlock;
542- (void)modifyMessage:(NSString *_Nonnull)messageId body:(
EMMessageBody *_Nonnull)body completion:(
void (^_Nonnull)(
EMError * _Nullable error,
EMChatMessage *_Nullable message))completionBlock;
564- (void)sendMessageReadAck:(NSString * _Nonnull)aMessageId
565 toUser:(NSString * _Nonnull)aUsername
566 completion:(
void (^_Nullable)(
EMError *_Nullable aError))aCompletionBlock;
591- (void)sendGroupMessageReadAck:(NSString * _Nonnull)aMessageId
592 toGroup:(NSString * _Nonnull)aGroupId
593 content:(NSString * _Nullable)aContent
594 completion:(
void (^_Nullable)(
EMError *_Nullable aError))aCompletionBlock;
629- (void)ackConversationRead:(NSString * _Nonnull)conversationId
630 completion:(
void (^_Nullable)(
EMError *_Nullable aError))aCompletionBlock;
650- (void)recallMessageWithMessageId:(NSString *_Nonnull)aMessageId
651 completion:(
void (^_Nullable)(
EMError *_Nullable aError))aCompletionBlock;
673- (void)recallMessageWithMessageId:(NSString *_Nonnull)aMessageId ext:(NSString * _Nullable)ext completion:(
void (^_Nonnull)(
EMError * _Nullable))aCompletionBlock;
694 progress:(
void (^_Nullable)(
int progress))aProgressBlock
695 completion:(
void (^_Nullable)(
EMChatMessage *_Nullable message,
EMError *_Nullable error))aCompletionBlock;
713 progress:(
void (^_Nullable)(
int progress))aProgressBlock
714 completion:(
void (^_Nullable)(
EMChatMessage *_Nullable message,
EMError *_Nullable error))aCompletionBlock;
735- (void)downloadMessageThumbnail:(
EMChatMessage *_Nonnull)aMessage
736 progress:(
void (^_Nullable)(
int progress))aProgressBlock
737 completion:(
void (^_Nullable)(
EMChatMessage *_Nullable message,
EMError *_Nullable error))aCompletionBlock;
762- (void)downloadMessageAttachment:(
EMChatMessage *_Nonnull)aMessage
763 progress:(
void (^_Nullable)(
int progress))aProgressBlock
764 completion:(
void (^_Nullable)(
EMChatMessage *_Nullable message,
EMError *_Nullable error))aCompletionBlock;
783- (void)downloadAndParseCombineMessage:(
EMChatMessage* _Nonnull)aMessage
784 completion:(
void (^_Nullable)(NSArray<
EMChatMessage *>*_Nullable messages,
EMError *_Nullable error))aCompletionBlock;
813 conversationType:(EMConversationType)aConversationType
814 startMessageId:(NSString *_Nullable)aStartMessageId
815 fetchDirection:(EMMessageFetchHistoryDirection)direction
816 pageSize:(
int)aPageSize
817 error:(
EMError **_Nullable)pError __deprecated_msg("Use -fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion: instead");
843 conversationType:(EMConversationType)aConversationType
844 startMessageId:(NSString *_Nullable)aStartMessageId
845 pageSize:(
int)aPageSize
846 error:(
EMError **_Nullable)pError __deprecated_msg("Use -fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion: instead");
873- (void)asyncFetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
874 conversationType:(EMConversationType)aConversationType
875 startMessageId:(NSString *_Nullable)aStartMessageId
876 pageSize:(
int)aPageSize
877 completion:(
void (^_Nullable)(
EMCursorResult<
EMChatMessage*> *_Nullable aResult,
EMError *_Nullable aError))aCompletionBlock __deprecated_msg("Use -fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion: instead");
904- (void)asyncFetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
905 conversationType:(EMConversationType)aConversationType
906 startMessageId:(NSString *_Nullable)aStartMessageId
907 fetchDirection:(EMMessageFetchHistoryDirection)direction
908 pageSize:(
int)aPageSize
909 completion:(
void (^_Nullable)(
EMCursorResult<
EMChatMessage*> *_Nullable aResult,
EMError *_Nullable aError))aCompletionBlock __deprecated_msg("Use -fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion: instead");
942- (void)asyncFetchGroupMessageAcksFromServer:(NSString *_Nonnull)aMessageId
943 groupId:(NSString *_Nonnull)aGroupId
944 startGroupAckId:(NSString *_Nonnull)aGroupAckId
945 pageSize:(
int)aPageSize
971- (void)reportMessageWithId:(NSString *_Nonnull )aMessageId
972 tag:(NSString *_Nonnull)aTag
973 reason:(NSString *_Nonnull)aReason
974 completion:(
void(^_Nullable)(
EMError* _Nullable error))aCompletion;
992- (void)deleteMessagesBefore:(NSUInteger)aTimestamp
993 completion:(
void(^)(
EMError*error))aCompletion;
1013- (void)removeMessagesFromServerWithConversation:(
EMConversation *_Nonnull)conversation messageIds:(NSArray <__kindof NSString*>*_Nonnull)messageIds completion:(
void (^ _Nullable)(
EMError * _Nullable aError))aCompletionBlock;
1030- (void)removeMessagesFromServerWithConversation:(
EMConversation *_Nonnull)conversation timeStamp:(NSTimeInterval)beforeTimeStamp completion:(
void (^ _Nullable)(
EMError * _Nullable aError))aCompletionBlock;
1049 targetLanguages:(NSArray<NSString*>* _Nonnull)aLanguages
1050 completion:(
void (^_Nullable)(
EMChatMessage * _Nullable message,
EMError * _Nullable error))aCompletionBlock;
1064- (void)fetchSupportedLanguages:(
void(^_Nullable)(NSArray<
EMTranslateLanguage*>* _Nullable languages,
EMError* _Nullable error))aCompletionBlock;
1102- (NSArray<
EMChatMessage *> * _Nullable)loadMessagesWithType:(EMMessageBodyType)aType
1103 timestamp:(
long long)aTimestamp
1105 fromUser:(NSString* _Nullable)aUsername
1106 searchDirection:(EMMessageSearchDirection)aDirection;
1138- (void)loadMessagesWithType:(EMMessageBodyType)aType
1139 timestamp:(
long long)aTimestamp
1141 fromUser:(NSString*)aUsername
1142 searchDirection:(EMMessageSearchDirection)aDirection
1175- (void)searchMessagesWithTypes:(NSArray <NSNumber*>* _Nonnull)aTypes
1176 timestamp:(
long long)aTimestamp
1178 fromUser:(NSString* _Nullable)aUsername
1179 searchDirection:(EMMessageSearchDirection)aDirection
1180 completion:(
void (^_Nonnull)(NSArray<
EMChatMessage *> * _Nullable aMessages,
EMError * _Nullable aError))aCompletionBlock;
1218- (NSArray<
EMChatMessage *> *)loadMessagesWithKeyword:(NSString*)aKeywords
1219 timestamp:(
long long)aTimestamp
1221 fromUser:(NSString*)aSender
1222 searchDirection:(EMMessageSearchDirection)aDirection;
1253- (void)loadMessagesWithKeyword:(NSString*)aKeywords
1254 timestamp:(
long long)aTimestamp
1256 fromUser:(NSString*)aSender
1257 searchDirection:(EMMessageSearchDirection)aDirection
1291- (void)loadMessagesWithKeyword:(NSString*)aKeywords
1292 timestamp:(
long long)aTimestamp
1294 fromUser:(NSString*)aSender
1295 searchDirection:(EMMessageSearchDirection)aDirection
1296 scope:(EMMessageSearchScope)aScope
1299NS_ASSUME_NONNULL_BEGIN
1315- (void)addReaction:(NSString *)reaction toMessage:(NSString *)messageId completion:(nullable
void(^)(
EMError * _Nullable))completion;
1332- (void)removeReaction:(NSString *)reaction fromMessage:(NSString *)messageId completion:(nullable
void(^)(
EMError * _Nullable))completion;
1351- (void)getReactionList:(NSArray <NSString *>*)messageIds
1352 groupId:(nullable NSString *)groupId
1353 chatType:(EMChatType)chatType
1375- (void)getReactionDetail:(NSString *)messageId
1376 reaction:(NSString *)reaction
1377 cursor:(nullable NSString *)cursor
1378 pageSize:(uint64_t)pageSize
1411- (void)fetchMessagesFromServerBy:(NSString* )conversationId
1412 conversationType:(EMConversationType)type
1413 cursor:(NSString* _Nullable)cursor
1414 pageSize:(NSUInteger)pageSize
1438- (void)addConversationMark:(NSArray<NSString*>* _Nonnull)conversationIds mark:(EMMarkType)mark completion:(
void (^_Nullable)(
EMError* _Nullable aError))completion;
1461- (void)removeConversationMark:(NSArray<NSString*>* _Nonnull)conversationIds mark:(EMMarkType)mark completion:(
void (^_Nullable)(
EMError* _Nullable aError))completion;
1503- (void)deleteAllMessagesAndConversations:(BOOL)clearServerData completion:(
void (^_Nullable)(
EMError * _Nullable aError))aCompletionBlock;
1518- (void)pinMessage:(NSString* _Nonnull)messageId completion:(
void (^_Nullable)(
EMChatMessage* _Nullable message,
EMError * _Nullable aError))aCompletionBlock;
1533- (void)unpinMessage:(NSString* _Nonnull)messageId completion:(
void (^_Nullable)(
EMChatMessage* _Nullable message,
EMError * _Nullable aError))aCompletionBlock;
1548- (void)getPinnedMessagesFromServer:(NSString* _Nonnull)conversationId completion:(
void (^_Nullable)(NSArray<
EMChatMessage*>* _Nullable messages,
EMError * _Nullable aError))aCompletionBlock;
1574- (void)getMessageCountWithCompletion:(
void (^)(NSInteger count,
EMError * _Nullable aError))completion;
1576NS_ASSUME_NONNULL_END
Definition: EMChatMessage.h:114
Definition: EMConversationFilter.h:22
Definition: EMConversation.h:115
Definition: EMCursorResult.h:27
Definition: EMFetchServerMessagesOption.h:23
Definition: EMGroupMessageAck.h:21
Definition: EMMessageBody.h:46
Definition: EMMessageReaction.h:21
Definition: EMTranslateLanguage.h:20
Definition: EMChatManagerDelegate.h:31
Definition: IEMChatManager.h:65
NSArray< EMConversation * > *_Nullable getAllConversations()
EMError * markAllConversationsAsRead()
void cleanConversationsMemoryCache()