add notify reply and clean

pull/478/head
Ryan Zhao 3 years ago
parent 86ab6c03eb
commit 423feae426

@ -168,8 +168,7 @@ public class NotificationPresenter: NSObject, NotificationsProtocol {
// Don't fire the notification if the current user isn't mentioned
// and isOnlyNotifyingForMentions is on.
let isUserMentioned = MentionUtilities.isUserMentioned(in: messageText ?? "")
if let groupThread = thread as? TSGroupThread, groupThread.isOnlyNotifyingForMentions && !isUserMentioned {
if let groupThread = thread as? TSGroupThread, groupThread.isOnlyNotifyingForMentions && !incomingMessage.isUserMentioned {
return
}

@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) BOOL wasReceivedByUD;
@property (nonatomic, readonly) BOOL isUserMentioned;
- (instancetype)initMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body

@ -13,6 +13,7 @@
#import "TSGroupThread.h"
#import <YapDatabase/YapDatabaseConnection.h>
#import <SessionUtilitiesKit/SessionUtilitiesKit.h>
#import <SessionMessagingKit/SessionMessagingKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN
@ -121,6 +122,12 @@ NS_ASSUME_NONNULL_BEGIN
return self.isExpiringMessage;
}
- (BOOL)isUserMentioned
{
NSString *userPublicKey = [SNGeneralUtilities getUserPublicKey];
return (self.body != nil && [self.body containsString:[NSString stringWithFormat:@"@%@", userPublicKey]]) || (self.quotedMessage != nil && [self.quotedMessage.authorId isEqualToString:userPublicKey]);
}
#pragma mark - OWSReadTracking
- (BOOL)shouldAffectUnreadCounts

Loading…
Cancel
Save