mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Attachment menu improvements
This commit is contained in:
@@ -289,7 +289,6 @@ public class AttachmentController: ViewController {
|
||||
self.currentType = type
|
||||
self.controller?.requestController(type, { [weak self] controller, mediaPickerContext in
|
||||
if let strongSelf = self {
|
||||
strongSelf.mediaPickerContext = mediaPickerContext
|
||||
if let controller = controller {
|
||||
strongSelf.controller?._ready.set(controller.ready.get())
|
||||
controller._presentedInModal = true
|
||||
@@ -346,6 +345,7 @@ public class AttachmentController: ViewController {
|
||||
strongSelf.switchingController = false
|
||||
}
|
||||
}
|
||||
strongSelf.mediaPickerContext = mediaPickerContext
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -419,7 +419,6 @@ public class AttachmentController: ViewController {
|
||||
}
|
||||
}
|
||||
|
||||
private var isCollapsed: Bool = false
|
||||
private var isUpdatingContainer = false
|
||||
private var switchingController = false
|
||||
func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
@@ -427,22 +426,15 @@ public class AttachmentController: ViewController {
|
||||
|
||||
transition.updateFrame(node: self.dim, frame: CGRect(origin: CGPoint(), size: layout.size))
|
||||
|
||||
if self.modalProgress < 0.5 {
|
||||
self.isCollapsed = false
|
||||
} else if self.modalProgress == 1.0 {
|
||||
self.isCollapsed = true
|
||||
}
|
||||
|
||||
var containerLayout = layout
|
||||
let containerRect: CGRect
|
||||
if case .regular = layout.metrics.widthClass {
|
||||
let size = CGSize(width: 390.0, height: 620.0)
|
||||
|
||||
let insets = layout.insets(options: [.input])
|
||||
let masterWidth = min(max(320.0, floor(layout.size.width / 3.0)), floor(layout.size.width / 2.0))
|
||||
var position: CGPoint = CGPoint(x: masterWidth - 174.0, y: layout.size.height - size.height - layout.intrinsicInsets.bottom - 40.0)
|
||||
if let inputHeight = layout.inputHeight {
|
||||
position.y -= inputHeight
|
||||
}
|
||||
let position: CGPoint = CGPoint(x: masterWidth - 174.0, y: layout.size.height - size.height - insets.bottom - 40.0)
|
||||
|
||||
containerRect = CGRect(origin: position, size: size)
|
||||
containerLayout.size = containerRect.size
|
||||
containerLayout.intrinsicInsets.bottom = 12.0
|
||||
@@ -469,8 +461,8 @@ public class AttachmentController: ViewController {
|
||||
}
|
||||
|
||||
|
||||
let isEffecitvelyCollapsedUpdated = (self.isCollapsed || self.selectionCount > 0) != (self.panel.isCollapsed || self.panel.isSelecting)
|
||||
let panelHeight = self.panel.update(layout: containerLayout, buttons: self.controller?.buttons ?? [], isCollapsed: self.isCollapsed, isSelecting: self.selectionCount > 0, transition: transition)
|
||||
let isEffecitvelyCollapsedUpdated = (self.selectionCount > 0) != (self.panel.isSelecting)
|
||||
let panelHeight = self.panel.update(layout: containerLayout, buttons: self.controller?.buttons ?? [], isSelecting: self.selectionCount > 0, transition: transition)
|
||||
var panelTransition = transition
|
||||
if isEffecitvelyCollapsedUpdated {
|
||||
panelTransition = .animated(duration: 0.25, curve: .easeInOut)
|
||||
|
||||
Reference in New Issue
Block a user