TREChatConversationManager Class Reference
| Inherits from | TREObject : TREEventEmitter : NSObject |
|---|---|
| Declared in | TREChatConversationManager.h |
conversations
由该 Manager 在本地实时维护的会话列表,方便开发者直接绑定到 UI 上。
@property (nonatomic) NSMutableArray *conversationsDiscussion
内部会做以下事情:
- 有新消息时,自动更新会话的
unreadMessageCount。 - 自动维护每个会话的
lastMessage。 - 自动根据
lastActiveAt对会话进行降序排序 。 - 被删除的会话会自动从此数组移除。
- 新创建的会话会自动添加到此数组。
该数组变化时会触发 kTREEventChatConversationsChanged Event 。
Declared In
TREChatConversationManager.h
totalUnreadMessageCount
由该 Manager 在本地实时维护的所有会话未读消息数总和。
@property (nonatomic) NSUInteger totalUnreadMessageCountDiscussion
该属性变化时会触发 kTREEventChatConversationsChanged Event 。
Declared In
TREChatConversationManager.h
– loadWithType:target:callback:
从服务端加载会话列表。
- (void)loadWithType:(NSString *)type target:(NSString *)target callback:(void ( ^ ) ( NSArray *conversations , NSError *error ))callbackParameters
type |
可选,过滤条件,会话类型, |
|---|---|
target |
可选,过滤条件,对方的唯一标识, |
callback |
结果回调。 |
Declared In
TREChatConversationManager.h
– conversationWithUser:
获取与指定用户的会话,没有则创建。
- (TREChatConversation *)conversationWithUser:(TREChatUser *)userParameters
user |
对方用户。 |
|---|
Return Value
会话。
Declared In
TREChatConversationManager.h
– conversationWithGroup:
获取与指定群组的会话,没有则创建。
- (TREChatConversation *)conversationWithGroup:(TREChatGroup *)groupParameters
group |
群组。 |
|---|
Return Value
会话。
Declared In
TREChatConversationManager.h
– conversationWithMessage:
根据消息获取会话,通常用于收到新消息时查询对应会话。
- (TREChatConversation *)conversationWithMessage:(TREChatMessage *)messageParameters
message |
消息。 |
|---|
Return Value
会话。
Declared In
TREChatConversationManager.h
– conversationWithType:target:
根据会话类型及对方唯一标识获取会话。
- (TREChatConversation *)conversationWithType:(NSString *)type target:(NSString *)targetParameters
type |
会话类型, |
|---|---|
target |
对方的唯一标识, |
Return Value
会话。
Declared In
TREChatConversationManager.h