mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Group boosts
This commit is contained in:
parent
714bcf7af3
commit
6af485cff1
@ -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:";
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 {
|
||||
@ -1116,12 +1112,16 @@ private final class SheetContent: CombinedComponent {
|
||||
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
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user