mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Implement refunded upgraded gift view.
This commit is contained in:
parent
e2bff474db
commit
92582d8434
7 changed files with 17 additions and 5 deletions
|
@ -2043,6 +2043,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_action_gift_premium_months#one" = "{count} Month Premium";
|
||||
"lng_action_gift_premium_months#other" = "{count} Months Premium";
|
||||
"lng_action_gift_premium_about" = "Subscription for exclusive Telegram features.";
|
||||
"lng_action_gift_refunded" = "This gift was downgraded because a request to refund the payment related to this gift was made, and the money was returned.";
|
||||
"lng_action_suggested_photo_me" = "You suggested this photo for {user}'s Telegram profile.";
|
||||
"lng_action_suggested_photo" = "{user} suggests this photo for your Telegram profile.";
|
||||
"lng_action_suggested_photo_button" = "View Photo";
|
||||
|
|
|
@ -1363,7 +1363,7 @@ void AddStarGiftTable(
|
|||
std::move(toggleVisibility)),
|
||||
marginWithButton);
|
||||
}
|
||||
if (entry.limitedCount > 0) {
|
||||
if (entry.limitedCount > 0 && !entry.giftRefunded) {
|
||||
auto amount = rpl::single(TextWithEntities{
|
||||
Lang::FormatCountDecimal(entry.limitedCount)
|
||||
});
|
||||
|
|
|
@ -85,6 +85,7 @@ struct CreditsHistoryEntry final {
|
|||
bool anonymous : 1 = false;
|
||||
bool stargift : 1 = false;
|
||||
bool giftTransferred : 1 = false;
|
||||
bool giftRefunded : 1 = false;
|
||||
bool savedToProfile : 1 = false;
|
||||
bool fromGiftsList : 1 = false;
|
||||
bool soldOutInfo : 1 = false;
|
||||
|
|
|
@ -5408,7 +5408,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
|||
const auto stars = action.vgift().match([&](
|
||||
const MTPDstarGift &data) {
|
||||
return uint64(data.vstars().v)
|
||||
+ uint64(data.vupgrade_stars().value_or_empty());
|
||||
+ uint64(action.vupgrade_stars().value_or_empty());
|
||||
}, [](const MTPDstarGiftUnique &) {
|
||||
return uint64();
|
||||
});
|
||||
|
|
|
@ -79,6 +79,8 @@ TextWithEntities PremiumGift::subtitle() {
|
|||
if (starGift()) {
|
||||
return !_data.message.empty()
|
||||
? _data.message
|
||||
: _data.refunded
|
||||
? tr::lng_action_gift_refunded(tr::now, Ui::Text::RichLangValue)
|
||||
: outgoingGift()
|
||||
? (_data.starsUpgradedBySender
|
||||
? tr::lng_action_gift_sent_upgradable(
|
||||
|
|
|
@ -1853,7 +1853,7 @@ void DetailsFiller::setupAboutVerification() {
|
|||
Ui::AddDivider(inner);
|
||||
} else if (!info->description.empty()) {
|
||||
Ui::AddDividerText(inner, rpl::single(info->description));
|
||||
} else if (_peer->verifiedByTelegram()) {
|
||||
} else if (peer->verifiedByTelegram()) {
|
||||
const auto phrases = PeerVerifyPhrases(peer);
|
||||
Ui::AddDividerText(inner, phrases.telegram());
|
||||
}
|
||||
|
|
|
@ -1182,7 +1182,10 @@ void ReceiptCreditsBox(
|
|||
box,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
(e.starsUpgradedBySender
|
||||
(e.giftRefunded
|
||||
? tr::lng_action_gift_refunded(
|
||||
Ui::Text::RichLangValue)
|
||||
: e.starsUpgradedBySender
|
||||
? tr::lng_action_gift_got_upgradable_text(
|
||||
Ui::Text::RichLangValue)
|
||||
: ((couldConvert || nonConvertible)
|
||||
|
@ -1211,6 +1214,9 @@ void ReceiptCreditsBox(
|
|||
tr::lng_paid_about_link_url(tr::now));
|
||||
return false;
|
||||
});
|
||||
if (e.giftRefunded) {
|
||||
about->setTextColorOverride(st::menuIconAttentionColor->c);
|
||||
}
|
||||
} else if (isStarGift) {
|
||||
} else if (e.gift || isPrize) {
|
||||
Ui::AddSkip(content);
|
||||
|
@ -1370,7 +1376,8 @@ void ReceiptCreditsBox(
|
|||
});
|
||||
};
|
||||
const auto canToggle = (canConvert || couldConvert || nonConvertible)
|
||||
&& !e.giftTransferred;
|
||||
&& !e.giftTransferred
|
||||
&& !e.giftRefunded;
|
||||
|
||||
AddStarGiftTable(
|
||||
controller,
|
||||
|
@ -1681,6 +1688,7 @@ void StarGiftViewBox(
|
|||
.anonymous = data.anonymous,
|
||||
.stargift = true,
|
||||
.giftTransferred = data.transferred,
|
||||
.giftRefunded = data.refunded,
|
||||
.savedToProfile = data.saved,
|
||||
.canUpgradeGift = data.upgradable,
|
||||
.hasGiftComment = !data.message.empty(),
|
||||
|
|
Loading…
Add table
Reference in a new issue