2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Count all accounts in Core::App().unreadBadge.

This commit is contained in:
John Preston
2020-06-18 15:17:58 +04:00
parent 357caf8007
commit 3a5ede534e
34 changed files with 255 additions and 175 deletions

View File

@@ -55,8 +55,6 @@ Account::~Account() {
session().saveSettingsNowIfNeeded();
}
destroySession();
_mtpValue.reset(nullptr);
base::take(_mtp);
}
[[nodiscard]] Storage::StartResult Account::legacyStart(
@@ -65,23 +63,17 @@ Account::~Account() {
const auto result = _local->legacyStart(passcode);
if (result == Storage::StartResult::Success) {
finishStarting(nullptr);
start(nullptr);
}
return result;
}
void Account::start(std::shared_ptr<MTP::AuthKey> localKey) {
finishStarting(_local->start(std::move(localKey)));
std::unique_ptr<MTP::Config> Account::prepareToStart(
std::shared_ptr<MTP::AuthKey> localKey) {
return _local->start(std::move(localKey));
}
void Account::startAdded(
std::shared_ptr<MTP::AuthKey> localKey,
std::unique_ptr<MTP::Config> config) {
_local->startAdded(std::move(localKey));
finishStarting(std::move(config));
}
void Account::finishStarting(std::unique_ptr<MTP::Config> config) {
void Account::start(std::unique_ptr<MTP::Config> config) {
startMtp(config
? std::move(config)
: std::make_unique<MTP::Config>(
@@ -91,6 +83,11 @@ void Account::finishStarting(std::unique_ptr<MTP::Config> config) {
watchSessionChanges();
}
void Account::prepareToStartAdded(
std::shared_ptr<MTP::AuthKey> localKey) {
_local->startAdded(std::move(localKey));
}
void Account::watchProxyChanges() {
using ProxyChange = Core::Application::ProxyChange;
@@ -189,8 +186,6 @@ void Account::destroySession() {
_sessionValue = nullptr;
_session = nullptr;
Notify::unreadCounterUpdated();
}
bool Account::sessionExists() const {