Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit b61a2f9

Browse files
authored
Merge pull request #412 from zapcannon87/master
Release v2.3.8
2 parents 9b6901c + 401a8df commit b61a2f9

File tree

3 files changed

+49
-16
lines changed

3 files changed

+49
-16
lines changed

ChatKit-OC/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PODS:
99
- AVOSCloudIM/_NOARC (= 11.4.7)
1010
- AVOSCloudIM/_NOARC (11.4.7):
1111
- AVOSCloud (= 11.4.7)
12-
- ChatKit (2.3.7):
12+
- ChatKit (2.3.8):
1313
- AVOSCloud (~> 11.4.7)
1414
- AVOSCloudIM (~> 11.4.7)
1515
- CYLDeallocBlockExecutor (~> 1.1.2)
@@ -91,7 +91,7 @@ EXTERNAL SOURCES:
9191
SPEC CHECKSUMS:
9292
AVOSCloud: e1257f9a7c28e04ae8642d554a37654e8392d1b7
9393
AVOSCloudIM: 5456179b251be8dead13eebabcbbfa6931cc4e1b
94-
ChatKit: e6b9beb9858165aaa92311e1661c986e069cd960
94+
ChatKit: 3a59c6e3f259f1056f02d92d0c1d8e9cf6434fda
9595
CYLDeallocBlockExecutor: ecf39e45dcead9e120f460df5668b8f5093d178e
9696
CYLTabBarController: 8d99fccf22866fe18c978c5ff863dc6051da45ff
9797
DACircularProgress: 4dd437c0fc3da5161cb289e07ac449493d41db71

ChatKit.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ChatKit"
3-
s.version = "2.3.7"
3+
s.version = "2.3.8"
44
s.summary = "An IM App Framework, support sending text, pictures, audio, video, location messaging, managing address book, more interesting features."
55
s.homepage = "https://github.com/LeanCloud/ChatKit-OC"
66
s.license = { :type => 'MIT', :file => 'LICENSE' }

ChatKit/Class/Tool/Service/LCCKConversationService.m

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,53 @@ - (void)fetchConversationWithConversationId:(NSString *)conversationId callback:
8080
}
8181

8282
- (void)fetchConversationsWithConversationIds:(NSSet *)conversationIds
83-
callback:(LCCKArrayResultBlock)callback {
84-
AVIMConversationQuery *query = [[LCCKSessionService sharedInstance].client conversationQuery];
85-
[query whereKey:@"objectId" containedIn:[conversationIds allObjects]];
86-
query.limit = conversationIds.count;
87-
query.option = AVIMConversationQueryOptionWithMessage;
88-
query.cacheMaxAge = kAVIMCachePolicyIgnoreCache;
89-
[query findConversationsWithCallback: ^(NSArray *objects, NSError *error) {
90-
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
91-
[objects makeObjectsPerformSelector:@selector(lastMessage)];
92-
dispatch_async(dispatch_get_main_queue(),^{
93-
!callback ?: callback(objects, error);
83+
callback:(LCCKArrayResultBlock)callback
84+
{
85+
[self fetchConversationsWithConversationIds:[[conversationIds allObjects] mutableCopy]
86+
results:[NSMutableArray array]
87+
callback:callback];
88+
}
89+
90+
- (void)fetchConversationsWithConversationIds:(NSMutableArray<NSString *> *)conversationIds
91+
results:(NSMutableArray<AVIMConversation *> *)results
92+
callback:(LCCKArrayResultBlock)callback
93+
{
94+
if (conversationIds.count <= 100) {
95+
AVIMConversationQuery *query = [[LCCKSessionService sharedInstance].client conversationQuery];
96+
[query whereKey:@"objectId" containedIn:conversationIds];
97+
query.limit = conversationIds.count;
98+
query.option = AVIMConversationQueryOptionWithMessage;
99+
query.cacheMaxAge = kAVIMCachePolicyIgnoreCache;
100+
[query findConversationsWithCallback: ^(NSArray *objects, NSError *error) {
101+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
102+
[objects makeObjectsPerformSelector:@selector(lastMessage)];
103+
if (objects) {
104+
[results addObjectsFromArray:objects];
105+
}
106+
dispatch_async(dispatch_get_main_queue(),^{
107+
!callback ?: callback(results, nil);
108+
});
94109
});
95-
});
96-
}];
110+
}];
111+
} else {
112+
NSRange range = NSMakeRange(0, 100);
113+
NSArray<NSString *> *ids = [conversationIds subarrayWithRange:range];
114+
[conversationIds removeObjectsInRange:range];
115+
AVIMConversationQuery *query = [[LCCKSessionService sharedInstance].client conversationQuery];
116+
[query whereKey:@"objectId" containedIn:ids];
117+
query.limit = ids.count;
118+
query.option = AVIMConversationQueryOptionWithMessage;
119+
query.cacheMaxAge = kAVIMCachePolicyIgnoreCache;
120+
[query findConversationsWithCallback: ^(NSArray *objects, NSError *error) {
121+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void) {
122+
[objects makeObjectsPerformSelector:@selector(lastMessage)];
123+
if (objects) {
124+
[results addObjectsFromArray:objects];
125+
}
126+
[self fetchConversationsWithConversationIds:conversationIds results:results callback:callback];
127+
});
128+
}];
129+
}
97130
}
98131

99132
- (void)fetchConversationWithPeerId:(NSString *)peerId callback:(AVIMConversationResultBlock)callback {

0 commit comments

Comments
 (0)