session-ios/SignalUtilitiesKit/Utilities/TSIncomingMessage+Conversio...

21 lines
682 B
Swift
Raw Normal View History

2020-11-17 06:23:13 +01:00
public extension TSIncomingMessage {
2020-11-18 05:36:51 +01:00
static func from(_ visibleMessage: VisibleMessage, associatedWith thread: TSThread, using transaction: YapDatabaseReadWriteTransaction) -> TSIncomingMessage {
2020-11-17 06:23:13 +01:00
let sender = visibleMessage.sender!
return TSIncomingMessage(
timestamp: visibleMessage.receivedTimestamp!,
in: thread,
authorId: sender,
sourceDeviceId: 1,
messageBody: visibleMessage.text!,
attachmentIds: [],
expiresInSeconds: 0,
quotedMessage: nil,
linkPreview: nil,
serverTimestamp: nil,
wasReceivedByUD: true
)
}
}