2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +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

@@ -273,6 +273,20 @@ not_null<Main::Account*> Domain::add(MTP::Environment environment) {
return account;
}
void Domain::addActivated(MTP::Environment environment) {
if (accounts().size() < Main::Domain::kMaxAccounts) {
activate(add(environment));
} else {
for (auto &[index, account] : accounts()) {
if (!account->sessionExists()
&& account->mtp().environment() == environment) {
activate(account.get());
break;
}
}
}
}
void Domain::watchSession(not_null<Account*> account) {
account->sessionValue(
) | rpl::filter([=](Session *session) {