2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Support logout of a secondary account.

This commit is contained in:
John Preston
2020-06-16 13:40:43 +04:00
parent 5e045ec02c
commit bc144377c0
18 changed files with 189 additions and 81 deletions

View File

@@ -451,15 +451,33 @@ void Application::startLocalStorage() {
_saveSettingsTimer.setCallback([=] { Local::writeSettings(); });
}
void Application::forceLogOut(const TextWithEntities &explanation) {
void Application::logout(Main::Account *account) {
if (account) {
account->logOut();
} else {
accounts().resetWithForgottenPasscode();
if (Global::LocalPasscode()) {
Global::SetLocalPasscode(false);
Global::RefLocalPasscodeChanged().notify();
}
Core::App().unlockPasscode();
Core::App().unlockTerms();
}
}
void Application::forceLogOut(
not_null<Main::Account*> account,
const TextWithEntities &explanation) {
const auto box = Ui::show(Box<InformBox>(
explanation,
tr::lng_passcode_logout(tr::now)));
box->setCloseByEscape(false);
box->setCloseByOutsideClick(false);
const auto weak = base::make_weak(account.get());
connect(box, &QObject::destroyed, [=] {
crl::on_main(this, [=] {
activeAccount().forcedLogOut();
crl::on_main(weak, [=] {
account->forcedLogOut();
});
});
}