Story caption and reply text length limit

This commit is contained in:
Ilya Laktyushin
2023-07-04 14:24:15 +02:00
parent 14c595b53f
commit 16c66c7bad
10 changed files with 291 additions and 81 deletions

View File

@@ -24,6 +24,7 @@ public final class TextFieldComponent: Component {
public final class ExternalState {
public fileprivate(set) var isEditing: Bool = false
public fileprivate(set) var hasText: Bool = false
public fileprivate(set) var textLength: Int = 0
public var initialText: NSAttributedString?
public var hasTrackingView = false
@@ -492,6 +493,10 @@ public final class TextFieldComponent: Component {
self.textView.becomeFirstResponder()
}
public func deactivateInput() {
self.textView.resignFirstResponder()
}
private var spoilersRevealed = false
private var spoilerIsDisappearing = false
private func updateSpoilersRevealed(animated: Bool = true) {
@@ -775,6 +780,7 @@ public final class TextFieldComponent: Component {
component.externalState.hasText = self.textStorage.length != 0
component.externalState.isEditing = isEditing
component.externalState.textLength = self.textStorage.string.count
if component.hideKeyboard {
if self.textView.inputView == nil {