Batch updates, and fixing bug where daemon would crash when accessing IMCore stuff from different threads
This commit is contained in:
@@ -23,13 +23,15 @@
|
||||
|
||||
- (void)main
|
||||
{
|
||||
NSArray<IMChat *> *chats = [sChatRegistry allExistingChats];
|
||||
__block NSMutableArray *conversations = [NSMutableArray array];
|
||||
|
||||
NSMutableArray *conversations = [NSMutableArray array];
|
||||
for (IMChat *chat in chats) {
|
||||
NSDictionary *chatDict = [chat mbim_dictionaryRepresentation];
|
||||
[conversations addObject:chatDict];
|
||||
}
|
||||
dispatch_sync([[self class] sharedIMAccessQueue], ^{
|
||||
NSArray<IMChat *> *chats = [sChatRegistry allExistingChats];
|
||||
for (IMChat *chat in chats) {
|
||||
NSDictionary *chatDict = [chat mbim_dictionaryRepresentation];
|
||||
[conversations addObject:chatDict];
|
||||
}
|
||||
});
|
||||
|
||||
MBIMJSONDataResponse *response = [MBIMJSONDataResponse responseWithJSONObject:conversations];
|
||||
self.serverCompletionBlock(response);
|
||||
|
||||
Reference in New Issue
Block a user