fix an issue when updating expiry unchanged messages won't start disappear

pull/731/head
Ryan ZHAO 6 months ago
parent 87309ccba1
commit e81923cdef

@ -254,7 +254,6 @@ final class VisibleMessageCell: MessageCell, TappableLabelDelegate {
timerView.set(.width, to: VisibleMessageCell.messageStatusImageViewSize)
timerView.set(.height, to: VisibleMessageCell.messageStatusImageViewSize)
messageStatusLabel.center(.vertical, in: messageStatusContainerView)
// messageStatusLabel.pin(.leading, to: .leading, of: messageStatusContainerView)
messageStatusLabelPaddingView.pin(.leading, to: .leading, of: messageStatusContainerView)
messageStatusLabelPaddingView.pin(.trailing, to: .trailing, of: messageStatusContainerView)
}

@ -63,26 +63,31 @@ public enum ExpirationUpdateJob: JobExecutor {
guard !unchangedMessages.isEmpty else { return }
dependencies.storage.writeAsync(using: dependencies) { db in
try unchangedMessages.forEach { updatedExpiry, hashes in
try hashes.forEach { hash in
unchangedMessages.forEach { updatedExpiry, hashes in
hashes.forEach { hash in
guard
let expiresInSeconds: TimeInterval = try? Interaction
let interaction: Interaction = try? Interaction
.filter(Interaction.Columns.serverHash == hash)
.select(Interaction.Columns.expiresInSeconds)
.asRequest(of: TimeInterval.self)
.fetchOne(db)
.fetchOne(db),
let expiresInSeconds: TimeInterval = interaction.expiresInSeconds
else { return }
let expiresStartedAtMs: TimeInterval = TimeInterval(updatedExpiry - UInt64(expiresInSeconds * 1000))
_ = try Interaction
.filter(Interaction.Columns.serverHash == hash)
.updateAll(
dependencies.jobRunner.upsert(
db,
job: DisappearingMessagesJob.updateNextRunIfNeeded(
db,
Interaction.Columns.expiresStartedAtMs.set(to: expiresStartedAtMs)
)
interaction: interaction,
startedAtMs: expiresStartedAtMs
),
canStartJob: true,
using: dependencies
)
}
}
}
}
)

Loading…
Cancel
Save