[WIP] Quotes and link previews

This commit is contained in:
Ali
2023-10-18 01:11:23 +04:00
parent 137c3d9101
commit af8474aca5
88 changed files with 2582 additions and 966 deletions

View File

@@ -382,7 +382,18 @@ func updatedChatEditInterfaceMessageState(state: ChatPresentationInterfaceState,
var updated = state
for media in message.media {
if let webpage = media as? TelegramMediaWebpage, case let .Loaded(content) = webpage.content {
updated = updated.updatedEditingUrlPreview((content.url, webpage))
let attribute = message.attributes.first(where: { $0 is WebpagePreviewMessageAttribute }) as? WebpagePreviewMessageAttribute
var positionBelowText = true
if let leadingPreview = attribute?.leadingPreview {
positionBelowText = !leadingPreview
}
let updatedPreview = ChatPresentationInterfaceState.UrlPreview(
url: content.url,
webPage: webpage,
positionBelowText: positionBelowText,
largeMedia: attribute?.forceLargeMedia
)
updated = updated.updatedEditingUrlPreview(updatedPreview)
}
}
var isPlaintext = true