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

Remove Auth() global access point.

This commit is contained in:
John Preston
2020-06-10 14:49:10 +04:00
parent 7892ba97e6
commit 5f8d22f1f2
24 changed files with 209 additions and 109 deletions

View File

@@ -114,25 +114,27 @@ Application::Application(not_null<Launcher*> launcher)
}, _lifetime);
activeAccount().sessionChanges(
) | rpl::start_with_next([=] {
) | rpl::start_with_next([=](Main::Session *session) {
if (_mediaView) {
hideMediaView();
_mediaView->clearData();
}
if (session && !UpdaterDisabled()) {
if (const auto mtp = activeAccount().mtp()) {
UpdateChecker().setMtproto(mtp, session->userId());
}
}
}, _lifetime);
activeAccount().mtpChanges(
) | rpl::filter([=](MTP::Instance *instance) {
return instance != nullptr;
}) | rpl::start_with_next([=](not_null<MTP::Instance*> mtp) {
}) | rpl::start_with_next([=] {
if (_window) {
// This should be called when user settings are read.
// Right now after they are read the startMtp() is called.
_window->widget()->updateTrayMenu();
}
if (!UpdaterDisabled()) {
UpdateChecker().setMtproto(mtp.get());
}
}, _lifetime);
}