mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
979 B
Swift
24 lines
979 B
Swift
4 years ago
|
|
||
|
@objc public extension TSOutgoingMessage {
|
||
|
|
||
|
@objc(from:associatedWith:)
|
||
|
static func from(_ visibleMessage: VisibleMessage, associatedWith thread: TSThread) -> TSOutgoingMessage {
|
||
|
var expiration: UInt32 = 0
|
||
|
if let disappearingMessagesConfiguration = OWSDisappearingMessagesConfiguration.fetch(uniqueId: thread.uniqueId!) {
|
||
|
expiration = disappearingMessagesConfiguration.isEnabled ? disappearingMessagesConfiguration.durationSeconds : 0
|
||
|
}
|
||
|
return TSOutgoingMessage(
|
||
4 years ago
|
outgoingMessageWithTimestamp: visibleMessage.sentTimestamp!,
|
||
4 years ago
|
in: thread,
|
||
|
messageBody: visibleMessage.text,
|
||
4 years ago
|
attachmentIds: NSMutableArray(),
|
||
4 years ago
|
expiresInSeconds: expiration,
|
||
4 years ago
|
expireStartedAt: 0,
|
||
|
isVoiceMessage: false,
|
||
|
groupMetaMessage: .unspecified,
|
||
4 years ago
|
quotedMessage: TSQuotedMessage.from(visibleMessage.quote),
|
||
4 years ago
|
linkPreview: nil
|
||
|
)
|
||
|
}
|
||
|
}
|