HyphenateSDK  3.3.0
Instance Methods | Properties | List of all members
EMConversation Class Reference

#import <EMConversation.h>

Inheritance diagram for EMConversation:

Instance Methods

(void) - insertMessage:error:
 
(void) - appendMessage:error:
 
(void) - deleteMessageWithId:error:
 
(void) - deleteAllMessages:
 
(void) - updateMessageChange:error:
 
(void) - markMessageAsReadWithId:error:
 
(void) - markAllMessagesAsRead:
 
(EMMessage *) - loadMessageWithId:error:
 
(EMMessage *) - lastReceivedMessage
 
(void) - loadMessagesStartFromId:count:searchDirection:completion:
 
(void) - loadMessagesWithType:timestamp:count:fromUser:searchDirection:completion:
 
(void) - loadMessagesWithKeyword:timestamp:count:fromUser:searchDirection:completion:
 
(void) - loadMessagesFrom:to:count:completion:
 
(BOOL) - insertMessage:
 
(BOOL) - appendMessage:
 
(BOOL) - deleteMessageWithId:
 
("Use -deleteAllMessages:") - __deprecated_msg
 
(BOOL) - updateMessage:
 
(BOOL) - markMessageAsReadWithId:
 
("Use -markAllMessagesAsRead:") - __deprecated_msg
 
("setExt: will update extend properties to DB") - __deprecated_msg
 
(EMMessage *) - loadMessageWithId:
 
(NSArray *) - loadMoreMessagesFromId:limit:direction:
 
(NSArray *) - loadMoreMessagesWithType:before:limit:from:direction:
 
(NSArray *) - loadMoreMessagesContain:before:limit:from:direction:
 
(NSArray *) - loadMoreMessagesFrom:to:maxCount:
 
("Use -lastReceivedMessage") - __deprecated_msg
 

Properties

NSString * conversationId
 
EMConversationType type
 
int unreadMessagesCount
 
NSDictionary * ext
 
EMMessagelatestMessage
 

Detailed Description

Chat conversation

Method Documentation

