File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -2041,6 +2041,7 @@ void SendGift(
2041
2041
.message = details.text ,
2042
2042
.recipient = peer,
2043
2043
.limitedCount = gift.info .limitedCount ,
2044
+ .perUserLimit = gift.info .perUserTotal ,
2044
2045
.anonymous = details.anonymous ,
2045
2046
.upgraded = details.upgraded ,
2046
2047
}, done, processNonPanelPaymentFormFactory);
@@ -2952,6 +2953,16 @@ void SendGiftBox(
2952
2953
[=] { state->resaleRequestingId = 0 ; });
2953
2954
} else if (star && IsSoldOut (star->info )) {
2954
2955
window->show (Box (SoldOutBox, window, *star));
2956
+ } else if (star
2957
+ && star->info .perUserTotal
2958
+ && !star->info .perUserRemains ) {
2959
+ window->showToast ({
2960
+ .text = tr::lng_gift_sent_finished (
2961
+ tr::now,
2962
+ lt_count,
2963
+ star->info .perUserTotal ,
2964
+ Ui::Text::RichLangValue),
2965
+ });
2955
2966
} else {
2956
2967
send ();
2957
2968
}
Original file line number Diff line number Diff line change @@ -533,6 +533,7 @@ void Form::requestForm() {
533
533
.invoice = invoice,
534
534
.inputInvoice = inputInvoice (),
535
535
.starGiftLimitedCount = gift ? gift->limitedCount : 0 ,
536
+ .starGiftPerUserLimit = gift ? gift->perUserLimit : 0 ,
536
537
.starGiftForm = true ,
537
538
};
538
539
_updates.fire (CreditsPaymentStarted{ .data = formData });
Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ struct InvoiceStarGift {
179
179
TextWithEntities message;
180
180
not_null<PeerData*> recipient;
181
181
int limitedCount = 0 ;
182
+ int perUserLimit = 0 ;
182
183
bool anonymous = false ;
183
184
bool upgraded = false ;
184
185
};
@@ -202,6 +203,7 @@ struct CreditsFormData {
202
203
InvoiceCredits invoice;
203
204
MTPInputInvoice inputInvoice;
204
205
int starGiftLimitedCount = 0 ;
206
+ int starGiftPerUserLimit = 0 ;
205
207
bool starGiftForm = false ;
206
208
};
207
209
Original file line number Diff line number Diff line change @@ -77,6 +77,14 @@ void ProcessCreditsPayment(
77
77
show->showToast (
78
78
tr::lng_gift_sold_out_title (tr::now));
79
79
}
80
+ } else if (*error == u" STARGIFT_USER_USAGE_LIMITED" _q) {
81
+ show->showToast ({
82
+ .text = tr::lng_gift_sent_finished (
83
+ tr::now,
84
+ lt_count,
85
+ std::max (form->starGiftPerUserLimit , 1 ),
86
+ Ui::Text::RichLangValue),
87
+ });
80
88
} else {
81
89
show->showToast (*error);
82
90
}
You can’t perform that action at this time.
0 commit comments