mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
6dc3045ccd
@ -12,7 +12,7 @@ public enum GalleryControllerItemSource {
|
||||
}
|
||||
|
||||
public final class GalleryControllerActionInteraction {
|
||||
public let openUrl: (String, Bool) -> Void
|
||||
public let openUrl: (String, Bool, Bool) -> Void
|
||||
public let openUrlIn: (String) -> Void
|
||||
public let openPeerMention: (String) -> Void
|
||||
public let openPeer: (EnginePeer) -> Void
|
||||
@ -25,7 +25,7 @@ public final class GalleryControllerActionInteraction {
|
||||
public let updateCanReadHistory: (Bool) -> Void
|
||||
|
||||
public init(
|
||||
openUrl: @escaping (String, Bool) -> Void,
|
||||
openUrl: @escaping (String, Bool, Bool) -> Void,
|
||||
openUrlIn: @escaping (String) -> Void,
|
||||
openPeerMention: @escaping (String) -> Void,
|
||||
openPeer: @escaping (EnginePeer) -> Void,
|
||||
|
@ -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, dismiss: true)
|
||||
return .url(url: url, concealed: concealed, forceExternal: false, 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, 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)
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
@ -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, dismiss: true), message)
|
||||
strongSelf.footerContentNode.openActionOptions?(.url(url: payload, concealed: true, forceExternal: false, dismiss: true), message)
|
||||
}
|
||||
recognizedContentNode.alpha = 0.0
|
||||
recognizedContentNode.frame = CGRect(origin: CGPoint(), size: size)
|
||||
|
@ -368,7 +368,7 @@ private final class UniversalVideoGalleryItemOverlayNode: GalleryOverlayContentN
|
||||
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, dismiss: false))
|
||||
self.performAction?(.url(url: ad.url, concealed: false, forceExternal: true, dismiss: false))
|
||||
}
|
||||
},
|
||||
moreAction: { [weak self] sourceNode in
|
||||
|
@ -5599,9 +5599,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
|
||||
}, callPeer: { peerId, isVideo in
|
||||
}, openConferenceCall: { _ in
|
||||
}, enqueueMessage: { _ in
|
||||
}, sendSticker: nil, sendEmoji: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in }, actionInteraction: GalleryControllerActionInteraction(openUrl: { [weak self] url, concealed in
|
||||
}, sendSticker: nil, sendEmoji: nil, setupTemporaryHiddenMedia: { _, _, _ in }, chatAvatarHiddenMedia: { _, _ in }, actionInteraction: GalleryControllerActionInteraction(openUrl: { [weak self] url, concealed, forceExternal in
|
||||
if let strongSelf = self {
|
||||
strongSelf.openUrl(url: url, concealed: false, external: false)
|
||||
strongSelf.openUrl(url: url, concealed: false, external: forceExternal)
|
||||
}
|
||||
}, openUrlIn: { [weak self] url in
|
||||
if let strongSelf = self {
|
||||
|
@ -2801,7 +2801,7 @@ final class StorageUsageScreenComponent: Component {
|
||||
sendEmoji: nil,
|
||||
setupTemporaryHiddenMedia: { _, _, _ in },
|
||||
chatAvatarHiddenMedia: { _, _ in },
|
||||
actionInteraction: GalleryControllerActionInteraction(openUrl: { [weak self] url, concealed in
|
||||
actionInteraction: GalleryControllerActionInteraction(openUrl: { [weak self] url, concealed, forceExternal in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
|
@ -1395,9 +1395,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}))
|
||||
}
|
||||
}, actionInteraction: GalleryControllerActionInteraction(
|
||||
openUrl: { [weak self] url, concealed in
|
||||
openUrl: { [weak self] url, concealed, forceExternal in
|
||||
if let self {
|
||||
self.openUrl(url, concealed: concealed, message: nil)
|
||||
self.openUrl(url, concealed: concealed, forceExternal: forceExternal, message: nil)
|
||||
}
|
||||
}, openUrlIn: { [weak self] url in
|
||||
if let self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user