mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Add ' (Test)' to checkout panel titles.
This commit is contained in:
parent
bdffdea358
commit
b1c122a260
3 changed files with 16 additions and 3 deletions
|
@ -126,6 +126,7 @@ void Form::fillInvoiceFromMessage() {
|
|||
return item->media();
|
||||
}();
|
||||
if (const auto invoice = media ? media->invoice() : nullptr) {
|
||||
_invoice.isTest = invoice->isTest;
|
||||
_invoice.cover = Ui::Cover{
|
||||
.title = invoice->title,
|
||||
.description = invoice->description,
|
||||
|
|
|
@ -56,7 +56,8 @@ void Panel::showForm(
|
|||
const RequestedInformation ¤t,
|
||||
const PaymentMethodDetails &method,
|
||||
const ShippingOptions &options) {
|
||||
_widget->setTitle(invoice.receipt
|
||||
_testMode = invoice.isTest;
|
||||
setTitle(invoice.receipt
|
||||
? tr::lng_payments_receipt_title()
|
||||
: tr::lng_payments_checkout_title());
|
||||
auto form = base::make_unique_q<FormSummary>(
|
||||
|
@ -81,7 +82,7 @@ void Panel::showEditInformation(
|
|||
const Invoice &invoice,
|
||||
const RequestedInformation ¤t,
|
||||
InformationField field) {
|
||||
_widget->setTitle(tr::lng_payments_shipping_address_title());
|
||||
setTitle(tr::lng_payments_shipping_address_title());
|
||||
auto edit = base::make_unique_q<EditInformation>(
|
||||
_widget.get(),
|
||||
invoice,
|
||||
|
@ -240,7 +241,7 @@ void Panel::showEditPaymentMethod(const PaymentMethodDetails &method) {
|
|||
: tr::lng_payments_processed_by(
|
||||
lt_provider,
|
||||
rpl::single(method.provider));
|
||||
_widget->setTitle(tr::lng_payments_card_title());
|
||||
setTitle(tr::lng_payments_card_title());
|
||||
if (method.native.supported) {
|
||||
showEditCard(method.native, CardField::Number);
|
||||
} else if (!showWebview(method.url, true, std::move(bottomText))) {
|
||||
|
@ -419,6 +420,15 @@ void Panel::showCardError(
|
|||
}
|
||||
}
|
||||
|
||||
void Panel::setTitle(rpl::producer<QString> title) {
|
||||
using namespace rpl::mappers;
|
||||
if (_testMode) {
|
||||
_widget->setTitle(std::move(title) | rpl::map(_1 + " (Test)"));
|
||||
} else {
|
||||
_widget->setTitle(std::move(title));
|
||||
}
|
||||
}
|
||||
|
||||
rpl::producer<> Panel::backRequests() const {
|
||||
return _widget->backRequests();
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
|
||||
private:
|
||||
bool createWebview();
|
||||
void setTitle(rpl::producer<QString> title);
|
||||
|
||||
const not_null<PanelDelegate*> _delegate;
|
||||
std::unique_ptr<SeparatePanel> _widget;
|
||||
|
@ -92,6 +93,7 @@ private:
|
|||
QPointer<FormSummary> _weakFormSummary;
|
||||
QPointer<EditInformation> _weakEditInformation;
|
||||
QPointer<EditCard> _weakEditCard;
|
||||
bool _testMode = false;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue