diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 6e09b0bca..e0e12d41c 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -5191,7 +5191,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 279; + CURRENT_PROJECT_VERSION = 281; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5260,7 +5260,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 279; + CURRENT_PROJECT_VERSION = 281; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -5321,7 +5321,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 279; + CURRENT_PROJECT_VERSION = 281; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5391,7 +5391,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 279; + CURRENT_PROJECT_VERSION = 281; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -6276,7 +6276,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 279; + CURRENT_PROJECT_VERSION = 281; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -6345,7 +6345,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 279; + CURRENT_PROJECT_VERSION = 281; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/Contents.json b/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/Contents.json index 60527f39d..87de6e895 100644 --- a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/Contents.json +++ b/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/Contents.json @@ -1,19 +1,8 @@ { "images" : [ { - "filename" : "ic_notification_mentions.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "ic_notification_mentions-1.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "ic_notification_mentions-2.png", - "idiom" : "universal", - "scale" : "3x" + "filename" : "ic_notifications_mentions.pdf", + "idiom" : "universal" } ], "info" : { diff --git a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-1.png b/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-1.png deleted file mode 100644 index fe39a8b35..000000000 Binary files a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-1.png and /dev/null differ diff --git a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-2.png b/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-2.png deleted file mode 100644 index fe39a8b35..000000000 Binary files a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions-2.png and /dev/null differ diff --git a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions.png b/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions.png deleted file mode 100644 index fe39a8b35..000000000 Binary files a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notification_mentions.png and /dev/null differ diff --git a/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notifications_mentions.pdf b/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notifications_mentions.pdf new file mode 100644 index 000000000..4dae2b8b6 Binary files /dev/null and b/Session/Meta/Images.xcassets/Session/NotifyMentions.imageset/ic_notifications_mentions.pdf differ diff --git a/Session/Notifications/AppNotifications.swift b/Session/Notifications/AppNotifications.swift index 3470edd51..3c3e4534b 100644 --- a/Session/Notifications/AppNotifications.swift +++ b/Session/Notifications/AppNotifications.swift @@ -353,8 +353,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 } diff --git a/SessionMessagingKit/Messages/Signal/TSIncomingMessage.h b/SessionMessagingKit/Messages/Signal/TSIncomingMessage.h index bb909b0fc..7cd8dd78b 100644 --- a/SessionMessagingKit/Messages/Signal/TSIncomingMessage.h +++ b/SessionMessagingKit/Messages/Signal/TSIncomingMessage.h @@ -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 diff --git a/SessionMessagingKit/Messages/Signal/TSIncomingMessage.m b/SessionMessagingKit/Messages/Signal/TSIncomingMessage.m index 81bf7beb1..a7e004b93 100644 --- a/SessionMessagingKit/Messages/Signal/TSIncomingMessage.m +++ b/SessionMessagingKit/Messages/Signal/TSIncomingMessage.m @@ -13,6 +13,7 @@ #import "TSGroupThread.h" #import #import +#import 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 diff --git a/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift b/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift index 2765b541a..025af2aba 100644 --- a/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift +++ b/SessionMessagingKit/Sending & Receiving/Pollers/ClosedGroupPoller.swift @@ -7,8 +7,8 @@ public final class ClosedGroupPoller : NSObject { private var timers: [String:Timer] = [:] // MARK: Settings - private static let minPollInterval: Double = 4 - private static let maxPollInterval: Double = 2 * 60 + private static let minPollInterval: Double = 2 + private static let maxPollInterval: Double = 30 // MARK: Error private enum Error : LocalizedError { diff --git a/SignalUtilitiesKit/Messaging/OWSMessageUtils.m b/SignalUtilitiesKit/Messaging/OWSMessageUtils.m index 7c0e20575..09ab38cb6 100644 --- a/SignalUtilitiesKit/Messaging/OWSMessageUtils.m +++ b/SignalUtilitiesKit/Messaging/OWSMessageUtils.m @@ -73,7 +73,7 @@ NS_ASSUME_NONNULL_BEGIN YapDatabaseViewTransaction *unreadMessages = [transaction ext:TSUnreadDatabaseViewExtensionName]; NSArray *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; }]; }