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

Use rpl for Window::Theme::Background updates.

This commit is contained in:
John Preston
2021-07-15 14:12:38 +03:00
parent 7e83088a84
commit 4276b6cce0
66 changed files with 203 additions and 262 deletions

View File

@@ -424,8 +424,7 @@ BackgroundRow::BackgroundRow(
});
using Update = const Window::Theme::BackgroundUpdate;
base::ObservableViewer(
*Window::Theme::Background()
Window::Theme::Background()->updates(
) | rpl::filter([](const Update &update) {
return (update.type == Update::Type::New
|| update.type == Update::Type::Start
@@ -958,8 +957,7 @@ void SetupChatBackground(
}, tile->lifetime());
using Update = const Window::Theme::BackgroundUpdate;
base::ObservableViewer(
*Window::Theme::Background()
Window::Theme::Background()->updates(
) | rpl::filter([](const Update &update) {
return (update.type == Update::Type::Changed);
}) | rpl::map([] {
@@ -1089,8 +1087,7 @@ void SetupDefaultThemes(
refreshColorizer(scheme.type);
}
base::ObservableViewer(
*Background()
Background()->updates(
) | rpl::filter([](const BackgroundUpdate &update) {
return (update.type == BackgroundUpdate::Type::ApplyingTheme);
}) | rpl::map([=] {
@@ -1254,9 +1251,9 @@ void SetupCloudThemes(
editWrap->toggleOn(rpl::single(BackgroundUpdate(
BackgroundUpdate::Type::ApplyingTheme,
Background()->tile()
)) | rpl::then(base::ObservableViewer(
*Background()
)) | rpl::filter([](const BackgroundUpdate &update) {
)) | rpl::then(
Background()->updates()
) | rpl::filter([](const BackgroundUpdate &update) {
return (update.type == BackgroundUpdate::Type::ApplyingTheme);
}) | rpl::map([=] {
const auto userId = controller->session().userId();