From 1e1b2e39de6ec52549ee7616a738206aa6594fce Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 27 May 2024 19:02:24 +0400 Subject: [PATCH] Various improvements --- .../Sources/FactCheckAlertController.swift | 7 ++++++- submodules/TelegramUI/Sources/ChatController.swift | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/submodules/TelegramUI/Components/Chat/FactCheckAlertController/Sources/FactCheckAlertController.swift b/submodules/TelegramUI/Components/Chat/FactCheckAlertController/Sources/FactCheckAlertController.swift index 66b836d6b1..8591c9993a 100644 --- a/submodules/TelegramUI/Components/Chat/FactCheckAlertController/Sources/FactCheckAlertController.swift +++ b/submodules/TelegramUI/Components/Chat/FactCheckAlertController/Sources/FactCheckAlertController.swift @@ -204,6 +204,11 @@ private final class FactCheckAlertContentNode: AlertContentNode { let inputInset: CGFloat = 16.0 let inputWidth = resultWidth - inputInset * 2.0 + var characterLimit: Int = 1024 + if let data = self.context.currentAppConfiguration.with({ $0 }).data, let value = data["factcheck_length_limit"] as? Double { + characterLimit = Int(value) + } + let inputFieldSize = self.inputField.update( transition: .immediate, component: AnyComponent(TextFieldComponent( @@ -219,7 +224,7 @@ private final class FactCheckAlertContentNode: AlertContentNode { customInputView: nil, resetText: nil, isOneLineWhenUnfocused: false, - characterLimit: 1024, + characterLimit: characterLimit, emptyLineHandling: .oneConsecutive, formatMenuAvailability: .available([.bold, .italic, .link]), returnKeyType: .default, diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index d32fae8d1f..61e03c9347 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -9594,7 +9594,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G |> deliverOnMainQueue).start(next: { [weak self] peer in if let self, !hashtag.isEmpty { var publicPosts = false - if case let .customChatContents(contents) = self.subject, case let .hashTagSearch(publicPostsValue) = contents.kind { + if let peer = self.presentationInterfaceState.renderedPeer, let channel = peer.peer as? TelegramChannel, case .broadcast = channel.info, !(channel.addressName ?? "").isEmpty { + publicPosts = true + } else if case let .customChatContents(contents) = self.subject, case let .hashTagSearch(publicPostsValue) = contents.kind { publicPosts = publicPostsValue } let searchController = HashtagSearchController(context: self.context, peer: peer.flatMap(EnginePeer.init), query: hashtag, publicPosts: publicPosts)