Combo update

This commit is contained in:
Ali
2021-06-10 01:15:00 +04:00
parent 9a364604c1
commit 3b621f0075
173 changed files with 8865 additions and 6411 deletions

View File

@@ -386,6 +386,8 @@ public class GalleryController: ViewController, StandalonePresentableController
public var centralItemUpdated: ((MessageId) -> Void)?
private var initialOrientation: UIInterfaceOrientation?
public init(context: AccountContext, source: GalleryControllerItemSource, invertItemOrder: Bool = false, streamSingleVideo: Bool = false, fromPlayingVideo: Bool = false, landscape: Bool = false, timecode: Double? = nil, synchronousLoad: Bool = false, replaceRootController: @escaping (ViewController, Promise<Bool>?) -> Void, baseNavigationController: NavigationController?, actionInteraction: GalleryControllerActionInteraction? = nil) {
self.context = context
self.source = source
@@ -897,6 +899,10 @@ public class GalleryController: ViewController, StandalonePresentableController
}
deinit {
if let initialOrientation = self.initialOrientation {
self.context.sharedContext.applicationBindings.forceOrientation(initialOrientation)
}
self.accountInUseDisposable.dispose()
self.disposable.dispose()
self.centralItemAttributesDisposable.dispose()
@@ -1019,6 +1025,17 @@ public class GalleryController: ViewController, StandalonePresentableController
self?.galleryNode.pager.centralItemNode()?.controlsVisibilityUpdated(isVisible: visible)
}
self.galleryNode.updateOrientation = { [weak self] orientation in
if let strongSelf = self {
if strongSelf.initialOrientation == nil {
strongSelf.initialOrientation = orientation == .portrait ? .landscapeRight : .portrait
} else if strongSelf.initialOrientation == orientation {
strongSelf.initialOrientation = nil
}
strongSelf.context.sharedContext.applicationBindings.forceOrientation(orientation)
}
}
let baseNavigationController = self.baseNavigationController
self.galleryNode.baseNavigationController = { [weak baseNavigationController] in
return baseNavigationController