2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add account from settings three-dot menu.

This commit is contained in:
John Preston
2020-06-30 21:16:05 +04:00
parent dd0e0a10cd
commit 5cc7c2b6c6
4 changed files with 24 additions and 12 deletions

View File

@@ -799,18 +799,7 @@ not_null<Ui::SlideWrap<Ui::RippleButton>*> MainMenu::setupAddAccount(
}, button->lifetime());
const auto add = [=](MTP::Environment environment) {
auto &domain = Core::App().domain();
if (domain.accounts().size() < Main::Domain::kMaxAccounts) {
domain.activate(domain.add(environment));
} else {
for (auto &[index, account] : domain.accounts()) {
if (!account->sessionExists()
&& account->mtp().environment() == environment) {
domain.activate(account.get());
break;
}
}
}
Core::App().domain().addActivated(environment);
};
button->setAcceptBoth(true);