Merge pull request #347 from mpretty-cyro/fix/shared-messages-not-expiring

Fixed an issue where shared messages and community invites wouldn't disappear
pull/1056/head
Morgan Pretty 4 months ago committed by GitHub
commit 380d81683a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -7677,7 +7677,7 @@
CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
CURRENT_PROJECT_VERSION = 516;
CURRENT_PROJECT_VERSION = 517;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -7756,7 +7756,7 @@
CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CURRENT_PROJECT_VERSION = 516;
CURRENT_PROJECT_VERSION = 517;
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;

@ -792,18 +792,19 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigationItemSource, Navi
)
.save(db)
let sentTimestampMs: Int64 = SnodeAPI.currentOffsetTimestampMs()
let destinationDisappearingMessagesConfiguration: DisappearingMessagesConfiguration? = try? DisappearingMessagesConfiguration
.filter(id: userId)
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
.fetchOne(db)
let interaction: Interaction = try Interaction(
threadId: thread.id,
threadVariant: thread.variant,
authorId: currentUserSessionId,
variant: .standardOutgoing,
timestampMs: SnodeAPI.currentOffsetTimestampMs(),
expiresInSeconds: try? DisappearingMessagesConfiguration
.select(.durationSeconds)
.filter(id: userId)
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
.asRequest(of: TimeInterval.self)
.fetchOne(db),
timestampMs: sentTimestampMs,
expiresInSeconds: destinationDisappearingMessagesConfiguration?.durationSeconds,
expiresStartedAtMs: (destinationDisappearingMessagesConfiguration?.type == .disappearAfterSend ? Double(sentTimestampMs) : nil),
linkPreviewUrl: communityUrl
)
.inserted(db)

@ -512,14 +512,21 @@ class NotificationActionHandler {
return Storage.shared
.writePublisher { db in
let sentTimestampMs: Int64 = SnodeAPI.currentOffsetTimestampMs()
let destinationDisappearingMessagesConfiguration: DisappearingMessagesConfiguration? = try? DisappearingMessagesConfiguration
.filter(id: threadId)
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
.fetchOne(db)
let interaction: Interaction = try Interaction(
threadId: threadId,
threadVariant: thread.variant,
authorId: getUserHexEncodedPublicKey(db),
variant: .standardOutgoing,
body: replyText,
timestampMs: SnodeAPI.currentOffsetTimestampMs(),
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: replyText)
timestampMs: sentTimestampMs,
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: replyText),
expiresInSeconds: destinationDisappearingMessagesConfiguration?.durationSeconds,
expiresStartedAtMs: (destinationDisappearingMessagesConfiguration?.type == .disappearAfterSend ? Double(sentTimestampMs) : nil)
).inserted(db)
try Interaction.markAsRead(

@ -280,14 +280,21 @@ final class ThreadPickerVC: UIViewController, UITableViewDataSource, UITableView
}
// Create the interaction
let sentTimestampMs: Int64 = SnodeAPI.currentOffsetTimestampMs()
let destinationDisappearingMessagesConfiguration: DisappearingMessagesConfiguration? = try? DisappearingMessagesConfiguration
.filter(id: threadId)
.filter(DisappearingMessagesConfiguration.Columns.isEnabled == true)
.fetchOne(db)
let interaction: Interaction = try Interaction(
threadId: threadId,
threadVariant: threadVariant,
authorId: getUserHexEncodedPublicKey(db),
variant: .standardOutgoing,
body: body,
timestampMs: SnodeAPI.currentOffsetTimestampMs(),
timestampMs: sentTimestampMs,
hasMention: Interaction.isUserMentioned(db, threadId: threadId, body: body),
expiresInSeconds: destinationDisappearingMessagesConfiguration?.durationSeconds,
expiresStartedAtMs: (destinationDisappearingMessagesConfiguration?.type == .disappearAfterSend ? Double(sentTimestampMs) : nil),
linkPreviewUrl: (isSharingUrl ? attachments.first?.linkPreviewDraft?.urlString : nil)
).inserted(db)

Loading…
Cancel
Save