mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Update API scheme on layer 217.
This commit is contained in:
@@ -2431,6 +2431,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_peer_gifts_filter_saved" = "Displayed";
|
||||
"lng_peer_gifts_filter_unsaved" = "Hidden";
|
||||
|
||||
"lng_premium_gift_duration_days#one" = "for {count} day";
|
||||
"lng_premium_gift_duration_days#other" = "for {count} days";
|
||||
"lng_premium_gift_duration_months#one" = "for {count} month";
|
||||
"lng_premium_gift_duration_months#other" = "for {count} months";
|
||||
"lng_premium_gift_duration_years#one" = "for {count} year";
|
||||
@@ -2726,8 +2728,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_premium_summary_title_subscribed" = "You are all set!";
|
||||
"lng_premium_summary_subtitle_gift#one" = "{user} has gifted you a {count}-month subscription to Telegram Premium.";
|
||||
"lng_premium_summary_subtitle_gift#other" = "{user} has gifted you a {count}-months subscription to Telegram Premium.";
|
||||
"lng_premium_summary_subtitle_gift_days#one" = "{user} has gifted you a {count}-day subscription to Telegram Premium.";
|
||||
"lng_premium_summary_subtitle_gift_days#other" = "{user} has gifted you a {count}-days subscription to Telegram Premium.";
|
||||
"lng_premium_summary_subtitle_gift_me#one" = "You gifted {user} a {count}-month subscription to Telegram Premium.";
|
||||
"lng_premium_summary_subtitle_gift_me#other" = "You gifted {user} a {count}-months subscription to Telegram Premium.";
|
||||
"lng_premium_summary_subtitle_gift_days_me#one" = "You gifted {user} a {count}-month subscription to Telegram Premium.";
|
||||
"lng_premium_summary_subtitle_gift_days_me#other" = "You gifted {user} a {count}-months subscription to Telegram Premium.";
|
||||
"lng_premium_summary_subtitle_wallpapers" = "Wallpapers for Both Sides";
|
||||
"lng_premium_summary_about_wallpapers" = "Set custom wallpapers for you and your chat partner.";
|
||||
"lng_premium_summary_subtitle_stories" = "Stories";
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace {
|
||||
.giveawayId = data.vgiveaway_msg_id().value_or_empty(),
|
||||
.date = data.vdate().v,
|
||||
.used = data.vused_date().value_or_empty(),
|
||||
.months = data.vmonths().v,
|
||||
.days = data.vdays().v,
|
||||
.giveaway = data.is_via_giveaway(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ struct GiftCode {
|
||||
MsgId giveawayId = 0;
|
||||
TimeId date = 0;
|
||||
TimeId used = 0; // 0 if not used.
|
||||
int months = 0;
|
||||
int days = 0;
|
||||
bool giveaway = false;
|
||||
|
||||
explicit operator bool() const {
|
||||
return months != 0;
|
||||
return days != 0;
|
||||
}
|
||||
|
||||
friend inline bool operator==(
|
||||
|
||||
@@ -236,8 +236,10 @@ void ShowInfoTooltip(
|
||||
return result;
|
||||
}
|
||||
|
||||
[[nodiscard]] tr::phrase<lngtag_count> GiftDurationPhrase(int months) {
|
||||
return (months < 12)
|
||||
[[nodiscard]] tr::phrase<lngtag_count> GiftDurationPhrase(int days) {
|
||||
return (days < 30)
|
||||
? tr::lng_premium_gift_duration_days
|
||||
: (days < 30 * 12)
|
||||
? tr::lng_premium_gift_duration_months
|
||||
: tr::lng_premium_gift_duration_years;
|
||||
}
|
||||
@@ -778,7 +780,7 @@ void AddTable(
|
||||
tr::lng_gift_link_label_gift(),
|
||||
tr::lng_gift_link_gift_premium(
|
||||
lt_duration,
|
||||
GiftDurationValue(current.months) | Ui::Text::ToWithEntities(),
|
||||
GiftDurationValue(current.days) | Ui::Text::ToWithEntities(),
|
||||
Ui::Text::WithEntities));
|
||||
if (!skipReason && current.from) {
|
||||
const auto reason = AddTableRow(
|
||||
@@ -863,17 +865,22 @@ void ShowAlreadyPremiumToast(
|
||||
|
||||
} // namespace
|
||||
|
||||
rpl::producer<QString> GiftDurationValue(int months) {
|
||||
return GiftDurationPhrase(months)(
|
||||
rpl::producer<QString> GiftDurationValue(int days) {
|
||||
return GiftDurationPhrase(days)(
|
||||
lt_count,
|
||||
rpl::single(float64((months < 12) ? months : (months / 12))));
|
||||
rpl::single(float64((days < 30)
|
||||
? days
|
||||
: (days < 30 * 12)
|
||||
? (days / 30)
|
||||
: (days / (30 * 12)))));
|
||||
}
|
||||
|
||||
QString GiftDuration(int months) {
|
||||
return GiftDurationPhrase(months)(
|
||||
tr::now,
|
||||
lt_count,
|
||||
(months < 12) ? months : (months / 12));
|
||||
QString GiftDuration(int days) {
|
||||
return GiftDurationPhrase(days)(tr::now, lt_count, (days < 30)
|
||||
? days
|
||||
: (days < 30 * 12)
|
||||
? (days / 30)
|
||||
: (days / (30 * 12)));
|
||||
}
|
||||
|
||||
void GiftCodeBox(
|
||||
@@ -1121,9 +1128,9 @@ void ResolveGiftCode(
|
||||
code.to = toId;
|
||||
const auto self = (fromId == selfId);
|
||||
const auto peer = session->data().peer(self ? toId : fromId);
|
||||
const auto months = code.months;
|
||||
const auto days = code.days;
|
||||
const auto parent = controller->parentController();
|
||||
Settings::ShowGiftPremium(parent, peer, months, self);
|
||||
Settings::ShowGiftPremium(parent, peer, days, self);
|
||||
} else {
|
||||
controller->uiShow()->showBox(Box(GiftCodeBox, controller, slug));
|
||||
}
|
||||
@@ -1242,7 +1249,7 @@ void GiveawayInfoBox(
|
||||
lt_channel,
|
||||
Ui::Text::Bold(first),
|
||||
lt_duration,
|
||||
TextWithEntities{ GiftDuration(months) },
|
||||
TextWithEntities{ GiftDuration(months * 30) },
|
||||
Ui::Text::RichLangValue),
|
||||
Ui::Text::RichLangValue));
|
||||
const auto many = start
|
||||
|
||||
@@ -44,8 +44,8 @@ namespace Window {
|
||||
class SessionNavigation;
|
||||
} // namespace Window
|
||||
|
||||
[[nodiscard]] rpl::producer<QString> GiftDurationValue(int months);
|
||||
[[nodiscard]] QString GiftDuration(int months);
|
||||
[[nodiscard]] rpl::producer<QString> GiftDurationValue(int days);
|
||||
[[nodiscard]] QString GiftDuration(int days);
|
||||
|
||||
void GiftCodeBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
|
||||
@@ -159,7 +159,8 @@ void Messages::send(TextWithTags text, int stars) {
|
||||
_call->inputCall(),
|
||||
MTP_long(randomId),
|
||||
serialized,
|
||||
MTP_long(stars)
|
||||
MTP_long(stars),
|
||||
MTPInputPeer() // send_as
|
||||
)).done([=](
|
||||
const MTPUpdates &result,
|
||||
const MTP::Response &response) {
|
||||
@@ -577,7 +578,8 @@ void Messages::reactionsPaidSend() {
|
||||
_call->inputCall(),
|
||||
MTP_long(randomId),
|
||||
MTP_textWithEntities(MTP_string(), MTP_vector<MTPMessageEntity>()),
|
||||
MTP_long(send.count)
|
||||
MTP_long(send.count),
|
||||
MTPInputPeer() // send_as
|
||||
)).done([=](
|
||||
const MTPUpdates &result,
|
||||
const MTP::Response &response) {
|
||||
|
||||
@@ -1650,7 +1650,7 @@ ServiceAction ParseServiceAction(
|
||||
content.cost = Ui::FillAmountAndCurrency(
|
||||
data.vamount().v,
|
||||
qs(data.vcurrency())).toUtf8();
|
||||
content.months = data.vmonths().v;
|
||||
content.days = data.vdays().v;
|
||||
result.content = content;
|
||||
}, [&](const MTPDmessageActionTopicCreate &data) {
|
||||
auto content = ActionTopicCreate();
|
||||
@@ -1693,7 +1693,7 @@ ServiceAction ParseServiceAction(
|
||||
: PeerId();
|
||||
content.viaGiveaway = data.is_via_giveaway();
|
||||
content.unclaimed = data.is_unclaimed();
|
||||
content.months = data.vmonths().v;
|
||||
content.days = data.vdays().v;
|
||||
content.code = data.vslug().v;
|
||||
result.content = content;
|
||||
}, [&](const MTPDmessageActionGiveawayLaunch &data) {
|
||||
|
||||
@@ -612,7 +612,7 @@ struct ActionWebViewDataSent {
|
||||
|
||||
struct ActionGiftPremium {
|
||||
Utf8String cost;
|
||||
int months = 0;
|
||||
int days = 0;
|
||||
};
|
||||
|
||||
struct ActionTopicCreate {
|
||||
@@ -637,7 +637,7 @@ struct ActionSetChatWallPaper {
|
||||
struct ActionGiftCode {
|
||||
QByteArray code;
|
||||
PeerId boostPeerId = 0;
|
||||
int months = 0;
|
||||
int days = 0;
|
||||
bool viaGiveaway = false;
|
||||
bool unclaimed = false;
|
||||
};
|
||||
|
||||
@@ -1271,15 +1271,15 @@ auto HtmlWriter::Wrap::pushMessage(
|
||||
+ SerializeString(data.text)
|
||||
+ "» button to the bot";
|
||||
}, [&](const ActionGiftPremium &data) {
|
||||
if (!data.months || data.cost.isEmpty()) {
|
||||
if (!data.days || data.cost.isEmpty()) {
|
||||
return serviceFrom + " sent you a gift.";
|
||||
}
|
||||
return serviceFrom
|
||||
+ " sent you a gift for "
|
||||
+ data.cost
|
||||
+ ": Telegram Premium for "
|
||||
+ QString::number(data.months).toUtf8()
|
||||
+ " months.";
|
||||
+ QString::number(data.days).toUtf8()
|
||||
+ " days.";
|
||||
}, [&](const ActionTopicCreate &data) {
|
||||
return serviceFrom
|
||||
+ " created topic «"
|
||||
@@ -1312,17 +1312,17 @@ auto HtmlWriter::Wrap::pushMessage(
|
||||
}, [&](const ActionGiftCode &data) {
|
||||
return data.unclaimed
|
||||
? ("This is an unclaimed Telegram Premium for "
|
||||
+ NumberToString(data.months)
|
||||
+ (data.months > 1 ? " months" : "month")
|
||||
+ NumberToString(data.days)
|
||||
+ (data.days > 1 ? " days" : " day")
|
||||
+ " prize in a giveaway organized by a channel.")
|
||||
: data.viaGiveaway
|
||||
? ("You won a Telegram Premium for "
|
||||
+ NumberToString(data.months)
|
||||
+ (data.months > 1 ? " months" : "month")
|
||||
+ NumberToString(data.days)
|
||||
+ (data.days > 1 ? " days" : " day")
|
||||
+ " prize in a giveaway organized by a channel.")
|
||||
: ("You've received a Telegram Premium for "
|
||||
+ NumberToString(data.months)
|
||||
+ (data.months > 1 ? " months" : "month")
|
||||
+ NumberToString(data.days)
|
||||
+ (data.days > 1 ? " days" : " day")
|
||||
+ " gift from a channel.");
|
||||
}, [&](const ActionGiveawayLaunch &data) {
|
||||
return serviceFrom + " just started a giveaway "
|
||||
|
||||
@@ -581,8 +581,8 @@ QByteArray SerializeMessage(
|
||||
if (!data.cost.isEmpty()) {
|
||||
push("cost", data.cost);
|
||||
}
|
||||
if (data.months) {
|
||||
push("months", data.months);
|
||||
if (data.days) {
|
||||
push("days", data.days);
|
||||
}
|
||||
}, [&](const ActionTopicCreate &data) {
|
||||
pushActor();
|
||||
@@ -617,7 +617,7 @@ QByteArray SerializeMessage(
|
||||
if (data.boostPeerId) {
|
||||
push("boost_peer_id", data.boostPeerId);
|
||||
}
|
||||
push("months", data.months);
|
||||
push("days", data.days);
|
||||
push("unclaimed", data.unclaimed);
|
||||
push("via_giveaway", data.viaGiveaway);
|
||||
}, [&](const ActionGiveawayLaunch &data) {
|
||||
|
||||
@@ -6523,7 +6523,7 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
|
||||
.message = (data.vmessage()
|
||||
? Api::ParseTextWithEntities(session, *data.vmessage())
|
||||
: TextWithEntities()),
|
||||
.count = data.vmonths().v,
|
||||
.count = data.vdays().v,
|
||||
.type = Data::GiftType::Premium,
|
||||
});
|
||||
}, [&](const MTPDmessageActionSuggestProfilePhoto &data) {
|
||||
@@ -6578,7 +6578,7 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
|
||||
.channel = (boostedId
|
||||
? history()->owner().channel(boostedId).get()
|
||||
: nullptr),
|
||||
.count = data.vmonths().v,
|
||||
.count = data.vdays().v,
|
||||
.type = Data::GiftType::Premium,
|
||||
.viaGiveaway = data.is_via_giveaway(),
|
||||
.unclaimed = data.is_unclaimed(),
|
||||
|
||||
@@ -128,7 +128,7 @@ auto GenerateGiveawayStart(
|
||||
lt_count,
|
||||
quantity,
|
||||
lt_duration,
|
||||
Ui::Text::Bold(GiftDuration(months)),
|
||||
Ui::Text::Bold(GiftDuration(months * 30)),
|
||||
Ui::Text::RichLangValue),
|
||||
st::chatGiveawayPrizesMargin);
|
||||
pushText(
|
||||
|
||||
@@ -318,8 +318,8 @@ ClickHandlerPtr PremiumGift::createViewLink() {
|
||||
data.count,
|
||||
date));
|
||||
} else if (data.slug.isEmpty()) {
|
||||
const auto months = data.count;
|
||||
Settings::ShowGiftPremium(controller, peer, months, sent);
|
||||
const auto days = data.count;
|
||||
Settings::ShowGiftPremium(controller, peer, days, sent);
|
||||
} else {
|
||||
const auto fromId = from->id;
|
||||
const auto toId = sent ? peer->id : selfId;
|
||||
|
||||
@@ -411,7 +411,7 @@ void InnerWidget::fill() {
|
||||
.from = _peer->id,
|
||||
.to = user->id,
|
||||
.date = TimeId(boost.date.toSecsSinceEpoch()),
|
||||
.months = boost.expiresAfterMonths,
|
||||
.days = boost.expiresAfterMonths * 30,
|
||||
};
|
||||
_show->showBox(Box(GiftCodePendingBox, _controller, d));
|
||||
} else {
|
||||
|
||||
@@ -172,13 +172,13 @@ messageActionSetChatTheme#b91bbd3a theme:ChatTheme = MessageAction;
|
||||
messageActionChatJoinedByRequest#ebbca3cb = MessageAction;
|
||||
messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction;
|
||||
messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction;
|
||||
messageActionGiftPremium#6c6274fa flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction;
|
||||
messageActionGiftPremium#48e91302 flags:# currency:string amount:long days:int crypto_currency:flags.0?string crypto_amount:flags.0?long message:flags.1?TextWithEntities = MessageAction;
|
||||
messageActionTopicCreate#d999256 flags:# title_missing:flags.1?true title:string icon_color:int icon_emoji_id:flags.0?long = MessageAction;
|
||||
messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction;
|
||||
messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction;
|
||||
messageActionRequestedPeer#31518e9b button_id:int peers:Vector<Peer> = MessageAction;
|
||||
messageActionSetChatWallPaper#5060a3f4 flags:# same:flags.0?true for_both:flags.1?true wallpaper:WallPaper = MessageAction;
|
||||
messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.5?true boost_peer:flags.1?Peer months:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction;
|
||||
messageActionGiftCode#31c48347 flags:# via_giveaway:flags.0?true unclaimed:flags.5?true boost_peer:flags.1?Peer days:int slug:string currency:flags.2?string amount:flags.2?long crypto_currency:flags.3?string crypto_amount:flags.3?long message:flags.4?TextWithEntities = MessageAction;
|
||||
messageActionGiveawayLaunch#a80f51e4 flags:# stars:flags.0?long = MessageAction;
|
||||
messageActionGiveawayResults#87e2f155 flags:# stars:flags.0?true winners_count:int unclaimed_count:int = MessageAction;
|
||||
messageActionBoostApply#cc02aa6d boosts:int = MessageAction;
|
||||
@@ -1363,7 +1363,7 @@ peerBlocked#e8fd8014 peer_id:Peer date:int = PeerBlocked;
|
||||
stats.messageStats#7fe91c14 views_graph:StatsGraph reactions_by_emotion_graph:StatsGraph = stats.MessageStats;
|
||||
|
||||
groupCallDiscarded#7780bcb4 id:long access_hash:long duration:int = GroupCall;
|
||||
groupCall#d7ca61d8 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true rtmp_stream:flags.12?true listeners_hidden:flags.13?true conference:flags.14?true creator:flags.15?true messages_enabled:flags.17?true can_change_messages_enabled:flags.18?true min:flags.19?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int invite_link:flags.16?string send_paid_messages_stars:flags.20?long = GroupCall;
|
||||
groupCall#efb2b617 flags:# join_muted:flags.1?true can_change_join_muted:flags.2?true join_date_asc:flags.6?true schedule_start_subscribed:flags.8?true can_start_video:flags.9?true record_video_active:flags.11?true rtmp_stream:flags.12?true listeners_hidden:flags.13?true conference:flags.14?true creator:flags.15?true messages_enabled:flags.17?true can_change_messages_enabled:flags.18?true min:flags.19?true id:long access_hash:long participants_count:int title:flags.3?string stream_dc_id:flags.4?int record_start_date:flags.5?int schedule_date:flags.7?int unmuted_video_count:flags.10?int unmuted_video_limit:int version:int invite_link:flags.16?string send_paid_messages_stars:flags.20?long default_send_as:flags.21?Peer = GroupCall;
|
||||
|
||||
inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;
|
||||
inputGroupCallSlug#fe06823f slug:string = InputGroupCall;
|
||||
@@ -1695,7 +1695,7 @@ messages.webPage#fd5e12bd webpage:WebPage chats:Vector<Chat> users:Vector<User>
|
||||
|
||||
premiumGiftCodeOption#257e962b flags:# users:int months:int store_product:flags.0?string store_quantity:flags.1?int currency:string amount:long = PremiumGiftCodeOption;
|
||||
|
||||
payments.checkedGiftCode#284a1096 flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int months:int used_date:flags.1?int chats:Vector<Chat> users:Vector<User> = payments.CheckedGiftCode;
|
||||
payments.checkedGiftCode#eb983f8f flags:# via_giveaway:flags.2?true from_id:flags.4?Peer giveaway_msg_id:flags.3?int to_id:flags.0?long date:int days:int used_date:flags.1?int chats:Vector<Chat> users:Vector<User> = payments.CheckedGiftCode;
|
||||
|
||||
payments.giveawayInfo#4367daa0 flags:# participating:flags.0?true preparing_results:flags.3?true start_date:int joined_too_early_date:flags.1?int admin_disallowed_chat_id:flags.2?long disallowed_country:flags.4?string = payments.GiveawayInfo;
|
||||
payments.giveawayInfoResults#e175e66f flags:# winner:flags.0?true refunded:flags.1?true start_date:int gift_code_slug:flags.3?string stars_prize:flags.4?long finish_date:int winners_count:int activated_count:flags.2?int = payments.GiveawayInfo;
|
||||
@@ -2571,7 +2571,7 @@ channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint addr
|
||||
channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates;
|
||||
channels.getInactiveChannels#11e831ee = messages.InactiveChats;
|
||||
channels.convertToGigagroup#b290c69 channel:InputChannel = Updates;
|
||||
channels.getSendAs#e785a43f flags:# for_paid_reactions:flags.0?true peer:InputPeer = channels.SendAsPeers;
|
||||
channels.getSendAs#e785a43f flags:# for_paid_reactions:flags.0?true for_live_stories:flags.1?true peer:InputPeer = channels.SendAsPeers;
|
||||
channels.deleteParticipantHistory#367544db channel:InputChannel participant:InputPeer = messages.AffectedHistory;
|
||||
channels.toggleJoinToSend#e4cb9580 channel:InputChannel enabled:Bool = Updates;
|
||||
channels.toggleJoinRequest#4c2985b6 channel:InputChannel enabled:Bool = Updates;
|
||||
@@ -2734,11 +2734,12 @@ phone.sendConferenceCallBroadcast#c6701900 call:InputGroupCall block:bytes = Upd
|
||||
phone.inviteConferenceCallParticipant#bcf22685 flags:# video:flags.0?true call:InputGroupCall user_id:InputUser = Updates;
|
||||
phone.declineConferenceCallInvite#3c479971 msg_id:int = Updates;
|
||||
phone.getGroupCallChainBlocks#ee9f88a6 call:InputGroupCall sub_chain_id:int offset:int limit:int = Updates;
|
||||
phone.sendGroupCallMessage#1a8d41cf flags:# call:InputGroupCall random_id:long message:TextWithEntities allow_paid_stars:flags.0?long = Updates;
|
||||
phone.sendGroupCallMessage#b1d11410 flags:# call:InputGroupCall random_id:long message:TextWithEntities allow_paid_stars:flags.0?long send_as:flags.1?InputPeer = Updates;
|
||||
phone.sendGroupCallEncryptedMessage#e5afa56d call:InputGroupCall encrypted_message:bytes = Bool;
|
||||
phone.deleteGroupCallMessages#f64f54f7 flags:# report_spam:flags.0?true call:InputGroupCall messages:Vector<int> = Updates;
|
||||
phone.deleteGroupCallParticipantMessages#1dbfeca0 flags:# report_spam:flags.0?true call:InputGroupCall participant:InputPeer = Updates;
|
||||
phone.getGroupCallStars#6f636302 call:InputGroupCall = phone.GroupCallStars;
|
||||
phone.saveDefaultSendAs#4167add1 call:InputGroupCall send_as:InputPeer = Bool;
|
||||
|
||||
langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference;
|
||||
langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector<string> = Vector<LangPackString>;
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Gift {
|
||||
|
||||
struct Data {
|
||||
PeerId peerId;
|
||||
int months = 0;
|
||||
int days = 0;
|
||||
bool me = false;
|
||||
|
||||
explicit operator bool() const {
|
||||
@@ -121,7 +121,7 @@ struct Data {
|
||||
[[nodiscard]] QString Serialize(const Data &gift) {
|
||||
return QString::number(gift.peerId.value)
|
||||
+ ':'
|
||||
+ QString::number(gift.months)
|
||||
+ QString::number(gift.days)
|
||||
+ ':'
|
||||
+ QString::number(gift.me ? 1 : 0);
|
||||
}
|
||||
@@ -133,7 +133,7 @@ struct Data {
|
||||
}
|
||||
return {
|
||||
.peerId = PeerId(components[0].toULongLong()),
|
||||
.months = components[1].toInt(),
|
||||
.days = components[1].toInt(),
|
||||
.me = (components[2].toInt() == 1),
|
||||
};
|
||||
}
|
||||
@@ -1096,9 +1096,9 @@ void Premium::setupSubscriptionOptions(
|
||||
|
||||
void Premium::setupSwipeBack() {
|
||||
using namespace Ui::Controls;
|
||||
|
||||
|
||||
auto swipeBackData = lifetime().make_state<SwipeBackResult>();
|
||||
|
||||
|
||||
auto update = [=](SwipeContextData data) {
|
||||
if (data.translation > 0) {
|
||||
if (!swipeBackData->callback) {
|
||||
@@ -1117,7 +1117,7 @@ void Premium::setupSwipeBack() {
|
||||
(*swipeBackData) = {};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
auto init = [=](int, Qt::LayoutDirection direction) {
|
||||
return (direction == Qt::RightToLeft)
|
||||
? DefaultSwipeBackHandlerFinishData([=] {
|
||||
@@ -1125,7 +1125,7 @@ void Premium::setupSwipeBack() {
|
||||
})
|
||||
: SwipeHandlerFinishData();
|
||||
};
|
||||
|
||||
|
||||
SetupSwipeHandler({
|
||||
.widget = this,
|
||||
.scroll = v::null,
|
||||
@@ -1186,11 +1186,16 @@ base::weak_qptr<Ui::RpWidget> Premium::createPinnedToTop(
|
||||
if (gift) {
|
||||
auto &data = _controller->session().data();
|
||||
if (const auto peer = data.peer(gift.peerId)) {
|
||||
const auto months = gift.days / 30;
|
||||
return (gift.me
|
||||
? tr::lng_premium_summary_subtitle_gift_me
|
||||
: tr::lng_premium_summary_subtitle_gift)(
|
||||
? (months
|
||||
? tr::lng_premium_summary_subtitle_gift_me
|
||||
: tr::lng_premium_summary_subtitle_gift_days_me)
|
||||
: (months
|
||||
? tr::lng_premium_summary_subtitle_gift
|
||||
: tr::lng_premium_summary_subtitle_gift_days))(
|
||||
lt_count,
|
||||
rpl::single(float64(gift.months)),
|
||||
rpl::single(float64(months ? months : gift.days)),
|
||||
lt_user,
|
||||
rpl::single(Ui::Text::Bold(peer->name())),
|
||||
Ui::Text::RichLangValue);
|
||||
@@ -1510,9 +1515,9 @@ void ShowPremium(
|
||||
void ShowGiftPremium(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> peer,
|
||||
int months,
|
||||
int days,
|
||||
bool me) {
|
||||
ShowPremium(controller, Ref::Gift::Serialize({ peer->id, months, me }));
|
||||
ShowPremium(controller, Ref::Gift::Serialize({ peer->id, days, me }));
|
||||
}
|
||||
|
||||
void ShowEmojiStatusPremium(
|
||||
|
||||
@@ -51,7 +51,7 @@ void ShowPremium(
|
||||
void ShowGiftPremium(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> peer,
|
||||
int months,
|
||||
int days,
|
||||
bool me);
|
||||
void ShowEmojiStatusPremium(
|
||||
not_null<Window::SessionController*> controller,
|
||||
|
||||
Reference in New Issue
Block a user