diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveFileNode/Sources/ChatMessageInteractiveFileNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveFileNode/Sources/ChatMessageInteractiveFileNode.swift index f709507d86..821eb02bba 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveFileNode/Sources/ChatMessageInteractiveFileNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveFileNode/Sources/ChatMessageInteractiveFileNode.swift @@ -353,7 +353,7 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode { let premiumConfiguration = PremiumConfiguration.with(appConfiguration: arguments.context.currentAppConfiguration.with { $0 }) let transcriptionText = self.forcedAudioTranscriptionText ?? transcribedText(message: message) - if transcriptionText == nil { + if transcriptionText == nil && !arguments.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost { if premiumConfiguration.audioTransciptionTrialCount > 0 { if !arguments.associatedData.isPremium { if self.presentAudioTranscriptionTooltip(finished: false) { @@ -361,7 +361,7 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode { } } } else { - guard arguments.associatedData.isPremium || arguments.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost else { + guard arguments.associatedData.isPremium else { if self.hapticFeedback == nil { self.hapticFeedback = HapticFeedback() } @@ -475,7 +475,7 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode { strongSelf.transcribeDisposable?.dispose() strongSelf.transcribeDisposable = nil - if let arguments = strongSelf.arguments, !arguments.associatedData.isPremium { + if let arguments = strongSelf.arguments, !arguments.associatedData.isPremium && !arguments.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost { Queue.mainQueue().after(0.1, { let _ = strongSelf.presentAudioTranscriptionTooltip(finished: true) }) diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift index 90d03e8602..a3a48a3c5b 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift @@ -1807,7 +1807,7 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { let premiumConfiguration = PremiumConfiguration.with(appConfiguration: item.context.currentAppConfiguration.with { $0 }) let transcriptionText = transcribedText(message: item.message) - if transcriptionText == nil { + if transcriptionText == nil && !item.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost { if premiumConfiguration.audioTransciptionTrialCount > 0 { if !item.associatedData.isPremium { if self.presentAudioTranscriptionTooltip(finished: false) { @@ -1815,7 +1815,7 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { } } } else { - guard item.associatedData.isPremium || item.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost else { + guard item.associatedData.isPremium else { if self.hapticFeedback == nil { self.hapticFeedback = HapticFeedback() } @@ -1875,7 +1875,7 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { strongSelf.transcribeDisposable?.dispose() strongSelf.transcribeDisposable = nil - if let item = strongSelf.item, !item.associatedData.isPremium { + if let item = strongSelf.item, !item.associatedData.isPremium && !item.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost { Queue.mainQueue().after(0.1, { let _ = strongSelf.presentAudioTranscriptionTooltip(finished: true) }) diff --git a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift index d4c8dd823a..cfa43ce97c 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift @@ -1472,6 +1472,8 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto let deviceContactsNumbers = self.context.sharedContext.deviceContactPhoneNumbers.get() |> distinctUntilChanged + let premiumConfiguration = PremiumConfiguration.with(appConfiguration: self.context.currentAppConfiguration.with { $0 }) + let messageViewQueue = Queue.mainQueue() let historyViewTransitionDisposable = combineLatest(queue: messageViewQueue, historyViewUpdate, @@ -1676,22 +1678,28 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto reverseGroups = reverseGroupsValue } - var isCopyProtectionEnabled: Bool = data.initialData?.peer?.isCopyProtectionEnabled ?? false - for entry in view.additionalData { - if case let .peer(_, maybePeer) = entry, let peer = maybePeer { - isCopyProtectionEnabled = peer.isCopyProtectionEnabled - } - } var isPremium = false if case let .user(user) = accountPeer, user.isPremium { isPremium = true } + var audioTranscriptionProvidedByBoost = false + var isCopyProtectionEnabled: Bool = data.initialData?.peer?.isCopyProtectionEnabled ?? false + for entry in view.additionalData { + if case let .peer(_, maybePeer) = entry, let peer = maybePeer { + isCopyProtectionEnabled = peer.isCopyProtectionEnabled + if let channel = peer as? TelegramChannel, let boostLevel = channel.approximateBoostLevel { + if boostLevel >= premiumConfiguration.minGroupAudioTranscriptionLevel { + audioTranscriptionProvidedByBoost = true + } + } + } + } let alwaysDisplayTranscribeButton = ChatMessageItemAssociatedData.DisplayTranscribeButton( canBeDisplayed: suggestAudioTranscription.0 < 2, displayForNotConsumed: suggestAudioTranscription.1, - providedByGroupBoost: false + providedByGroupBoost: audioTranscriptionProvidedByBoost ) var translateToLanguage: String?