WIP: make job chain of disappearing messages job, expiration update job, and config sync job

pull/941/head
ryanzhao 11 months ago
parent d81a8743ac
commit aace269359

@ -2,6 +2,7 @@
import UIKit
import SessionUIKit
import CoreMedia
public protocol VideoPreviewDelegate: AnyObject {
func cameraDidConfirmTurningOn()

@ -538,16 +538,9 @@ public extension Interaction {
interactionInfo: [InteractionReadInfo],
lastReadTimestampMs: Int64
) throws {
// Update the last read timestamp if needed
try SessionUtil.syncThreadLastReadIfNeeded(
db,
threadId: threadId,
threadVariant: threadVariant,
lastReadTimestampMs: lastReadTimestampMs
)
// Add the 'DisappearingMessagesJob' if needed - this will update any expiring
// messages `expiresStartedAtMs` values
// messages `expiresStartedAtMs` values in local database, and create seperate
// jobs updating message expiration
JobRunner.upsert(
db,
job: DisappearingMessagesJob.updateNextRunIfNeeded(
@ -558,6 +551,14 @@ public extension Interaction {
)
)
// Update the last read timestamp if needed
try SessionUtil.syncThreadLastReadIfNeeded(
db,
threadId: threadId,
threadVariant: threadVariant,
lastReadTimestampMs: lastReadTimestampMs
)
// Clear out any notifications for the interactions we mark as read
Environment.shared?.notificationsManager.wrappedValue?.cancelNotifications(
identifiers: interactionInfo

@ -194,7 +194,7 @@ public extension DisappearingMessagesJob {
interactionExpirationInfosByExpiresInSeconds.forEach { expiresInSeconds, expirationInfos in
let expirationTimestampMs: Int64 = Int64(startedAtMs + expiresInSeconds * 1000)
JobRunner.add(
JobRunner.upsert(
db,
job: Job(
variant: .expirationUpdate,

Loading…
Cancel
Save