diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index fda6b2b4a3..5adcefef3c 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -10293,6 +10293,7 @@ Sorry for the inconvenience."; "Stats.Boosts.Unclaimed" = "Unclaimed"; "Stats.Boosts.GetBoosts" = "Get Boosts via Gifts"; "Stats.Boosts.GetBoostsInfo" = "Get more boosts for your channel by gifting Premium to your subscribers."; +"Stats.Boosts.TooltipToBeDistributed" = "The recipient will be selected when the giveaway ends."; "Notification.PremiumPrize.Title" = "Congratulations!"; "Notification.PremiumPrize.UnclaimedText" = "You have an unclaimed prize from a giveaway by **%1$@**.\n\nThis prize is a **Telegram Premium** subscription for %2$@."; @@ -10383,7 +10384,7 @@ Sorry for the inconvenience."; "GiftLink.UsedDescription" = "This link was used to activate a **Telegram Premium** subscription."; "GiftLink.PersonalDescription" = "This link allows **%@** to activate a **Telegram Premium** subscription."; "GiftLink.PersonalUsedDescription" = "This link allowed **%@** to activate a **Telegram Premium** subscription."; -"GiftLink.UnclaimedDescription" = "This link allows to activate a **Telegram Premium** subscription."; +"GiftLink.UnclaimedDescription" = "This link allows anyone to activate a **Telegram Premium** subscription."; "GiftLink.Footer" = "You can also [send this link]() to a friend as a gift."; "GiftLink.UsedFooter" = "This link was used on %@."; "GiftLink.NotUsedFooter" = "This link hasn't been used yet."; diff --git a/submodules/PremiumUI/Sources/PremiumGiftCodeScreen.swift b/submodules/PremiumUI/Sources/PremiumGiftCodeScreen.swift index 05735b2d65..a040564d18 100644 --- a/submodules/PremiumUI/Sources/PremiumGiftCodeScreen.swift +++ b/submodules/PremiumUI/Sources/PremiumGiftCodeScreen.swift @@ -222,13 +222,17 @@ private final class PremiumGiftCodeSheetContent: CombinedComponent { toPeer = nil descriptionText = strings.GiftLink_UnclaimedDescription } - if boost.slug == nil { + if boost.flags.contains(.isUnclaimed) || boost.slug == nil { additionalText = strings.GiftLink_NotUsedFooter } else { additionalText = "" } buttonText = strings.Common_OK - link = nil + if boost.flags.contains(.isUnclaimed), let slug = boost.slug { + link = "https://t.me/giftcode/\(slug)" + } else { + link = nil + } date = boost.date toPeerId = boost.peer?.id fromPeer = state.peerMap[channelId] diff --git a/submodules/StatisticsUI/Sources/ChannelStatsController.swift b/submodules/StatisticsUI/Sources/ChannelStatsController.swift index 30fb591c75..3108581f1f 100644 --- a/submodules/StatisticsUI/Sources/ChannelStatsController.swift +++ b/submodules/StatisticsUI/Sources/ChannelStatsController.swift @@ -907,6 +907,7 @@ public func channelStatsController(context: AccountContext, updatedPresentationD let boostsContext = ChannelBoostersContext(account: context.account, peerId: peerId, gift: false) let giftsContext = ChannelBoostersContext(account: context.account, peerId: peerId, gift: true) + var dismissAllTooltipsImpl: (() -> Void)? var presentImpl: ((ViewController) -> Void)? var pushImpl: ((ViewController) -> Void)? @@ -964,6 +965,13 @@ public func channelStatsController(context: AccountContext, updatedPresentationD presentImpl?(shareController) }, openBoost: { boost in + dismissAllTooltipsImpl?() + if boost.peer == nil, boost.flags.contains(.isGiveaway) && !boost.flags.contains(.isUnclaimed) { + let presentationData = context.sharedContext.currentPresentationData.with { $0 } + presentImpl?(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.Stats_Boosts_TooltipToBeDistributed, timeout: nil, customUndoText: nil), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false })) + return + } + let controller = PremiumGiftCodeScreen(context: context, subject: .boost(peerId, boost), action: {}) pushImpl?(controller) }, @@ -1091,6 +1099,21 @@ public func channelStatsController(context: AccountContext, updatedPresentationD let contextController = ContextController(presentationData: presentationData, source: .extracted(ChannelStatsContextExtractedContentSource(controller: controller, sourceNode: sourceNode, keepInPlace: false)), items: .single(ContextController.Items(content: .list(items))), gesture: gesture) controller.presentInGlobalOverlay(contextController) } + dismissAllTooltipsImpl = { [weak controller] in + if let controller { + controller.window?.forEachController({ controller in + if let controller = controller as? UndoOverlayController { + controller.dismiss() + } + }) + controller.forEachController({ controller in + if let controller = controller as? UndoOverlayController { + controller.dismiss() + } + return true + }) + } + } presentImpl = { [weak controller] c in controller?.present(c, in: .window(.root)) }