Fix non-interactive embed preview edge case

This commit is contained in:
Ali 2023-10-25 16:56:35 +04:00
parent 2bc324f131
commit 4ecd18e649
2 changed files with 19 additions and 3 deletions

View File

@ -89,7 +89,20 @@ public final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContent
case .automaticPlayback:
openChatMessageMode = .automaticPlayback
}
let _ = item.controllerInteraction.openMessage(item.message, openChatMessageMode)
if !item.controllerInteraction.openMessage(item.message, openChatMessageMode) {
if let webPage = strongSelf.webPage, case let .Loaded(content) = webPage.content {
var isConcealed = true
if item.message.text.contains(content.url) {
isConcealed = false
}
if let attribute = item.message.webpagePreviewAttribute {
if attribute.isSafe {
isConcealed = false
}
}
item.controllerInteraction.openUrl(ChatControllerInteraction.OpenUrl(url: content.url, concealed: isConcealed, progress: strongSelf.contentNode.makeProgress()))
}
}
}
}
self.contentNode.activateAction = { [weak self] in

View File

@ -17995,8 +17995,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
} else if let embedUrl = content.embedUrl, !embedUrl.isEmpty {
progress?.set(.single(false))
let _ = self.controllerInteraction?.openMessage(message, .default)
return
if let controllerInteraction = self.controllerInteraction {
if controllerInteraction.openMessage(message, .default) {
return
}
}
}
}