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.actionNodes.last?.actionEnabled = false
|
||||||
contentNode.inputFieldNode.textChanged = { [weak contentNode] title in
|
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
|
controller.willDismiss = { [weak contentNode] in
|
||||||
contentNode?.inputFieldNode.deactivateInput()
|
contentNode?.inputFieldNode.deactivateInput()
|
||||||
|
@ -4393,15 +4393,32 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var replaceImpl: ((ViewController) -> Void)?
|
if self.context.isPremium {
|
||||||
let controller = PremiumDemoScreen(context: self.context, subject: .noAds, action: {
|
self.present(UndoOverlayController(presentationData: self.presentationData, content: .actionSucceeded(title: nil, text: self.presentationData.strings.ReportAd_Hidden, cancel: nil, destructive: false), elevatedLayout: false, action: { _ in
|
||||||
let controller = PremiumIntroScreen(context: self.context, source: .ads)
|
return true
|
||||||
replaceImpl?(controller)
|
}), in: .current)
|
||||||
})
|
|
||||||
replaceImpl = { [weak controller] c in
|
var adOpaqueId: Data?
|
||||||
controller?.replace(with: c)
|
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
|
}, openAdsInfo: { [weak self] in
|
||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
|
@ -180,19 +180,9 @@ public func chatTranslationState(context: AccountContext, peerId: EnginePeer.Id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var justUpdated = false
|
|
||||||
return cachedChatTranslationState(engine: context.engine, peerId: peerId)
|
return cachedChatTranslationState(engine: context.engine, peerId: peerId)
|
||||||
|> mapToSignal { cached in
|
|> mapToSignal { cached in
|
||||||
let skipCached: Bool
|
if let cached, cached.baseLang == baseLang {
|
||||||
#if DEBUG
|
|
||||||
skipCached = true
|
|
||||||
if justUpdated {
|
|
||||||
return .complete()
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
skipCached = false
|
|
||||||
#endif
|
|
||||||
if let cached, cached.baseLang == baseLang, !skipCached {
|
|
||||||
if !dontTranslateLanguages.contains(cached.fromLang) {
|
if !dontTranslateLanguages.contains(cached.fromLang) {
|
||||||
return .single(cached)
|
return .single(cached)
|
||||||
} else {
|
} 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 state = ChatTranslationState(baseLang: baseLang, fromLang: fromLang, toLang: nil, isEnabled: false)
|
||||||
let _ = updateChatTranslationState(engine: context.engine, peerId: peerId, state: state).start()
|
let _ = updateChatTranslationState(engine: context.engine, peerId: peerId, state: state).start()
|
||||||
justUpdated = true
|
|
||||||
if !dontTranslateLanguages.contains(fromLang) {
|
if !dontTranslateLanguages.contains(fromLang) {
|
||||||
return state
|
return state
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user