mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Temp
This commit is contained in:
parent
664c5b3759
commit
9e5db9c4dc
@ -73,9 +73,12 @@ private final class ContextControllerContentSourceImpl: ContextControllerContent
|
||||
let controller: ViewController
|
||||
weak var sourceNode: ASDisplayNode?
|
||||
|
||||
init(controller: ViewController, sourceNode: ASDisplayNode?) {
|
||||
let navigationController: NavigationController?
|
||||
|
||||
init(controller: ViewController, sourceNode: ASDisplayNode?, navigationController: NavigationController?) {
|
||||
self.controller = controller
|
||||
self.sourceNode = sourceNode
|
||||
self.navigationController = navigationController
|
||||
}
|
||||
|
||||
func transitionInfo() -> ContextControllerTakeControllerInfo? {
|
||||
@ -661,12 +664,12 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
||||
case let .groupReference(groupReference):
|
||||
let chatListController = ChatListControllerImpl(context: strongSelf.context, groupId: groupReference.groupId, controlsHistoryPreload: false, hideNetworkActivityStatus: true, previewing: true, enableDebugActions: false)
|
||||
chatListController.navigationPresentation = .master
|
||||
let contextController = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node)), items: archiveContextMenuItems(context: strongSelf.context, groupId: groupReference.groupId, chatListController: strongSelf), reactionItems: [], gesture: gesture)
|
||||
let contextController = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: archiveContextMenuItems(context: strongSelf.context, groupId: groupReference.groupId, chatListController: strongSelf), reactionItems: [], gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
case let .peer(peer):
|
||||
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(peer.peer.peerId), subject: nil, botStart: nil, mode: .standard(previewing: true))
|
||||
chatController.canReadHistory.set(false)
|
||||
let contextController = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.peer.peerId, source: .chatList, chatListController: strongSelf), reactionItems: [], gesture: gesture)
|
||||
let contextController = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.peer.peerId, source: .chatList, chatListController: strongSelf), reactionItems: [], gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
}
|
||||
}
|
||||
@ -679,7 +682,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
|
||||
|
||||
let chatController = strongSelf.context.sharedContext.makeChatController(context: strongSelf.context, chatLocation: .peer(peer.id), subject: nil, botStart: nil, mode: .standard(previewing: true))
|
||||
chatController.canReadHistory.set(false)
|
||||
let contextController = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.id, source: .search(source), chatListController: strongSelf), reactionItems: [], gesture: gesture)
|
||||
let contextController = ContextController(account: strongSelf.context.account, theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings, source: .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.id, source: .search(source), chatListController: strongSelf), reactionItems: [], gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
}
|
||||
|
||||
|
@ -29,16 +29,30 @@ public final class ContextExtractedContentNode: ASDisplayNode {
|
||||
final class ContextControllerContentNode: ASDisplayNode {
|
||||
let sourceNode: ASDisplayNode
|
||||
let controller: ViewController
|
||||
private let tapped: () -> Void
|
||||
|
||||
init(sourceNode: ASDisplayNode, controller: ViewController) {
|
||||
init(sourceNode: ASDisplayNode, controller: ViewController, tapped: @escaping () -> Void) {
|
||||
self.sourceNode = sourceNode
|
||||
self.controller = controller
|
||||
self.tapped = tapped
|
||||
|
||||
super.init()
|
||||
|
||||
self.addSubnode(controller.displayNode)
|
||||
}
|
||||
|
||||
override 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()
|
||||
}
|
||||
}
|
||||
|
||||
func updateLayout(size: CGSize, transition: ContainedViewLayoutTransition) {
|
||||
transition.updateFrame(node: self.controller.displayNode, frame: CGRect(origin: CGPoint(), size: size))
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
private let beginDismiss: (ContextMenuActionResult) -> Void
|
||||
private let reactionSelected: (String) -> Void
|
||||
private let beganAnimatingOut: () -> Void
|
||||
private let attemptTransitionControllerIntoNavigation: () -> Void
|
||||
private let getController: () -> ContextController?
|
||||
private weak var gesture: ContextGesture?
|
||||
|
||||
@ -107,7 +108,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
|
||||
private let itemsDisposable = MetaDisposable()
|
||||
|
||||
init(account: Account, controller: ContextController, theme: PresentationTheme, strings: PresentationStrings, source: ContextContentSource, items: Signal<[ContextMenuItem], NoError>, reactionItems: [ReactionContextItem], beginDismiss: @escaping (ContextMenuActionResult) -> Void, recognizer: TapLongTapOrDoubleTapGestureRecognizer?, gesture: ContextGesture?, reactionSelected: @escaping (String) -> Void, beganAnimatingOut: @escaping () -> Void) {
|
||||
init(account: Account, controller: ContextController, theme: PresentationTheme, strings: PresentationStrings, source: ContextContentSource, items: Signal<[ContextMenuItem], NoError>, reactionItems: [ReactionContextItem], beginDismiss: @escaping (ContextMenuActionResult) -> Void, recognizer: TapLongTapOrDoubleTapGestureRecognizer?, gesture: ContextGesture?, reactionSelected: @escaping (String) -> Void, beganAnimatingOut: @escaping () -> Void, attemptTransitionControllerIntoNavigation: @escaping () -> Void) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.source = source
|
||||
@ -115,6 +116,7 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
self.beginDismiss = beginDismiss
|
||||
self.reactionSelected = reactionSelected
|
||||
self.beganAnimatingOut = beganAnimatingOut
|
||||
self.attemptTransitionControllerIntoNavigation = attemptTransitionControllerIntoNavigation
|
||||
self.gesture = gesture
|
||||
|
||||
self.getController = { [weak controller] in
|
||||
@ -456,7 +458,9 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
case let .controller(source):
|
||||
let transitionInfo = source.transitionInfo()
|
||||
if let transitionInfo = transitionInfo, let (sourceNode, sourceNodeRect) = transitionInfo.sourceNode() {
|
||||
let contentParentNode = ContextControllerContentNode(sourceNode: sourceNode, controller: source.controller)
|
||||
let contentParentNode = ContextControllerContentNode(sourceNode: sourceNode, controller: source.controller, tapped: { [weak self] in
|
||||
self?.attemptTransitionControllerIntoNavigation()
|
||||
})
|
||||
self.contentContainerNode.contentNode = .controller(contentParentNode)
|
||||
self.contentContainerNode.clipsToBounds = true
|
||||
self.contentContainerNode.cornerRadius = 14.0
|
||||
@ -1269,6 +1273,9 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi
|
||||
case let .controller(controller):
|
||||
let controllerPoint = self.view.convert(point, to: controller.controller.view)
|
||||
if let result = controller.controller.view.hitTest(controllerPoint, with: event) {
|
||||
#if DEBUG
|
||||
//return controller.view
|
||||
#endif
|
||||
return result
|
||||
}
|
||||
}
|
||||
@ -1317,6 +1324,8 @@ public protocol ContextExtractedContentSource: class {
|
||||
|
||||
public protocol ContextControllerContentSource: class {
|
||||
var controller: ViewController { get }
|
||||
var navigationController: NavigationController? { get }
|
||||
|
||||
func transitionInfo() -> ContextControllerTakeControllerInfo?
|
||||
}
|
||||
|
||||
@ -1379,6 +1388,19 @@ public final class ContextController: ViewController, StandalonePresentableContr
|
||||
strongSelf.reactionSelected?(value)
|
||||
}, beganAnimatingOut: { [weak self] in
|
||||
self?.statusBar.statusBarStyle = .Ignore
|
||||
}, attemptTransitionControllerIntoNavigation: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
switch strongSelf.source {
|
||||
/*case let .controller(controller):
|
||||
if let navigationController = controller.navigationController {
|
||||
strongSelf.presentingViewController?.dismiss(animated: false, completion: nil)
|
||||
navigationController.pushViewController(controller.controller, animated: false)
|
||||
}*/
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
|
||||
self.displayNodeDidLoad()
|
||||
|
Loading…
x
Reference in New Issue
Block a user