New media pasteboard screen

This commit is contained in:
Ilya Laktyushin
2022-10-25 19:58:51 +03:00
parent f8c5bf2a6b
commit 1b2379fe8c
30 changed files with 661 additions and 2252 deletions

View File

@@ -168,6 +168,7 @@ public class AttachmentController: ViewController {
private let buttons: [AttachmentButtonType]
private let initialButton: AttachmentButtonType
private let fromMenu: Bool
private let hasTextInput: Bool
private let makeEntityInputView: () -> AttachmentTextInputPanelInputView?
public var willDismiss: () -> Void = {}
@@ -437,10 +438,10 @@ public class AttachmentController: ViewController {
}
}
private func updateSelectionCount(_ count: Int) {
fileprivate func updateSelectionCount(_ count: Int, animated: Bool = true) {
self.selectionCount = count
if let layout = self.validLayout {
self.containerLayoutUpdated(layout, transition: .animated(duration: 0.4, curve: .spring))
self.containerLayoutUpdated(layout, transition: animated ? .animated(duration: 0.4, curve: .spring) : .immediate)
}
}
@@ -754,7 +755,7 @@ public class AttachmentController: ViewController {
let previousHasButton = self.hasButton
let hasButton = self.panel.isButtonVisible && !self.isDismissing
self.hasButton = hasButton
if let controller = self.controller, controller.buttons.count > 1 {
if let controller = self.controller, controller.buttons.count > 1 || controller.hasTextInput {
hasPanel = true
}
@@ -856,13 +857,14 @@ public class AttachmentController: ViewController {
public var getSourceRect: (() -> CGRect?)?
public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, chatLocation: ChatLocation, buttons: [AttachmentButtonType], initialButton: AttachmentButtonType = .gallery, fromMenu: Bool = false, makeEntityInputView: @escaping () -> AttachmentTextInputPanelInputView?) {
public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, chatLocation: ChatLocation, buttons: [AttachmentButtonType], initialButton: AttachmentButtonType = .gallery, fromMenu: Bool = false, hasTextInput: Bool = true, makeEntityInputView: @escaping () -> AttachmentTextInputPanelInputView? = { return nil}) {
self.context = context
self.updatedPresentationData = updatedPresentationData
self.chatLocation = chatLocation
self.buttons = buttons
self.initialButton = initialButton
self.fromMenu = fromMenu
self.hasTextInput = hasTextInput
self.makeEntityInputView = makeEntityInputView
super.init(navigationBarPresentationData: nil)
@@ -886,6 +888,10 @@ public class AttachmentController: ViewController {
return self.buttons.contains(.standalone)
}
public func updateSelectionCount(_ count: Int) {
self.node.updateSelectionCount(count, animated: false)
}
private var node: Node {
return self.displayNode as! Node
}