mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various improvements
This commit is contained in:
@@ -9,12 +9,15 @@ import ChatPresentationInterfaceState
|
||||
import ComponentFlow
|
||||
import AccountContext
|
||||
import AnimatedCountLabelNode
|
||||
import GlassBackgroundComponent
|
||||
|
||||
final class AttachmentTextInputActionButtonsNode: ASDisplayNode, ChatSendMessageActionSheetControllerSourceSendButtonNode {
|
||||
private let strings: PresentationStrings
|
||||
private let glass: Bool
|
||||
|
||||
let sendContainerNode: ASDisplayNode
|
||||
let backgroundNode: ASDisplayNode
|
||||
let backgroundView: GlassBackgroundView?
|
||||
let backgroundNode: ASDisplayNode?
|
||||
let sendButton: HighlightTrackingButtonNode
|
||||
var sendButtonHasApplyIcon = false
|
||||
var animatingSendButton = false
|
||||
@@ -35,16 +38,24 @@ final class AttachmentTextInputActionButtonsNode: ASDisplayNode, ChatSendMessage
|
||||
|
||||
private var validLayout: CGSize?
|
||||
|
||||
init(presentationInterfaceState: ChatPresentationInterfaceState, presentController: @escaping (ViewController) -> Void) {
|
||||
init(presentationInterfaceState: ChatPresentationInterfaceState, glass: Bool, presentController: @escaping (ViewController) -> Void) {
|
||||
self.theme = presentationInterfaceState.theme
|
||||
self.strings = presentationInterfaceState.strings
|
||||
self.glass = glass
|
||||
|
||||
self.sendContainerNode = ASDisplayNode()
|
||||
self.sendContainerNode.layer.allowsGroupOpacity = true
|
||||
|
||||
self.backgroundNode = ASDisplayNode()
|
||||
self.backgroundNode.backgroundColor = theme.chat.inputPanel.actionControlFillColor
|
||||
self.backgroundNode.clipsToBounds = true
|
||||
if glass {
|
||||
self.backgroundView = GlassBackgroundView()
|
||||
self.backgroundNode = nil
|
||||
} else {
|
||||
self.backgroundNode = ASDisplayNode()
|
||||
self.backgroundNode?.backgroundColor = theme.chat.inputPanel.actionControlFillColor
|
||||
self.backgroundNode?.clipsToBounds = true
|
||||
self.backgroundView = nil
|
||||
}
|
||||
|
||||
self.sendButton = HighlightTrackingButtonNode(pointerStyle: nil)
|
||||
|
||||
self.textNode = ImmediateAnimatedCountLabelNode()
|
||||
@@ -78,7 +89,11 @@ final class AttachmentTextInputActionButtonsNode: ASDisplayNode, ChatSendMessage
|
||||
}
|
||||
|
||||
self.addSubnode(self.sendContainerNode)
|
||||
self.sendContainerNode.addSubnode(self.backgroundNode)
|
||||
if let backgroundView = self.backgroundView {
|
||||
self.sendContainerNode.view.addSubview(backgroundView)
|
||||
} else if let backgroundNode = self.backgroundNode {
|
||||
self.sendContainerNode.addSubnode(backgroundNode)
|
||||
}
|
||||
self.sendContainerNode.addSubnode(self.sendButton)
|
||||
self.sendContainerNode.addSubnode(self.textNode)
|
||||
}
|
||||
@@ -99,11 +114,13 @@ final class AttachmentTextInputActionButtonsNode: ASDisplayNode, ChatSendMessage
|
||||
}
|
||||
}
|
||||
|
||||
self.sendButtonPointerInteraction = PointerInteraction(view: self.sendButton.view, customInteractionView: self.backgroundNode.view, style: .lift)
|
||||
if let backgroundNode = self.backgroundNode {
|
||||
self.sendButtonPointerInteraction = PointerInteraction(view: self.sendButton.view, customInteractionView: backgroundNode.view, style: .lift)
|
||||
}
|
||||
}
|
||||
|
||||
func updateTheme(theme: PresentationTheme, wallpaper: TelegramWallpaper) {
|
||||
self.backgroundNode.backgroundColor = theme.chat.inputPanel.actionControlFillColor
|
||||
self.backgroundNode?.backgroundColor = theme.chat.inputPanel.actionControlFillColor
|
||||
}
|
||||
|
||||
private var absoluteRect: (CGRect, CGSize)?
|
||||
@@ -141,7 +158,7 @@ final class AttachmentTextInputActionButtonsNode: ASDisplayNode, ChatSendMessage
|
||||
|
||||
let textSize = self.textNode.updateLayout(size: CGSize(width: 100.0, height: 100.0), animated: transition.isAnimated)
|
||||
if minimized {
|
||||
width = 44.0
|
||||
width = 53.0
|
||||
} else {
|
||||
width = textSize.width + buttonInset * 2.0
|
||||
}
|
||||
@@ -155,9 +172,16 @@ final class AttachmentTextInputActionButtonsNode: ASDisplayNode, ChatSendMessage
|
||||
transition.updateFrame(layer: self.sendButton.layer, frame: CGRect(origin: CGPoint(), size: buttonSize))
|
||||
transition.updateFrame(node: self.sendContainerNode, frame: CGRect(origin: CGPoint(), size: buttonSize))
|
||||
|
||||
let backgroundSize = CGSize(width: width - 11.0, height: 33.0)
|
||||
transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((width - backgroundSize.width) / 2.0), y: floorToScreenPixels((size.height - backgroundSize.height) / 2.0)), size: backgroundSize))
|
||||
self.backgroundNode.cornerRadius = backgroundSize.height / 2.0
|
||||
if let backgroundView = self.backgroundView {
|
||||
let backgroundSize = CGSize(width: width - 13.0, height: 40.0)
|
||||
let backgroundFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((width - backgroundSize.width) / 2.0), y: floorToScreenPixels((size.height - backgroundSize.height) / 2.0)), size: backgroundSize)
|
||||
transition.updateFrame(view: backgroundView, frame: backgroundFrame)
|
||||
backgroundView.update(size: backgroundSize, cornerRadius: backgroundSize.height * 0.5, isDark: false, tintColor: .init(kind: .custom, color: self.theme.chat.inputPanel.actionControlFillColor), transition: ComponentTransition(transition))
|
||||
} else if let backgroundNode {
|
||||
let backgroundSize = CGSize(width: width - 11.0, height: 33.0)
|
||||
transition.updateFrame(node: backgroundNode, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((width - backgroundSize.width) / 2.0), y: floorToScreenPixels((size.height - backgroundSize.height) / 2.0)), size: backgroundSize))
|
||||
backgroundNode.cornerRadius = backgroundSize.height / 2.0
|
||||
}
|
||||
|
||||
return buttonSize
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import ChatInputTextNode
|
||||
private let counterFont = Font.with(size: 14.0, design: .regular, traits: [.monospacedNumbers])
|
||||
private let minInputFontSize: CGFloat = 5.0
|
||||
|
||||
private func calclulateTextFieldMinHeight(_ presentationInterfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
|
||||
private func calclulateTextFieldMinHeight(_ presentationInterfaceState: ChatPresentationInterfaceState, glass: Bool = false, metrics: LayoutMetrics) -> CGFloat {
|
||||
let baseFontSize = max(minInputFontSize, presentationInterfaceState.fontSize.baseDisplaySize)
|
||||
var result: CGFloat
|
||||
if baseFontSize.isEqual(to: 26.0) {
|
||||
@@ -49,25 +49,34 @@ private func calclulateTextFieldMinHeight(_ presentationInterfaceState: ChatPres
|
||||
result = max(33.0, result)
|
||||
}
|
||||
|
||||
if glass {
|
||||
result = max(38.0, result)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
private func calculateTextFieldRealInsets(_ presentationInterfaceState: ChatPresentationInterfaceState) -> UIEdgeInsets {
|
||||
private func calculateTextFieldRealInsets(_ presentationInterfaceState: ChatPresentationInterfaceState, glass: Bool = false) -> UIEdgeInsets {
|
||||
let baseFontSize = max(minInputFontSize, presentationInterfaceState.fontSize.baseDisplaySize)
|
||||
let top: CGFloat
|
||||
let bottom: CGFloat
|
||||
if baseFontSize.isEqual(to: 14.0) {
|
||||
top = 2.0
|
||||
if glass {
|
||||
top = 4.0
|
||||
bottom = 1.0
|
||||
} else if baseFontSize.isEqual(to: 15.0) {
|
||||
top = 1.0
|
||||
bottom = 1.0
|
||||
} else if baseFontSize.isEqual(to: 16.0) {
|
||||
top = 0.5
|
||||
bottom = 0.0
|
||||
} else {
|
||||
top = 0.0
|
||||
bottom = 0.0
|
||||
if baseFontSize.isEqual(to: 14.0) {
|
||||
top = 2.0
|
||||
bottom = 1.0
|
||||
} else if baseFontSize.isEqual(to: 15.0) {
|
||||
top = 1.0
|
||||
bottom = 1.0
|
||||
} else if baseFontSize.isEqual(to: 16.0) {
|
||||
top = 0.5
|
||||
bottom = 0.0
|
||||
} else {
|
||||
top = 0.0
|
||||
bottom = 0.0
|
||||
}
|
||||
}
|
||||
return UIEdgeInsets(top: 4.5 + top, left: 0.0, bottom: 5.5 + bottom, right: 32.0)
|
||||
}
|
||||
@@ -243,15 +252,16 @@ private func makeTextInputTheme(context: AccountContext, interfaceState: ChatPre
|
||||
public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, ASEditableTextNodeDelegate, ChatInputTextNodeDelegate {
|
||||
private let context: AccountContext
|
||||
|
||||
private let glass: Bool
|
||||
private let isCaption: Bool
|
||||
private let isAttachment: Bool
|
||||
|
||||
private let presentController: (ViewController) -> Void
|
||||
private let makeEntityInputView: () -> AttachmentTextInputPanelInputView?
|
||||
|
||||
private var textPlaceholderNode: ImmediateTextNode
|
||||
public var textPlaceholderNode: ImmediateTextNode
|
||||
private let textInputContainerBackgroundNode: ASImageNode
|
||||
private let textInputContainer: ASDisplayNode
|
||||
public let textInputContainer: ASDisplayNode
|
||||
public var textInputNode: ChatInputTextNode?
|
||||
private var dustNode: InvisibleInkDustNode?
|
||||
private var customEmojiContainerView: CustomEmojiContainerView?
|
||||
@@ -265,7 +275,11 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
private let actionButtons: AttachmentTextInputActionButtonsNode
|
||||
private let counterTextNode: ImmediateTextNode
|
||||
|
||||
private let inputModeView: ComponentHostView<Empty>
|
||||
public var opaqueActionButtons: ASDisplayNode {
|
||||
return self.actionButtons
|
||||
}
|
||||
|
||||
public let inputModeView: ComponentHostView<Empty>
|
||||
|
||||
private var validLayout: (CGFloat, CGFloat, CGFloat, UIEdgeInsets, CGFloat, LayoutMetrics, Bool)?
|
||||
|
||||
@@ -379,9 +393,10 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
private var maxCaptionLength: Int32?
|
||||
|
||||
public init(context: AccountContext, presentationInterfaceState: ChatPresentationInterfaceState, isCaption: Bool = false, isAttachment: Bool = false, isScheduledMessages: Bool = false, presentController: @escaping (ViewController) -> Void, makeEntityInputView: @escaping () -> AttachmentTextInputPanelInputView?) {
|
||||
public init(context: AccountContext, presentationInterfaceState: ChatPresentationInterfaceState, glass: Bool = false, isCaption: Bool = false, isAttachment: Bool = false, isScheduledMessages: Bool = false, presentController: @escaping (ViewController) -> Void, makeEntityInputView: @escaping () -> AttachmentTextInputPanelInputView?) {
|
||||
self.context = context
|
||||
self.presentationInterfaceState = presentationInterfaceState
|
||||
self.glass = glass
|
||||
self.isCaption = isCaption
|
||||
self.isAttachment = isAttachment
|
||||
self.presentController = presentController
|
||||
@@ -401,7 +416,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
self.textInputContainerBackgroundNode.displaysAsynchronously = false
|
||||
|
||||
self.textInputContainer = ASDisplayNode()
|
||||
if !isCaption {
|
||||
if !isCaption && !glass {
|
||||
self.textInputContainer.addSubnode(self.textInputContainerBackgroundNode)
|
||||
}
|
||||
|
||||
@@ -420,7 +435,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
self.oneLineNode = TextNodeWithEntities()
|
||||
self.oneLineNode.textNode.isUserInteractionEnabled = false
|
||||
|
||||
self.actionButtons = AttachmentTextInputActionButtonsNode(presentationInterfaceState: presentationInterfaceState, presentController: presentController)
|
||||
self.actionButtons = AttachmentTextInputActionButtonsNode(presentationInterfaceState: presentationInterfaceState, glass: glass, presentController: presentController)
|
||||
self.counterTextNode = ImmediateTextNode()
|
||||
self.counterTextNode.textAlignment = .center
|
||||
|
||||
@@ -441,7 +456,10 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
self.addSubnode(self.textInputContainer)
|
||||
self.addSubnode(self.textInputBackgroundNode)
|
||||
self.textInputBackgroundNode.addSubnode(self.textInputBackgroundImageNode)
|
||||
|
||||
if !glass {
|
||||
self.textInputBackgroundNode.addSubnode(self.textInputBackgroundImageNode)
|
||||
}
|
||||
|
||||
self.addSubnode(self.textPlaceholderNode)
|
||||
|
||||
@@ -589,7 +607,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||
refreshChatTextInputTypingAttributes(textInputNode.textView, theme: presentationInterfaceState.theme, baseFontSize: baseFontSize)
|
||||
textInputNode.textContainerInset = calculateTextFieldRealInsets(presentationInterfaceState)
|
||||
textInputNode.textContainerInset = calculateTextFieldRealInsets(presentationInterfaceState, glass: self.glass)
|
||||
}
|
||||
|
||||
if !self.textInputContainer.bounds.size.width.isZero {
|
||||
@@ -628,7 +646,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
private func textFieldMaxHeight(_ maxHeight: CGFloat, metrics: LayoutMetrics) -> CGFloat {
|
||||
let textFieldInsets = self.textFieldInsets(metrics: metrics)
|
||||
return max(33.0, maxHeight - (textFieldInsets.top + textFieldInsets.bottom + self.textInputViewInternalInsets.top + self.textInputViewInternalInsets.bottom))
|
||||
return max(self.glass ? 40.0 : 33.0, maxHeight - (textFieldInsets.top + textFieldInsets.bottom + self.textInputViewInternalInsets.top + self.textInputViewInternalInsets.bottom))
|
||||
}
|
||||
|
||||
private func calculateTextFieldMetrics(width: CGFloat, maxHeight: CGFloat, metrics: LayoutMetrics) -> (accessoryButtonsWidth: CGFloat, textFieldHeight: CGFloat) {
|
||||
@@ -641,8 +659,8 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
var textFieldMinHeight: CGFloat = 35.0
|
||||
var textFieldRealInsets = UIEdgeInsets()
|
||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||
textFieldMinHeight = calclulateTextFieldMinHeight(presentationInterfaceState, metrics: metrics)
|
||||
textFieldRealInsets = calculateTextFieldRealInsets(presentationInterfaceState)
|
||||
textFieldMinHeight = calclulateTextFieldMinHeight(presentationInterfaceState, glass: self.glass, metrics: metrics)
|
||||
textFieldRealInsets = calculateTextFieldRealInsets(presentationInterfaceState, glass: self.glass)
|
||||
}
|
||||
|
||||
let textFieldHeight: CGFloat
|
||||
@@ -666,7 +684,12 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
private func textFieldInsets(metrics: LayoutMetrics) -> UIEdgeInsets {
|
||||
var insets = UIEdgeInsets(top: 6.0, left: 6.0, bottom: 6.0, right: 42.0)
|
||||
if case .regular = metrics.widthClass, case .regular = metrics.heightClass {
|
||||
if self.glass {
|
||||
insets.left = 8.0
|
||||
insets.top = 0.0
|
||||
insets.bottom = 0.0
|
||||
insets.right += 3.0
|
||||
} else if case .regular = metrics.widthClass, case .regular = metrics.heightClass {
|
||||
insets.top += 1.0
|
||||
insets.bottom += 1.0
|
||||
}
|
||||
@@ -680,7 +703,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
}
|
||||
|
||||
func minimalHeight(interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
|
||||
let textFieldMinHeight = calclulateTextFieldMinHeight(interfaceState, metrics: metrics)
|
||||
let textFieldMinHeight = calclulateTextFieldMinHeight(interfaceState, glass: self.glass, metrics: metrics)
|
||||
var minimalHeight: CGFloat = 14.0 + textFieldMinHeight
|
||||
if case .regular = metrics.widthClass, case .regular = metrics.heightClass {
|
||||
minimalHeight += 2.0
|
||||
@@ -689,6 +712,9 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
}
|
||||
|
||||
override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
guard self.isUserInteractionEnabled else {
|
||||
return nil
|
||||
}
|
||||
if !self.inputModeView.isHidden, let result = self.inputModeView.hitTest(self.view.convert(point, to: self.inputModeView), with: event) {
|
||||
return result
|
||||
}
|
||||
@@ -703,7 +729,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
let leftInset = leftInset + 8.0
|
||||
let rightInset = rightInset + 8.0
|
||||
|
||||
|
||||
var transition = transition
|
||||
if let previousAdditionalSideInsets = previousAdditionalSideInsets, previousAdditionalSideInsets.right != additionalSideInsets.right {
|
||||
if case .animated = transition {
|
||||
@@ -758,7 +784,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
self.actionButtons.updateTheme(theme: interfaceState.theme, wallpaper: interfaceState.chatWallpaper)
|
||||
|
||||
let textFieldMinHeight = calclulateTextFieldMinHeight(interfaceState, metrics: metrics)
|
||||
let textFieldMinHeight = calclulateTextFieldMinHeight(interfaceState, glass: self.glass, metrics: metrics)
|
||||
let minimalInputHeight: CGFloat = 2.0 + textFieldMinHeight
|
||||
|
||||
let backgroundColor: UIColor
|
||||
@@ -828,9 +854,9 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
}
|
||||
}
|
||||
|
||||
var textFieldMinHeight: CGFloat = 33.0
|
||||
var textFieldMinHeight: CGFloat = self.glass ? 40.0 : 33.0
|
||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||
textFieldMinHeight = calclulateTextFieldMinHeight(presentationInterfaceState, metrics: metrics)
|
||||
textFieldMinHeight = calclulateTextFieldMinHeight(presentationInterfaceState, glass: self.glass, metrics: metrics)
|
||||
}
|
||||
let minimalHeight: CGFloat = 14.0 + textFieldMinHeight
|
||||
|
||||
@@ -852,7 +878,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
var textInputViewRealInsets = UIEdgeInsets()
|
||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||
textInputViewRealInsets = calculateTextFieldRealInsets(presentationInterfaceState)
|
||||
textInputViewRealInsets = calculateTextFieldRealInsets(presentationInterfaceState, glass: self.glass)
|
||||
}
|
||||
|
||||
if self.isCaption {
|
||||
@@ -922,7 +948,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
let textFieldFrame = CGRect(origin: CGPoint(x: self.textInputViewInternalInsets.left, y: self.textInputViewInternalInsets.top), size: CGSize(width: textInputFrame.size.width - (self.textInputViewInternalInsets.left + self.textInputViewInternalInsets.right), height: textInputFrame.size.height - self.textInputViewInternalInsets.top - textInputViewInternalInsets.bottom))
|
||||
let shouldUpdateLayout = textFieldFrame.size != textInputNode.frame.size
|
||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||
textInputNode.textContainerInset = calculateTextFieldRealInsets(presentationInterfaceState)
|
||||
textInputNode.textContainerInset = calculateTextFieldRealInsets(presentationInterfaceState, glass: self.glass)
|
||||
}
|
||||
transition.updateFrame(node: textInputNode, frame: textFieldFrame)
|
||||
if shouldUpdateLayout {
|
||||
@@ -932,6 +958,10 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
self.actionButtons.updateAccessibility()
|
||||
|
||||
if self.glass {
|
||||
panelHeight += 11.0
|
||||
}
|
||||
|
||||
return panelHeight
|
||||
}
|
||||
|
||||
@@ -943,11 +973,14 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
let leftInset = leftInsetValue + 8.0
|
||||
let rightInset = rightInsetValue + 8.0
|
||||
|
||||
var textFieldMinHeight: CGFloat = 33.0
|
||||
var textFieldMinHeight: CGFloat = self.glass ? 40.0 : 33.0
|
||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||
textFieldMinHeight = calclulateTextFieldMinHeight(presentationInterfaceState, metrics: metrics)
|
||||
textFieldMinHeight = calclulateTextFieldMinHeight(presentationInterfaceState, glass: self.glass, metrics: metrics)
|
||||
}
|
||||
var minimalHeight: CGFloat = textFieldMinHeight
|
||||
if !self.glass {
|
||||
minimalHeight += 14.0
|
||||
}
|
||||
let minimalHeight: CGFloat = 14.0 + textFieldMinHeight
|
||||
|
||||
var panelHeight = panelHeight
|
||||
var composeButtonsOffset: CGFloat = 0.0
|
||||
@@ -983,16 +1016,18 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
isMinimized = !self.isAttachment || inputHasText
|
||||
text = presentationInterfaceState.strings.MediaPicker_Send
|
||||
}
|
||||
actionButtonsSize = self.actionButtons.updateLayout(size: CGSize(width: 44.0, height: minimalHeight), transition: transition, minimized: isMinimized, text: text, interfaceState: presentationInterfaceState)
|
||||
actionButtonsSize = self.actionButtons.updateLayout(size: CGSize(width: 44.0, height: minimalHeight), transition: transition, minimized: isMinimized && !self.glass, text: text, interfaceState: presentationInterfaceState)
|
||||
textBackgroundInset = actionButtonsSize.width - 44.0
|
||||
} else {
|
||||
actionButtonsSize = CGSize(width: 44.0, height: minimalHeight)
|
||||
}
|
||||
|
||||
let actionButtonsFrame = CGRect(origin: CGPoint(x: width - rightInset - actionButtonsSize.width + 1.0 - UIScreenPixel + composeButtonsOffset, y: panelHeight - minimalHeight), size: actionButtonsSize)
|
||||
let actionButtonsOriginOffset: CGFloat = self.glass ? -3.0 : 0.0
|
||||
let actionButtonsFrame = CGRect(origin: CGPoint(x: width - rightInset - actionButtonsSize.width + 1.0 - UIScreenPixel + composeButtonsOffset + actionButtonsOriginOffset, y: panelHeight - minimalHeight), size: actionButtonsSize)
|
||||
transition.updateFrame(node: self.actionButtons, frame: actionButtonsFrame)
|
||||
|
||||
let textInputBackgroundFrame = CGRect(origin: CGPoint(), size: CGSize(width: baseWidth - textFieldInsets.left - textFieldInsets.right + composeButtonsOffset - textBackgroundInset, height: textInputFrame.size.height))
|
||||
let textInputHeight = panelHeight - textFieldInsets.top - textFieldInsets.bottom
|
||||
let textInputBackgroundFrame = CGRect(origin: CGPoint(), size: CGSize(width: baseWidth - textFieldInsets.left - textFieldInsets.right + composeButtonsOffset - textBackgroundInset, height: textInputHeight))
|
||||
transition.updateFrame(node: self.textInputContainerBackgroundNode, frame: textInputBackgroundFrame)
|
||||
|
||||
transition.updateFrame(layer: self.textInputBackgroundNode.layer, frame: CGRect(x: leftInset + textFieldInsets.left, y: textFieldInsets.top, width: baseWidth - textFieldInsets.left - textFieldInsets.right + composeButtonsOffset - textBackgroundInset, height: panelHeight - textFieldInsets.top - textFieldInsets.bottom))
|
||||
@@ -1000,13 +1035,13 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
|
||||
var textInputViewRealInsets = UIEdgeInsets()
|
||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||
textInputViewRealInsets = calculateTextFieldRealInsets(presentationInterfaceState)
|
||||
textInputViewRealInsets = calculateTextFieldRealInsets(presentationInterfaceState, glass: self.glass)
|
||||
|
||||
var colors: [String: UIColor] = [:]
|
||||
let colorKeys: [String] = [
|
||||
"__allcolors__"
|
||||
]
|
||||
let color = defaultDarkPresentationTheme.chat.inputPanel.inputControlColor
|
||||
let color = self.theme?.chat.inputPanel.inputControlColor ?? defaultDarkPresentationTheme.chat.inputPanel.inputControlColor
|
||||
for colorKey in colorKeys {
|
||||
colors[colorKey] = color
|
||||
}
|
||||
@@ -1028,7 +1063,11 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
environment: {},
|
||||
containerSize: CGSize(width: 32.0, height: 32.0)
|
||||
)
|
||||
transition.updateFrame(view: self.inputModeView, frame: CGRect(origin: CGPoint(x: textInputBackgroundFrame.maxX - inputNodeSize.width - 1.0, y: textInputBackgroundFrame.maxY - inputNodeSize.height - 1.0), size: inputNodeSize))
|
||||
var inputNodeOffset: CGPoint = CGPoint(x: -1.0, y: -1.0)
|
||||
if self.glass {
|
||||
inputNodeOffset = CGPoint(x: -4.0, y: -4.0)
|
||||
}
|
||||
transition.updateFrame(view: self.inputModeView, frame: CGRect(origin: CGPoint(x: textInputBackgroundFrame.maxX - inputNodeSize.width + inputNodeOffset.x, y: textInputBackgroundFrame.maxY - inputNodeSize.height + inputNodeOffset.y), size: inputNodeSize))
|
||||
}
|
||||
|
||||
let placeholderFrame: CGRect
|
||||
@@ -1294,7 +1333,7 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
|
||||
let panelHeight = self.panelHeight(textFieldHeight: textFieldHeight, metrics: metrics)
|
||||
var textFieldMinHeight: CGFloat = 33.0
|
||||
if let presentationInterfaceState = self.presentationInterfaceState {
|
||||
textFieldMinHeight = calclulateTextFieldMinHeight(presentationInterfaceState, metrics: metrics)
|
||||
textFieldMinHeight = calclulateTextFieldMinHeight(presentationInterfaceState, glass: self.glass, metrics: metrics)
|
||||
}
|
||||
let minimalHeight: CGFloat = 14.0 + textFieldMinHeight
|
||||
|
||||
|
||||
Reference in New Issue
Block a user