mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Return 'testmode' code when no authed accounts.
This commit is contained in:
@@ -115,6 +115,22 @@ auto GenerateCodes() {
|
||||
}
|
||||
});
|
||||
});
|
||||
codes.emplace(qsl("testmode"), [](SessionController *window) {
|
||||
auto &domain = Core::App().domain();
|
||||
if (domain.started()
|
||||
&& (domain.accounts().size() == 1)
|
||||
&& !domain.active().sessionExists()) {
|
||||
const auto environment = domain.active().mtp().environment();
|
||||
domain.addActivated([&] {
|
||||
return (environment == MTP::Environment::Production)
|
||||
? MTP::Environment::Test
|
||||
: MTP::Environment::Production;
|
||||
}());
|
||||
Ui::Toast::Show((environment == MTP::Environment::Production)
|
||||
? "Switched to the test environment."
|
||||
: "Switched to the production environment.");
|
||||
}
|
||||
});
|
||||
codes.emplace(qsl("folders"), [](SessionController *window) {
|
||||
if (window) {
|
||||
window->showSettings(Settings::Type::Folders);
|
||||
|
Reference in New Issue
Block a user