mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
• Updated to latest libSession • Updated code to use urls and strings from libSession • Split the profile and message pro feature bitsets • Fixed a bunch of warnings • Fixed a bug where the Toggle ListItemAccessory could swallow touches and make it appear as though something changed when it didn't • Fixed a bug where not all profile data was getting encoded/decoded
87 lines
3.0 KiB
Swift
87 lines
3.0 KiB
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
import UniformTypeIdentifiers
|
|
import GRDB
|
|
import SessionUIKit
|
|
import SessionUtilitiesKit
|
|
|
|
public struct QuotedReplyModel: Sendable, Equatable, Hashable {
|
|
public let threadId: String
|
|
public let quotedInteractionId: Int64?
|
|
public let authorId: String
|
|
public let authorName: String
|
|
public let timestampMs: Int64
|
|
public let body: String?
|
|
public let attachment: Attachment?
|
|
public let contentType: String?
|
|
public let sourceFileName: String?
|
|
public let thumbnailDownloadFailed: Bool
|
|
public let proMessageFeatures: SessionPro.MessageFeatures
|
|
public let currentUserSessionIds: Set<String>
|
|
|
|
// MARK: - Initialization
|
|
|
|
private init(
|
|
threadId: String,
|
|
quotedInteractionId: Int64?,
|
|
authorId: String,
|
|
authorName: String,
|
|
timestampMs: Int64,
|
|
body: String?,
|
|
attachment: Attachment?,
|
|
contentType: String?,
|
|
sourceFileName: String?,
|
|
thumbnailDownloadFailed: Bool,
|
|
proMessageFeatures: SessionPro.MessageFeatures,
|
|
currentUserSessionIds: Set<String>
|
|
) {
|
|
self.threadId = threadId
|
|
self.quotedInteractionId = quotedInteractionId
|
|
self.authorId = authorId
|
|
self.authorName = authorName
|
|
self.timestampMs = timestampMs
|
|
self.body = body
|
|
self.attachment = attachment
|
|
self.contentType = contentType
|
|
self.sourceFileName = sourceFileName
|
|
self.thumbnailDownloadFailed = thumbnailDownloadFailed
|
|
self.proMessageFeatures = proMessageFeatures
|
|
self.currentUserSessionIds = currentUserSessionIds
|
|
}
|
|
|
|
public static func quotedReplyForSending(
|
|
threadId: String,
|
|
quotedInteractionId: Int64?,
|
|
authorId: String,
|
|
authorName: String,
|
|
variant: Interaction.Variant,
|
|
body: String?,
|
|
timestampMs: Int64,
|
|
attachments: [Attachment]?,
|
|
linkPreviewAttachment: Attachment?,
|
|
proMessageFeatures: SessionPro.MessageFeatures,
|
|
currentUserSessionIds: Set<String>
|
|
) -> QuotedReplyModel? {
|
|
guard variant == .standardOutgoing || variant == .standardIncoming else { return nil }
|
|
guard (body != nil && body?.isEmpty == false) || attachments?.isEmpty == false else { return nil }
|
|
|
|
let targetAttachment: Attachment? = (attachments?.first ?? linkPreviewAttachment)
|
|
|
|
return QuotedReplyModel(
|
|
threadId: threadId,
|
|
quotedInteractionId: quotedInteractionId,
|
|
authorId: authorId,
|
|
authorName: authorName,
|
|
timestampMs: timestampMs,
|
|
body: body,
|
|
attachment: targetAttachment,
|
|
contentType: targetAttachment?.contentType,
|
|
sourceFileName: targetAttachment?.sourceFilename,
|
|
thumbnailDownloadFailed: false,
|
|
proMessageFeatures: proMessageFeatures,
|
|
currentUserSessionIds: currentUserSessionIds
|
|
)
|
|
}
|
|
}
|