- ("Use -)deleteAllMessages:

Delete all message of the conversation

Returns
Delete result, YES: success, No: fail

Mark all message as read

Returns
Result of mark all message as read, YES: success, No: fail
- "setExt:

Update conversation extend properties to DB

Returns
Extend properties update result, YES: success, No: fail
- ("Use -lastReceivedMessage") __deprecated_msg

Get latest message that received from others

Returns
Message instance
- (BOOL) appendMessage: ("Use -appendMessage:error:")  __deprecated_msg

Insert a message to the tail of conversation, message's conversationId should equle to conversation's conversationId, message will be inserted to DB, and update conversation's property

Parameters
aMessageMessage
Returns
Message insert result, YES: success, No: fail
- (void) appendMessage: (EMMessage *)  aMessage
error: (EMError **)  pError 

Insert a message to the end of a conversation. ConversationId of the message should be the same as conversationId of the conversation in order to insert the message into the conversation correctly.

Parameters
aMessageMessage
pErrorError
- (void) deleteAllMessages: (EMError **)  pError

Delete all message of a conversation

Parameters
pErrorError
- (BOOL) deleteMessageWithId: ("Use -deleteMessageWithId:error:")  __deprecated_msg

Delete a message

Parameters
aMessageIdMessage's ID who will be deleted
Returns
Message delete result, YES: success, No: fail
- (void) deleteMessageWithId: (NSString *)  aMessageId
error: (EMError **)  pError 

Delete a message

Parameters
aMessageIdMessageId of the message to be deleted
pErrorError
- (BOOL) insertMessage: ("Use -insertMessage:error:")  __deprecated_msg

Insert a message to a conversation. ConversationId of the message should be the same as conversationId of the conversation in order to insert the message into the conversation correctly.

Parameters
aMessageMessage
Returns
Message insert result, return YES or success, return No for failure.
- (void) insertMessage: (EMMessage *)  aMessage
error: (EMError **)  pError 

Insert a message to a conversation. ConversationId of the message should be the same as conversationId of the conversation in order to insert the message into the conversation correctly.

Parameters
aMessageMessage
pErrorError
- (EMMessage *) lastReceivedMessage

Get last received message

Returns
Message instance
- (void) loadMessagesFrom: (long long)  aStartTimestamp
to: (long long)  aEndTimestamp
count: (int)  aCount
completion: (void(^)(NSArray *aMessages, EMError *aError))  aCompletionBlock 

Load messages within specified time range, retruning messages are sorted by receiving timestamp

Parameters
aStartTimestampStart time's timestamp in miliseconds
aEndTimestampEnd time's timestamp in miliseconds
aCountMessage search direction
aCompletionBlockThe callback block of completion
- (void) loadMessagesStartFromId: (NSString *)  aMessageId
count: (int)  aCount
searchDirection: (EMMessageSearchDirection)  aDirection
completion: (void(^)(NSArray *aMessages, EMError *aError))  aCompletionBlock 

Load messages from a specified message, returning messages are sorted by receiving timestamp. If the aMessageId is nil, return the latest received messages.

Parameters
aMessageIdReference message's ID
aCountCount of messages to load
aDirectionMessage search direction
aCompletionBlockThe callback block of completion
- (void) loadMessagesWithKeyword: (NSString *)  aKeyword
timestamp: (long long)  aTimestamp
count: (int)  aCount
fromUser: (NSString *)  aSender
searchDirection: (EMMessageSearchDirection)  aDirection
completion: (void(^)(NSArray *aMessages, EMError *aError))  aCompletionBlock 

Load messages with specified keyword, returning messages are sorted by receiving timestamp. If reference timestamp is negative, load from the latest messages; if message count is negative, count deal with 1 and load one message that meet the condition.

Parameters
aKeywordsSearch content, will ignore it if it's empty
aTimestampReference timestamp
aCountCount of messages to load
aSenderMessage sender (optional)
aDirectionMessage search direction
aCompletionBlockThe callback block of completion
- (void) loadMessagesWithType: (EMMessageBodyType)  aType
timestamp: (long long)  aTimestamp
count: (int)  aCount
fromUser: (NSString *)  aUsername
searchDirection: (EMMessageSearchDirection)  aDirection
completion: (void(^)(NSArray *aMessages, EMError *aError))  aCompletionBlock 

Load messages with specified type, returning messages are sorted by receiving timestamp. If reference timestamp is negative, load from the latest messages; if message count is negative, count deal with 1 and load one message that meet the condition.

Parameters
aTypeMessage type to load
aTimestampReference timestamp
aLimitCount of messages to load
aUsernameMessage sender (optional)
aDirectionMessage search direction
aCompletionBlockThe callback block of completion
- (EMMessage *) loadMessageWithId: ("Use -loadMessageWithId:error:")  __deprecated_msg

Get a message with the ID

Parameters
aMessageIdMessage's id
Returns
Message instance
- (EMMessage *) loadMessageWithId: (NSString *)  aMessageId
error: (EMError **)  pError 

Get a message with the ID

Parameters
aMessageIdMessageID
pErrorError
- (NSArray *) loadMoreMessagesContain: (NSString *)  aKeywords
before: (long long)  aTimestamp
limit: (int)  aLimit
from: (NSString *)  aSender
direction: ("Use -loadMessagesContainKeywords:timestamp:count:fromUser:searchDirection:completion:")  __deprecated_msg 

Get more messages contain specified keywords from DB, result messages are sorted by received time, if reference timestamp is negative, will fetch message from latest message, andd will fetch all messages that meet the condition if aLimit is negative

Parameters
aKeywordsSearch content, will ignore it if it's empty
aTimestampReference timestamp
aLimitCount of messages to load
aSenderMessage sender, will ignore it if it's empty
aDirectionMessage search direction
Returns
Message list<EMMessage>
- (NSArray *) loadMoreMessagesFrom: (long long)  aStartTimestamp
to: (long long)  aEndTimestamp
maxCount: ("Use -loadMessagesFrom:to:count:completion:")  __deprecated_msg 

Load messages from DB in duration, result messages are sorted by receive time, user should limit the max count to load to avoid memory issue

Parameters
aStartTimestampStart time's timestamp in miliseconds
aEndTimestampEnd time's timestamp in miliseconds
aMaxCountMessage search direction
Returns
Message list<EMMessage>
- (NSArray *) loadMoreMessagesFromId: (NSString *)  aMessageId
limit: (int)  aLimit
direction: ("Use -loadMessagesStartFromId:count:searchDirection:completion:")  __deprecated_msg 

Get more messages from DB, result messages are sorted by receive time, and NOT include the reference message, if reference messag's ID is nil, will fetch message from latest message

Parameters
aMessageIdReference message's ID
aLimitCount of messages to load
aDirectionMessage search direction
Returns
Message list<EMMessage>
- (NSArray *) loadMoreMessagesWithType: (EMMessageBodyType)  aType
before: (long long)  aTimestamp
limit: (int)  aLimit
from: (NSString *)  aSender
direction: ("Use -loadMessagesWithType:timestamp:count:fromUser:searchDirection:completion:")  __deprecated_msg 

Get more messages with specified type from DB, result messages are sorted by received time, if reference timestamp is negative, will fetch message from latest message, andd will fetch all messages that meet the condition if aLimit is negative

Parameters
aTypeMessage type to load
aTimestampReference timestamp
aLimitCount of messages to load
aSenderMessage sender, will ignore it if it's empty
aDirectionMessage search direction
Returns
Message list<EMMessage>
- (void) markAllMessagesAsRead: (EMError **)  pError

Mark all message as read

Parameters
pErrorError
- (BOOL) markMessageAsReadWithId: ("Use -markMessageAsReadWithId:error:")  __deprecated_msg

Mark a message as read

Parameters
aMessageIdMessage's ID who will be set read status
Returns
Result of mark message as read, YES: success, No: fail
- (void) markMessageAsReadWithId: (NSString *)  aMessageId
error: (EMError **)  pError 

Mark a message as read

Parameters
aMessageIdMessageID
pErrorError
- (BOOL) updateMessage: ("Use -updateMessageChange:error:")  __deprecated_msg

Update a message, can't update message's messageId, conversation's latestMessage and so on properties will update after update the message

Parameters
aMessageMessage
Returns
Message update result, YES: success, No: fail
- (void) updateMessageChange: (EMMessage *)  aMessage
error: (EMError **)  pError 

Update a local message, conversation's latestMessage and other properties will be updated accordingly. Please note that messageId can not be updated.

Parameters
aMessageMessage
pErrorError

Property Documentation

- (NSString*) conversationId
readnonatomiccopy

Unique identifier of conversation

- (NSDictionary*) ext
readwritenonatomiccopy

Conversation extension property

- (EMMessage*) latestMessage
readnonatomicstrong

Conversation latest message

- (EMConversationType) type
readnonatomicassign

Conversation type

- (int) unreadMessagesCount
readnonatomicassign

Count of unread messages


The documentation for this class was generated from the following file: