File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -402,12 +402,27 @@ - (void)updateHistoryInBackgroundWithCompletionBlock:(UpdateHistoryInBackgroundC
402
402
403
403
// Store new messages
404
404
if (messages.count > 0 ) {
405
- [self storeMessages: messages];
406
- [self checkLastCommonReadMessage: lastCommonReadMessage];
407
-
408
405
// In case we finish after the app already got active again, notify any potential view controller
409
406
NSMutableDictionary *userInfo = [NSMutableDictionary new ];
410
407
[userInfo setObject: self ->_room.token forKey: @" room" ];
408
+
409
+ for (NSDictionary *messageDict in messages) {
410
+ NCChatMessage *message = [NCChatMessage messageWithDictionary: messageDict andAccountId: self ->_account.accountId];
411
+
412
+ if (message && [message.systemMessage isEqualToString: @" history_cleared" ]) {
413
+ [self clearHistoryAndResetChatController ];
414
+
415
+ [userInfo setObject: message forKey: @" historyCleared" ];
416
+ [[NSNotificationCenter defaultCenter ] postNotificationName: NCChatControllerDidReceiveHistoryClearedNotification
417
+ object: self
418
+ userInfo: userInfo];
419
+ return ;
420
+ }
421
+ }
422
+
423
+ [self storeMessages: messages];
424
+ [self checkLastCommonReadMessage: lastCommonReadMessage];
425
+
411
426
[[NSNotificationCenter defaultCenter ] postNotificationName: NCChatControllerDidReceiveMessagesInBackgroundNotification
412
427
object: self
413
428
userInfo: userInfo];
You can’t perform that action at this time.
0 commit comments