Various fixes

This commit is contained in:
Ilya Laktyushin
2020-11-12 20:12:00 +04:00
parent 8081430ad2
commit 40e28d769d
13 changed files with 138 additions and 138 deletions

View File

@@ -16,6 +16,7 @@ import ActivityIndicator
import AnimationUI
private let accessoryButtonFont = Font.medium(14.0)
private let counterFont = Font.with(size: 14.0, design: .regular, traits: [.monospacedNumbers])
private final class AccessoryItemIconButton: HighlightTrackingButton {
private let item: ChatTextInputAccessoryItem
@@ -1193,11 +1194,11 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
let textCount = Int32(textInputNode.textView.text.count)
let counterColor: UIColor = textCount > inputTextMaxLength ? presentationInterfaceState.theme.chat.inputPanel.panelControlDestructiveColor : presentationInterfaceState.theme.chat.inputPanel.panelControlColor
let remainingCount = inputTextMaxLength - textCount
let counterText = remainingCount >= 5 ? "" : "\(inputTextMaxLength - textCount)"
self.counterTextNode.attributedText = NSAttributedString(string: counterText, font: Font.regular(14.0), textColor: counterColor)
let remainingCount = max(-999, inputTextMaxLength - textCount)
let counterText = remainingCount >= 5 ? "" : "\(remainingCount)"
self.counterTextNode.attributedText = NSAttributedString(string: counterText, font: counterFont, textColor: counterColor)
} else {
self.counterTextNode.attributedText = NSAttributedString(string: "", font: Font.regular(14.0), textColor: .black)
self.counterTextNode.attributedText = NSAttributedString(string: "", font: counterFont, textColor: .black)
}
let counterSize = self.counterTextNode.updateLayout(CGSize(width: 44.0, height: 44.0))
@@ -1481,11 +1482,11 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
let textCount = Int32(textInputNode.textView.text.count)
let counterColor: UIColor = textCount > inputTextMaxLength ? presentationInterfaceState.theme.chat.inputPanel.panelControlDestructiveColor : presentationInterfaceState.theme.chat.inputPanel.panelControlColor
let remainingCount = inputTextMaxLength - textCount
let counterText = remainingCount >= 5 ? "" : "\(inputTextMaxLength - textCount)"
self.counterTextNode.attributedText = NSAttributedString(string: counterText, font: Font.regular(14.0), textColor: counterColor)
let remainingCount = max(-999, inputTextMaxLength - textCount)
let counterText = remainingCount >= 5 ? "" : "\(remainingCount)"
self.counterTextNode.attributedText = NSAttributedString(string: counterText, font: counterFont, textColor: counterColor)
} else {
self.counterTextNode.attributedText = NSAttributedString(string: "", font: Font.regular(14.0), textColor: .black)
self.counterTextNode.attributedText = NSAttributedString(string: "", font: counterFont, textColor: .black)
}
if let (width, leftInset, rightInset, maxHeight, metrics, isSecondary) = self.validLayout {