Allow clearing saved payments information.
This commit is contained in:
parent
65dd9b82c0
commit
79f7aa703a
|
@ -454,6 +454,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_settings_sensitive_title" = "Sensitive content";
|
"lng_settings_sensitive_title" = "Sensitive content";
|
||||||
"lng_settings_sensitive_disable_filtering" = "Disable filtering";
|
"lng_settings_sensitive_disable_filtering" = "Disable filtering";
|
||||||
"lng_settings_sensitive_about" = "Display sensitive media in public channels on all your Telegram devices.";
|
"lng_settings_sensitive_about" = "Display sensitive media in public channels on all your Telegram devices.";
|
||||||
|
"lng_settings_security_bots" = "Bots and websites";
|
||||||
|
"lng_settings_clear_payment_info" = "Clear Payment and Shipping Info";
|
||||||
|
|
||||||
|
"lng_clear_payment_info_title" = "Clear payment info";
|
||||||
|
"lng_clear_payment_info_sure" = "Are you sure you want to clear your payment and shipping info?";
|
||||||
|
"lng_clear_payment_info_shipping" = "Shipping info";
|
||||||
|
"lng_clear_payment_info_payment" = "Payment info";
|
||||||
|
"lng_clear_payment_info_clear" = "Clear";
|
||||||
|
"lng_clear_payment_info_confirm" = "Delete your shipping info and instruct all payment providers to remove your saved credit cards? Note that Telegram never stores your credit card data.";
|
||||||
|
|
||||||
"lng_settings_auto_night_mode" = "Auto-Night mode";
|
"lng_settings_auto_night_mode" = "Auto-Night mode";
|
||||||
"lng_settings_auto_night_enabled" = "Match the system settings";
|
"lng_settings_auto_night_enabled" = "Match the system settings";
|
||||||
|
|
|
@ -29,6 +29,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/widgets/shadow.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "ui/widgets/checkbox.h"
|
||||||
|
#include "ui/layers/generic_box.h"
|
||||||
#include "calls/calls_instance.h"
|
#include "calls/calls_instance.h"
|
||||||
#include "core/core_cloud_password.h"
|
#include "core/core_cloud_password.h"
|
||||||
#include "core/update_checker.h"
|
#include "core/update_checker.h"
|
||||||
|
@ -42,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "facades.h"
|
#include "facades.h"
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
|
#include "styles/style_layers.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
|
||||||
#include <QtGui/QGuiApplication>
|
#include <QtGui/QGuiApplication>
|
||||||
|
@ -566,6 +569,83 @@ void SetupSelfDestruction(
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearPaymentInfoBoxBuilder(
|
||||||
|
not_null<Ui::GenericBox*> box,
|
||||||
|
not_null<Main::Session*> session) {
|
||||||
|
box->setTitle(tr::lng_clear_payment_info_title());
|
||||||
|
|
||||||
|
const auto checkboxPadding = style::margins(
|
||||||
|
st::boxRowPadding.left(),
|
||||||
|
st::boxRowPadding.left(),
|
||||||
|
st::boxRowPadding.right(),
|
||||||
|
st::boxRowPadding.bottom());
|
||||||
|
const auto label = box->addRow(object_ptr<Ui::FlatLabel>(
|
||||||
|
box,
|
||||||
|
tr::lng_clear_payment_info_sure(),
|
||||||
|
st::boxLabel));
|
||||||
|
const auto shipping = box->addRow(
|
||||||
|
object_ptr<Ui::Checkbox>(
|
||||||
|
box,
|
||||||
|
tr::lng_clear_payment_info_shipping(tr::now),
|
||||||
|
true,
|
||||||
|
st::defaultBoxCheckbox),
|
||||||
|
checkboxPadding);
|
||||||
|
const auto payment = box->addRow(
|
||||||
|
object_ptr<Ui::Checkbox>(
|
||||||
|
box,
|
||||||
|
tr::lng_clear_payment_info_payment(tr::now),
|
||||||
|
true,
|
||||||
|
st::defaultBoxCheckbox),
|
||||||
|
checkboxPadding);
|
||||||
|
|
||||||
|
using Flags = MTPpayments_ClearSavedInfo::Flags;
|
||||||
|
const auto flags = box->lifetime().make_state<Flags>();
|
||||||
|
|
||||||
|
box->addButton(tr::lng_clear_payment_info_clear(), [=] {
|
||||||
|
using Flag = Flags::Enum;
|
||||||
|
*flags = (shipping->checked() ? Flag::f_info : Flag(0))
|
||||||
|
| (payment->checked() ? Flag::f_credentials : Flag(0));
|
||||||
|
delete label;
|
||||||
|
delete shipping;
|
||||||
|
delete payment;
|
||||||
|
box->addRow(object_ptr<Ui::FlatLabel>(
|
||||||
|
box,
|
||||||
|
tr::lng_clear_payment_info_confirm(),
|
||||||
|
st::boxLabel));
|
||||||
|
box->clearButtons();
|
||||||
|
box->addButton(tr::lng_clear_payment_info_clear(), [=] {
|
||||||
|
session->api().request(MTPpayments_ClearSavedInfo(
|
||||||
|
MTP_flags(*flags)
|
||||||
|
)).send();
|
||||||
|
box->closeBox();
|
||||||
|
}, st::attentionBoxButton);
|
||||||
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
|
}, st::attentionBoxButton);
|
||||||
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ClearPaymentInfoBox(not_null<Main::Session*> session) {
|
||||||
|
return Box(ClearPaymentInfoBoxBuilder, session);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetupBotsAndWebsites(
|
||||||
|
not_null<Window::SessionController*> controller,
|
||||||
|
not_null<Ui::VerticalLayout*> container) {
|
||||||
|
AddSkip(container);
|
||||||
|
AddSubsectionTitle(container, tr::lng_settings_security_bots());
|
||||||
|
|
||||||
|
const auto session = &controller->session();
|
||||||
|
AddButton(
|
||||||
|
container,
|
||||||
|
tr::lng_settings_clear_payment_info(),
|
||||||
|
st::settingsButton
|
||||||
|
)->addClickHandler([=] {
|
||||||
|
Ui::show(ClearPaymentInfoBox(session));
|
||||||
|
});
|
||||||
|
|
||||||
|
AddSkip(container);
|
||||||
|
}
|
||||||
|
|
||||||
void SetupSessionsList(
|
void SetupSessionsList(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
|
@ -735,6 +815,8 @@ void PrivacySecurity::setupContent(
|
||||||
AddDivider(content);
|
AddDivider(content);
|
||||||
#endif // !OS_MAC_STORE && !OS_WIN_STORE
|
#endif // !OS_MAC_STORE && !OS_WIN_STORE
|
||||||
SetupSelfDestruction(controller, content, trigger());
|
SetupSelfDestruction(controller, content, trigger());
|
||||||
|
AddDivider(content);
|
||||||
|
SetupBotsAndWebsites(controller, content);
|
||||||
|
|
||||||
Ui::ResizeFitChild(this, content);
|
Ui::ResizeFitChild(this, content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 876f0f06dc8eac766aecd695944455eaf577a4b9
|
Subproject commit a51db55ef278b949e184a241bed03b04b0acba77
|
Loading…
Reference in New Issue