Merge commit 'e236672d01030256872550fba651b508a92532a1'

This commit is contained in:
Isaac
2024-05-03 22:56:53 +04:00
9 changed files with 204 additions and 71 deletions

View File

@@ -2478,22 +2478,30 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
guard message.adAttribute == nil && message.id.namespace == Namespaces.Message.Cloud else {
continue
}
if !message.text.isEmpty && message.author?.id != self.context.account.peerId {
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
} else {
messageIdsToTranslate.append(message.id)
}
guard message.author?.id != self.context.account.peerId else {
continue
}
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
continue
}
if !message.text.isEmpty {
messageIdsToTranslate.append(message.id)
} else if let _ = message.media.first(where: { $0 is TelegramMediaPoll }) {
messageIdsToTranslate.append(message.id)
}
case let .MessageGroupEntry(_, messages, _):
for (message, _, _, _, _) in messages {
guard message.adAttribute == nil && message.id.namespace == Namespaces.Message.Cloud else {
continue
}
if !message.text.isEmpty && message.author?.id != self.context.account.peerId {
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
} else {
messageIdsToTranslate.append(message.id)
}
guard message.author?.id != self.context.account.peerId else {
continue
}
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
continue
}
if !message.text.isEmpty {
messageIdsToTranslate.append(message.id)
}
}
default: