|
|
|
@ -111,7 +111,8 @@ public final class LokiPublicChatAPI : LokiDotNetAPI {
|
|
|
|
|
let signature = LokiPublicChatMessage.Signature(data: Data(hex: hexEncodedSignatureData), version: signatureVersion)
|
|
|
|
|
let attachmentsAsJSON = annotations.filter { $0["type"] as? String == attachmentType }
|
|
|
|
|
let attachments: [LokiPublicChatMessage.Attachment] = attachmentsAsJSON.compactMap { attachmentAsJSON in
|
|
|
|
|
guard let value = attachmentAsJSON["value"] as? JSON, let kindAsString = value["lokiType"] as? String, let kind = LokiPublicChatMessage.Attachment.Kind(rawValue: kindAsString), let serverID = value["id"] as? UInt64, let contentType = value["contentType"] as? String, let size = value["size"] as? UInt, let fileName = value["fileName"] as? String, let flags = value["flags"] as? UInt, let width = value["width"] as? UInt, let height = value["height"] as? UInt, let url = value["url"] as? String else { return nil }
|
|
|
|
|
guard let value = attachmentAsJSON["value"] as? JSON, let kindAsString = value["lokiType"] as? String, let kind = LokiPublicChatMessage.Attachment.Kind(rawValue: kindAsString), let serverID = value["id"] as? UInt64, let contentType = value["contentType"] as? String, let size = value["size"] as? UInt, let fileName = value["fileName"] as? String, let width = value["width"] as? UInt, let height = value["height"] as? UInt, let url = value["url"] as? String else { return nil }
|
|
|
|
|
let flags = (value["flags"] as? UInt) ?? 0
|
|
|
|
|
let caption = value["caption"] as? String
|
|
|
|
|
let linkPreviewURL = value["linkPreviewUrl"] as? String
|
|
|
|
|
let linkPreviewTitle = value["linkPreviewTitle"] as? String
|
|
|
|
|