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.
session-ios/SignalUtilitiesKit/Messaging/Attachments/Attachment+Conversion.swift

23 lines
740 B
Swift

extension TSAttachmentPointer {
public static func from(_ attachment: VisibleMessage.Attachment) -> TSAttachmentPointer {
let kind: TSAttachmentType
switch attachment.kind! {
case .generic: kind = .default
case .voiceMessage: kind = .voiceMessage
}
return TSAttachmentPointer(
serverId: 0,
key: attachment.key,
digest: attachment.digest,
byteCount: UInt32(attachment.sizeInBytes!),
contentType: attachment.contentType!,
sourceFilename: attachment.fileName,
caption: attachment.caption,
albumMessageId: nil,
attachmentType: kind,
mediaSize: attachment.size!)
}
}