mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Return 'testmode' code when no authed accounts.
This commit is contained in:
parent
58008ab7b0
commit
883a62c0a2
2 changed files with 19 additions and 1 deletions
|
@ -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) {
|
codes.emplace(qsl("folders"), [](SessionController *window) {
|
||||||
if (window) {
|
if (window) {
|
||||||
window->showSettings(Settings::Type::Folders);
|
window->showSettings(Settings::Type::Folders);
|
||||||
|
|
|
@ -350,7 +350,9 @@ void IntroWidget::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntroWidget::keyPressEvent(QKeyEvent *e) {
|
void IntroWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
CodesFeedString(nullptr, e->text());
|
crl::on_main(this, [text = e->text()]{
|
||||||
|
CodesFeedString(nullptr, text);
|
||||||
|
});
|
||||||
return RpWidget::keyPressEvent(e);
|
return RpWidget::keyPressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue