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

Replace observer_peer with rpl interface.

This commit is contained in:
John Preston
2020-06-12 16:12:34 +04:00
parent b0f9ad71dd
commit 3c4e959468
81 changed files with 1405 additions and 1304 deletions

View File

@@ -27,11 +27,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "calls/calls_box_controller.h"
#include "lang/lang_keys.h"
#include "core/click_handler_types.h"
#include "observer_peer.h"
#include "main/main_session.h"
#include "data/data_folder.h"
#include "data/data_session.h"
#include "data/data_user.h"
#include "data/data_changes.h"
#include "mainwidget.h"
#include "facades.h"
#include "app.h"
@@ -213,11 +213,14 @@ MainMenu::MainMenu(
_version->setLink(2, std::make_shared<LambdaClickHandler>([] { Ui::show(Box<AboutBox>()); }));
subscribe(_controller->session().downloaderTaskFinished(), [=] { update(); });
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(Notify::PeerUpdate::Flag::UserPhoneChanged, [this](const Notify::PeerUpdate &update) {
if (update.peer->isSelf()) {
updatePhone();
}
}));
_controller->session().changes().peerUpdates(
_controller->session().user(),
Data::PeerUpdate::Flag::PhoneNumber
) | rpl::start_with_next([=] {
updatePhone();
}, lifetime());
subscribe(Global::RefPhoneCallsEnabledChanged(), [this] { refreshMenu(); });
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.type == Window::Theme::BackgroundUpdate::Type::ApplyingTheme) {