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
@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "export/output/export_output_abstract.h"
#include "export/output/export_output_result.h"
#include "export/output/export_output_stats.h"
#include "mtproto/mtp_instance.h"
namespace Export {
namespace {
@@ -34,6 +35,7 @@ class ControllerObject {
public:
ControllerObject(
crl::weak_on_queue<ControllerObject> weak,
QPointer<MTP::Instance> mtproto,
const MTPInputPeer &peer);
rpl::producer<State> state() const;
@@ -131,8 +133,9 @@ private:
ControllerObject::ControllerObject(
crl::weak_on_queue<ControllerObject> weak,
QPointer<MTP::Instance> mtproto,
const MTPInputPeer &peer)
: _api(weak.runner())
: _api(mtproto, weak.runner())
, _state(PasswordCheckState{}) {
_api.errors(
) | rpl::start_with_next([=](RPCError &&error) {
@@ -586,7 +589,10 @@ void ControllerObject::setFinishedState() {
_stats.bytesCount() });
}
Controller::Controller(const MTPInputPeer &peer) : _wrapped(peer) {
Controller::Controller(
QPointer<MTP::Instance> mtproto,
const MTPInputPeer &peer)
: _wrapped(std::move(mtproto), peer) {
}
rpl::producer<State> Controller::state() const {