mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
c4214a5c82
commit
d4c13120f8
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user