mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Update API scheme to layer 190.
Support adding messages to gifts of Premium subscriptions.
This commit is contained in:
parent
b3dddc1dfe
commit
db475ef0b4
4 changed files with 34 additions and 21 deletions
|
@ -1083,19 +1083,7 @@ void SendGiftBox(
|
|||
};
|
||||
button->setClickedCallback([=] {
|
||||
const auto star = std::get_if<GiftTypeStars>(&descriptor);
|
||||
if (v::is<GiftTypePremium>(descriptor)) {
|
||||
if (state->sending) {
|
||||
return;
|
||||
} else {
|
||||
state->sending = true;
|
||||
}
|
||||
SendGift(
|
||||
window,
|
||||
peer,
|
||||
api,
|
||||
GiftDetails{ descriptor },
|
||||
premiumSent);
|
||||
} else if (star && star->limitedCount && !star->limitedLeft) {
|
||||
if (star && star->limitedCount && !star->limitedLeft) {
|
||||
window->showToast({
|
||||
.title = tr::lng_gift_sold_out_title(tr::now),
|
||||
.text = tr::lng_gift_sold_out_text(
|
||||
|
|
|
@ -5421,8 +5421,18 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
|
|||
_media = std::make_unique<Data::MediaGiftBox>(
|
||||
this,
|
||||
_from,
|
||||
Data::GiftType::Premium,
|
||||
data.vmonths().v);
|
||||
Data::GiftCode{
|
||||
.message = (data.vmessage()
|
||||
? TextWithEntities{
|
||||
.text = qs(data.vmessage()->data().vtext()),
|
||||
.entities = Api::EntitiesFromMTP(
|
||||
&history()->session(),
|
||||
data.vmessage()->data().ventities().v),
|
||||
}
|
||||
: TextWithEntities()),
|
||||
.count = data.vmonths().v,
|
||||
.type = Data::GiftType::Premium,
|
||||
});
|
||||
}, [&](const MTPDmessageActionSuggestProfilePhoto &data) {
|
||||
data.vphoto().match([&](const MTPDphoto &photo) {
|
||||
_flags |= MessageFlag::IsUserpicSuggestion;
|
||||
|
@ -5453,6 +5463,14 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
|
|||
_from,
|
||||
Data::GiftCode{
|
||||
.slug = qs(data.vslug()),
|
||||
.message = (data.vmessage()
|
||||
? TextWithEntities{
|
||||
.text = qs(data.vmessage()->data().vtext()),
|
||||
.entities = Api::EntitiesFromMTP(
|
||||
&history()->session(),
|
||||
data.vmessage()->data().ventities().v),
|
||||
}
|
||||
: TextWithEntities()),
|
||||
.channel = (boostedId
|
||||
? history()->owner().channel(boostedId).get()
|
||||
: nullptr),
|
||||
|
|
|
@ -169,13 +169,13 @@ messageActionSetChatTheme#aa786345 emoticon:string = MessageAction;
|
|||
messageActionChatJoinedByRequest#ebbca3cb = MessageAction;
|
||||
messageActionWebViewDataSentMe#47dd8079 text:string data:string = MessageAction;
|
||||
messageActionWebViewDataSent#b4c38cb5 text:string = MessageAction;
|
||||
messageActionGiftPremium#c83d6aec flags:# currency:string amount:long months:int crypto_currency:flags.0?string crypto_amount:flags.0?long = 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;
|
||||
messageActionTopicCreate#d999256 flags:# 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#678c2e09 flags:# via_giveaway:flags.0?true unclaimed:flags.2?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 = MessageAction;
|
||||
messageActionGiftCode#56d03994 flags:# via_giveaway:flags.0?true unclaimed:flags.2?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;
|
||||
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;
|
||||
|
@ -1476,7 +1476,7 @@ help.premiumPromo#5334759c status_text:string status_entities:Vector<MessageEnti
|
|||
|
||||
inputStorePaymentPremiumSubscription#a6751e66 flags:# restore:flags.0?true upgrade:flags.1?true = InputStorePaymentPurpose;
|
||||
inputStorePaymentGiftPremium#616f7fe8 user_id:InputUser currency:string amount:long = InputStorePaymentPurpose;
|
||||
inputStorePaymentPremiumGiftCode#a3805f3f flags:# users:Vector<InputUser> boost_peer:flags.0?InputPeer currency:string amount:long = InputStorePaymentPurpose;
|
||||
inputStorePaymentPremiumGiftCode#fb790393 flags:# users:Vector<InputUser> boost_peer:flags.0?InputPeer currency:string amount:long message:flags.1?TextWithEntities = InputStorePaymentPurpose;
|
||||
inputStorePaymentPremiumGiveaway#160544ca flags:# only_new_subscribers:flags.0?true winners_are_visible:flags.3?true boost_peer:InputPeer additional_peers:flags.1?Vector<InputPeer> countries_iso2:flags.2?Vector<string> prize_description:flags.4?string random_id:long until_date:int currency:string amount:long = InputStorePaymentPurpose;
|
||||
inputStorePaymentStarsTopup#dddd0f56 stars:long currency:string amount:long = InputStorePaymentPurpose;
|
||||
inputStorePaymentStarsGift#1d741ef7 user_id:InputUser stars:long currency:string amount:long = InputStorePaymentPurpose;
|
||||
|
@ -2565,4 +2565,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool;
|
|||
|
||||
fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;
|
||||
|
||||
// LAYER 189
|
||||
// LAYER 190
|
||||
|
|
|
@ -415,7 +415,8 @@ MTPInputInvoice Form::inputInvoice() const {
|
|||
using Flag = MTPDinputStorePaymentPremiumGiftCode::Flag;
|
||||
return MTP_inputInvoicePremiumGiftCode(
|
||||
MTP_inputStorePaymentPremiumGiftCode(
|
||||
MTP_flags(users->boostPeer ? Flag::f_boost_peer : Flag()),
|
||||
MTP_flags((users->boostPeer ? Flag::f_boost_peer : Flag())
|
||||
| (users->message.empty() ? Flag(0) : Flag::f_message)),
|
||||
MTP_vector_from_range(ranges::views::all(
|
||||
users->users
|
||||
) | ranges::views::transform([](not_null<UserData*> user) {
|
||||
|
@ -423,7 +424,13 @@ MTPInputInvoice Form::inputInvoice() const {
|
|||
})),
|
||||
users->boostPeer ? users->boostPeer->input : MTPInputPeer(),
|
||||
MTP_string(giftCode.currency),
|
||||
MTP_long(giftCode.amount)),
|
||||
MTP_long(giftCode.amount),
|
||||
MTP_textWithEntities(
|
||||
MTP_string(users->message.text),
|
||||
Api::EntitiesToMTP(
|
||||
&users->users.front()->session(),
|
||||
users->message.entities,
|
||||
Api::ConvertOption::SkipLocal))),
|
||||
option);
|
||||
} else {
|
||||
return MTP_inputInvoicePremiumGiftCode(
|
||||
|
|
Loading…
Add table
Reference in a new issue