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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user