Fixed a bug where a stale flag was used to determine how to send a push notification

This commit is contained in:
Morgan Pretty 2023-01-24 17:37:30 +11:00
parent d38a44515d
commit 5659b55eae
1 changed files with 2 additions and 1 deletions

View File

@ -66,7 +66,6 @@ public final class MessageSender {
) throws -> Promise<Void> {
let (promise, seal) = Promise<Void>.pending()
let userPublicKey: String = getUserHexEncodedPublicKey(db)
let isMainAppActive: Bool = (UserDefaults.sharedLokiProject?[.isMainAppActive]).defaulting(to: false)
let messageSendTimestamp: Int64 = SnodeAPI.currentOffsetTimestampMs()
// Set the timestamp, sender and recipient
@ -261,6 +260,8 @@ public final class MessageSender {
behaviour: .runOnce,
details: NotifyPushServerJob.Details(message: snodeMessage)
)
let isMainAppActive: Bool = (UserDefaults.sharedLokiProject?[.isMainAppActive])
.defaulting(to: false)
if isMainAppActive {
JobRunner.add(db, job: job)