mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
WIP toolbar improvements
This commit is contained in:
parent
cbb66d3c42
commit
95f483d5db
@ -2937,7 +2937,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate, Ch
|
||||
|
||||
// MARK: Swiftgram
|
||||
var toolbarOffset: CGFloat = 0.0
|
||||
toolbarOffset = layoutToolbar(transition: transition, panelHeight: panelHeight, width: width, leftInset: originalLeftInset, rightInset: rightInset, displayBotStartButton: displayBotStartButton)
|
||||
toolbarOffset = layoutToolbar(transition: transition, panelHeight: panelHeight, width: width, leftInset: originalLeftInset, rightInset: rightInset, displayBotStartButton: displayBotStartButton, animatedTransition: animatedTransition)
|
||||
|
||||
return panelHeight + toolbarOffset
|
||||
}
|
||||
@ -5224,7 +5224,7 @@ extension ChatTextInputPanelNode {
|
||||
self.view.addSubview(toolbarHostingController.view)
|
||||
}
|
||||
|
||||
func layoutToolbar(transition: ContainedViewLayoutTransition, panelHeight: CGFloat, width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, displayBotStartButton: Bool) -> CGFloat {
|
||||
func layoutToolbar(transition: ContainedViewLayoutTransition, panelHeight: CGFloat, width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, displayBotStartButton: Bool, animatedTransition: Bool) -> CGFloat {
|
||||
var toolbarHeight: CGFloat = 0.0
|
||||
var toolbarSpacing: CGFloat = 0.0
|
||||
if #available(iOS 13.0, *) {
|
||||
@ -5232,15 +5232,26 @@ extension ChatTextInputPanelNode {
|
||||
if displayBotStartButton {
|
||||
toolbarHostingController.view.isHidden = true
|
||||
} else if !self.isFocused {
|
||||
if animatedTransition {
|
||||
transition.updateAlpha(layer: toolbarHostingController.view.layer, alpha: 0.0, completion: { _ in
|
||||
toolbarHostingController.view.isHidden = true
|
||||
})
|
||||
} else {
|
||||
toolbarHostingController.view.alpha = 0.0
|
||||
toolbarHostingController.view.isHidden = true
|
||||
}
|
||||
} else {
|
||||
toolbarHeight = 44.0
|
||||
toolbarSpacing = 1.0
|
||||
toolbarHostingController.view.isHidden = false
|
||||
transition.updateFrame(view: toolbarHostingController.view, frame: CGRect(origin: CGPoint(x: leftInset, y: panelHeight + toolbarSpacing), size: CGSize(width: width - rightInset - leftInset, height: toolbarHeight)))
|
||||
let newFrame = CGRect(origin: CGPoint(x: leftInset, y: panelHeight + toolbarSpacing), size: CGSize(width: width - rightInset - leftInset, height: toolbarHeight))
|
||||
if animatedTransition {
|
||||
transition.updateFrame(view: toolbarHostingController.view, frame: newFrame)
|
||||
transition.updateAlpha(layer: toolbarHostingController.view.layer, alpha: 1.0)
|
||||
} else {
|
||||
toolbarHostingController.view.frame = newFrame
|
||||
toolbarHostingController.view.alpha = 1.0
|
||||
}
|
||||
toolbarHostingController.view.isHidden = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user