diff --git a/submodules/TelegramUI/Components/Stickers/StickerPackEditTitleController/Sources/StickerPackEditTitleController.swift b/submodules/TelegramUI/Components/Stickers/StickerPackEditTitleController/Sources/StickerPackEditTitleController.swift index 08309c8eef..562726776a 100644 --- a/submodules/TelegramUI/Components/Stickers/StickerPackEditTitleController/Sources/StickerPackEditTitleController.swift +++ b/submodules/TelegramUI/Components/Stickers/StickerPackEditTitleController/Sources/StickerPackEditTitleController.swift @@ -794,7 +794,7 @@ public func stickerPackEditTitleController(context: AccountContext, forceDark: B }) contentNode.actionNodes.last?.actionEnabled = false contentNode.inputFieldNode.textChanged = { [weak contentNode] title in - contentNode?.actionNodes.last?.actionEnabled = title.trimmingTrailingSpaces().count >= 3 + contentNode?.actionNodes.last?.actionEnabled = title.trimmingTrailingSpaces().trimmingEmojis.count >= 3 } controller.willDismiss = { [weak contentNode] in contentNode?.inputFieldNode.deactivateInput() diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 0fa51c2521..5b5c604b0b 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -4393,15 +4393,32 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G guard let self else { return } - var replaceImpl: ((ViewController) -> Void)? - let controller = PremiumDemoScreen(context: self.context, subject: .noAds, action: { - let controller = PremiumIntroScreen(context: self.context, source: .ads) - replaceImpl?(controller) - }) - replaceImpl = { [weak controller] c in - controller?.replace(with: c) + if self.context.isPremium { + self.present(UndoOverlayController(presentationData: self.presentationData, content: .actionSucceeded(title: nil, text: self.presentationData.strings.ReportAd_Hidden, cancel: nil, destructive: false), elevatedLayout: false, action: { _ in + return true + }), in: .current) + + var adOpaqueId: Data? + self.chatDisplayNode.historyNode.forEachVisibleMessageItemNode { itemView in + if let adAttribute = itemView.item?.message.adAttribute { + adOpaqueId = adAttribute.opaqueId + } + } + let _ = self.context.engine.accountData.updateAdMessagesEnabled(enabled: false).start() + if let adOpaqueId { + self.removeAd(opaqueId: adOpaqueId) + } + } else { + var replaceImpl: ((ViewController) -> Void)? + let controller = PremiumDemoScreen(context: self.context, subject: .noAds, action: { + let controller = PremiumIntroScreen(context: self.context, source: .ads) + replaceImpl?(controller) + }) + replaceImpl = { [weak controller] c in + controller?.replace(with: c) + } + self.push(controller) } - self.push(controller) }, openAdsInfo: { [weak self] in guard let self else { return diff --git a/submodules/TranslateUI/Sources/ChatTranslation.swift b/submodules/TranslateUI/Sources/ChatTranslation.swift index cad9a68ecc..606b23013b 100644 --- a/submodules/TranslateUI/Sources/ChatTranslation.swift +++ b/submodules/TranslateUI/Sources/ChatTranslation.swift @@ -180,19 +180,9 @@ public func chatTranslationState(context: AccountContext, peerId: EnginePeer.Id) } } - var justUpdated = false return cachedChatTranslationState(engine: context.engine, peerId: peerId) |> mapToSignal { cached in - let skipCached: Bool - #if DEBUG - skipCached = true - if justUpdated { - return .complete() - } - #else - skipCached = false - #endif - if let cached, cached.baseLang == baseLang, !skipCached { + if let cached, cached.baseLang == baseLang { if !dontTranslateLanguages.contains(cached.fromLang) { return .single(cached) } else { @@ -290,7 +280,6 @@ public func chatTranslationState(context: AccountContext, peerId: EnginePeer.Id) } let state = ChatTranslationState(baseLang: baseLang, fromLang: fromLang, toLang: nil, isEnabled: false) let _ = updateChatTranslationState(engine: context.engine, peerId: peerId, state: state).start() - justUpdated = true if !dontTranslateLanguages.contains(fromLang) { return state } else {