mirror of https://github.com/procxx/kepka.git
Move delete-from-ToS to AuthSession.
This commit is contained in:
parent
3fa3428b4b
commit
efb2972d28
|
@ -480,6 +480,12 @@ void AuthSession::localPasscodeChanged() {
|
||||||
checkAutoLock();
|
checkAutoLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuthSession::termsDeleteNow() {
|
||||||
|
api().request(MTPaccount_DeleteAccount(
|
||||||
|
MTP_string("Decline ToS update")
|
||||||
|
)).send();
|
||||||
|
}
|
||||||
|
|
||||||
void AuthSession::checkAutoLock() {
|
void AuthSession::checkAutoLock() {
|
||||||
if (!Global::LocalPasscode()
|
if (!Global::LocalPasscode()
|
||||||
|| Core::App().passcodeLocked()) {
|
|| Core::App().passcodeLocked()) {
|
||||||
|
|
|
@ -317,6 +317,7 @@ public:
|
||||||
void checkAutoLock();
|
void checkAutoLock();
|
||||||
void checkAutoLockIn(crl::time time);
|
void checkAutoLockIn(crl::time time);
|
||||||
void localPasscodeChanged();
|
void localPasscodeChanged();
|
||||||
|
void termsDeleteNow();
|
||||||
|
|
||||||
rpl::lifetime &lifetime() {
|
rpl::lifetime &lifetime() {
|
||||||
return _lifetime;
|
return _lifetime;
|
||||||
|
|
|
@ -898,10 +898,6 @@ rpl::producer<bool> Application::termsLockValue() const {
|
||||||
) | rpl::then(termsLockChanges());
|
) | rpl::then(termsLockChanges());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::termsDeleteNow() {
|
|
||||||
MTP::send(MTPaccount_DeleteAccount(MTP_string("Decline ToS update")));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Application::locked() const {
|
bool Application::locked() const {
|
||||||
return passcodeLocked() || termsLocked();
|
return passcodeLocked() || termsLocked();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,10 +64,7 @@ namespace Core {
|
||||||
class Launcher;
|
class Launcher;
|
||||||
struct LocalUrlHandler;
|
struct LocalUrlHandler;
|
||||||
|
|
||||||
class Application final
|
class Application final : public QObject, private base::Subscriber {
|
||||||
: public QObject
|
|
||||||
, public RPCSender
|
|
||||||
, private base::Subscriber {
|
|
||||||
public:
|
public:
|
||||||
Application(not_null<Launcher*> launcher);
|
Application(not_null<Launcher*> launcher);
|
||||||
|
|
||||||
|
@ -188,7 +185,6 @@ public:
|
||||||
[[nodiscard]] std::optional<Window::TermsLock> termsLocked() const;
|
[[nodiscard]] std::optional<Window::TermsLock> termsLocked() const;
|
||||||
rpl::producer<bool> termsLockChanges() const;
|
rpl::producer<bool> termsLockChanges() const;
|
||||||
rpl::producer<bool> termsLockValue() const;
|
rpl::producer<bool> termsLockValue() const;
|
||||||
void termsDeleteNow();
|
|
||||||
|
|
||||||
[[nodiscard]] bool locked() const;
|
[[nodiscard]] bool locked() const;
|
||||||
rpl::producer<bool> lockChanges() const;
|
rpl::producer<bool> lockChanges() const;
|
||||||
|
|
|
@ -202,12 +202,19 @@ void MainWindow::showTermsDecline() {
|
||||||
|
|
||||||
void MainWindow::showTermsDelete() {
|
void MainWindow::showTermsDelete() {
|
||||||
const auto box = std::make_shared<QPointer<BoxContent>>();
|
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||||
|
const auto deleteByTerms = [=] {
|
||||||
|
if (AuthSession::Exists()) {
|
||||||
|
Auth().termsDeleteNow();
|
||||||
|
} else {
|
||||||
|
Ui::hideLayer();
|
||||||
|
}
|
||||||
|
};
|
||||||
*box = Ui::show(
|
*box = Ui::show(
|
||||||
Box<ConfirmBox>(
|
Box<ConfirmBox>(
|
||||||
lang(lng_terms_delete_warning),
|
lang(lng_terms_delete_warning),
|
||||||
lang(lng_terms_delete_now),
|
lang(lng_terms_delete_now),
|
||||||
st::attentionBoxButton,
|
st::attentionBoxButton,
|
||||||
[=] { Core::App().termsDeleteNow(); },
|
deleteByTerms,
|
||||||
[=] { if (*box) (*box)->closeBox(); }),
|
[=] { if (*box) (*box)->closeBox(); }),
|
||||||
LayerOption::KeepOther);
|
LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue