mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Allow crafting another gift after success.
This commit is contained in:
@@ -4158,6 +4158,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_gift_craft_failed_about#one" = "This crafting attempt was unsuccessful.\n**{count}** gift was lost.";
|
||||
"lng_gift_craft_failed_about#other" = "This crafting attempt was unsuccessful.\n**{count}** gifts were lost.";
|
||||
"lng_gift_craft_new_button" = "Craft New Gift";
|
||||
"lng_gift_craft_another_button" = "Craft Another Gift";
|
||||
"lng_gift_craft_unavailable" = "Crafting unavailable";
|
||||
"lng_gift_craft_when" = "This gift will become available for crafting on {date} at {time}.";
|
||||
|
||||
|
||||
@@ -3355,7 +3355,8 @@ void AddUpgradeGiftCover(
|
||||
Data::CreditsHistoryEntry EntryForUpgradedGift(
|
||||
const std::shared_ptr<Data::GiftUpgradeResult> &gift,
|
||||
uint64 nextToUpgradeStickerId,
|
||||
Fn<void()> nextToUpgradeShow) {
|
||||
Fn<void()> nextToUpgradeShow,
|
||||
Fn<void()> craftAnother) {
|
||||
Expects(gift != nullptr);
|
||||
|
||||
const auto unique = gift->info.unique;
|
||||
@@ -3378,6 +3379,7 @@ Data::CreditsHistoryEntry EntryForUpgradedGift(
|
||||
.uniqueGift = unique,
|
||||
.nextToUpgradeStickerId = nextToUpgradeStickerId,
|
||||
.nextToUpgradeShow = nextToUpgradeShow,
|
||||
.craftAnotherCallback = craftAnother,
|
||||
.peerType = Data::CreditsHistoryEntry::PeerType::Peer,
|
||||
.limitedCount = gift->info.limitedCount,
|
||||
.limitedLeft = gift->info.limitedLeft,
|
||||
|
||||
@@ -183,7 +183,8 @@ void SendGiftBox(
|
||||
[[nodiscard]] Data::CreditsHistoryEntry EntryForUpgradedGift(
|
||||
const std::shared_ptr<Data::GiftUpgradeResult> &gift,
|
||||
uint64 nextToUpgradeStickerId = 0,
|
||||
Fn<void()> nextToUpgradeShow = nullptr);
|
||||
Fn<void()> nextToUpgradeShow = nullptr,
|
||||
Fn<void()> craftAnother = nullptr);
|
||||
|
||||
[[nodiscard]] std::shared_ptr<Data::GiftUpgradeResult> FindUniqueGift(
|
||||
not_null<Main::Session*> session,
|
||||
|
||||
@@ -1897,8 +1897,15 @@ void StartCraftAnimation(
|
||||
|
||||
box->setStyle(st::giftBox);
|
||||
|
||||
auto craftAnotherCallback = crl::guard(box, [=] {
|
||||
retryWithNewGift([=] { box->closeBox(); });
|
||||
});
|
||||
|
||||
const auto entry = EntryForUpgradedGift(
|
||||
*state->craftResult);
|
||||
*state->craftResult,
|
||||
0,
|
||||
nullptr,
|
||||
craftAnotherCallback);
|
||||
Settings::GenericCreditsEntryBody(box, show, entry);
|
||||
container->resizeToWidth(st::boxWideWidth);
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ struct CreditsHistoryEntry final {
|
||||
Fn<std::vector<CreditsHistoryEntry>()> pinnedSavedGifts;
|
||||
uint64 nextToUpgradeStickerId = 0;
|
||||
Fn<void()> nextToUpgradeShow;
|
||||
Fn<void()> craftAnotherCallback;
|
||||
CreditsAmount starrefAmount;
|
||||
int starrefCommission = 0;
|
||||
uint64 starrefRecipientId = 0;
|
||||
|
||||
@@ -2286,6 +2286,8 @@ void GenericCreditsEntryBody(
|
||||
? tr::lng_credits_subscription_off_button()
|
||||
: toRejoin
|
||||
? tr::lng_credits_subscription_off_rejoin_button()
|
||||
: e.craftAnotherCallback
|
||||
? tr::lng_gift_craft_another_button()
|
||||
: canUpgradeFree
|
||||
? tr::lng_gift_upgrade_free()
|
||||
: canUpgrade
|
||||
@@ -2350,6 +2352,9 @@ void GenericCreditsEntryBody(
|
||||
showNextToUpgrade();
|
||||
close();
|
||||
return;
|
||||
} else if (e.craftAnotherCallback) {
|
||||
e.craftAnotherCallback();
|
||||
return;
|
||||
} else if (state->confirmButtonBusy.current()
|
||||
|| state->convertButtonBusy.current()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user