Merge commit 'b04766d36b72c84dd8d6ab311d21ecf3f8d06a53'

This commit is contained in:
Ali
2023-10-25 18:00:07 +04:00
3 changed files with 31 additions and 3 deletions

View File

@@ -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.";

View File

@@ -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]

View File

@@ -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))
}