Skip to content

Commit

Permalink
support conversation query for systemConversation and transientConver…
Browse files Browse the repository at this point in the history
…sation
  • Loading branch information
ChenYilong committed Dec 7, 2016
1 parent aa1dc0e commit 4ad411f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ChatKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ChatKit"
s.version = "0.8.6"
s.version = "0.8.7"
s.summary = "An IM App Framework, support sending text, pictures, audio, video, location messaging, managing address book, more interesting features."
s.homepage = "https://github.com/LeanCloud/ChatKit-OC"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
19 changes: 14 additions & 5 deletions ChatKit/Class/Tool/Service/LCCKConversationService.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,20 @@ - (void)fecthConversationWithConversationId:(NSString *)conversationId callback:

- (void)fetchConversationsWithConversationIds:(NSSet *)conversationIds
callback:(LCCKArrayResultBlock)callback {
AVIMConversationQuery *query = [[LCCKSessionService sharedInstance].client conversationQuery];
[query whereKey:@"objectId" containedIn:[conversationIds allObjects]];
query.cachePolicy = kAVCachePolicyNetworkElseCache;
query.limit = 1000; // default limit:10
[query findConversationsWithCallback: ^(NSArray *objects, NSError *error) {
AVIMClient *client = [LCCKSessionService sharedInstance].client;
AVIMConversationQuery *queryForNormalConversation = [client conversationQuery];
[queryForNormalConversation whereKey:@"objectId" containedIn:[conversationIds allObjects]];

AVIMConversationQuery *queryForSystemConversation = [client conversationQuery];
[queryForSystemConversation whereKey:@"sys" equalTo:@(YES)];

AVIMConversationQuery *queryForTransientConversation = [client conversationQuery];
[queryForSystemConversation whereKey:@"tr" equalTo:@(YES)];

AVIMConversationQuery *queryForAll = [AVIMConversationQuery orQueryWithSubqueries:@[ queryForNormalConversation, queryForSystemConversation, queryForTransientConversation ]];
queryForAll.limit = conversationIds.count;

[queryForAll findConversationsWithCallback: ^(NSArray *objects, NSError *error) {
if (error) {
!callback ?: callback(nil, error);
} else {
Expand Down

0 comments on commit 4ad411f

Please sign in to comment.