Force external for video ads

This commit is contained in:
Ilya Laktyushin
2025-08-13 18:07:18 +04:00
parent 8f70aa3957
commit 91036bcdc2
8 changed files with 17 additions and 17 deletions

View File

@@ -386,7 +386,7 @@ public func galleryItemForEntry(
}
}
if content == nil, let webEmbedContent = WebEmbedVideoContent(userLocation: .peer(message.id.peerId), webPage: webpage, webpageContent: webpageContent, forcedTimestamp: timecode.flatMap(Int.init), openUrl: { url in
performAction(.url(url: url.absoluteString, concealed: false, dismiss: true))
performAction(.url(url: url.absoluteString, concealed: false, forceExternal: false, dismiss: true))
}) {
content = webEmbedContent
}
@@ -504,7 +504,7 @@ private enum GalleryMessageHistoryView {
}
public enum GalleryControllerInteractionTapAction {
case url(url: String, concealed: Bool, dismiss: Bool)
case url(url: String, concealed: Bool, forceExternal: Bool, dismiss: Bool)
case textMention(String)
case peerMention(PeerId, String)
case botCommand(String)
@@ -960,14 +960,14 @@ public class GalleryController: ViewController, StandalonePresentableController,
performActionImpl = { [weak self] action in
if let strongSelf = self {
if case let .url(_, _, dismiss) = action, !dismiss {
if case let .url(_, _, _, dismiss) = action, !dismiss {
} else if case .timecode = action {
} else {
strongSelf.dismiss(forceAway: false)
}
switch action {
case let .url(url, concealed, _):
strongSelf.actionInteraction?.openUrl(url, concealed)
case let .url(url, concealed, forceExternal, _):
strongSelf.actionInteraction?.openUrl(url, concealed, forceExternal)
case let .textMention(mention):
strongSelf.actionInteraction?.openPeerMention(mention)
case let .peerMention(peerId, _):
@@ -996,7 +996,7 @@ public class GalleryController: ViewController, StandalonePresentableController,
presentationData = presentationData.withUpdated(theme: defaultDarkColorPresentationTheme)
}
switch action {
case let .url(url, _, _):
case let .url(url, _, forceExternal, _):
var cleanUrl = url
var canAddToReadingList = true
let canOpenIn = availableOpenInOptions(context: strongSelf.context, item: .url(url: url)).count > 1
@@ -1031,7 +1031,7 @@ public class GalleryController: ViewController, StandalonePresentableController,
strongSelf.actionInteraction?.openUrlIn(url)
} else {
strongSelf.dismiss(forceAway: false)
strongSelf.actionInteraction?.openUrl(url, false)
strongSelf.actionInteraction?.openUrl(url, false, forceExternal)
}
}
}))