2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Several working accounts together.

This commit is contained in:
John Preston
2020-06-16 10:42:47 +04:00
parent 6fc5e22882
commit ab5796c117
14 changed files with 97 additions and 60 deletions

View File

@@ -148,19 +148,18 @@ Application::~Application() {
_mediaView = nullptr;
}
if (activeAccount().sessionExists()) {
activeAccount().session().saveSettingsNowIfNeeded();
unlockTerms();
for (const auto &[index, account] : accounts().list()) {
if (account->sessionExists()) {
account->session().saveSettingsNowIfNeeded();
}
// Some MTP requests can be cancelled from data clearing.
account->destroySession();
account->clearMtp();
}
// This can call writeMap() that serializes Main::Session.
// In case it gets called after destroySession() we get missing data.
Local::finish();
// Some MTP requests can be cancelled from data clearing.
unlockTerms();
activeAccount().destroySession();
activeAccount().clearMtp();
Shortcuts::Finish();
Ui::Emoji::Clear();
@@ -230,6 +229,10 @@ void Application::run() {
QMimeDatabase().mimeTypeForName(qsl("text/plain"));
_window = std::make_unique<Window::Controller>();
accounts().activeChanges(
) | rpl::start_with_next([=](not_null<Main::Account*> account) {
_window->showAccount(account);
}, _window->widget()->lifetime());
QCoreApplication::instance()->installEventFilter(this);
connect(
@@ -251,8 +254,6 @@ void Application::run() {
Global::RefLocalPasscodeChanged().notify();
lockByPasscode();
DEBUG_LOG(("Application Info: passcode needed..."));
} else {
_window->showAccount(&activeAccount());
}
_window->widget()->show();