This repository was archived by the owner on Jul 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
ChatKit/Class/Module/Conversation/Model Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -712,7 +712,6 @@ - (void)preloadMessageToTableView:(id)aMessage callback:(LCCKVoidBlock)callback
712712 NSUInteger newLastMessageCout = self.dataArray .count ;
713713 NSIndexPath *indexPath = [NSIndexPath indexPathForRow: self .dataArray.count - 1 inSection: 0 ];
714714 [self .delegate messageSendStateChanged: LCCKMessageSendStateSending withProgress: 0 .0f forIndex: indexPath.row];
715- LCCKLock ();
716715 NSMutableArray *indexPaths = [NSMutableArray arrayWithObject: indexPath];
717716 NSUInteger additionItemsCount = newLastMessageCout - oldLastMessageCount;
718717 if (additionItemsCount > 1 ) {
@@ -721,12 +720,17 @@ - (void)preloadMessageToTableView:(id)aMessage callback:(LCCKVoidBlock)callback
721720 [indexPaths addObject: indexPath];
722721 }
723722 }
724- dispatch_async ( dispatch_get_main_queue (),^ {
723+ if ( NSThread . isMainThread ) {
725724 [self .parentConversationViewController.tableView insertRowsAtIndexPaths: [indexPaths copy ] withRowAnimation: UITableViewRowAnimationNone];
726- LCCKUnlock ();
727725 [self .parentConversationViewController scrollToBottomAnimated: YES ];
728726 !callback ?: callback ();
729- });
727+ } else {
728+ dispatch_async (dispatch_get_main_queue (), ^{
729+ [self .parentConversationViewController.tableView insertRowsAtIndexPaths: [indexPaths copy ] withRowAnimation: UITableViewRowAnimationNone];
730+ [self .parentConversationViewController scrollToBottomAnimated: YES ];
731+ !callback ?: callback ();
732+ });
733+ }
730734}
731735
732736#pragma mark - Getters
You can’t perform that action at this time.
0 commit comments