mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +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));
|
||||
const auto changed = (_accountToActivate != i->index);
|
||||
auto wasAuthed = false;
|
||||
|
||||
_activeLifetime.destroy();
|
||||
if (_active.current()) {
|
||||
_lastActiveIndex = _accountToActivate;
|
||||
wasAuthed = _active.current()->sessionExists();
|
||||
}
|
||||
_accountToActivate = i->index;
|
||||
_active = account.get();
|
||||
|
@ -352,7 +354,13 @@ void Domain::activate(not_null<Main::Account*> account) {
|
|||
) | rpl::start_to_stream(_activeSessions, _activeLifetime);
|
||||
|
||||
if (changed) {
|
||||
scheduleWriteAccounts();
|
||||
if (wasAuthed) {
|
||||
scheduleWriteAccounts();
|
||||
} else {
|
||||
crl::on_main(&Core::App(), [=] {
|
||||
removeRedundantAccounts();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue