mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Various fixes
This commit is contained in:
@@ -773,6 +773,26 @@ public final class MessageInputPanelComponent: Component {
|
||||
return result
|
||||
}
|
||||
|
||||
private var sendMessageAction() {
|
||||
guard let component = self.component else {
|
||||
return
|
||||
}
|
||||
if let maxLength = component.maxLength, self.textFieldExternalState.textLength > maxLength {
|
||||
self.animateError()
|
||||
component.presentTextLengthLimitTooltip?()
|
||||
} else {
|
||||
var sendActionTransition: MessageInputPanelComponent.SendActionTransition?
|
||||
if let snapshotView = self.textClippingView.snapshotView(afterScreenUpdates: false), let backgroundView = self.fieldGlassBackgroundView {
|
||||
sendActionTransition = MessageInputPanelComponent.SendActionTransition(
|
||||
textSnapshotView: snapshotView,
|
||||
globalFrame: backgroundView.convert(backgroundView.bounds, to: nil),
|
||||
cornerRadius: baseFieldHeight * 0.5
|
||||
)
|
||||
}
|
||||
component.sendMessageAction(sendActionTransition)
|
||||
}
|
||||
}
|
||||
|
||||
func update(component: MessageInputPanelComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
let previousPlaceholder = self.component?.placeholder
|
||||
|
||||
@@ -882,7 +902,10 @@ public final class MessageInputPanelComponent: Component {
|
||||
},
|
||||
paste: { data in
|
||||
component.paste(data)
|
||||
}
|
||||
},
|
||||
returnKeyAction: component.style == .glass ? { [weak self] in
|
||||
self?.sendMessageAction()
|
||||
} : nil
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: availableTextFieldSize
|
||||
@@ -1564,20 +1587,7 @@ public final class MessageInputPanelComponent: Component {
|
||||
component.sendMessageAction(nil)
|
||||
} else if case let .text(string) = self.getSendMessageInput(), string.string.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
} else {
|
||||
if let maxLength = component.maxLength, self.textFieldExternalState.textLength > maxLength {
|
||||
self.animateError()
|
||||
component.presentTextLengthLimitTooltip?()
|
||||
} else {
|
||||
var sendActionTransition: MessageInputPanelComponent.SendActionTransition?
|
||||
if let snapshotView = self.textClippingView.snapshotView(afterScreenUpdates: false), let backgroundView = self.fieldGlassBackgroundView {
|
||||
sendActionTransition = MessageInputPanelComponent.SendActionTransition(
|
||||
textSnapshotView: snapshotView,
|
||||
globalFrame: backgroundView.convert(backgroundView.bounds, to: nil),
|
||||
cornerRadius: baseFieldHeight * 0.5
|
||||
)
|
||||
}
|
||||
component.sendMessageAction(sendActionTransition)
|
||||
}
|
||||
self.sendMessageAction()
|
||||
}
|
||||
}
|
||||
case .apply:
|
||||
|
||||
Reference in New Issue
Block a user