don't add badge for messages with no mention

This commit is contained in:
Ryan Zhao 2021-07-30 09:45:28 +10:00
parent 423feae426
commit 38a19ad2d1
1 changed files with 5 additions and 1 deletions

View File

@ -73,7 +73,7 @@ NS_ASSUME_NONNULL_BEGIN
YapDatabaseViewTransaction *unreadMessages = [transaction ext:TSUnreadDatabaseViewExtensionName];
NSArray<NSString *> *allGroups = [unreadMessages allGroups];
for (NSString *groupID in allGroups) {
TSThread *thread = [TSThread fetchObjectWithUniqueID:groupID transaction:transaction];
TSGroupThread *thread = [TSGroupThread fetchObjectWithUniqueID:groupID transaction:transaction];
if (thread.isMuted) continue;
[unreadMessages enumerateKeysAndObjectsInGroup:groupID
usingBlock:^(NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop) {
@ -85,6 +85,10 @@ NS_ASSUME_NONNULL_BEGIN
NSLog(@"Found an already read message in the * unread * messages list.");
return;
}
TSIncomingMessage * incomingMessage = (TSIncomingMessage *)object;
if (incomingMessage != nil && thread.isOnlyNotifyingForMentions && !incomingMessage.isUserMentioned) {
return;
}
count += 1;
}];
}