HyphenateChatSDK 4.10.0
IEMChatManager.h
1
15#import <Foundation/Foundation.h>
16
17#import "EMCommonDefs.h"
18#import "EMChatManagerDelegate.h"
19#import "EMConversation.h"
20
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"
32
33#import "EMGroupMessageAck.h"
34#import "EMTranslateLanguage.h"
35#import "EMFetchServerMessagesOption.h"
36#import "EMConversationFilter.h"
37
45typedef NS_ENUM(NSUInteger, EMMessageFetchHistoryDirection) {
46 EMMessageFetchHistoryDirectionUp = 0,
47 EMMessageFetchHistoryDirectionDown
49};
50
51
52@class EMError;
53
65@protocol IEMChatManager <NSObject>
66
67@required
68
69#pragma mark - Delegate
70
84- (void)addDelegate:(id<EMChatManagerDelegate> _Nullable)aDelegate
85 delegateQueue:(dispatch_queue_t _Nullable)aQueue;
86
98- (void)removeDelegate:(id<EMChatManagerDelegate> _Nonnull)aDelegate;
99
100#pragma mark - Conversation
101
117- (NSArray<EMConversation *> * _Nullable)getAllConversations;
118
144- (NSArray<EMConversation *> * _Nullable)filterConversationsFromDB:(BOOL)cleanMemoryCache filter:(BOOL(^_Nullable)(EMConversation * _Nonnull conversation))filter NS_SWIFT_NAME(filterConversationsFromDB(cleanMemoryCache:filter:));
145
146
155
177- (NSArray<EMConversation *> * _Nullable)getAllConversations:(BOOL)isSort;
178
190- (void)getConversationsFromServer:(void (^_Nullable)(NSArray<EMConversation *> * _Nullable aConversations, EMError * _Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(4_0_0, "Use -IEMChatManager getConversationsFromServerWithCursor:pageSize:completion");
191
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;
234
254- (void)getPinnedConversationsFromServerWithCursor:(nullable NSString *)cursor pageSize:(UInt8)limit completion:(nonnull void (^)(EMCursorResult<EMConversation *> * _Nullable result, EMError * _Nullable error))completionBlock;
255
275- (void)pinConversation:(nonnull NSString *)conversationId isPinned:(BOOL)isPinned completionBlock:(nullable void(^)(EMError * _Nullable error))completionBlock;
276
292- (EMConversation *_Nullable)getConversationWithConvId:(NSString * _Nullable)aConversationId;
293
317- (EMConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
318 type:(EMConversationType)aType
319 createIfNotExist:(BOOL)aIfCreate;
320
348- (EMConversation *_Nullable)getConversation:(NSString *_Nonnull)aConversationId
349 type:(EMConversationType)aType
350 createIfNotExist:(BOOL)aIfCreate isThread:(BOOL)isThread;
351
372- (void)deleteConversation:(NSString * _Nonnull)aConversationId
373 isDeleteMessages:(BOOL)aIsDeleteMessages
374 completion:(void (^_Nullable)(NSString * _Nullable aConversationId, EMError *_Nullable aError))aCompletionBlock;
375
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;
402
423- (void)deleteConversations:(NSArray<EMConversation *> * _Nullable)aConversations
424 isDeleteMessages:(BOOL)aIsDeleteMessages
425 completion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
426
442- (void)importConversations:(NSArray<EMConversation *> * _Nullable)aConversations
443 completion:(void (^ _Nullable)(EMError * _Nullable aError))aCompletionBlock;
444
445#pragma mark - Message
446
461- (EMChatMessage * _Nullable)getMessageWithMessageId:(NSString * _Nonnull)aMessageId;
462
482- (NSString * _Nullable)getMessageAttachmentPath:(NSString * _Nonnull)aConversationId;
483
498- (void)importMessages:(NSArray<EMChatMessage *> * _Nonnull)aMessages
499 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
500
521- (void)updateMessage:(EMChatMessage *_Nonnull)aMessage
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;
543
564- (void)sendMessageReadAck:(NSString * _Nonnull)aMessageId
565 toUser:(NSString * _Nonnull)aUsername
566 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
567
568
591- (void)sendGroupMessageReadAck:(NSString * _Nonnull)aMessageId
592 toGroup:(NSString * _Nonnull)aGroupId
593 content:(NSString * _Nullable)aContent
594 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
595
629- (void)ackConversationRead:(NSString * _Nonnull)conversationId
630 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
631
650- (void)recallMessageWithMessageId:(NSString *_Nonnull)aMessageId
651 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
652
673- (void)recallMessageWithMessageId:(NSString *_Nonnull)aMessageId ext:(NSString * _Nullable)ext completion:(void (^_Nonnull)(EMError * _Nullable))aCompletionBlock;
693- (void)sendMessage:(EMChatMessage *_Nonnull)aMessage
694 progress:(void (^_Nullable)(int progress))aProgressBlock
695 completion:(void (^_Nullable)(EMChatMessage *_Nullable message, EMError *_Nullable error))aCompletionBlock;
696
712- (void)resendMessage:(EMChatMessage *_Nonnull)aMessage
713 progress:(void (^_Nullable)(int progress))aProgressBlock
714 completion:(void (^_Nullable)(EMChatMessage *_Nullable message, EMError *_Nullable error))aCompletionBlock;
715
735- (void)downloadMessageThumbnail:(EMChatMessage *_Nonnull)aMessage
736 progress:(void (^_Nullable)(int progress))aProgressBlock
737 completion:(void (^_Nullable)(EMChatMessage *_Nullable message, EMError *_Nullable error))aCompletionBlock;
738
762- (void)downloadMessageAttachment:(EMChatMessage *_Nonnull)aMessage
763 progress:(void (^_Nullable)(int progress))aProgressBlock
764 completion:(void (^_Nullable)(EMChatMessage *_Nullable message, EMError *_Nullable error))aCompletionBlock;
765
783- (void)downloadAndParseCombineMessage:(EMChatMessage* _Nonnull)aMessage
784 completion:(void (^_Nullable)(NSArray<EMChatMessage *>*_Nullable messages, EMError *_Nullable error))aCompletionBlock;
785
812- (EMCursorResult<EMChatMessage*> *_Nullable)fetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
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");
842- (EMCursorResult<EMChatMessage*> *_Nullable)fetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
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");
847
848
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");
910
911
912
913
942- (void)asyncFetchGroupMessageAcksFromServer:(NSString *_Nonnull)aMessageId
943 groupId:(NSString *_Nonnull)aGroupId
944 startGroupAckId:(NSString *_Nonnull)aGroupAckId
945 pageSize:(int)aPageSize
946 completion:(void (^_Nullable)(EMCursorResult<EMGroupMessageAck *> *_Nullable aResult, EMError *_Nullable error, int totalCount))aCompletionBlock;
947
971- (void)reportMessageWithId:(NSString *_Nonnull )aMessageId
972 tag:(NSString *_Nonnull)aTag
973 reason:(NSString *_Nonnull)aReason
974 completion:(void(^_Nullable)(EMError* _Nullable error))aCompletion;
975
992- (void)deleteMessagesBefore:(NSUInteger)aTimestamp
993 completion:(void(^)(EMError*error))aCompletion;
994
995
996
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;
1031
1032
1048- (void)translateMessage:(EMChatMessage * _Nonnull)aMessage
1049 targetLanguages:(NSArray<NSString*>* _Nonnull)aLanguages
1050 completion:(void (^_Nullable)(EMChatMessage * _Nullable message, EMError * _Nullable error))aCompletionBlock;
1051
1064- (void)fetchSupportedLanguages:(void(^_Nullable)(NSArray<EMTranslateLanguage*>* _Nullable languages,EMError* _Nullable error))aCompletionBlock;
1065
1102- (NSArray<EMChatMessage *> * _Nullable)loadMessagesWithType:(EMMessageBodyType)aType
1103 timestamp:(long long)aTimestamp
1104 count:(int)aCount
1105 fromUser:(NSString* _Nullable)aUsername
1106 searchDirection:(EMMessageSearchDirection)aDirection;
1107
1138- (void)loadMessagesWithType:(EMMessageBodyType)aType
1139 timestamp:(long long)aTimestamp
1140 count:(int)aCount
1141 fromUser:(NSString*)aUsername
1142 searchDirection:(EMMessageSearchDirection)aDirection
1143 completion:(void (^)(NSArray<EMChatMessage *> *aMessages, EMError *aError))aCompletionBlock;
1144
1175- (void)searchMessagesWithTypes:(NSArray <NSNumber*>* _Nonnull)aTypes
1176 timestamp:(long long)aTimestamp
1177 count:(int)aCount
1178 fromUser:(NSString* _Nullable)aUsername
1179 searchDirection:(EMMessageSearchDirection)aDirection
1180 completion:(void (^_Nonnull)(NSArray<EMChatMessage *> * _Nullable aMessages, EMError * _Nullable aError))aCompletionBlock;
1181
1218- (NSArray<EMChatMessage *> *)loadMessagesWithKeyword:(NSString*)aKeywords
1219 timestamp:(long long)aTimestamp
1220 count:(int)aCount
1221 fromUser:(NSString*)aSender
1222 searchDirection:(EMMessageSearchDirection)aDirection;
1223
1253- (void)loadMessagesWithKeyword:(NSString*)aKeywords
1254 timestamp:(long long)aTimestamp
1255 count:(int)aCount
1256 fromUser:(NSString*)aSender
1257 searchDirection:(EMMessageSearchDirection)aDirection
1258 completion:(void (^)(NSArray<EMChatMessage *> *aMessages, EMError *aError))aCompletionBlock;
1259
1291- (void)loadMessagesWithKeyword:(NSString*)aKeywords
1292 timestamp:(long long)aTimestamp
1293 count:(int)aCount
1294 fromUser:(NSString*)aSender
1295 searchDirection:(EMMessageSearchDirection)aDirection
1296 scope:(EMMessageSearchScope)aScope
1297 completion:(void (^)(NSArray<EMChatMessage *> *aMessages, EMError *aError))aCompletionBlock;
1298
1299NS_ASSUME_NONNULL_BEGIN
1315- (void)addReaction:(NSString *)reaction toMessage:(NSString *)messageId completion:(nullable void(^)(EMError * _Nullable))completion;
1316
1332- (void)removeReaction:(NSString *)reaction fromMessage:(NSString *)messageId completion:(nullable void(^)(EMError * _Nullable))completion;
1333
1351- (void)getReactionList:(NSArray <NSString *>*)messageIds
1352 groupId:(nullable NSString *)groupId
1353 chatType:(EMChatType)chatType
1354 completion:(void (^)(NSDictionary <NSString *, NSArray<EMMessageReaction *> *> *, EMError * _Nullable))completion;
1355
1375- (void)getReactionDetail:(NSString *)messageId
1376 reaction:(NSString *)reaction
1377 cursor:(nullable NSString *)cursor
1378 pageSize:(uint64_t)pageSize
1379 completion:(void (^)(EMMessageReaction *, NSString * _Nullable cursor, EMError * _Nullable))completion;
1380
1411- (void)fetchMessagesFromServerBy:(NSString* )conversationId
1412 conversationType:(EMConversationType)type
1413 cursor:(NSString* _Nullable)cursor
1414 pageSize:(NSUInteger)pageSize
1415 option:(EMFetchServerMessagesOption* _Nullable)option
1416 completion:(void (^_Nullable)(EMCursorResult<EMChatMessage*>* _Nullable result, EMError* _Nullable aError))aCompletionBlock;
1417
1438- (void)addConversationMark:(NSArray<NSString*>* _Nonnull)conversationIds mark:(EMMarkType)mark completion:(void (^_Nullable)(EMError* _Nullable aError))completion;
1439
1461- (void)removeConversationMark:(NSArray<NSString*>* _Nonnull)conversationIds mark:(EMMarkType)mark completion:(void (^_Nullable)(EMError* _Nullable aError))completion;
1462
1479- (void)getConversationsFromServerWithCursor:(NSString * _Nullable)cursor filter:(EMConversationFilter* _Nonnull)filter completion:(nonnull void (^)(EMCursorResult<EMConversation *> * _Nullable result, EMError * _Nullable error))completionBlock;
1480
1503- (void)deleteAllMessagesAndConversations:(BOOL)clearServerData completion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
1504
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;
1534
1548- (void)getPinnedMessagesFromServer:(NSString* _Nonnull)conversationId completion:(void (^_Nullable)(NSArray<EMChatMessage*>* _Nullable messages,EMError * _Nullable aError))aCompletionBlock;
1549
1562
1574- (void)getMessageCountWithCompletion:(void (^)(NSInteger count, EMError * _Nullable aError))completion;
1575
1576NS_ASSUME_NONNULL_END
1577
1578@end
Definition: EMChatMessage.h:114
Definition: EMConversationFilter.h:22
Definition: EMConversation.h:115
Definition: EMCursorResult.h:27
Definition: EMError.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()