mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Merge commit '1507e99c1d785a03be868d37603f676662d90b97'
This commit is contained in:
commit
1b066a3c8e
@ -783,7 +783,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, ASScroll
|
||||
if let (attributeText, fullText) = self.textNode.attributeSubstring(name: TelegramTextAttributes.URL, index: index) {
|
||||
concealed = !doesUrlMatchText(url: url, text: attributeText, fullText: fullText)
|
||||
}
|
||||
return .url(url: url, concealed: concealed)
|
||||
return .url(url: url, concealed: concealed, dismiss: true)
|
||||
} else if let peerMention = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerMention)] as? TelegramPeerMention {
|
||||
return .peerMention(peerMention.peerId, peerMention.mention)
|
||||
} else if let peerName = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.PeerTextMention)] as? String {
|
||||
|
@ -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))
|
||||
performAction(.url(url: url.absoluteString, concealed: false, dismiss: true))
|
||||
}) {
|
||||
content = webEmbedContent
|
||||
}
|
||||
@ -504,7 +504,7 @@ private enum GalleryMessageHistoryView {
|
||||
}
|
||||
|
||||
public enum GalleryControllerInteractionTapAction {
|
||||
case url(url: String, concealed: Bool)
|
||||
case url(url: String, concealed: Bool, dismiss: Bool)
|
||||
case textMention(String)
|
||||
case peerMention(PeerId, String)
|
||||
case botCommand(String)
|
||||
@ -960,12 +960,13 @@ public class GalleryController: ViewController, StandalonePresentableController,
|
||||
|
||||
performActionImpl = { [weak self] action in
|
||||
if let strongSelf = self {
|
||||
if case .timecode = action {
|
||||
if case let .url(_, _, dismiss) = action, !dismiss {
|
||||
} else if case .timecode = action {
|
||||
} else {
|
||||
strongSelf.dismiss(forceAway: false)
|
||||
}
|
||||
switch action {
|
||||
case let .url(url, concealed):
|
||||
case let .url(url, concealed, _):
|
||||
strongSelf.actionInteraction?.openUrl(url, concealed)
|
||||
case let .textMention(mention):
|
||||
strongSelf.actionInteraction?.openPeerMention(mention)
|
||||
@ -995,7 +996,7 @@ public class GalleryController: ViewController, StandalonePresentableController,
|
||||
presentationData = presentationData.withUpdated(theme: defaultDarkColorPresentationTheme)
|
||||
}
|
||||
switch action {
|
||||
case let .url(url, _):
|
||||
case let .url(url, _, _):
|
||||
var cleanUrl = url
|
||||
var canAddToReadingList = true
|
||||
let canOpenIn = availableOpenInOptions(context: strongSelf.context, item: .url(url: url)).count > 1
|
||||
|
@ -435,7 +435,7 @@ final class ChatImageGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
guard let strongSelf = self, let message = strongSelf.message else {
|
||||
return
|
||||
}
|
||||
strongSelf.footerContentNode.openActionOptions?(.url(url: payload, concealed: true), message)
|
||||
strongSelf.footerContentNode.openActionOptions?(.url(url: payload, concealed: true, dismiss: true), message)
|
||||
}
|
||||
recognizedContentNode.alpha = 0.0
|
||||
recognizedContentNode.frame = CGRect(origin: CGPoint(), size: size)
|
||||
|
@ -333,6 +333,11 @@ private final class UniversalVideoGalleryItemOverlayNode: GalleryOverlayContentN
|
||||
|
||||
let sideInset: CGFloat = 16.0
|
||||
|
||||
var maxWidth = min(size.width, size.height) - sideInset * 2.0
|
||||
if case .regular = metrics.widthClass {
|
||||
maxWidth = 414.0
|
||||
}
|
||||
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let adSize = self.adView.update(
|
||||
transition: .immediate,
|
||||
@ -358,8 +363,12 @@ private final class UniversalVideoGalleryItemOverlayNode: GalleryOverlayContentN
|
||||
},
|
||||
adAction: { [weak self] in
|
||||
if let self, let ad = adMessage.adAttribute {
|
||||
self.hiddenMessages.insert(adMessage.id)
|
||||
if let validLayout = self.validLayout {
|
||||
self.updateLayout(size: validLayout.size, metrics: validLayout.metrics, insets: validLayout.insets, isHidden: false, transition: .immediate)
|
||||
}
|
||||
context.engine.messages.markAdAction(opaqueId: ad.opaqueId, media: false, fullscreen: false)
|
||||
self.performAction?(.url(url: ad.url, concealed: false))
|
||||
self.performAction?(.url(url: ad.url, concealed: false, dismiss: false))
|
||||
}
|
||||
},
|
||||
moreAction: { [weak self] sourceNode in
|
||||
@ -370,7 +379,7 @@ private final class UniversalVideoGalleryItemOverlayNode: GalleryOverlayContentN
|
||||
)
|
||||
),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: size.width - sideInset * 2.0, height: 200.0)
|
||||
containerSize: CGSize(width: maxWidth, height: 200.0)
|
||||
)
|
||||
if let adView = self.adView.view {
|
||||
if adView.superview == nil {
|
||||
@ -2091,13 +2100,17 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
|
||||
if let contentInfo = item.contentInfo, case let .message(message, _) = contentInfo {
|
||||
self.overlayContentNode.performAction = { [weak self] action in
|
||||
guard let self , let item = self.item else {
|
||||
guard let self, let item = self.item else {
|
||||
return
|
||||
}
|
||||
if case .url = action {
|
||||
self.pictureInPictureButtonPressed()
|
||||
Queue.mainQueue().after(0.3) {
|
||||
item.performAction(action)
|
||||
}
|
||||
} else {
|
||||
item.performAction(action)
|
||||
}
|
||||
item.performAction(action)
|
||||
}
|
||||
self.overlayContentNode.presentPremiumDemo = { [weak self] in
|
||||
self?.presentPremiumDemo()
|
||||
|
@ -328,6 +328,14 @@ func openChatMessageImpl(_ params: OpenChatMessageParams) -> Bool {
|
||||
|
||||
params.blockInteraction.set(.single(true))
|
||||
|
||||
var presentInCurrent = false
|
||||
if let channel = params.message.peers[params.message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
|
||||
if let layout = params.navigationController?.validLayout, case .regular = layout.metrics.widthClass {
|
||||
} else {
|
||||
presentInCurrent = true
|
||||
}
|
||||
}
|
||||
|
||||
let _ = (gallery
|
||||
|> deliverOnMainQueue).startStandalone(next: { gallery in
|
||||
params.blockInteraction.set(.single(false))
|
||||
@ -344,7 +352,7 @@ func openChatMessageImpl(_ params: OpenChatMessageParams) -> Bool {
|
||||
return nil
|
||||
})
|
||||
|
||||
params.present(gallery, arguments, .window(.root))
|
||||
params.present(gallery, arguments, presentInCurrent ? .current : .window(.root))
|
||||
})
|
||||
return true
|
||||
case let .secretGallery(gallery):
|
||||
|
Loading…
x
Reference in New Issue
Block a user