9#import <Foundation/Foundation.h>
11#import "AgoraChatCommonDefs.h"
12#import "AgoraChatManagerDelegate.h"
13#import "AgoraChatConversation.h"
15#import "AgoraChatMessage.h"
16#import "AgoraChatTextMessageBody.h"
17#import "AgoraChatLocationMessageBody.h"
18#import "AgoraChatCmdMessageBody.h"
19#import "AgoraChatFileMessageBody.h"
20#import "AgoraChatImageMessageBody.h"
21#import "AgoraChatVoiceMessageBody.h"
22#import "AgoraChatVideoMessageBody.h"
23#import "AgoraChatCustomMessageBody.h"
24#import "AgoraChatCombineMessageBody.h"
25#import "AgoraChatCursorResult.h"
27#import "AgoraChatGroupMessageAck.h"
28#import "AgoraChatTranslateLanguage.h"
29#import "AgoraChatFetchServerMessagesOption.h"
30#import "AgoraChatConversationFilter.h"
36typedef NS_ENUM(NSUInteger, AgoraChatMessageFetchHistoryDirection) {
37 AgoraChatMessageFetchHistoryDirectionUp = 0,
38 AgoraChatMessageFetchHistoryDirectionDown
55#pragma mark - Delegate
65 delegateQueue:(dispatch_queue_t _Nullable)aQueue;
75#pragma mark - Conversation
100- (NSArray<
AgoraChatConversation *> * _Nullable)filterConversationsFromDB:(BOOL)cleanMemoryCache filter:(BOOL(^_Nullable)(
AgoraChatConversation * _Nonnull conversation))filter NS_SWIFT_NAME(filterConversationsFromDB(cleanMemoryCache:filter:));
128- (void)getConversationsFromServer:(
void (^_Nullable)(NSArray<
AgoraChatConversation *> * _Nullable aConversations,
AgoraChatError * _Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(4_0_0, "Use -
IAgoraChatManager getConversationsFromServerWithCursor:pageSize:completion");
138- (void)getConversationsFromServerByPage:(NSUInteger)pageNumber
139 pageSize:(NSUInteger)pageSize
177- (void)pinConversation:(nonnull NSString *)conversationId isPinned:(BOOL)isPinned completionBlock:(nullable
void(^)(
AgoraChatError * _Nullable error))completionBlock;
202 type:(AgoraChatConversationType)aType
203 createIfNotExist:(BOOL)aIfCreate;
220 type:(AgoraChatConversationType)aType
221 createIfNotExist:(BOOL)aIfCreate isThread:(BOOL)isThread;
234- (void)deleteConversation:(NSString * _Nonnull)aConversationId
235 isDeleteMessages:(BOOL)aIsDeleteMessages
236 completion:(
void (^_Nullable)(NSString * _Nullable aConversationId,
AgoraChatError *_Nullable aError))aCompletionBlock;
250 - (void)deleteServerConversation:(NSString * _Nonnull)aConversationId
251 conversationType:(AgoraChatConversationType)aConversationType
252 isDeleteServerMessages:(BOOL)aIsDeleteServerMessages
253 completion:(
void (^_Nullable)(NSString * _Nullable aConversationId,
AgoraChatError * _Nullable aError))aCompletionBlock;
267 isDeleteMessages:(BOOL)aIsDeleteMessages
268 completion:(
void (^_Nullable)(
AgoraChatError * _Nullable aError))aCompletionBlock;
279 completion:(
void (^ _Nullable)(
AgoraChatError * _Nullable aError))aCompletionBlock;
281#pragma mark - Message
290- (
AgoraChatMessage * _Nullable)getMessageWithMessageId:(NSString * _Nonnull)aMessageId;
302- (NSString * _Nullable)getMessageAttachmentPath:(NSString * _Nonnull)aConversationId;
313 completion:(
void (^_Nullable)(
AgoraChatError *_Nullable aError))aCompletionBlock;
353- (void)sendMessageReadAck:(NSString * _Nonnull)aMessageId
354 toUser:(NSString * _Nonnull)aUsername
355 completion:(
void (^_Nullable)(
AgoraChatError *_Nullable aError))aCompletionBlock;
370- (void)sendGroupMessageReadAck:(NSString * _Nonnull)aMessageId
371 toGroup:(NSString * _Nonnull)aGroupId
372 content:(NSString * _Nullable)aContent
373 completion:(
void (^_Nullable)(
AgoraChatError *_Nullable aError))aCompletionBlock;
391- (void)ackConversationRead:(NSString * _Nonnull)conversationId
392 completion:(
void (^_Nullable)(
AgoraChatError *_Nullable aError))aCompletionBlock;
404- (void)recallMessageWithMessageId:(NSString *_Nonnull)aMessageId
405 completion:(
void (^_Nullable)(
AgoraChatError *_Nullable aError))aCompletionBlock;
418- (void)recallMessageWithMessageId:(NSString *_Nonnull)aMessageId ext:(NSString * _Nullable)ext completion:(
void (^_Nonnull)(
AgoraChatError * _Nullable))aCompletionBlock;
430 progress:(
void (^_Nullable)(
int progress))aProgressBlock
442 progress:(
void (^_Nullable)(
int progress))aProgressBlock
456 progress:(
void (^_Nullable)(
int progress))aProgressBlock
472 progress:(
void (^_Nullable)(
int progress))aProgressBlock
501 conversationType:(AgoraChatConversationType)aConversationType
502 startMessageId:(NSString *_Nullable)aStartMessageId
503 fetchDirection:(AgoraChatMessageFetchHistoryDirection)direction
504 pageSize:(
int)aPageSize
505 error:(
AgoraChatError **_Nullable)pError __deprecated_msg("Use -fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion: instead");
519 conversationType:(AgoraChatConversationType)aConversationType
520 startMessageId:(NSString *_Nullable)aStartMessageId
521 pageSize:(
int)aPageSize
522 error:(
AgoraChatError **_Nullable)pError __deprecated_msg("Use -fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion: instead");
537- (void)asyncFetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
538 conversationType:(AgoraChatConversationType)aConversationType
539 startMessageId:(NSString *_Nullable)aStartMessageId
540 pageSize:(
int)aPageSize
541 completion:(
void (^_Nullable)(
AgoraChatCursorResult<
AgoraChatMessage*> *_Nullable aResult,
AgoraChatError *_Nullable aError))aCompletionBlock __deprecated_msg("Use -fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion: instead");
555- (void)asyncFetchHistoryMessagesFromServer:(NSString *_Nonnull)aConversationId
556 conversationType:(AgoraChatConversationType)aConversationType
557 startMessageId:(NSString *_Nullable)aStartMessageId
558 fetchDirection:(AgoraChatMessageFetchHistoryDirection)direction
559 pageSize:(
int)aPageSize
560 completion:(
void (^_Nullable)(
AgoraChatCursorResult<
AgoraChatMessage*> *_Nullable aResult,
AgoraChatError *_Nullable aError))aCompletionBlock __deprecated_msg("Use -fetchMessagesFromServerBy:conversationType:cursor:pageSize:option:completion: instead");
579- (void)asyncFetchGroupMessageAcksFromServer:(NSString *_Nonnull)aMessageId
580 groupId:(NSString *_Nonnull)aGroupId
581 startGroupAckId:(NSString *_Nonnull)aGroupAckId
582 pageSize:(
int)aPageSize
596- (void)reportMessageWithId:(NSString *_Nonnull )aMessageId
597 tag:(NSString *_Nonnull)aTag
598 reason:(NSString *_Nonnull)aReason
599 completion:(
void(^_Nullable)(
AgoraChatError* _Nullable error))aCompletion;
609- (void)deleteMessagesBefore:(NSUInteger)aTimestamp
623- (void)removeMessagesFromServerWithConversation:(
AgoraChatConversation *_Nonnull)conversation messageIds:(NSArray <__kindof NSString*>*_Nonnull)messageIds completion:(
void (^ _Nullable)(
AgoraChatError * _Nullable aError))aCompletionBlock;
633- (void)removeMessagesFromServerWithConversation:(
AgoraChatConversation *_Nonnull)conversation timeStamp:(NSTimeInterval)beforeTimeStamp completion:(
void (^ _Nullable)(
AgoraChatError * _Nullable aError))aCompletionBlock;
645 targetLanguages:(NSArray<NSString*>* _Nonnull)aLanguages
676- (NSArray<
AgoraChatMessage *> * _Nullable)loadMessagesWithType:(AgoraChatMessageBodyType)aType
677 timestamp:(
long long)aTimestamp
679 fromUser:(NSString* _Nullable)aUsername
680 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
698- (void)loadMessagesWithType:(AgoraChatMessageBodyType)aType
699 timestamp:(
long long)aTimestamp
701 fromUser:(NSString*)aUsername
702 searchDirection:(AgoraChatMessageSearchDirection)aDirection
721- (void)searchMessagesWithTypes:(NSArray <NSNumber*>* _Nonnull)aTypes
722 timestamp:(
long long)aTimestamp
724 fromUser:(NSString* _Nullable)aUsername
725 searchDirection:(AgoraChatMessageSearchDirection)aDirection
747- (NSArray<
AgoraChatMessage *> *)loadMessagesWithKeyword:(NSString*)aKeywords
748 timestamp:(
long long)aTimestamp
750 fromUser:(NSString*)aSender
751 searchDirection:(AgoraChatMessageSearchDirection)aDirection;
768- (void)loadMessagesWithKeyword:(NSString*)aKeywords
769 timestamp:(
long long)aTimestamp
771 fromUser:(NSString*)aSender
772 searchDirection:(AgoraChatMessageSearchDirection)aDirection
791- (void)loadMessagesWithKeyword:(NSString*)aKeywords
792 timestamp:(
long long)aTimestamp
794 fromUser:(NSString*)aSender
795 searchDirection:(AgoraChatMessageSearchDirection)aDirection
796 scope:(AgoraChatMessageSearchScope)aScope
799NS_ASSUME_NONNULL_BEGIN
808- (void)addReaction:(NSString *)reaction toMessage:(NSString *)messageId completion:(nullable
void(^)(
AgoraChatError * _Nullable))completion;
818- (void)removeReaction:(NSString *)reaction fromMessage:(NSString *)messageId completion:(nullable
void(^)(
AgoraChatError * _Nullable))completion;
829- (void)getReactionList:(NSArray <NSString *>*)messageIds
830 groupId:(nullable NSString *)groupId
831 chatType:(AgoraChatType)chatType
844- (void)getReactionDetail:(NSString *)messageId
845 reaction:(NSString *)reaction
846 cursor:(nullable NSString *)cursor
847 pageSize:(uint64_t)pageSize
866- (void)fetchMessagesFromServerBy:(NSString* )conversationId
867 conversationType:(AgoraChatConversationType)type
868 cursor:(NSString* _Nullable)cursor
869 pageSize:(NSUInteger)pageSize
884- (void)addConversationMark:(NSArray<NSString*>* _Nonnull)conversationIds mark:(AgoraChatMarkType)mark completion:(
void (^_Nullable)(
AgoraChatError* _Nullable aError))completion;
898- (void)removeConversationMark:(NSArray<NSString*>* _Nonnull)conversationIds mark:(AgoraChatMarkType)mark completion:(
void (^_Nullable)(
AgoraChatError* _Nullable aError))completion;
923- (void)deleteAllMessagesAndConversations:(BOOL)clearServerData completion:(
void (^_Nullable)(
AgoraChatError * _Nullable aError))aCompletionBlock;
932- (void)pinMessage:(NSString* _Nonnull)messageId completion:(
void (^_Nullable)(
AgoraChatMessage* _Nullable message,
AgoraChatError * _Nullable aError))aCompletionBlock;
941- (void)unpinMessage:(NSString* _Nonnull)messageId completion:(
void (^_Nullable)(
AgoraChatMessage* _Nullable message,
AgoraChatError * _Nullable aError))aCompletionBlock;
950- (void)getPinnedMessagesFromServer:(NSString* _Nonnull)conversationId completion:(
void (^_Nullable)(NSArray<
AgoraChatMessage*>* _Nullable messages,
AgoraChatError * _Nullable aError))aCompletionBlock;
966- (void)getMessageCountWithCompletion:(
void (^)(NSInteger count,
AgoraChatError * _Nullable aError))completion;
Definition: AgoraChatConversationFilter.h:19
Definition: AgoraChatConversation.h:87
Definition: AgoraChatCursorResult.h:16
Definition: AgoraChatError.h:18
Definition: AgoraChatFetchServerMessagesOption.h:20
Definition: AgoraChatGroupMessageAck.h:18
Definition: AgoraChatMessageBody.h:33
Definition: AgoraChatMessage.h:87
Definition: AgoraChatMessageReaction.h:18
Definition: AgoraChatTranslateLanguage.h:17
Definition: AgoraChatManagerDelegate.h:22
Definition: IAgoraChatManager.h:51
void cleanConversationsMemoryCache()
AgoraChatError * markAllConversationsAsRead()
NSArray< AgoraChatConversation * > *_Nullable getAllConversations()