This commit is contained in:
Isaac
2025-10-18 02:35:58 +08:00
parent 0619f73819
commit abe3a01668
7 changed files with 71 additions and 46 deletions

View File

@@ -112,6 +112,7 @@ public final class ChatTextInputPanelComponent: Component {
let hideKeyboard: Bool
let insets: UIEdgeInsets
let maxHeight: CGFloat
let maxLength: Int?
let sendAction: (() -> Void)?
let sendContextAction: ((UIView, ContextGesture) -> Void)?
@@ -130,6 +131,7 @@ public final class ChatTextInputPanelComponent: Component {
hideKeyboard: Bool,
insets: UIEdgeInsets,
maxHeight: CGFloat,
maxLength: Int?,
sendAction: (() -> Void)?,
sendContextAction: ((UIView, ContextGesture) -> Void)?
) {
@@ -147,6 +149,7 @@ public final class ChatTextInputPanelComponent: Component {
self.hideKeyboard = hideKeyboard
self.insets = insets
self.maxHeight = maxHeight
self.maxLength = maxLength
self.sendAction = sendAction
self.sendContextAction = sendContextAction
}
@@ -194,6 +197,9 @@ public final class ChatTextInputPanelComponent: Component {
if lhs.maxHeight != rhs.maxHeight {
return false
}
if lhs.maxLength != rhs.maxLength {
return false
}
if (lhs.sendAction == nil) != (rhs.sendAction == nil) {
return false
}
@@ -783,6 +789,7 @@ public final class ChatTextInputPanelComponent: Component {
}
panelNode.customSendColor = component.sendColor
panelNode.customInputTextMaxLength = component.maxLength
if let resetInputState = component.externalState.resetInputState {
component.externalState.resetInputState = nil

View File

@@ -387,6 +387,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
public var customLeftAction: LeftAction?
public var customRightAction: RightAction?
public var customSendColor: UIColor?
public var customInputTextMaxLength: Int?
private var starReactionButton: ComponentView<Empty>?
@@ -3580,7 +3581,9 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
private func updateCounterTextNode(transition: ContainedViewLayoutTransition) {
var inputTextMaxLength: Int32?
if let presentationInterfaceState = self.presentationInterfaceState {
if let customInputTextMaxLength = self.customInputTextMaxLength {
inputTextMaxLength = Int32(customInputTextMaxLength)
} else if let presentationInterfaceState = self.presentationInterfaceState {
if let editMessage = presentationInterfaceState.interfaceState.editMessage, let inputTextMaxLengthValue = editMessage.inputTextMaxLength {
inputTextMaxLength = inputTextMaxLengthValue
} else if case let .customChatContents(customChatContents) = presentationInterfaceState.subject, case .businessLinkSetup = customChatContents.kind {