mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Attachment menu improvements
This commit is contained in:
@@ -17,6 +17,7 @@ import SegmentedControlNode
|
||||
import ManagedAnimationNode
|
||||
import ContextUI
|
||||
import LegacyMediaPickerUI
|
||||
import WebSearchUI
|
||||
|
||||
private class MediaAssetsContext: NSObject, PHPhotoLibraryChangeObserver {
|
||||
private var registeredChangeObserver = false
|
||||
@@ -388,6 +389,8 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
private let titleView: MediaPickerSegmentedTitleView
|
||||
private let moreButtonNode: MediaPickerMoreButtonNode
|
||||
|
||||
public weak var webSearchController: WebSearchController?
|
||||
|
||||
public var openCamera: ((TGAttachmentCameraView?) -> Void)?
|
||||
public var presentStickers: ((@escaping (TelegramMediaFile, Bool, UIView, CGRect) -> Void) -> TGPhotoPaintStickersScreen?)?
|
||||
public var presentSchedulePicker: (Bool, @escaping (Int32) -> Void) -> Void = { _, _ in }
|
||||
@@ -1016,7 +1019,21 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
|
||||
self.scrollToTop = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
strongSelf.controllerNode.scrollToTop(animated: true)
|
||||
if let webSearchController = strongSelf.webSearchController {
|
||||
webSearchController.scrollToTop?()
|
||||
} else {
|
||||
strongSelf.controllerNode.scrollToTop(animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.scrollToTopWithTabBar = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
if let webSearchController = strongSelf.webSearchController {
|
||||
webSearchController.cancel()
|
||||
} else {
|
||||
strongSelf.scrollToTop?()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1067,6 +1084,14 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
|
||||
self.dismiss()
|
||||
}
|
||||
|
||||
public func prepareForReuse() {
|
||||
if let webSearchController = self.webSearchController {
|
||||
self.webSearchController = nil
|
||||
webSearchController.dismiss()
|
||||
}
|
||||
self.scrollToTop?()
|
||||
}
|
||||
|
||||
@objc private func searchOrMorePressed(node: ContextReferenceContentNode, gesture: ContextGesture?) {
|
||||
switch self.moreButtonNode.iconNode.iconState {
|
||||
case .search:
|
||||
|
||||
Reference in New Issue
Block a user