mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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#one" = "{count} Month Premium";
|
||||||
"lng_action_gift_premium_months#other" = "{count} Months Premium";
|
"lng_action_gift_premium_months#other" = "{count} Months Premium";
|
||||||
"lng_action_gift_premium_about" = "Subscription for exclusive Telegram features.";
|
"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_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" = "{user} suggests this photo for your Telegram profile.";
|
||||||
"lng_action_suggested_photo_button" = "View Photo";
|
"lng_action_suggested_photo_button" = "View Photo";
|
||||||
|
|
|
@ -1363,7 +1363,7 @@ void AddStarGiftTable(
|
||||||
std::move(toggleVisibility)),
|
std::move(toggleVisibility)),
|
||||||
marginWithButton);
|
marginWithButton);
|
||||||
}
|
}
|
||||||
if (entry.limitedCount > 0) {
|
if (entry.limitedCount > 0 && !entry.giftRefunded) {
|
||||||
auto amount = rpl::single(TextWithEntities{
|
auto amount = rpl::single(TextWithEntities{
|
||||||
Lang::FormatCountDecimal(entry.limitedCount)
|
Lang::FormatCountDecimal(entry.limitedCount)
|
||||||
});
|
});
|
||||||
|
|
|
@ -85,6 +85,7 @@ struct CreditsHistoryEntry final {
|
||||||
bool anonymous : 1 = false;
|
bool anonymous : 1 = false;
|
||||||
bool stargift : 1 = false;
|
bool stargift : 1 = false;
|
||||||
bool giftTransferred : 1 = false;
|
bool giftTransferred : 1 = false;
|
||||||
|
bool giftRefunded : 1 = false;
|
||||||
bool savedToProfile : 1 = false;
|
bool savedToProfile : 1 = false;
|
||||||
bool fromGiftsList : 1 = false;
|
bool fromGiftsList : 1 = false;
|
||||||
bool soldOutInfo : 1 = false;
|
bool soldOutInfo : 1 = false;
|
||||||
|
|
|
@ -5408,7 +5408,7 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
||||||
const auto stars = action.vgift().match([&](
|
const auto stars = action.vgift().match([&](
|
||||||
const MTPDstarGift &data) {
|
const MTPDstarGift &data) {
|
||||||
return uint64(data.vstars().v)
|
return uint64(data.vstars().v)
|
||||||
+ uint64(data.vupgrade_stars().value_or_empty());
|
+ uint64(action.vupgrade_stars().value_or_empty());
|
||||||
}, [](const MTPDstarGiftUnique &) {
|
}, [](const MTPDstarGiftUnique &) {
|
||||||
return uint64();
|
return uint64();
|
||||||
});
|
});
|
||||||
|
|
|
@ -79,6 +79,8 @@ TextWithEntities PremiumGift::subtitle() {
|
||||||
if (starGift()) {
|
if (starGift()) {
|
||||||
return !_data.message.empty()
|
return !_data.message.empty()
|
||||||
? _data.message
|
? _data.message
|
||||||
|
: _data.refunded
|
||||||
|
? tr::lng_action_gift_refunded(tr::now, Ui::Text::RichLangValue)
|
||||||
: outgoingGift()
|
: outgoingGift()
|
||||||
? (_data.starsUpgradedBySender
|
? (_data.starsUpgradedBySender
|
||||||
? tr::lng_action_gift_sent_upgradable(
|
? tr::lng_action_gift_sent_upgradable(
|
||||||
|
|
|
@ -1853,7 +1853,7 @@ void DetailsFiller::setupAboutVerification() {
|
||||||
Ui::AddDivider(inner);
|
Ui::AddDivider(inner);
|
||||||
} else if (!info->description.empty()) {
|
} else if (!info->description.empty()) {
|
||||||
Ui::AddDividerText(inner, rpl::single(info->description));
|
Ui::AddDividerText(inner, rpl::single(info->description));
|
||||||
} else if (_peer->verifiedByTelegram()) {
|
} else if (peer->verifiedByTelegram()) {
|
||||||
const auto phrases = PeerVerifyPhrases(peer);
|
const auto phrases = PeerVerifyPhrases(peer);
|
||||||
Ui::AddDividerText(inner, phrases.telegram());
|
Ui::AddDividerText(inner, phrases.telegram());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1182,7 +1182,10 @@ void ReceiptCreditsBox(
|
||||||
box,
|
box,
|
||||||
object_ptr<Ui::FlatLabel>(
|
object_ptr<Ui::FlatLabel>(
|
||||||
box,
|
box,
|
||||||
(e.starsUpgradedBySender
|
(e.giftRefunded
|
||||||
|
? tr::lng_action_gift_refunded(
|
||||||
|
Ui::Text::RichLangValue)
|
||||||
|
: e.starsUpgradedBySender
|
||||||
? tr::lng_action_gift_got_upgradable_text(
|
? tr::lng_action_gift_got_upgradable_text(
|
||||||
Ui::Text::RichLangValue)
|
Ui::Text::RichLangValue)
|
||||||
: ((couldConvert || nonConvertible)
|
: ((couldConvert || nonConvertible)
|
||||||
|
@ -1211,6 +1214,9 @@ void ReceiptCreditsBox(
|
||||||
tr::lng_paid_about_link_url(tr::now));
|
tr::lng_paid_about_link_url(tr::now));
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
if (e.giftRefunded) {
|
||||||
|
about->setTextColorOverride(st::menuIconAttentionColor->c);
|
||||||
|
}
|
||||||
} else if (isStarGift) {
|
} else if (isStarGift) {
|
||||||
} else if (e.gift || isPrize) {
|
} else if (e.gift || isPrize) {
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
|
@ -1370,7 +1376,8 @@ void ReceiptCreditsBox(
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const auto canToggle = (canConvert || couldConvert || nonConvertible)
|
const auto canToggle = (canConvert || couldConvert || nonConvertible)
|
||||||
&& !e.giftTransferred;
|
&& !e.giftTransferred
|
||||||
|
&& !e.giftRefunded;
|
||||||
|
|
||||||
AddStarGiftTable(
|
AddStarGiftTable(
|
||||||
controller,
|
controller,
|
||||||
|
@ -1681,6 +1688,7 @@ void StarGiftViewBox(
|
||||||
.anonymous = data.anonymous,
|
.anonymous = data.anonymous,
|
||||||
.stargift = true,
|
.stargift = true,
|
||||||
.giftTransferred = data.transferred,
|
.giftTransferred = data.transferred,
|
||||||
|
.giftRefunded = data.refunded,
|
||||||
.savedToProfile = data.saved,
|
.savedToProfile = data.saved,
|
||||||
.canUpgradeGift = data.upgradable,
|
.canUpgradeGift = data.upgradable,
|
||||||
.hasGiftComment = !data.message.empty(),
|
.hasGiftComment = !data.message.empty(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue