tweak: fix reaction notifications
This commit is contained in:
parent
78d8e939f1
commit
0a9856d49a
|
@ -5782,7 +5782,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 348;
|
||||
CURRENT_PROJECT_VERSION = 369;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
|
@ -5807,7 +5807,7 @@
|
|||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13.0;
|
||||
MARKETING_VERSION = 2.0.2;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@ -5855,7 +5855,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 348;
|
||||
CURRENT_PROJECT_VERSION = 369;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
|
@ -5885,7 +5885,7 @@
|
|||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13.0;
|
||||
MARKETING_VERSION = 2.0.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@ -5921,7 +5921,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 348;
|
||||
CURRENT_PROJECT_VERSION = 369;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
|
@ -5944,7 +5944,7 @@
|
|||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13.0;
|
||||
MARKETING_VERSION = 2.0.2;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
|
||||
|
@ -5995,7 +5995,7 @@
|
|||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 348;
|
||||
CURRENT_PROJECT_VERSION = 369;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = SUQ8J2PCT7;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
|
@ -6023,7 +6023,7 @@
|
|||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.13.0;
|
||||
MARKETING_VERSION = 2.0.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
||||
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
import GRDB
|
||||
|
|
|
@ -582,7 +582,7 @@ public extension Interaction {
|
|||
|
||||
func notificationIdentifier(isBackgroundPoll: Bool) -> String {
|
||||
// When the app is in the background we want the notifications to be grouped to prevent spam
|
||||
guard isBackgroundPoll else { return threadId }
|
||||
guard !isBackgroundPoll else { return threadId }
|
||||
|
||||
return "\(threadId)-\(id ?? 0)"
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ extension MessageReceiver {
|
|||
}()
|
||||
|
||||
// Handle emoji reacts first (otherwise it's essentially an invalid message)
|
||||
if let interactionId: Int64 = try handleEmojiReactIfNeeded(db, message: message, associatedWithProto: proto, sender: sender, messageSentTimestamp: messageSentTimestamp, openGroupId: openGroupId, threadId: threadInfo.id) {
|
||||
if let interactionId: Int64 = try handleEmojiReactIfNeeded(db, message: message, associatedWithProto: proto, sender: sender, messageSentTimestamp: messageSentTimestamp, openGroupId: openGroupId, thread: thread) {
|
||||
return interactionId
|
||||
}
|
||||
|
||||
|
@ -304,7 +304,7 @@ extension MessageReceiver {
|
|||
sender: String,
|
||||
messageSentTimestamp: TimeInterval,
|
||||
openGroupId: String?,
|
||||
threadId: String
|
||||
thread: SessionThread
|
||||
) throws -> Int64? {
|
||||
guard
|
||||
let reaction: VisibleMessage.VMReaction = message.reaction,
|
||||
|
@ -313,7 +313,7 @@ extension MessageReceiver {
|
|||
|
||||
let maybeInteractionId: Int64? = try? Interaction
|
||||
.select(.id)
|
||||
.filter(Interaction.Columns.threadId == threadId)
|
||||
.filter(Interaction.Columns.threadId == thread.id)
|
||||
.filter(Interaction.Columns.timestampMs == reaction.timestamp)
|
||||
.filter(Interaction.Columns.authorId == reaction.publicKey)
|
||||
.filter(Interaction.Columns.variant != Interaction.Variant.standardIncomingDeleted)
|
||||
|
@ -332,7 +332,7 @@ extension MessageReceiver {
|
|||
|
||||
switch reaction.kind {
|
||||
case .react:
|
||||
try Reaction(
|
||||
let reaction = Reaction(
|
||||
interactionId: interactionId,
|
||||
serverHash: message.serverHash,
|
||||
timestampMs: Int64(messageSentTimestamp * 1000),
|
||||
|
@ -340,7 +340,14 @@ extension MessageReceiver {
|
|||
emoji: reaction.emoji,
|
||||
count: 1,
|
||||
sortId: sortId
|
||||
).insert(db)
|
||||
)
|
||||
try reaction.insert(db)
|
||||
Environment.shared?.notificationsManager.wrappedValue?
|
||||
.notifyUser(
|
||||
db,
|
||||
forReaction: reaction,
|
||||
in: thread
|
||||
)
|
||||
|
||||
case .remove:
|
||||
try Reaction
|
||||
|
|
Loading…
Reference in New Issue