From dfa4a9990dbb855fc3a748db4071b31aa92e57b0 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 2 Jul 2020 22:11:45 +0400 Subject: [PATCH] Show accounts in main menu when added. --- Telegram/SourceFiles/core/core_settings.cpp | 2 +- Telegram/SourceFiles/core/core_settings.h | 2 +- Telegram/SourceFiles/main/main_domain.cpp | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/core/core_settings.cpp b/Telegram/SourceFiles/core/core_settings.cpp index 5e7cb62b5..23c5d0eaf 100644 --- a/Telegram/SourceFiles/core/core_settings.cpp +++ b/Telegram/SourceFiles/core/core_settings.cpp @@ -458,7 +458,7 @@ void Settings::resetOnLastLogout() { //_videoPipGeometry = QByteArray(); _dictionariesEnabled = std::vector(); _autoDownloadDictionaries = true; - _mainMenuAccountsShown = false; + _mainMenuAccountsShown = true; _tabbedSelectorSectionEnabled = false; // per-window _floatPlayerColumn = Window::Column::Second; // per-window _floatPlayerCorner = RectPart::TopRight; // per-window diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h index cedbe6a94..b8eae179e 100644 --- a/Telegram/SourceFiles/core/core_settings.h +++ b/Telegram/SourceFiles/core/core_settings.h @@ -464,7 +464,7 @@ private: QByteArray _videoPipGeometry; rpl::variable> _dictionariesEnabled; rpl::variable _autoDownloadDictionaries = true; - rpl::variable _mainMenuAccountsShown = false; + rpl::variable _mainMenuAccountsShown = true; bool _tabbedSelectorSectionEnabled = false; // per-window Window::Column _floatPlayerColumn; // per-window RectPart _floatPlayerCorner; // per-window diff --git a/Telegram/SourceFiles/main/main_domain.cpp b/Telegram/SourceFiles/main/main_domain.cpp index d9525fb73..7b9766984 100644 --- a/Telegram/SourceFiles/main/main_domain.cpp +++ b/Telegram/SourceFiles/main/main_domain.cpp @@ -270,6 +270,13 @@ not_null Domain::add(MTP::Environment environment) { _local->startAdded(account, std::move(config)); watchSession(account); _accountsChanges.fire({}); + + auto &settings = Core::App().settings(); + if (_accounts.size() == 2 && !settings.mainMenuAccountsShown()) { + settings.setMainMenuAccountsShown(true); + Core::App().saveSettingsDelayed(); + } + return account; }