Native picture in picture support

This commit is contained in:
Ali
2021-11-02 16:04:39 +04:00
parent cf624bcad3
commit 17c84b85a0
17 changed files with 469 additions and 87 deletions

View File

@@ -385,6 +385,8 @@ public class GalleryController: ViewController, StandalonePresentableController
private var screenCaptureEventsDisposable: Disposable?
public var centralItemUpdated: ((MessageId) -> Void)?
public var onDidAppear: (() -> Void)?
public var useSimpleAnimation: Bool = false
private var initialOrientation: UIInterfaceOrientation?
@@ -1037,11 +1039,11 @@ public class GalleryController: ViewController, StandalonePresentableController
self?.presentingViewController?.dismiss(animated: false, completion: nil)
}
self.galleryNode.beginCustomDismiss = { [weak self] in
self.galleryNode.beginCustomDismiss = { [weak self] simpleAnimation in
if let strongSelf = self {
strongSelf._hiddenMedia.set(.single(nil))
let animatedOutNode = true
let animatedOutNode = !simpleAnimation
strongSelf.galleryNode.animateOut(animateContent: animatedOutNode, completion: {
})
@@ -1296,13 +1298,15 @@ public class GalleryController: ViewController, StandalonePresentableController
}
centralItemNode.activateAsInitial()
}
self.onDidAppear?()
}
if !self.isPresentedInPreviewingContext() {
self.galleryNode.setControlsHidden(self.landscape, animated: false)
if let presentationArguments = self.presentationArguments as? GalleryControllerPresentationArguments {
if presentationArguments.animated {
self.galleryNode.animateIn(animateContent: !nodeAnimatesItself)
self.galleryNode.animateIn(animateContent: !nodeAnimatesItself && !self.useSimpleAnimation)
}
}
}