2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Pass MTP::Instance to MTP::Sender.

This commit is contained in:
John Preston
2019-11-27 11:02:56 +03:00
parent a0152557ec
commit e943264823
65 changed files with 406 additions and 275 deletions

View File

@@ -93,6 +93,7 @@ Application::Application(not_null<Launcher*> launcher)
, _dcOptions(std::make_unique<MTP::DcOptions>())
, _account(std::make_unique<Main::Account>(cDataFile()))
, _langpack(std::make_unique<Lang::Instance>())
, _langCloudManager(std::make_unique<Lang::CloudManager>(langpack()))
, _emojiKeywords(std::make_unique<ChatHelpers::EmojiKeywords>())
, _audio(std::make_unique<Media::Audio::Instance>())
, _logo(Window::LoadLogo())
@@ -114,9 +115,6 @@ Application::Application(not_null<Launcher*> launcher)
) | rpl::filter([=](MTP::Instance *instance) {
return instance != nullptr;
}) | rpl::start_with_next([=](not_null<MTP::Instance*> mtp) {
_langCloudManager = std::make_unique<Lang::CloudManager>(
langpack(),
mtp);
if (!UpdaterDisabled()) {
UpdateChecker().setMtproto(mtp.get());
}
@@ -134,11 +132,6 @@ Application::~Application() {
// Some MTP requests can be cancelled from data clearing.
unlockTerms();
activeAccount().destroySession();
// The langpack manager should be destroyed before MTProto instance,
// because it is MTP::Sender and it may have pending requests.
_langCloudManager.reset();
activeAccount().clearMtp();
Shortcuts::Finish();

View File

@@ -266,7 +266,7 @@ private:
std::unique_ptr<Window::Controller> _window;
std::unique_ptr<Media::View::OverlayWidget> _mediaView;
const std::unique_ptr<Lang::Instance> _langpack;
std::unique_ptr<Lang::CloudManager> _langCloudManager;
const std::unique_ptr<Lang::CloudManager> _langCloudManager;
const std::unique_ptr<ChatHelpers::EmojiKeywords> _emojiKeywords;
std::unique_ptr<Lang::Translator> _translator;
base::Observable<void> _passcodedChanged;