HyphenateSDK  3.6.1
EMConversation.h
1 
15 #import <Foundation/Foundation.h>
16 
17 #import "EMMessageBody.h"
18 
19 /*
20  * \~chinese
21  * 会话类型
22  *
23  * \~english
24  * Conversation type
25  */
26 typedef enum {
27  EMConversationTypeChat = 0,
28  EMConversationTypeGroupChat,
29  EMConversationTypeChatRoom
30 } EMConversationType;
31 
32 /*
33  * \~chinese
34  * 消息搜索方向
35  *
36  * \~english
37  * Message search direction
38  */
39 typedef enum {
40  EMMessageSearchDirectionUp = 0,
41  EMMessageSearchDirectionDown
42 } EMMessageSearchDirection;
43 
44 @class EMMessage;
45 @class EMError;
46 
54 @interface EMConversation : NSObject
55 
71 @property (nonatomic, copy, readonly) NSString *conversationId;
72 
80 @property (nonatomic, assign, readonly) EMConversationType type;
81 
89 @property (nonatomic, assign, readonly) int unreadMessagesCount;
90 
98 @property (nonatomic, copy) NSDictionary *ext;
99 
107 @property (nonatomic, strong, readonly) EMMessage *latestMessage;
108 
121 
139 - (void)insertMessage:(EMMessage *)aMessage
140  error:(EMError **)pError;
141 
156 - (void)appendMessage:(EMMessage *)aMessage
157  error:(EMError **)pError;
158 
173 - (void)deleteMessageWithId:(NSString *)aMessageId
174  error:(EMError **)pError;
175 
187 - (void)deleteAllMessages:(EMError **)pError;
188 
204 - (void)updateMessageChange:(EMMessage *)aMessage
205  error:(EMError **)pError;
206 
221 - (void)markMessageAsReadWithId:(NSString *)aMessageId
222  error:(EMError **)pError;
223 
236 - (void)markAllMessagesAsRead:(EMError **)pError;
237 
238 
239 #pragma mark - Load Messages Methods
240 
255 - (EMMessage *)loadMessageWithId:(NSString *)aMessageId
256  error:(EMError **)pError;
257 
278 - (void)loadMessagesStartFromId:(NSString *)aMessageId
279  count:(int)aCount
280  searchDirection:(EMMessageSearchDirection)aDirection
281  completion:(void (^)(NSArray *aMessages, EMError *aError))aCompletionBlock;
282 
307 - (void)loadMessagesWithType:(EMMessageBodyType)aType
308  timestamp:(long long)aTimestamp
309  count:(int)aCount
310  fromUser:(NSString*)aUsername
311  searchDirection:(EMMessageSearchDirection)aDirection
312  completion:(void (^)(NSArray *aMessages, EMError *aError))aCompletionBlock;
313 
338 - (void)loadMessagesWithKeyword:(NSString*)aKeyword
339  timestamp:(long long)aTimestamp
340  count:(int)aCount
341  fromUser:(NSString*)aSender
342  searchDirection:(EMMessageSearchDirection)aDirection
343  completion:(void (^)(NSArray *aMessages, EMError *aError))aCompletionBlock;
344 
363 - (void)loadMessagesFrom:(long long)aStartTimestamp
364  to:(long long)aEndTimestamp
365  count:(int)aCount
366  completion:(void (^)(NSArray *aMessages, EMError *aError))aCompletionBlock;
367 
368 
369 #pragma mark - Deprecated methods
370 
386 - (BOOL)insertMessage:(EMMessage *)aMessage __deprecated_msg("Use -insertMessage:error:");
387 
403 - (BOOL)appendMessage:(EMMessage *)aMessage __deprecated_msg("Use -appendMessage:error:");
404 
420 - (BOOL)deleteMessageWithId:(NSString *)aMessageId __deprecated_msg("Use -deleteMessageWithId:error:");
421 
433 - (BOOL)deleteAllMessages __deprecated_msg("Use -deleteAllMessages:");
434 
450 - (BOOL)updateMessage:(EMMessage *)aMessage __deprecated_msg("Use -updateMessageChange:error:");
451 
467 - (BOOL)markMessageAsReadWithId:(NSString *)aMessageId __deprecated_msg("Use -markMessageAsReadWithId:error:");
468 
480 - (BOOL)markAllMessagesAsRead __deprecated_msg("Use -markAllMessagesAsRead:");
481 
493 - (BOOL)updateConversationExtToDB __deprecated_msg("setExt: will update extend properties to DB");
494 
510 - (EMMessage *)loadMessageWithId:(NSString *)aMessageId __deprecated_msg("Use -loadMessageWithId:error:");
511 
531 - (NSArray *)loadMoreMessagesFromId:(NSString *)aMessageId
532  limit:(int)aLimit
533  direction:(EMMessageSearchDirection)aDirection __deprecated_msg("Use -loadMessagesStartFromId:count:searchDirection:completion:");
534 
558 - (NSArray *)loadMoreMessagesWithType:(EMMessageBodyType)aType
559  before:(long long)aTimestamp
560  limit:(int)aLimit
561  from:(NSString*)aSender
562  direction:(EMMessageSearchDirection)aDirection __deprecated_msg("Use -loadMessagesWithType:timestamp:count:fromUser:searchDirection:completion:");
563 
587 - (NSArray *)loadMoreMessagesContain:(NSString*)aKeywords
588  before:(long long)aTimestamp
589  limit:(int)aLimit
590  from:(NSString*)aSender
591  direction:(EMMessageSearchDirection)aDirection __deprecated_msg("Use -loadMessagesContainKeywords:timestamp:count:fromUser:searchDirection:completion:");
592 
612 - (NSArray *)loadMoreMessagesFrom:(long long)aStartTimestamp
613  to:(long long)aEndTimestamp
614  maxCount:(int)aMaxCount __deprecated_msg("Use -loadMessagesFrom:to:count:completion:");
615 
627 - (EMMessage *)latestMessageFromOthers __deprecated_msg("Use -lastReceivedMessage");
628 
629 @end
NSString * conversationId
Definition: EMConversation.h:71
Definition: EMConversation.h:54
Definition: EMError.h:26
EMMessage * lastReceivedMessage()
int unreadMessagesCount
Definition: EMConversation.h:89
EMConversationType type
Definition: EMConversation.h:80
NSDictionary * ext
Definition: EMConversation.h:98
Definition: EMMessage.h:65
"Use -deleteAllMessages:" __deprecated_msg()
EMMessage * latestMessage
Definition: EMConversation.h:107