mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Destroy non-authed account on deactivate.
This commit is contained in:
parent
c8efb77520
commit
31c745cb07
1 changed files with 9 additions and 1 deletions
|
@ -341,10 +341,12 @@ void Domain::activate(not_null<Main::Account*> account) {
|
||||||
});
|
});
|
||||||
Assert(i != end(_accounts));
|
Assert(i != end(_accounts));
|
||||||
const auto changed = (_accountToActivate != i->index);
|
const auto changed = (_accountToActivate != i->index);
|
||||||
|
auto wasAuthed = false;
|
||||||
|
|
||||||
_activeLifetime.destroy();
|
_activeLifetime.destroy();
|
||||||
if (_active.current()) {
|
if (_active.current()) {
|
||||||
_lastActiveIndex = _accountToActivate;
|
_lastActiveIndex = _accountToActivate;
|
||||||
|
wasAuthed = _active.current()->sessionExists();
|
||||||
}
|
}
|
||||||
_accountToActivate = i->index;
|
_accountToActivate = i->index;
|
||||||
_active = account.get();
|
_active = account.get();
|
||||||
|
@ -352,7 +354,13 @@ void Domain::activate(not_null<Main::Account*> account) {
|
||||||
) | rpl::start_to_stream(_activeSessions, _activeLifetime);
|
) | rpl::start_to_stream(_activeSessions, _activeLifetime);
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
scheduleWriteAccounts();
|
if (wasAuthed) {
|
||||||
|
scheduleWriteAccounts();
|
||||||
|
} else {
|
||||||
|
crl::on_main(&Core::App(), [=] {
|
||||||
|
removeRedundantAccounts();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue