Always show Translate in public channels for some languages

This commit is contained in:
Ilya Laktyushin
2022-04-03 21:36:00 +04:00
parent 6724ac9402
commit 9426bd5060
4 changed files with 25 additions and 5 deletions

View File

@@ -883,7 +883,12 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
})))
}
let (canTranslate, _) = canTranslateText(context: context, text: messageText, showTranslate: translationSettings.showTranslate, ignoredLanguages: translationSettings.ignoredLanguages)
var showTranslateIfTopical = false
if let peer = chatPresentationInterfaceState.renderedPeer?.chatMainPeer as? TelegramChannel, case .broadcast = peer.info, !(peer.addressName ?? "").isEmpty {
showTranslateIfTopical = true
}
let (canTranslate, _) = canTranslateText(context: context, text: messageText, showTranslate: translationSettings.showTranslate, showTranslateIfTopical: showTranslateIfTopical, ignoredLanguages: translationSettings.ignoredLanguages)
if canTranslate {
actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuTranslate, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Translate"), color: theme.actionSheet.primaryTextColor)