mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Support phrases for unclaimed giveaway prizes.
This commit is contained in:
parent
c480ab1a3b
commit
fe0e526b79
9 changed files with 48 additions and 13 deletions
|
@ -2111,6 +2111,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_prize_gift_about" = "You've received a gift from {channel}.";
|
||||
"lng_prize_gift_duration" = "Your gift is a **Telegram Premium** subscription {duration}.";
|
||||
"lng_prize_open" = "Open Gift Link";
|
||||
"lng_prize_unclaimed_title" = "Unclaimed Prize";
|
||||
"lng_prize_unclaimed_about" = "You have an unclaimed prize from a giveaway by {channel}.";
|
||||
"lng_prize_unclaimed_duration" = "This prize is a **Telegram Premium** subscription {duration}.";
|
||||
|
||||
"lng_prizes_title#one" = "Giveaway Prize";
|
||||
"lng_prizes_title#other" = "Giveaway Prizes";
|
||||
|
@ -2161,10 +2164,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_gift_link_about" = "This link allows you to activate\na **Telegram Premium** subscription.";
|
||||
"lng_gift_link_label_from" = "From";
|
||||
"lng_gift_link_label_to" = "To";
|
||||
"lng_gift_link_label_to_unclaimed" = "No recipient";
|
||||
"lng_gift_link_label_gift" = "Gift";
|
||||
"lng_gift_link_gift_premium" = "Telegram Premium {duration}";
|
||||
"lng_gift_link_label_reason" = "Reason";
|
||||
"lng_gift_link_reason_giveaway" = "Giveaway";
|
||||
"lng_gift_link_reason_unclaimed" = "Incomplete Giveaway";
|
||||
"lng_gift_link_reason_chosen" = "You were selected by the channel";
|
||||
"lng_gift_link_label_date" = "Date";
|
||||
"lng_gift_link_also_send" = "You can also {link} to a friend as a gift.";
|
||||
|
|
|
@ -477,11 +477,18 @@ void GiftCodeBox(
|
|||
tr::lng_gift_link_label_from(),
|
||||
controller,
|
||||
current.from);
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_gift_link_label_to(),
|
||||
controller,
|
||||
current.to);
|
||||
if (current.to) {
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_gift_link_label_to(),
|
||||
controller,
|
||||
current.to);
|
||||
} else {
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_gift_link_label_to(),
|
||||
tr::lng_gift_link_label_to_unclaimed(Ui::Text::WithEntities));
|
||||
}
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_gift_link_label_gift(),
|
||||
|
@ -493,11 +500,16 @@ void GiftCodeBox(
|
|||
table,
|
||||
tr::lng_gift_link_label_reason(),
|
||||
(current.giveawayId
|
||||
? (tr::lng_gift_link_reason_giveaway() | Ui::Text::ToLink())
|
||||
? ((current.to
|
||||
? tr::lng_gift_link_reason_giveaway
|
||||
: tr::lng_gift_link_reason_unclaimed)(
|
||||
) | Ui::Text::ToLink())
|
||||
: current.giveaway
|
||||
? (tr::lng_gift_link_reason_giveaway(
|
||||
Ui::Text::WithEntities
|
||||
) | rpl::type_erased())
|
||||
? ((current.to
|
||||
? tr::lng_gift_link_reason_giveaway
|
||||
: tr::lng_gift_link_reason_unclaimed)(
|
||||
Ui::Text::WithEntities
|
||||
) | rpl::type_erased())
|
||||
: tr::lng_gift_link_reason_chosen(Ui::Text::WithEntities)));
|
||||
reason->setClickHandlerFilter([=](const auto &...) {
|
||||
controller->showPeerHistory(
|
||||
|
|
|
@ -104,6 +104,7 @@ struct GiftCode {
|
|||
ChannelData *channel = nullptr;
|
||||
int months = 0;
|
||||
bool viaGiveaway = false;
|
||||
bool unclaimed = false;
|
||||
};
|
||||
|
||||
class Media {
|
||||
|
|
|
@ -1330,6 +1330,7 @@ ServiceAction ParseServiceAction(
|
|||
? peerFromMTP(*data.vboost_peer())
|
||||
: PeerId();
|
||||
content.viaGiveaway = data.is_via_giveaway();
|
||||
content.unclaimed = data.is_unclaimed();
|
||||
content.months = data.vmonths().v;
|
||||
content.code = data.vslug().v;
|
||||
result.content = content;
|
||||
|
|
|
@ -544,6 +544,7 @@ struct ActionGiftCode {
|
|||
PeerId boostPeerId = 0;
|
||||
int months = 0;
|
||||
bool viaGiveaway = false;
|
||||
bool unclaimed = false;
|
||||
};
|
||||
|
||||
struct ActionRequestedPeer {
|
||||
|
|
|
@ -1280,7 +1280,12 @@ auto HtmlWriter::Wrap::pushMessage(
|
|||
+ wrapReplyToLink("the same background")
|
||||
+ " for this chat";
|
||||
}, [&](const ActionGiftCode &data) {
|
||||
return data.viaGiveaway
|
||||
return data.unclaimed
|
||||
? ("This is an unclaimed Telegram Premium for "
|
||||
+ NumberToString(data.months)
|
||||
+ (data.months > 1 ? " months" : "month")
|
||||
+ " prize in a giveaway organized by a channel.")
|
||||
: data.viaGiveaway
|
||||
? ("You won a Telegram Premium for "
|
||||
+ NumberToString(data.months)
|
||||
+ (data.months > 1 ? " months" : "month")
|
||||
|
|
|
@ -600,6 +600,7 @@ QByteArray SerializeMessage(
|
|||
push("boost_peer_id", data.boostPeerId);
|
||||
}
|
||||
push("months", data.months);
|
||||
push("unclaimed", data.unclaimed);
|
||||
push("via_giveaway", data.viaGiveaway);
|
||||
}, [&](const ActionGiveawayLaunch &data) {
|
||||
pushAction("giveaway_launch");
|
||||
|
|
|
@ -4477,7 +4477,9 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
|
|||
const auto months = action.vmonths().v;
|
||||
|
||||
result.text = {
|
||||
(action.is_via_giveaway()
|
||||
(action.is_unclaimed()
|
||||
? tr::lng_prize_unclaimed_about
|
||||
: action.is_via_giveaway()
|
||||
? tr::lng_prize_about
|
||||
: tr::lng_prize_gift_about)(
|
||||
tr::now,
|
||||
|
@ -4668,6 +4670,7 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
|
|||
: nullptr),
|
||||
.months = data.vmonths().v,
|
||||
.viaGiveaway = data.is_via_giveaway(),
|
||||
.unclaimed = data.is_unclaimed(),
|
||||
});
|
||||
}, [](const auto &) {
|
||||
});
|
||||
|
|
|
@ -45,6 +45,8 @@ QSize PremiumGift::size() {
|
|||
QString PremiumGift::title() {
|
||||
return _data.slug.isEmpty()
|
||||
? tr::lng_premium_summary_title(tr::now)
|
||||
: _data.unclaimed
|
||||
? tr::lng_prize_unclaimed_title(tr::now)
|
||||
: tr::lng_prize_title(tr::now);
|
||||
}
|
||||
|
||||
|
@ -53,7 +55,9 @@ TextWithEntities PremiumGift::subtitle() {
|
|||
return { GiftDuration(_data.months) };
|
||||
}
|
||||
const auto name = _data.channel ? _data.channel->name() : "channel";
|
||||
auto result = (_data.viaGiveaway
|
||||
auto result = (_data.unclaimed
|
||||
? tr::lng_prize_unclaimed_about
|
||||
: _data.viaGiveaway
|
||||
? tr::lng_prize_about
|
||||
: tr::lng_prize_gift_about)(
|
||||
tr::now,
|
||||
|
@ -61,7 +65,9 @@ TextWithEntities PremiumGift::subtitle() {
|
|||
Ui::Text::Bold(name),
|
||||
Ui::Text::RichLangValue);
|
||||
result.append("\n\n");
|
||||
result.append((_data.viaGiveaway
|
||||
result.append((_data.unclaimed
|
||||
? tr::lng_prize_unclaimed_duration
|
||||
: _data.viaGiveaway
|
||||
? tr::lng_prize_duration
|
||||
: tr::lng_prize_gift_duration)(
|
||||
tr::now,
|
||||
|
|
Loading…
Add table
Reference in a new issue