2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Move terms lock from Core::App to Session.

This commit is contained in:
John Preston
2020-06-24 11:56:16 +04:00
parent 30c82bb2e0
commit e7b8a52278
19 changed files with 233 additions and 272 deletions

View File

@@ -121,42 +121,6 @@ auto GenerateCodes() {
}
});
codes.emplace(qsl("accadd"), [](SessionController *window) {
crl::on_main(&Core::App(), [=] {
if (window
&& !Core::App().locked()
&& Core::App().domain().started()
&& Core::App().domain().accounts().size() < 3) {
Core::App().domain().activate(
Core::App().domain().add(MTP::Environment::Production));
}
});
});
codes.emplace(qsl("acctest"), [](SessionController *window) {
crl::on_main(&Core::App(), [=] {
if (window
&& !Core::App().locked()
&& Core::App().domain().started()
&& Core::App().domain().accounts().size() < 3) {
Core::App().domain().activate(
Core::App().domain().add(MTP::Environment::Test));
}
});
});
for (auto i = 0; i != 3; ++i) {
codes.emplace(qsl("account%1").arg(i + 1), [=](
SessionController *window) {
crl::on_main(&Core::App(), [=] {
const auto &list = Core::App().domain().accounts();
if (i < list.size()) {
Core::App().domain().activate(list[i].account.get());
}
});
});
}
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
codes.emplace(qsl("registertg"), [](SessionController *window) {
Platform::RegisterCustomScheme(true);