#import <AgoraChatConversation.h>
◆ appendMessage:error:
Inserts a message to the end of a conversation in local database. The conversationId of the message should be the same as the conversationId of the conversation in order to insert the message into the conversation correctly.
- Parameters
-
aMessage | The message instance. |
pError | The error information if the method fails: Error. |
◆ deleteAllMessages:
Deletes all messages of the conversation from memory cache and local database.
- Parameters
-
pError | The error information if the method fails: Error. |
◆ deleteMessageWithId:error:
- (void) deleteMessageWithId: |
|
(NSString *_Nonnull) |
aMessageId |
error: |
|
(AgoraChatError **_Nullable) |
pError |
|
|
| |
Deletes a message.
- Parameters
-
aMessageId | The ID of the message to be deleted. |
pError | The error information if the method fails: Error. |
◆ insertMessage:error:
Inserts a message to a conversation in local database and SDK will update the last message automatically.
The conversation ID of the message should be the same as conversation ID of the conversation in order to insert the message into the conversation correctly. The inserting message will be inserted based on timestamp.
Method AgoraChatConversation insertMessage:error: = AgoraChatManager importMsessage:completion: + update conversation latest message
- Parameters
-
aMessage | The message instance. |
pError | The error information if the method fails: Error. |
◆ lastReceivedMessage
Gets the last received message.
- Returns
- The message instance.
◆ loadCustomMsgWithKeyword:timestamp:count:fromUser:searchDirection:
- (NSArray< AgoraChatMessage * > *_Nullable) loadCustomMsgWithKeyword: |
|
(NSString *) |
aKeyword |
timestamp: |
|
(long long) |
aTimestamp |
count: |
|
(int) |
aCount |
fromUser: |
|
(NSString *_Nullable) |
aSender |
searchDirection: |
|
(AgoraChatMessageSearchDirection) |
aDirection |
|
|
| |
Loads custom messages with specified keyword from local database. The returning messages are sorted by receiving timestamp based on AgoraChatMessageSearchDirection. If the reference timestamp is negative, load from the latest messages; if message count is negative, will be handled as count=1.
This is a synchronous method and blocks the current thread.
- Parameters
-
aKeyword | The search keyword. If aKeyword=nil, ignore. |
aTimestamp | The load based on reference timestamp. If aTimestamp=-1, will load from the most recent (the latest) message |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aSender | The user that sends the message. Setting it as NIL means that the SDK ignores this parameter. |
aDirection | The message search direction. AgoraChatMessageSearchDirectionUp: get aCount of messages before aMessageId; AgoraChatMessageSearchDirectionDown: get aCount of messages after aMessageId * -— |
- Returns
- AgoraChatMessage The message list.
◆ loadCustomMsgWithKeyword:timestamp:count:fromUser:searchDirection:completion:
- (void) loadCustomMsgWithKeyword: |
|
(NSString *_Nullable) |
aKeyword |
timestamp: |
|
(long long) |
aTimestamp |
count: |
|
(int) |
aCount |
fromUser: |
|
(NSString *_Nullable) |
aSender |
searchDirection: |
|
(AgoraChatMessageSearchDirection) |
aDirection |
completion: |
|
(void(^)(NSArray< AgoraChatMessage * > *_Nullable aMessages, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Loads custom messages with specified keyword from local database. returning messages are sorted by receiving timestamp based on AgoraChatMessageSearchDirection. If reference timestamp is negative, load from the latest messages; if message count is negative, will be handled as count=1
- Parameters
-
aKeyword | The keyword for searching the messages. Setting it as NIL means that the SDK ignores this parameter. |
aTimestamp | The reference Unix timestamp for the messages to be loaded. If you set this parameter as a negative value, the SDK loads messages from the latest. |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aSender | The user that sends the message. Setting it as NIL means that the SDK ignores this parameter. |
aDirection | The message search direction: AgoraChatMessageSearchDirection. AgoraChatMessageSearchDirectionUp: get aCount of messages before aMessageId; AgoraChatMessageSearchDirectionDown: get aCount of messages after aMessageId * -— |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ loadMessagesFrom:to:count:
- (NSArray< AgoraChatMessage * > *_Nullable) loadMessagesFrom: |
|
(long long) |
aStartTimestamp |
to: |
|
(long long) |
aEndTimestamp |
count: |
|
(int) |
aCount |
|
|
| |
Loads messages within specified time range from local database. Returning messages are sorted by sending timestamp.
This is a synchronous method and blocks the current thread.
- Parameters
-
aStartTimestamp | The starting timestamp in miliseconds. |
aEndTimestamp | The ending timestamp in miliseconds. |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
- Returns
- AgoraChatMessage The message list.
◆ loadMessagesFrom:to:count:completion:
- (void) loadMessagesFrom: |
|
(long long) |
aStartTimestamp |
to: |
|
(long long) |
aEndTimestamp |
count: |
|
(int) |
aCount |
completion: |
|
(void(^)(NSArray< AgoraChatMessage * > *_Nullable aMessages, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Loads messages within specified time range from local database. Returning messages are sorted by sending timestamp.
- Parameters
-
aStartTimestamp | The starting timestamp in miliseconds. |
aEndTimestamp | The ending timestamp in miliseconds. |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ loadMessagesStartFromId:count:searchDirection:
- (NSArray< AgoraChatMessage * > *_Nullable) loadMessagesStartFromId: |
|
(NSString *_Nullable) |
aMessageId |
count: |
|
(int) |
aCount |
searchDirection: |
|
(AgoraChatMessageSearchDirection) |
aDirection |
|
|
| |
Loads messages starting from the specified message id from local database.
This method returns messages in the sequence of the timestamp when they are received.
This is a synchronous method and blocks the current thread.
- Parameters
-
aMessageId | The specified message ID. |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aDirection | The message search direction: AgoraChatMessageSearchDirection. AgoraChatMessageSearchDirectionUp: get aCount of messages before aMessageId; AgoraChatMessageSearchDirectionDown: get aCount of messages after aMessageId |
- Returns
- AgoraChatMessage The message instance.
◆ loadMessagesStartFromId:count:searchDirection:completion:
- (void) loadMessagesStartFromId: |
|
(NSString *_Nullable) |
aMessageId |
count: |
|
(int) |
aCount |
searchDirection: |
|
(AgoraChatMessageSearchDirection) |
aDirection |
completion: |
|
(void(^)(NSArray< AgoraChatMessage * > *_Nullable aMessages, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Loads messages starting from the specified message ID from local database.
Returning messages are sorted by receiving timestamp based on AgoraChatMessageSearchDirection. If the aMessageId is nil, will return starting from the latest message.
- Parameters
-
aMessageId | The specified message ID loading messages start from. |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aDirection | The message search direction: AgoraChatMessageSearchDirection. AgoraChatMessageSearchDirectionUp: get aCount of messages before the timestamp of the specified message ID; AgoraChatMessageSearchDirectionDown: get aCount of messages after the timestamp of the specified message ID. |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ loadMessagesWithKeyword:timestamp:count:fromUser:searchDirection:
- (NSArray< AgoraChatMessage * > *_Nullable) loadMessagesWithKeyword: |
|
(NSString *_Nullable) |
aKeyword |
timestamp: |
|
(long long) |
aTimestamp |
count: |
|
(int) |
aCount |
fromUser: |
|
(NSString *_Nullable) |
aSender |
searchDirection: |
|
(AgoraChatMessageSearchDirection) |
aDirection |
|
|
| |
Loads messages with specified keyword from local database, returning messages are sorted by receiving timestamp based on AgoraChatMessageSearchDirection. If reference timestamp is negative, load from the latest messages; if message count is negative, will be handled as count=1
This is a synchronous method and blocks the current thread.
- Parameters
-
aKeyword | The keyword for searching the messages. Setting it as NIL means that the SDK ignores this parameter. |
aTimestamp | The reference timestamp for the messages to be loaded. If you set this parameter as a negative value, the SDK loads messages from the latest. |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aSender | The message sender (optional). If the parameter is nil, ignore. |
aDirection | The message search direction: AgoraChatMessageSearchDirection. AgoraChatMessageSearchDirectionUp: get aCount of messages before aMessageId; AgoraChatMessageSearchDirectionDown: get aCount of messages after aMessageId * -— |
- Returns
- AgoraChatMessage The message list.
◆ loadMessagesWithKeyword:timestamp:count:fromUser:searchDirection:completion:
- (void) loadMessagesWithKeyword: |
|
(NSString *_Nullable) |
aKeyword |
timestamp: |
|
(long long) |
aTimestamp |
count: |
|
(int) |
aCount |
fromUser: |
|
(NSString *_Nullable) |
aSender |
searchDirection: |
|
(AgoraChatMessageSearchDirection) |
aDirection |
completion: |
|
(void(^)(NSArray< AgoraChatMessage * > *_Nullable aMessages, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Loads messages with specified keyword from local database. Returning messages are sorted by receiving timestamp based on AgoraChatMessageSearchDirection. If reference timestamp is negative, load from the latest messages; if message count is negative, will be handled as count=1
- Parameters
-
aKeyword | The search keyword. If aKeyword=nil, ignore. |
aTimestamp | The load based on reference timestamp. If aTimestamp=-1, will load from the most recent (the latest) message |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aSender | The message sender (optional). If the parameter is nil, ignore. |
aDirection | The message search direction. AgoraChatMessageSearchDirectionUp: get aCount of messages before aMessageId; AgoraChatMessageSearchDirectionDown: get aCount of messages after aMessageId * -— |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ loadMessagesWithType:timestamp:count:fromUser:searchDirection:
- (NSArray< AgoraChatMessage * > *_Nullable) loadMessagesWithType: |
|
(AgoraChatMessageBodyType) |
aType |
timestamp: |
|
(long long) |
aTimestamp |
count: |
|
(int) |
aCount |
fromUser: |
|
(NSString *_Nullable) |
aUsername |
searchDirection: |
|
(AgoraChatMessageSearchDirection) |
aDirection |
|
|
| |
Loads messages with specified message type from local database. Returning messages are sorted by receiving timestamp based on AgoraChatMessageSearchDirection.
This is a synchronous method and blocks the current thread.
- Parameters
-
aType | The message type to load. Type includes txt : text msg, img : image msg, loc: location msg, audio: audio msg, video: video msg, file: file msg, cmd: command msg. |
aTimestamp | The reference timestamp for the messages to be loaded. If you set this parameter as a negative value, the SDK loads messages from the latest. |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aUsername | The user that sends the message. Setting it as NIL means that the SDK ignores this parameter. |
aDirection | The message search direction: AgoraChatMessageSearchDirection. AgoraChatMessageSearchDirectionUp: get aCount of messages before aMessageId; AgoraChatMessageSearchDirectionDown: get aCount of messages after aMessageId |
- Returns
- AgoraChatMessage The message instance.
◆ loadMessagesWithType:timestamp:count:fromUser:searchDirection:completion:
- (void) loadMessagesWithType: |
|
(AgoraChatMessageBodyType) |
aType |
timestamp: |
|
(long long) |
aTimestamp |
count: |
|
(int) |
aCount |
fromUser: |
|
(NSString *_Nullable) |
aUsername |
searchDirection: |
|
(AgoraChatMessageSearchDirection) |
aDirection |
completion: |
|
(void(^)(NSArray< AgoraChatMessage * > *_Nullable aMessages, AgoraChatError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Loads messages with specified message type from local database. Returning messages are sorted by receiving timestamp based on AgoraChatMessageSearchDirection.
- Parameters
-
aType | The message type to load. Type includes txt : text msg, img : image msg, loc: location msg, audio: audio msg, video: video msg, file: file msg, cmd: command msg. |
aTimestamp | The reference timestamp for the messages to be loaded. If you set this parameter as a negative value, the SDK loads messages from the latest. |
aCount | The number of messages to load. If you set this parameter less than 1, it will be handled as count=1. |
aUsername | The message sender (optional). If the parameter is nil, ignore. |
aDirection | The message search direction. AgoraChatMessageSearchDirectionUp: get aCount of messages before aMessageId; AgoraChatMessageSearchDirectionDown: get aCount of messages after aMessageId |
aCompletionBlock | The completion block, which contains the error message if the method fails. |
◆ loadMessageWithId:error:
Gets a message with the ID.
- Parameters
-
aMessageId | The message ID. |
pError | The error information if the method fails: Error. |
◆ markAllMessagesAsRead:
Marks all messages as read.
- Parameters
-
pError | The error information if the method fails: Error. |
◆ markMessageAsReadWithId:error:
- (void) markMessageAsReadWithId: |
|
(NSString *_Nonnull) |
aMessageId |
error: |
|
(AgoraChatError **_Nullable) |
pError |
|
|
| |
Marks a message as read.
- Parameters
-
aMessageId | The message ID. |
pError | The error information if the method fails: Error. |
◆ updateMessageChange:error:
Uses this method to update a message in local database. Changing properties will affect data in database.
The latestMessage of the conversation and other properties will be updated accordingly. The messageID of the message cannot be updated.
- Parameters
-
aMessage | The message to be updated. |
pError | The error information if the method fails: Error. |
◆ conversationId
- (NSString*) conversationId |
|
readnonatomiccopy |
The conversation ID. For one-to-one chat,conversation ID is to chat user's name. For group chat, conversation ID is groupID(), different with getGroupName(). For chat room, conversation ID is chatroom ID, different with chat room name(). For help desk, it is same with one-to-one chat, conversation ID is also chat user's name.
◆ ext
The conversation extension property.
◆ isChatThread
The latest message in the conversation.
◆ latestMessage
The latest message in the conversation.
◆ messagesCount
◆ type
- (AgoraChatConversationType) type |
|
readnonatomicassign |
◆ unreadMessagesCount
- (int) unreadMessagesCount |
|
readnonatomicassign |
The number of unread messages.
The documentation for this class was generated from the following file: