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

Remove MTP::MainInstance() global access point.

This commit is contained in:
John Preston
2020-06-11 20:09:46 +04:00
parent 7f09da9e32
commit 0ad7dcaef9
84 changed files with 823 additions and 1362 deletions

View File

@@ -21,7 +21,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwidget.h"
#include "observer_peer.h"
#include "api/api_updates.h"
#include "apiwrap.h"
#include "main/main_app_config.h"
#include "main/main_session.h"
#include "facades.h"
@@ -350,14 +349,14 @@ void Account::startMtp() {
}
return true;
}));
_mtp->setStateChangedHandler([](MTP::ShiftedDcId dc, int32 state) {
if (dc == MTP::maindc()) {
_mtp->setStateChangedHandler([=](MTP::ShiftedDcId dc, int32 state) {
if (dc == _mtp->mainDcId()) {
Global::RefConnectionTypeChanged().notify();
}
});
_mtp->setSessionResetHandler([=](MTP::ShiftedDcId shiftedDcId) {
if (sessionExists()) {
if (shiftedDcId == session().api().instance()->mainDcId()) {
if (shiftedDcId == _mtp->mainDcId()) {
session().updates().getDifference();
}
}