mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Upgrade peek controller to modern context menu implementation
This commit is contained in:
@@ -183,8 +183,6 @@ public enum TabBarItemContextActionType {
|
||||
public let navigationBar: NavigationBar?
|
||||
private(set) var toolbar: Toolbar?
|
||||
|
||||
private var previewingContext: Any?
|
||||
|
||||
public var displayNavigationBar = true
|
||||
open var navigationBarRequiresEntireLayoutUpdate: Bool {
|
||||
return true
|
||||
@@ -612,33 +610,6 @@ public enum TabBarItemContextActionType {
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 9.0, iOS 9.0, *)
|
||||
open func registerForPreviewing(with delegate: UIViewControllerPreviewingDelegate, sourceView: UIView, theme: PeekControllerTheme, onlyNative: Bool) {
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 9.0, iOS 9.0, *)
|
||||
public func registerForPreviewingNonNative(with delegate: UIViewControllerPreviewingDelegate, sourceView: UIView, theme: PeekControllerTheme) {
|
||||
if true || self.traitCollection.forceTouchCapability != .available {
|
||||
if self.previewingContext == nil {
|
||||
let previewingContext = SimulatedViewControllerPreviewing(theme: theme, delegate: delegate, sourceView: sourceView, node: self.displayNode, present: { [weak self] c, a in
|
||||
self?.presentInGlobalOverlay(c, with: a)
|
||||
}, customPresent: { [weak self] c, n in
|
||||
return self?.customPresentPreviewingController?(c, n)
|
||||
})
|
||||
self.previewingContext = previewingContext
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@available(iOSApplicationExtension 9.0, iOS 9.0, *)
|
||||
open override func unregisterForPreviewing(withContext previewing: UIViewControllerPreviewing) {
|
||||
if self.previewingContext != nil {
|
||||
self.previewingContext = nil
|
||||
} else {
|
||||
super.unregisterForPreviewing(withContext: previewing)
|
||||
}
|
||||
}
|
||||
|
||||
public final func navigationNextSibling() -> UIViewController? {
|
||||
if let navigationController = self.navigationController as? NavigationController {
|
||||
if let index = navigationController.viewControllers.firstIndex(where: { $0 === self }) {
|
||||
|
||||
Reference in New Issue
Block a user