mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00

# Conflicts: # .gitignore # BUCK # Makefile # Telegram/Telegram-iOS/Telegram-iOS-Hockeyapp.entitlements # submodules/AsyncDisplayKit/Source/ASDisplayNode.h # submodules/AsyncDisplayKit/Source/Private/ASDisplayNode+FrameworkPrivate.h # submodules/Display/Display/ListView.swift # submodules/Display/Display/Navigation/NavigationController.swift # submodules/Display/Display/NavigationBar.swift # submodules/Display/Display/NavigationButtonNode.swift # submodules/Display/Display/TabBarNode.swift # submodules/Display/Display/ViewController.swift # submodules/Display/Source/ContextContentContainerNode.swift # submodules/Display/Source/ContextContentSourceNode.swift # submodules/Display/Source/ContextControllerSourceNode.swift # submodules/Display/Source/ContextGesture.swift # submodules/TelegramUI/Sources/Resources/Animations/ChatListEmpty.tgs # submodules/TelegramUI/Sources/Resources/Animations/ChatListFilterEmpty.tgs # submodules/TelegramUI/TelegramUI/ChatController.swift # submodules/TelegramUI/TelegramUI/FetchVideoMediaResource.swift # submodules/ffmpeg/FFMpeg/FFMpegRemuxer.m
65 lines
2.2 KiB
Swift
65 lines
2.2 KiB
Swift
import Foundation
|
|
import AsyncDisplayKit
|
|
import Display
|
|
|
|
public final class ContextExtractedContentContainingNode: ASDisplayNode {
|
|
public let contentNode: ContextExtractedContentNode
|
|
public var contentRect: CGRect = CGRect()
|
|
public var isExtractedToContextPreview: Bool = false
|
|
public var willUpdateIsExtractedToContextPreview: ((Bool, ContainedViewLayoutTransition) -> Void)?
|
|
public var isExtractedToContextPreviewUpdated: ((Bool) -> Void)?
|
|
public var updateAbsoluteRect: ((CGRect, CGSize) -> Void)?
|
|
public var applyAbsoluteOffset: ((CGFloat, ContainedViewLayoutTransitionCurve, Double) -> Void)?
|
|
public var applyAbsoluteOffsetSpring: ((CGFloat, Double, CGFloat) -> Void)?
|
|
public var layoutUpdated: ((CGSize) -> Void)?
|
|
public var updateDistractionFreeMode: ((Bool) -> Void)?
|
|
|
|
public override init() {
|
|
self.contentNode = ContextExtractedContentNode()
|
|
|
|
super.init()
|
|
|
|
self.addSubnode(self.contentNode)
|
|
}
|
|
}
|
|
|
|
public final class ContextExtractedContentNode: ASDisplayNode {
|
|
}
|
|
|
|
public final class ContextControllerContentNode: ASDisplayNode {
|
|
public let sourceNode: ASDisplayNode
|
|
public let controller: ViewController
|
|
private let tapped: () -> Void
|
|
|
|
public init(sourceNode: ASDisplayNode, controller: ViewController, tapped: @escaping () -> Void) {
|
|
self.sourceNode = sourceNode
|
|
self.controller = controller
|
|
self.tapped = tapped
|
|
|
|
super.init()
|
|
|
|
self.addSubnode(controller.displayNode)
|
|
}
|
|
|
|
override public func didLoad() {
|
|
super.didLoad()
|
|
|
|
self.view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:))))
|
|
}
|
|
|
|
@objc private func tapGesture(_ recognizer: UITapGestureRecognizer) {
|
|
if case .ended = recognizer.state {
|
|
self.tapped()
|
|
}
|
|
}
|
|
|
|
public func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) {
|
|
transition.updateFrame(node: self.controller.displayNode, frame: CGRect(origin: CGPoint(), size: size))
|
|
}
|
|
}
|
|
|
|
public enum ContextContentNode {
|
|
case extracted(node: ContextExtractedContentContainingNode, keepInPlace: Bool)
|
|
case controller(ContextControllerContentNode)
|
|
}
|