diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 9ef1cada19..13b3958157 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -11224,3 +11224,5 @@ Sorry for the inconvenience."; "GroupBoost.Info" = "Members of your group can **boost** it so that it **levels up** and gets **exclusive features**."; "Chat.GroupEmojiTooltip" = "All members of this group can\nuse the # **%@** pack"; + +"GroupBoost.AskToBoost" = "Ask your **Premium** members to boost your group with this link:"; diff --git a/submodules/AccountContext/Sources/ChatController.swift b/submodules/AccountContext/Sources/ChatController.swift index 2757bedab7..838cad2405 100644 --- a/submodules/AccountContext/Sources/ChatController.swift +++ b/submodules/AccountContext/Sources/ChatController.swift @@ -18,13 +18,16 @@ public final class ChatMessageItemAssociatedData: Equatable { public struct DisplayTranscribeButton: Equatable { public let canBeDisplayed: Bool public let displayForNotConsumed: Bool + public let providedByGroupBoost: Bool public init( canBeDisplayed: Bool, - displayForNotConsumed: Bool + displayForNotConsumed: Bool, + providedByGroupBoost: Bool ) { self.canBeDisplayed = canBeDisplayed self.displayForNotConsumed = displayForNotConsumed + self.providedByGroupBoost = providedByGroupBoost } } @@ -77,7 +80,7 @@ public final class ChatMessageItemAssociatedData: Equatable { isPremium: Bool, accountPeer: EnginePeer?, forceInlineReactions: Bool = false, - alwaysDisplayTranscribeButton: DisplayTranscribeButton = DisplayTranscribeButton(canBeDisplayed: false, displayForNotConsumed: false), + alwaysDisplayTranscribeButton: DisplayTranscribeButton = DisplayTranscribeButton(canBeDisplayed: false, displayForNotConsumed: false, providedByGroupBoost: false), topicAuthorId: EnginePeer.Id? = nil, hasBots: Bool = false, translateToLanguage: String? = nil, diff --git a/submodules/AccountContext/Sources/Premium.swift b/submodules/AccountContext/Sources/Premium.swift index 09ee8ce89a..a8a5e15385 100644 --- a/submodules/AccountContext/Sources/Premium.swift +++ b/submodules/AccountContext/Sources/Premium.swift @@ -205,7 +205,7 @@ public struct PremiumConfiguration { minChannelEmojiStatusLevel: get(data["channel_emoji_status_level_min"]) ?? defaultValue.minChannelEmojiStatusLevel, minChannelWallpaperLevel: get(data["channel_wallpaper_level_min"]) ?? defaultValue.minChannelWallpaperLevel, minChannelCustomWallpaperLevel: get(data["channel_custom_wallpaper_level_min"]) ?? defaultValue.minChannelCustomWallpaperLevel, - minGroupProfileIconLevel: get(data["group_profile_bg_icon_level_min "]) ?? defaultValue.minGroupProfileIconLevel, + minGroupProfileIconLevel: get(data["group_profile_bg_icon_level_min"]) ?? defaultValue.minGroupProfileIconLevel, minGroupEmojiStatusLevel: get(data["group_emoji_status_level_min"]) ?? defaultValue.minGroupEmojiStatusLevel, minGroupWallpaperLevel: get(data["group_wallpaper_level_min"]) ?? defaultValue.minGroupWallpaperLevel, minGroupCustomWallpaperLevel: get(data["group_custom_wallpaper_level_min"]) ?? defaultValue.minGroupCustomWallpaperLevel, diff --git a/submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift b/submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift index 95fdc69d6f..1d1a97e6fc 100644 --- a/submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumBoostLevelsScreen.swift @@ -644,7 +644,7 @@ private final class SheetContent: CombinedComponent { } if needsSecondParagraph { - textString += "\n\n\(strings.ChannelBoost_AskToBoost)" + textString += "\n\n\(isGroup ? strings.GroupBoost_AskToBoost : strings.ChannelBoost_AskToBoost)" } } else { textString = strings.ChannelBoost_MaxLevelReached_Text(peerName, "\(level)").string @@ -1102,10 +1102,6 @@ private final class SheetContent: CombinedComponent { perks.append(.nameColor(nameColorsCount)) } - if isGroup && level >= requiredBoostSubjectLevel(subject: .audioTranscription, group: isGroup, context: component.context, configuration: premiumConfiguration) { - perks.append(.audioTranscription) - } - var profileColorsCount: Int32 = 0 for (colorLevel, count) in profileColorsAtLevel { if level >= colorLevel { @@ -1115,13 +1111,17 @@ private final class SheetContent: CombinedComponent { if profileColorsCount > 0 { perks.append(.profileColor(profileColorsCount)) } - + + if isGroup && level >= requiredBoostSubjectLevel(subject: .emojiPack, group: isGroup, context: component.context, configuration: premiumConfiguration) { + perks.append(.emojiPack) + } + if level >= requiredBoostSubjectLevel(subject: .profileIcon, group: isGroup, context: component.context, configuration: premiumConfiguration) { perks.append(.profileIcon) } if isGroup && level >= requiredBoostSubjectLevel(subject: .audioTranscription, group: isGroup, context: component.context, configuration: premiumConfiguration) { - perks.append(.emojiPack) + perks.append(.audioTranscription) } var linkColorsCount: Int32 = 0 diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveFileNode/Sources/ChatMessageInteractiveFileNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveFileNode/Sources/ChatMessageInteractiveFileNode.swift index b48bb3b249..d240b3c302 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveFileNode/Sources/ChatMessageInteractiveFileNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveFileNode/Sources/ChatMessageInteractiveFileNode.swift @@ -361,7 +361,7 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode { } } } else { - guard arguments.associatedData.isPremium else { + guard arguments.associatedData.isPremium || arguments.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost else { if self.hapticFeedback == nil { self.hapticFeedback = HapticFeedback() } @@ -771,6 +771,8 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode { } else if arguments.incoming && isConsumed == false && arguments.associatedData.alwaysDisplayTranscribeButton.displayForNotConsumed { displayTranscribe = true } + } else if arguments.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost { + displayTranscribe = true } } diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift index ce30016614..cf72e8dacc 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageInteractiveInstantVideoNode/Sources/ChatMessageInteractiveInstantVideoNode.swift @@ -841,6 +841,8 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { } else { displayTranscribe = false } + } else if item.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost { + displayTranscribe = true } } @@ -1813,13 +1815,12 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { } } } else { - guard item.associatedData.isPremium else { + guard item.associatedData.isPremium || item.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost else { if self.hapticFeedback == nil { self.hapticFeedback = HapticFeedback() } self.hapticFeedback?.impact(.medium) - let tipController = UndoOverlayController(presentationData: presentationData, content: .universal(animation: "anim_voiceToText", scale: 0.065, colors: [:], title: nil, text: presentationData.strings.Message_AudioTranscription_SubscribeToPremium, customUndoText: presentationData.strings.Message_AudioTranscription_SubscribeToPremiumAction, timeout: nil), elevatedLayout: false, position: .top, animateInAsReplacement: false, action: { action in if case .undo = action { let context = item.context diff --git a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift index ea3c06d77e..d4c8dd823a 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift @@ -1690,7 +1690,8 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto let alwaysDisplayTranscribeButton = ChatMessageItemAssociatedData.DisplayTranscribeButton( canBeDisplayed: suggestAudioTranscription.0 < 2, - displayForNotConsumed: suggestAudioTranscription.1 + displayForNotConsumed: suggestAudioTranscription.1, + providedByGroupBoost: false ) var translateToLanguage: String?