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
|
// MARK: Swiftgram
|
||||||
var toolbarOffset: CGFloat = 0.0
|
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
|
return panelHeight + toolbarOffset
|
||||||
}
|
}
|
||||||
@ -5224,7 +5224,7 @@ extension ChatTextInputPanelNode {
|
|||||||
self.view.addSubview(toolbarHostingController.view)
|
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 toolbarHeight: CGFloat = 0.0
|
||||||
var toolbarSpacing: CGFloat = 0.0
|
var toolbarSpacing: CGFloat = 0.0
|
||||||
if #available(iOS 13.0, *) {
|
if #available(iOS 13.0, *) {
|
||||||
@ -5232,15 +5232,26 @@ extension ChatTextInputPanelNode {
|
|||||||
if displayBotStartButton {
|
if displayBotStartButton {
|
||||||
toolbarHostingController.view.isHidden = true
|
toolbarHostingController.view.isHidden = true
|
||||||
} else if !self.isFocused {
|
} else if !self.isFocused {
|
||||||
transition.updateAlpha(layer: toolbarHostingController.view.layer, alpha: 0.0, completion: { _ in
|
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
|
toolbarHostingController.view.isHidden = true
|
||||||
})
|
}
|
||||||
} else {
|
} else {
|
||||||
toolbarHeight = 44.0
|
toolbarHeight = 44.0
|
||||||
toolbarSpacing = 1.0
|
toolbarSpacing = 1.0
|
||||||
|
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
|
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)))
|
|
||||||
transition.updateAlpha(layer: toolbarHostingController.view.layer, alpha: 1.0)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user