This commit is contained in:
Isaac
2025-11-07 18:59:29 +08:00
parent c3fdcbde88
commit 6ea1d44e94
7 changed files with 65 additions and 10 deletions

View File

@@ -764,6 +764,9 @@ public final class MessageInputPanelComponent: Component {
guard let component = self.component else {
return true
}
if let _ = self.inputPanel?.view as? ChatTextInputPanelComponent.View {
return true
}
if let maxLength = component.maxLength, self.textFieldExternalState.textLength > maxLength {
return false
} else {
@@ -772,6 +775,9 @@ public final class MessageInputPanelComponent: Component {
}
public var isActive: Bool {
if let inputPanelView = self.inputPanel?.view as? ChatTextInputPanelComponent.View {
return inputPanelView.isActive
}
if let textFieldView = self.textField.view as? TextFieldComponent.View {
return textFieldView.isActive
} else {
@@ -781,6 +787,10 @@ public final class MessageInputPanelComponent: Component {
public func deactivateInput(force: Bool = false) {
if self.canDeactivateInput() || force {
if let inputPanelView = self.inputPanel?.view as? ChatTextInputPanelComponent.View {
inputPanelView.deactivateInput()
return
}
if let textFieldView = self.textField.view as? TextFieldComponent.View {
textFieldView.deactivateInput()
}
@@ -788,6 +798,7 @@ public final class MessageInputPanelComponent: Component {
}
public func animateError() {
self.inputPanel?.view?.layer.addShakeAnimation()
self.textField.view?.layer.addShakeAnimation()
self.hapticFeedback.error()
}