Merge pull request #652 from mpretty-cyro/fix/outgoing-disappearing-messages
Fixed a bug where disappearing messages weren't working for local outgoing messages
This commit is contained in:
commit
7a6d6fe2aa
|
@ -369,9 +369,15 @@ extension ConversationVC:
|
||||||
body: text,
|
body: text,
|
||||||
timestampMs: sentTimestampMs,
|
timestampMs: sentTimestampMs,
|
||||||
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: text),
|
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: text),
|
||||||
|
expiresInSeconds: try? DisappearingMessagesConfiguration
|
||||||
|
.select(.durationSeconds)
|
||||||
|
.filter(id: threadId)
|
||||||
|
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
|
||||||
|
.asRequest(of: TimeInterval.self)
|
||||||
|
.fetchOne(db),
|
||||||
linkPreviewUrl: linkPreviewDraft?.urlString
|
linkPreviewUrl: linkPreviewDraft?.urlString
|
||||||
).inserted(db)
|
).inserted(db)
|
||||||
|
|
||||||
// If there is a LinkPreview and it doesn't match an existing one then add it now
|
// If there is a LinkPreview and it doesn't match an existing one then add it now
|
||||||
if
|
if
|
||||||
let linkPreviewDraft: LinkPreviewDraft = linkPreviewDraft,
|
let linkPreviewDraft: LinkPreviewDraft = linkPreviewDraft,
|
||||||
|
@ -459,7 +465,13 @@ extension ConversationVC:
|
||||||
variant: .standardOutgoing,
|
variant: .standardOutgoing,
|
||||||
body: text,
|
body: text,
|
||||||
timestampMs: sentTimestampMs,
|
timestampMs: sentTimestampMs,
|
||||||
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: text)
|
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: text),
|
||||||
|
expiresInSeconds: try? DisappearingMessagesConfiguration
|
||||||
|
.select(.durationSeconds)
|
||||||
|
.filter(id: threadId)
|
||||||
|
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
|
||||||
|
.asRequest(of: TimeInterval.self)
|
||||||
|
.fetchOne(db)
|
||||||
).inserted(db)
|
).inserted(db)
|
||||||
|
|
||||||
try MessageSender.send(
|
try MessageSender.send(
|
||||||
|
|
|
@ -436,7 +436,13 @@ class NotificationActionHandler {
|
||||||
variant: .standardOutgoing,
|
variant: .standardOutgoing,
|
||||||
body: replyText,
|
body: replyText,
|
||||||
timestampMs: Int64(floor(Date().timeIntervalSince1970 * 1000)),
|
timestampMs: Int64(floor(Date().timeIntervalSince1970 * 1000)),
|
||||||
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: replyText)
|
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: replyText),
|
||||||
|
expiresInSeconds: try? DisappearingMessagesConfiguration
|
||||||
|
.select(.durationSeconds)
|
||||||
|
.filter(id: threadId)
|
||||||
|
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
|
||||||
|
.asRequest(of: TimeInterval.self)
|
||||||
|
.fetchOne(db)
|
||||||
).inserted(db)
|
).inserted(db)
|
||||||
|
|
||||||
try Interaction.markAsRead(
|
try Interaction.markAsRead(
|
||||||
|
|
|
@ -233,6 +233,12 @@ public class SMKOpenGroup: NSObject {
|
||||||
authorId: userId,
|
authorId: userId,
|
||||||
variant: .standardOutgoing,
|
variant: .standardOutgoing,
|
||||||
timestampMs: Int64(floor(Date().timeIntervalSince1970 * 1000)),
|
timestampMs: Int64(floor(Date().timeIntervalSince1970 * 1000)),
|
||||||
|
expiresInSeconds: try? DisappearingMessagesConfiguration
|
||||||
|
.select(.durationSeconds)
|
||||||
|
.filter(id: userId)
|
||||||
|
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
|
||||||
|
.asRequest(of: TimeInterval.self)
|
||||||
|
.fetchOne(db),
|
||||||
linkPreviewUrl: urlString
|
linkPreviewUrl: urlString
|
||||||
)
|
)
|
||||||
.saved(db)
|
.saved(db)
|
||||||
|
|
|
@ -236,6 +236,12 @@ final class ThreadPickerVC: UIViewController, UITableViewDataSource, UITableView
|
||||||
body: body,
|
body: body,
|
||||||
timestampMs: Int64(floor(Date().timeIntervalSince1970 * 1000)),
|
timestampMs: Int64(floor(Date().timeIntervalSince1970 * 1000)),
|
||||||
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: body),
|
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: body),
|
||||||
|
expiresInSeconds: try? DisappearingMessagesConfiguration
|
||||||
|
.select(.durationSeconds)
|
||||||
|
.filter(id: threadId)
|
||||||
|
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
|
||||||
|
.asRequest(of: TimeInterval.self)
|
||||||
|
.fetchOne(db),
|
||||||
linkPreviewUrl: (isSharingUrl ? attachments.first?.linkPreviewDraft?.urlString : nil)
|
linkPreviewUrl: (isSharingUrl ? attachments.first?.linkPreviewDraft?.urlString : nil)
|
||||||
).inserted(db)
|
).inserted(db)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue