From 6af4878504d310fbc9c8959820b59aa223b2c899 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sun, 28 Sep 2025 21:31:54 +0400 Subject: [PATCH] Various improvements --- submodules/Display/Source/WindowContent.swift | 3 ++- .../Components/MessageItemComponent.swift | 5 ++++- .../Sources/VideoChatScreen.swift | 20 +++++++------------ .../Sources/MessageInputPanelComponent.swift | 2 +- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/submodules/Display/Source/WindowContent.swift b/submodules/Display/Source/WindowContent.swift index ec513047c5..8e565dffb6 100644 --- a/submodules/Display/Source/WindowContent.swift +++ b/submodules/Display/Source/WindowContent.swift @@ -520,8 +520,9 @@ public class Window1 { let testView = UIView() testView.backgroundColor = .blue testView.layer.zPosition = 1000.0 - #endif self.hostView.containerView.addSubview(testView) + #endif + self.keyboardFrameChangeObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillChangeFrameNotification, object: nil, queue: nil, using: { [weak self] notification in if let strongSelf = self { var isTablet = false diff --git a/submodules/TelegramCallsUI/Sources/Components/MessageItemComponent.swift b/submodules/TelegramCallsUI/Sources/Components/MessageItemComponent.swift index 4fe9e6d787..c0c9003fd6 100644 --- a/submodules/TelegramCallsUI/Sources/Components/MessageItemComponent.swift +++ b/submodules/TelegramCallsUI/Sources/Components/MessageItemComponent.swift @@ -158,6 +158,9 @@ final class MessageItemComponent: Component { let textFont = Font.regular(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 linkColor: UIColor = UIColor(rgb: 0x59b6fa) @@ -240,7 +243,7 @@ final class MessageItemComponent: Component { ) ) } 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 { textWithAppliedEntities.insert(NSAttributedString(string: peerName + " ", font: boldTextFont, textColor: textColor), at: 0) } diff --git a/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift b/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift index b680ec4a28..7dc23601ee 100644 --- a/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift +++ b/submodules/TelegramCallsUI/Sources/VideoChatScreen.swift @@ -1404,18 +1404,12 @@ final class VideoChatScreenComponent: Component { guard !text.string.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { 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) } 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)) } @@ -3596,13 +3590,13 @@ final class VideoChatScreenComponent: Component { ) if inputHeight > 0.0 { - inputPanelBottomInset = inputHeight - environment.safeInsets.bottom + inputPanelBottomInset = inputHeight } else { if self.inputPanelExternalState.isEditing { if buttonsOnTheSide { inputPanelBottomInset = 16.0 } else { - inputPanelBottomInset = availableSize.height - microphoneButtonFrame.minY + inputPanelBottomInset = availableSize.height - microphoneButtonFrame.minY + 20.0 } } else { inputPanelBottomInset = -inputPanelSize.height - environment.safeInsets.bottom @@ -3618,7 +3612,7 @@ final class VideoChatScreenComponent: Component { } else { 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 inputPanelView.superview == nil { self.containerView.addSubview(inputPanelView) @@ -3687,9 +3681,9 @@ final class VideoChatScreenComponent: Component { } else { 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 { - reactionsInset += 48.0 + reactionsInset += 62.0 let reactionContextNode: ReactionContextNode var reactionContextNodeTransition = transition @@ -3956,7 +3950,7 @@ final class VideoChatScreenComponent: Component { } 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( transition: transition, component: AnyComponent(MessageListComponent( diff --git a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift index d5c6a34b7f..93db1c9112 100644 --- a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift +++ b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift @@ -897,7 +897,7 @@ public final class MessageInputPanelComponent: Component { }, isOneLineWhenUnfocused: component.style == .media, 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, lockedFormatAction: { component.presentTextFormattingTooltip?()