Skip to content

Commit

Permalink
f Comment a lot of MTP. Fix test environment.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Jun 26, 2024
1 parent 7286468 commit da28998
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/boxes/connection_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,9 @@ void ProxiesBoxController::setTryIPv6(bool enabled) {
return;
}
Core::App().settings().proxy().setTryIPv6(enabled);
#if 0 // mtp
_account->mtp().restart();
#endif
_settings.connectionTypeChangesNotify();
saveDelayed();
}
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/export/export_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ void Manager::start(
_panel->activatePanel();
return;
}
#if 0 // tdlib todo export
_controller = std::make_unique<Controller>(
&session->mtp(),
singlePeer);
#endif
return;
_panel = std::make_unique<View::PanelController>(
session,
_controller.get());
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/main/main_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ Tdb::Account &Session::tdb() const {
return _account->tdb();
}

Tdb::Sender &Session::sender() {
Tdb::Sender &Session::sender() const {
return *_sender;
}

Expand Down Expand Up @@ -402,11 +402,11 @@ void Session::saveSettingsNowIfNeeded() {
MTP::DcId Session::mainDcId() const {
return _account->mtp().mainDcId();
}
#endif

MTP::Instance &Session::mtp() const {
return _account->mtp();
}
#endif

const MTP::ConfigFields &Session::serverConfig() const {
return _account->mtp().configValues();
Expand Down
10 changes: 8 additions & 2 deletions Telegram/SourceFiles/main/main_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ class Session final : public base::has_weak_ptr {
[[nodiscard]] AppConfig &appConfig() const;

[[nodiscard]] Tdb::Account &tdb() const;
[[nodiscard]] Tdb::Sender &sender();
[[nodiscard]] Tdb::Sender &sender() const;

// For using legacy code MTP::Sender _api; _api(&session->mtp()).
[[nodiscard]] Tdb::Sender &mtp() const {
return sender();
}

[[nodiscard]] bool loggingOut() const;

bool apply(const Tdb::TLDupdateOption &option);
Expand Down Expand Up @@ -212,8 +218,8 @@ class Session final : public base::has_weak_ptr {
[[nodiscard]] rpl::producer<> downloaderTaskFinished() const;
#if 0 // mtp
[[nodiscard]] MTP::DcId mainDcId() const;
#endif
[[nodiscard]] MTP::Instance &mtp() const;
#endif
[[nodiscard]] const MTP::ConfigFields &serverConfig() const;
[[nodiscard]] ApiWrap &api() {
return *_api;
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/settings/settings_advanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void SetupConnectionType(
not_null<Main::Account*> account,
not_null<Ui::VerticalLayout*> container) {
const auto connectionType = [=] {
#if 0 // todo
const auto transport = account->mtp().dctransport();
if (!Core::App().settings().proxy().isEnabled()) {
return transport.isEmpty()
Expand All @@ -85,6 +86,8 @@ void SetupConnectionType(
? tr::lng_connection_proxy_connecting(tr::now)
: tr::lng_connection_proxy(tr::now, lt_transport, transport);
}
#endif
return u"TDLib"_q;
};
const auto button = AddButtonWithLabel(
container,
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/settings/settings_codes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ auto GenerateCodes() {
}
});
});
#if 0 // mtp
codes.emplace(u"endpoints"_q, [](SessionController *window) {
if (!Core::App().domain().started()) {
return;
Expand All @@ -142,6 +143,7 @@ auto GenerateCodes() {
}
});
});
#endif
codes.emplace(u"testmode"_q, [](SessionController *window) {
auto &domain = Core::App().domain();
if (domain.started()
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/settings/settings_information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,10 @@ not_null<Ui::SlideWrap<Ui::SettingsButton>*> AccountsList::setupAdd() {
for (const auto &[index, account] : domain.accounts()) {
const auto raw = account.get();
if (!raw->sessionExists()
#if 0 // mtp
&& raw->mtp().environment() == environment) {
#endif
&& raw->testMode() == (environment == Environment::Test)) {
found = true;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/window/window_connecting_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,9 @@ void ConnectionState::Widget::refreshRetryLink(bool hasRetry) {
tr::lng_reconnecting_try_now(tr::now),
st::connectingRetryLink);
_retry->addClickHandler([=] {
#if 0 // todo
_account->mtp().restart();
#endif
});
updateRetryGeometry();
} else if (!hasRetry) {
Expand Down

0 comments on commit da28998

Please sign in to comment.