Various improvements

This commit is contained in:
Ilya Laktyushin 2025-09-28 21:31:54 +04:00
parent 3fe6791076
commit 6af4878504
4 changed files with 14 additions and 16 deletions

View File

@ -520,8 +520,9 @@ public class Window1 {
let testView = UIView() let testView = UIView()
testView.backgroundColor = .blue testView.backgroundColor = .blue
testView.layer.zPosition = 1000.0 testView.layer.zPosition = 1000.0
#endif
self.hostView.containerView.addSubview(testView) self.hostView.containerView.addSubview(testView)
#endif
self.keyboardFrameChangeObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillChangeFrameNotification, object: nil, queue: nil, using: { [weak self] notification in self.keyboardFrameChangeObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillChangeFrameNotification, object: nil, queue: nil, using: { [weak self] notification in
if let strongSelf = self { if let strongSelf = self {
var isTablet = false var isTablet = false

View File

@ -158,6 +158,9 @@ final class MessageItemComponent: Component {
let textFont = Font.regular(14.0) let textFont = Font.regular(14.0)
let boldTextFont = Font.semibold(14.0) let boldTextFont = Font.semibold(14.0)
let italicFont = Font.italic(14.0)
let boldItalicTextFont = Font.semiboldItalic(14.0)
let monospaceFont = Font.monospace(14.0)
let textColor: UIColor = .white let textColor: UIColor = .white
let linkColor: UIColor = UIColor(rgb: 0x59b6fa) let linkColor: UIColor = UIColor(rgb: 0x59b6fa)
@ -240,7 +243,7 @@ final class MessageItemComponent: Component {
) )
) )
} else { } else {
let textWithAppliedEntities = stringWithAppliedEntities(text, entities: entities, baseColor: textColor, linkColor: linkColor, baseFont: textFont, linkFont: textFont, boldFont: boldTextFont, italicFont: textFont, boldItalicFont: boldTextFont, fixedFont: textFont, blockQuoteFont: textFont, message: nil, entityFiles: self.entityFiles).mutableCopy() as! NSMutableAttributedString let textWithAppliedEntities = stringWithAppliedEntities(text, entities: entities, baseColor: textColor, linkColor: linkColor, baseFont: textFont, linkFont: textFont, boldFont: boldTextFont, italicFont: italicFont, boldItalicFont: boldItalicTextFont, fixedFont: monospaceFont, blockQuoteFont: textFont, message: nil, entityFiles: self.entityFiles).mutableCopy() as! NSMutableAttributedString
if !peerName.isEmpty { if !peerName.isEmpty {
textWithAppliedEntities.insert(NSAttributedString(string: peerName + " ", font: boldTextFont, textColor: textColor), at: 0) textWithAppliedEntities.insert(NSAttributedString(string: peerName + " ", font: boldTextFont, textColor: textColor), at: 0)
} }

View File

@ -1404,18 +1404,12 @@ final class VideoChatScreenComponent: Component {
guard !text.string.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { guard !text.string.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else {
return return
} }
let entities = generateTextEntities(text.string, enabledTypes: [.mention, .hashtag, .allUrl], currentEntities: generateChatInputTextEntities(text)) let entities = generateTextEntities(text.string, enabledTypes: [.mention, .hashtag], currentEntities: generateChatInputTextEntities(text))
call.sendMessage(randomId: randomId, text: text.string, entities: entities) call.sendMessage(randomId: randomId, text: text.string, entities: entities)
} }
inputPanelView.clearSendMessageInput(updateState: true) inputPanelView.clearSendMessageInput(updateState: true)
// self.currentInputMode = .text
// if hasFirstResponder(self) {
// self.endEditing(true)
// } else {
// self.state?.updated(transition: .spring(duration: 0.3))
// }
(self.environment?.controller() as? VideoChatScreenV2Impl)?.requestLayout(forceUpdate: true, transition: .animated(duration: 0.3, curve: .spring)) (self.environment?.controller() as? VideoChatScreenV2Impl)?.requestLayout(forceUpdate: true, transition: .animated(duration: 0.3, curve: .spring))
} }
@ -3596,13 +3590,13 @@ final class VideoChatScreenComponent: Component {
) )
if inputHeight > 0.0 { if inputHeight > 0.0 {
inputPanelBottomInset = inputHeight - environment.safeInsets.bottom inputPanelBottomInset = inputHeight
} else { } else {
if self.inputPanelExternalState.isEditing { if self.inputPanelExternalState.isEditing {
if buttonsOnTheSide { if buttonsOnTheSide {
inputPanelBottomInset = 16.0 inputPanelBottomInset = 16.0
} else { } else {
inputPanelBottomInset = availableSize.height - microphoneButtonFrame.minY inputPanelBottomInset = availableSize.height - microphoneButtonFrame.minY + 20.0
} }
} else { } else {
inputPanelBottomInset = -inputPanelSize.height - environment.safeInsets.bottom inputPanelBottomInset = -inputPanelSize.height - environment.safeInsets.bottom
@ -3618,7 +3612,7 @@ final class VideoChatScreenComponent: Component {
} else { } else {
inputPanelOriginX = floorToScreenPixels((availableSize.width - inputPanelSize.width) / 2.0) inputPanelOriginX = floorToScreenPixels((availableSize.width - inputPanelSize.width) / 2.0)
} }
let inputPanelFrame = CGRect(origin: CGPoint(x: inputPanelOriginX, y: availableSize.height - environment.safeInsets.bottom - inputPanelBottomInset - inputPanelSize.height - 3.0), size: inputPanelSize) let inputPanelFrame = CGRect(origin: CGPoint(x: inputPanelOriginX, y: availableSize.height - inputPanelBottomInset - inputPanelSize.height - 3.0), size: inputPanelSize)
if let inputPanelView = self.inputPanel.view { if let inputPanelView = self.inputPanel.view {
if inputPanelView.superview == nil { if inputPanelView.superview == nil {
self.containerView.addSubview(inputPanelView) self.containerView.addSubview(inputPanelView)
@ -3687,9 +3681,9 @@ final class VideoChatScreenComponent: Component {
} else { } else {
reactionContextNodeOriginX = 0.0 reactionContextNodeOriginX = 0.0
} }
let reactionsAnchorRect: CGRect = CGRect(origin: CGPoint(x: availableSize.width - 44.0, y: availableSize.height - inputPanelBottomInset - inputPanelSize.height - 18.0), size: CGSize(width: 44.0, height: 44.0)) let reactionsAnchorRect: CGRect = CGRect(origin: CGPoint(x: availableSize.width - 44.0, y: availableSize.height - inputPanelBottomInset - inputPanelSize.height + 2.0), size: CGSize(width: 44.0, height: 44.0))
if let reactionItems = self.reactionItems, effectiveDisplayReactions { if let reactionItems = self.reactionItems, effectiveDisplayReactions {
reactionsInset += 48.0 reactionsInset += 62.0
let reactionContextNode: ReactionContextNode let reactionContextNode: ReactionContextNode
var reactionContextNodeTransition = transition var reactionContextNodeTransition = transition
@ -3956,7 +3950,7 @@ final class VideoChatScreenComponent: Component {
} }
let normalMessagesBottomInset: CGFloat = buttonsOnTheSide ? 16.0 : availableSize.height - microphoneButtonFrame.minY + 16.0 let normalMessagesBottomInset: CGFloat = buttonsOnTheSide ? 16.0 : availableSize.height - microphoneButtonFrame.minY + 16.0
let messagesBottomInset: CGFloat = max(inputPanelBottomInset + inputPanelSize.height + 31.0, normalMessagesBottomInset) + reactionsInset let messagesBottomInset: CGFloat = max(inputPanelBottomInset + inputPanelSize.height - 3.0, normalMessagesBottomInset) + reactionsInset
let messagesListSize = self.messagesList.update( let messagesListSize = self.messagesList.update(
transition: transition, transition: transition,
component: AnyComponent(MessageListComponent( component: AnyComponent(MessageListComponent(

View File

@ -897,7 +897,7 @@ public final class MessageInputPanelComponent: Component {
}, },
isOneLineWhenUnfocused: component.style == .media, isOneLineWhenUnfocused: component.style == .media,
emptyLineHandling: component.style == .glass ? .notAllowed : .allowed, emptyLineHandling: component.style == .glass ? .notAllowed : .allowed,
formatMenuAvailability: component.isFormattingLocked ? .locked : .available(TextFieldComponent.FormatMenuAvailability.Action.all), formatMenuAvailability: component.isFormattingLocked ? .locked : .available(component.style == .glass ? [.bold, .italic, .strikethrough, .underline, .spoiler] : TextFieldComponent.FormatMenuAvailability.Action.all),
returnKeyType: component.style == .glass ? .send : .default, returnKeyType: component.style == .glass ? .send : .default,
lockedFormatAction: { lockedFormatAction: {
component.presentTextFormattingTooltip?() component.presentTextFormattingTooltip?()