From a279f0a296800cc1f973433a07b01a37466a666d Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 7 Dec 2025 05:16:50 +0000 Subject: [PATCH 001/136] Attempt to fix cache key instability in macOS packaged and Linux actions --- .github/workflows/linux.yml | 1 + .github/workflows/mac_packaged.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 551fa6c4c1..0ba54dffa6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -71,6 +71,7 @@ jobs: poetry install DOCKERFILE=$(DEBUG= LTO= poetry run gen_dockerfile) echo "$DOCKERFILE" > Dockerfile + rm -rf __pycache__ - name: Free up some disk space. uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be diff --git a/.github/workflows/mac_packaged.yml b/.github/workflows/mac_packaged.yml index 34a33c9aa0..6c94b6368c 100644 --- a/.github/workflows/mac_packaged.yml +++ b/.github/workflows/mac_packaged.yml @@ -85,7 +85,7 @@ jobs: echo "MACOSX_DEPLOYMENT_TARGET=$(grep 'set(QT_SUPPORTED_MIN_MACOS_VERSION' /opt/homebrew/Cellar/qtbase/*/lib/cmake/Qt6/Qt6ConfigExtras.cmake | sed -E 's/^.*"(.*)"\)$/\1/')" >> $GITHUB_ENV echo "LibrariesPath=`pwd`" >> $GITHUB_ENV - curl -o tg_owt-version.json https://api.github.com/repos/desktop-app/tg_owt/git/refs/heads/master + echo "WEBRTC=`curl -sSL https://api.github.com/repos/desktop-app/tg_owt/git/refs/heads/master | jq -r .object.sha`" >> $GITHUB_ENV - name: RNNoise. run: | @@ -103,7 +103,7 @@ jobs: uses: actions/cache@v4 with: path: ${{ env.LibrariesPath }}/tg_owt - key: ${{ runner.OS }}-webrtc-${{ env.CACHE_KEY }}-${{ hashFiles('**/tg_owt-version.json') }} + key: ${{ runner.OS }}-webrtc-${{ env.CACHE_KEY }}-${{ env.WEBRTC }} - name: WebRTC. if: steps.cache-webrtc.outputs.cache-hit != 'true' run: | From a7be550550a12df92b29adbaee2be1d32e174f7e Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 7 Dec 2025 07:50:25 +0000 Subject: [PATCH 002/136] Fix packaged build with Updater on macOS --- Telegram/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 99f9c613dc..14aa5b0a9c 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -2127,7 +2127,7 @@ if (NOT DESKTOP_APP_DISABLE_AUTOUPDATE AND NOT build_macstore AND NOT build_wins endif() elseif (APPLE) add_custom_command(TARGET Updater - PRE_LINK + POST_BUILD COMMAND mkdir -p $/../Frameworks COMMAND cp $ $/../Frameworks/ ) From 6ea30feb188c829c603949dac8e22928f89d358a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Dec 2025 09:51:18 +0000 Subject: [PATCH 003/136] Attach malloc_trim lifetime to LinuxIntegration --- .../platform/linux/integration_linux.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/integration_linux.cpp b/Telegram/SourceFiles/platform/linux/integration_linux.cpp index 9ea29d6ba8..2c38756f1a 100644 --- a/Telegram/SourceFiles/platform/linux/integration_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/integration_linux.cpp @@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/core_settings.h" #endif #include "base/random.h" +#include "base/qt_connection.h" #include @@ -147,6 +148,10 @@ private: #if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) base::Platform::XDP::SettingWatcher _darkModeWatcher; #endif // Qt < 6.5.0 +#ifdef __GLIBC__ + base::qt_connection _memoryTrim; + crl::time _memoryTrimmed = 0; +#endif // __GLIBC__ }; LinuxIntegration::LinuxIntegration() @@ -173,14 +178,13 @@ LinuxIntegration::LinuxIntegration() #ifdef __GLIBC__ mallopt(M_ARENA_MAX, 1); - QObject::connect( + _memoryTrim = QObject::connect( QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, - [] { - static auto since = crl::now(); - if (crl::now() - since >= 10000) { + [=] { + if (crl::now() - _memoryTrimmed >= 10000) { malloc_trim(0); - since = crl::now(); + _memoryTrimmed = crl::now(); } }); #endif // __GLIBC__ From c27c47dd52c62571365f6d2630f327b4cf956f3a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Dec 2025 09:52:30 +0000 Subject: [PATCH 004/136] Set M_ARENA_MAX earlier It doesn't work properly with auto-updatable builds otherwise --- Telegram/SourceFiles/platform/linux/integration_linux.cpp | 1 - Telegram/SourceFiles/platform/linux/launcher_linux.cpp | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/platform/linux/integration_linux.cpp b/Telegram/SourceFiles/platform/linux/integration_linux.cpp index 2c38756f1a..f5d9473a3f 100644 --- a/Telegram/SourceFiles/platform/linux/integration_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/integration_linux.cpp @@ -177,7 +177,6 @@ LinuxIntegration::LinuxIntegration() } #ifdef __GLIBC__ - mallopt(M_ARENA_MAX, 1); _memoryTrim = QObject::connect( QCoreApplication::eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, diff --git a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp index 3c853c7cdd..869b79e76f 100644 --- a/Telegram/SourceFiles/platform/linux/launcher_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/launcher_linux.cpp @@ -14,12 +14,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#ifdef __GLIBC__ +#include +#endif // __GLIBC__ + using namespace gi::repository; namespace Platform { Launcher::Launcher(int argc, char *argv[]) : Core::Launcher(argc, argv) { +#ifdef __GLIBC__ + mallopt(M_ARENA_MAX, 1); +#endif // __GLIBC__ } int Launcher::exec() { From 412c06160adb8d7e389c324f1b7b33227d9c6ae9 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Dec 2025 20:35:00 +0000 Subject: [PATCH 005/136] Fix setting Breakpad framework path with non-Xcode generators --- Telegram/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 14aa5b0a9c..8026393fb0 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1938,8 +1938,9 @@ if (build_macstore) set(bundle_identifier "org.telegram.desktop") set(bundle_entitlements "Telegram Lite.entitlements") set(output_name "Telegram Lite") - set_target_properties(Telegram PROPERTIES - XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS ${libs_loc}/breakpad/src/client/mac/build/Release + target_link_options(Telegram + PRIVATE + -F${libs_loc}/breakpad/src/client/mac/build/Release ) target_link_frameworks(Telegram PRIVATE Breakpad) add_custom_command(TARGET Telegram From 2ae31f7285dee1c4c6b7a2926d4923163e00c837 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 8 Dec 2025 11:56:46 +0000 Subject: [PATCH 006/136] Support crashpad_handler in packaged mode --- Telegram/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 8026393fb0..19435203c9 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1910,15 +1910,17 @@ elseif (APPLE) COMMAND cp ${CMAKE_BINARY_DIR}/lib_spellcheck.rcc $/../Resources ) if (NOT build_macstore AND NOT DESKTOP_APP_DISABLE_CRASH_REPORTS) - if (DESKTOP_APP_MAC_ARCH STREQUAL "x86_64" OR DESKTOP_APP_MAC_ARCH STREQUAL "arm64") - set(crashpad_dir_part ".${DESKTOP_APP_MAC_ARCH}") + if (DESKTOP_APP_USE_PACKAGED) + find_program(CRASHPAD_HANDLER crashpad_handler REQUIRED) + elseif (DESKTOP_APP_MAC_ARCH STREQUAL "x86_64" OR DESKTOP_APP_MAC_ARCH STREQUAL "arm64") + set(CRASHPAD_HANDLER "${libs_loc}/crashpad/out/$,Debug,Release>.${DESKTOP_APP_MAC_ARCH}/crashpad_handler") else() - set(crashpad_dir_part "") + set(CRASHPAD_HANDLER "${libs_loc}/crashpad/out/$,Debug,Release>/crashpad_handler") endif() add_custom_command(TARGET Telegram PRE_LINK COMMAND mkdir -p $/../Helpers - COMMAND cp ${libs_loc}/crashpad/out/$,Debug,Release>${crashpad_dir_part}/crashpad_handler $/../Helpers/ + COMMAND cp ${CRASHPAD_HANDLER} $/../Helpers/ ) endif() else() From 6cfda1dd4352c1670bf8d888aca55176ba974638 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 9 Dec 2025 16:36:02 +0000 Subject: [PATCH 007/136] Use gi::object_cast --- .../platform/linux/notifications_manager_linux.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 176eb1de43..409659fcb1 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -382,10 +382,8 @@ Manager::Private::Private(not_null manager) }; }; - auto activate = gi::wrap( - G_SIMPLE_ACTION( - actionMap.lookup_action("notification-activate").gobj_()), - gi::transfer_none); + auto activate = gi::object_cast( + actionMap.lookup_action("notification-activate")); const auto activateSig = activate.signal_activate().connect([=]( Gio::SimpleAction, @@ -400,10 +398,8 @@ Manager::Private::Private(not_null manager) activate.disconnect(activateSig); }); - auto markAsRead = gi::wrap( - G_SIMPLE_ACTION( - actionMap.lookup_action("notification-mark-as-read").gobj_()), - gi::transfer_none); + auto markAsRead = gi::object_cast( + actionMap.lookup_action("notification-mark-as-read")); const auto markAsReadSig = markAsRead.signal_activate().connect([=]( Gio::SimpleAction, From b172c9a3b2786afb3598158d7bbab5a71e625557 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 9 Dec 2025 00:45:41 +0300 Subject: [PATCH 008/136] Added check for empty proxy list before showing delete all menu item. --- Telegram/SourceFiles/boxes/connection_box.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 9f2ea2ff41..49e134861c 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -796,12 +796,14 @@ void ProxiesBox::setupTopButton() { .handler = [=] { AddProxyFromClipboard(_controller, uiShow()); }, .icon = &st::menuIconImportTheme, }); - addAction({ - .text = tr::lng_group_invite_context_delete_all(tr::now), - .handler = [=] { _controller->deleteItems(); }, - .icon = &st::menuIconDeleteAttention, - .isAttention = true, - }); + if (!_rows.empty()) { + addAction({ + .text = tr::lng_group_invite_context_delete_all(tr::now), + .handler = [=] { _controller->deleteItems(); }, + .icon = &st::menuIconDeleteAttention, + .isAttention = true, + }); + } (*menu)->popup(QCursor::pos()); return true; }); From f0a3ddb184afd6f274b02bc226d2f6d4e5c237cf Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 9 Dec 2025 00:48:13 +0300 Subject: [PATCH 009/136] Fixed phrase in menu item to share gift collection. --- Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp index aa979751b3..576f550f96 100644 --- a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp +++ b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_widget.cpp @@ -994,7 +994,7 @@ void InnerWidget::showMenuForCollection(int id) { editCollectionGifts(id); }, &st::menuIconGiftPremium); if (const auto username = _peer->username(); !username.isEmpty()) { - addAction(tr::lng_stories_album_share(tr::now), [=] { + addAction(tr::lng_gift_collection_share(tr::now), [=] { shareCollectionLink(username, id); }, &st::menuIconShare); } From 52cc76636c4e04e1fda0b5d6361ae289f2ddf936 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 9 Dec 2025 01:17:46 +0300 Subject: [PATCH 010/136] Moved out verify details below app button when it is presented in info. --- .../info/profile/info_profile_actions.cpp | 22 ++++++++++++++----- .../profile/info_profile_inner_widget.cpp | 15 +++++++++++-- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index ced91a9389..64bfff3ec6 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -2076,13 +2076,23 @@ void DetailsFiller::setupMainApp() { }); const auto url = tr::lng_mini_apps_tos_url(tr::now); - Ui::AddDividerText( + const auto divider = Ui::AddDividerText( _wrap, - tr::lng_profile_open_app_about( - lt_terms, - tr::lng_profile_open_app_terms() | Ui::Text::ToLink(url), - Ui::Text::WithEntities) - )->setClickHandlerFilter([=](const auto &...) { + rpl::combine( + tr::lng_profile_open_app_about( + lt_terms, + tr::lng_profile_open_app_terms() | Ui::Text::ToLink(url), + Ui::Text::WithEntities), + user->session().changes().peerFlagsValue( + user, + Data::PeerUpdate::Flag::VerifyInfo) + ) | rpl::map([=](TextWithEntities text, auto) { + if (const auto verify = user->botVerifyDetails()) { + text = text.append(u"\n\n"_q).append(verify->description); + } + return text; + })); + divider->setClickHandlerFilter([=](const auto &...) { UrlClickHandler::Open(url); return false; }); diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp index 2bc119c938..970f4847c8 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp @@ -64,8 +64,16 @@ void AddAboutVerification( } if (!info) { Ui::AddDivider(inner); - } else if (!info->description.empty()) { - Ui::AddDividerText(inner, rpl::single(info->description)); + } else { + auto hasMainApp = false; + if (const auto user = peer->asUser()) { + if (user->botInfo) { + hasMainApp = user->botInfo->hasMainApp; + } + } + if (!hasMainApp && !info->description.empty()) { + Ui::AddDividerText(inner, rpl::single(info->description)); + } } inner->resizeToWidth(inner->width()); }, inner->lifetime()); @@ -166,6 +174,9 @@ object_ptr InnerWidget::setupContent( addAboutVerificationOrDivider(result, rpl::duplicate(showNext)); result->add(std::move(actions)); } + if (!_aboutVerificationAdded) { + AddAboutVerification(result, _peer); + } if (_peer->isChat() || _peer->isMegagroup()) { if (!_peer->isMonoforum()) { setupMembers(result.data(), rpl::duplicate(showNext)); From 4a43dfd0911602f40379a6ea9c22d02711d44791 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 9 Dec 2025 02:19:48 +0300 Subject: [PATCH 011/136] Added profile color support to calls panel. --- Telegram/CMakeLists.txt | 2 + Telegram/SourceFiles/calls/calls_panel.cpp | 37 ++- Telegram/SourceFiles/calls/calls_panel.h | 4 + .../calls/calls_panel_background.cpp | 225 ++++++++++++++++++ .../calls/calls_panel_background.h | 75 ++++++ 5 files changed, 341 insertions(+), 2 deletions(-) create mode 100644 Telegram/SourceFiles/calls/calls_panel_background.cpp create mode 100644 Telegram/SourceFiles/calls/calls_panel_background.h diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 19435203c9..5bf0f0a7b3 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -407,6 +407,8 @@ PRIVATE calls/calls_instance.h calls/calls_panel.cpp calls/calls_panel.h + calls/calls_panel_background.cpp + calls/calls_panel_background.h calls/calls_signal_bars.cpp calls/calls_signal_bars.h calls/calls_top_bar.cpp diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index aef7937de5..6293307ecd 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "calls/calls_panel.h" #include "boxes/peers/replace_boost_box.h" // CreateUserpicsWithMoreBadge +#include "calls/calls_panel_background.h" #include "data/data_photo.h" #include "data/data_session.h" #include "data/data_user.h" @@ -570,6 +571,13 @@ void Panel::reinitWithCall(Call *call) { _user = _call->user(); + _background = std::make_unique( + _user, + [=] { + updateTextColors(); + widget()->update(); + }); + _call->confereceSupportedValue( ) | rpl::start_with_next([=](bool supported) { _conferenceSupported = supported; @@ -763,6 +771,7 @@ void Panel::reinitWithCall(Call *call) { _name->setText(_user->name()); updateStatusText(_call->state()); + updateTextColors(); _answerHangupRedial->raise(); _decline->raise(); @@ -1239,9 +1248,21 @@ void Panel::paint(QRect clip) { if (!_incoming->widget()->isHidden()) { region = region.subtracted(QRegion(_incoming->widget()->geometry())); } - for (const auto &rect : region) { - p.fillRect(rect, st::callBgOpaque); + + if (_background) { + _background->paint( + p, + widget()->size(), + _bodyTop, + _bodySt->photoTop, + _bodySt->photoSize, + region); + } else { + for (const auto &rect : region) { + p.fillRect(rect, st::callBgOpaque); + } } + if (_incoming && _incoming->widget()->isHidden()) { _call->videoIncoming()->markFrameShown(); } @@ -1403,6 +1424,18 @@ void Panel::updateStatusText(State state) { updateStatusGeometry(); } +void Panel::updateTextColors() { + if (!_background) { + _name->setTextColorOverride(std::nullopt); + _status->setTextColorOverride(std::nullopt); + return; + } + _name->setTextColorOverride( + _background->textColorOverride(st::callName.textFg)); + _status->setTextColorOverride( + _background->textColorOverride(st::callStatus.textFg)); +} + void Panel::startDurationUpdateTimer(crl::time currentDuration) { auto msTillNextSecond = 1000 - (currentDuration % 1000); _updateDurationTimer.callOnce(msTillNextSecond + 5); diff --git a/Telegram/SourceFiles/calls/calls_panel.h b/Telegram/SourceFiles/calls/calls_panel.h index bcdf373c42..66716a76be 100644 --- a/Telegram/SourceFiles/calls/calls_panel.h +++ b/Telegram/SourceFiles/calls/calls_panel.h @@ -64,6 +64,7 @@ class Window; class Userpic; class SignalBars; class VideoBubble; +class PanelBackground; struct DeviceSelection; struct ConferencePanelMigration; @@ -140,6 +141,7 @@ private: void stateChanged(State state); void showControls(); void updateStatusText(State state); + void updateTextColors(); void startDurationUpdateTimer(crl::time currentDuration); void setIncomingSize(QSize size); void refreshIncomingGeometry(); @@ -214,6 +216,8 @@ private: rpl::event_stream _startOutgoingRequests; + std::unique_ptr _background; + rpl::lifetime _lifetime; }; diff --git a/Telegram/SourceFiles/calls/calls_panel_background.cpp b/Telegram/SourceFiles/calls/calls_panel_background.cpp new file mode 100644 index 0000000000..a98ab14105 --- /dev/null +++ b/Telegram/SourceFiles/calls/calls_panel_background.cpp @@ -0,0 +1,225 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#include "calls/calls_panel_background.h" + +#include "apiwrap.h" +#include "api/api_peer_colors.h" +#include "data/data_changes.h" +#include "data/data_document.h" +#include "data/data_emoji_statuses.h" +#include "data/data_peer.h" +#include "data/data_session.h" +#include "data/stickers/data_custom_emoji.h" +#include "main/main_session.h" +#include "ui/color_contrast.h" +#include "ui/top_background_gradient.h" +#include "styles/style_calls.h" + +namespace Calls { + +PanelBackground::PanelBackground( + not_null peer, + Fn updateCallback) +: _peer(peer) +, _updateCallback(std::move(updateCallback)) { + updateColors(); + updateEmojiId(); + + _peer->session().changes().peerFlagsValue( + _peer, + Data::PeerUpdate::Flag::ColorProfile + | Data::PeerUpdate::Flag::EmojiStatus + ) | rpl::start_with_next([=] { + updateColors(); + _brushSize = QSize(); + if (_updateCallback) { + _updateCallback(); + } + }, _lifetime); + + _peer->session().changes().peerFlagsValue( + _peer, + Data::PeerUpdate::Flag::BackgroundEmoji + | Data::PeerUpdate::Flag::EmojiStatus + ) | rpl::start_with_next([=] { + updateEmojiId(); + if (_updateCallback) { + _updateCallback(); + } + }, _lifetime); +} + +void PanelBackground::paint( + QPainter &p, + QSize widgetSize, + int bodyTop, + int photoTop, + int photoSize, + const QRegion ®ion) { + if (!_colors || _colors->bg.empty()) { + for (const auto &rect : region) { + p.fillRect(rect, st::callBgOpaque); + } + return; + } + + const auto &colors = _colors->bg; + if (colors.size() == 1) { + for (const auto &rect : region) { + p.fillRect(rect, colors.front()); + } + } else { + const auto center = QPoint( + widgetSize.width() / 2, + bodyTop + photoTop + photoSize / 2); + const auto radius = std::max( + std::hypot(center.x(), center.y()), + std::hypot(widgetSize.width() - center.x(), + widgetSize.height() - center.y())); + if (_brushSize != widgetSize) { + updateBrush(widgetSize, center, radius, colors); + } + for (const auto &rect : region) { + p.fillRect(rect, _brush); + } + } + + const auto emojiId = _currentEmojiId; + if (!emojiId) { + _emoji = nullptr; + _cachedImage = QImage(); + _cachedEmojiId = 0; + return; + } + + const auto userpicX = (widgetSize.width() - photoSize) / 2; + const auto userpicY = bodyTop + photoTop; + const auto padding = photoSize; + const auto patternRect = QRect( + userpicX - padding, + userpicY - padding / 2, + photoSize + padding * 2, + photoSize + padding); + + if (!_emoji + || _emoji->entityData() + != Data::SerializeCustomEmojiId(emojiId)) { + const auto document = _peer->owner().document(emojiId); + _emoji = document->owner().customEmojiManager().create( + document, + [=] { + _cachedImage = QImage(); + if (_updateCallback) { + _updateCallback(); + } + }, + Data::CustomEmojiSizeTag::Large); + _cachedImage = QImage(); + _cachedEmojiId = 0; + } + + if (_emoji && _emoji->ready()) { + if (_cachedImage.isNull() + || _cachedRect != patternRect + || _cachedEmojiId != emojiId) { + renderPattern(patternRect, emojiId); + } + p.drawImage(patternRect, _cachedImage); + } +} + +void PanelBackground::updateBrush( + QSize widgetSize, + QPoint center, + float64 radius, + const std::vector &colors) { + _brushSize = widgetSize; + auto gradient = QRadialGradient(center, radius); + const auto step = 1.0 / (colors.size() - 1); + for (auto i = 0; i < colors.size(); ++i) { + gradient.setColorAt(i * step, colors[colors.size() - 1 - i]); + } + _brush = QBrush(gradient); +} + +void PanelBackground::renderPattern(const QRect &rect, DocumentId emojiId) { + const auto ratio = style::DevicePixelRatio(); + _cachedImage = QImage( + rect.size() * ratio, + QImage::Format_ARGB32_Premultiplied); + _cachedImage.setDevicePixelRatio(ratio); + _cachedImage.fill(Qt::transparent); + + auto painter = QPainter(&_cachedImage); + const auto patternColor = QColor(0, 0, 0, int(0.6 * 255)); + const auto &points = Ui::PatternBgPoints(); + const auto localRect = QRect(QPoint(), rect.size()); + Ui::PaintBgPoints( + painter, + points, + _cache, + _emoji.get(), + patternColor, + localRect, + 1.); + + _cachedRect = rect; + _cachedEmojiId = emojiId; +} + +void PanelBackground::updateColors() { + const auto collectible = _peer->emojiStatusId().collectible; + if (collectible && collectible->centerColor.isValid()) { + _colors = Data::ColorProfileSet{ + .bg = { collectible->edgeColor, collectible->centerColor }, + }; + } else { + _colors = _peer->session().api().peerColors().colorProfileFor(_peer); + } +} + +void PanelBackground::updateEmojiId() { + const auto collectible = _peer->emojiStatusId().collectible; + _currentEmojiId = (collectible && collectible->patternDocumentId) + ? collectible->patternDocumentId + : _peer->profileBackgroundEmojiId(); +} + +std::optional PanelBackground::edgeColor() const { + const auto collectible = _peer->emojiStatusId().collectible; + if (collectible && collectible->edgeColor.isValid()) { + return collectible->edgeColor; + } + if (_colors && !_colors->bg.empty()) { + return _colors->bg.front(); + } + return std::nullopt; +} + +std::optional PanelBackground::textColorOverride( + const style::color &defaultColor) const { + const auto collectible = _peer->emojiStatusId().collectible; + if (collectible && collectible->textColor.isValid()) { + return collectible->textColor; + } + const auto edge = edgeColor(); + if (!edge) { + return std::nullopt; + } + constexpr auto kMinContrast = 5.5; + if (kMinContrast > Ui::CountContrast(defaultColor->c, *edge)) { + return st::groupCallMembersFg->c; + } + return std::nullopt; +} + +rpl::lifetime &PanelBackground::lifetime() { + return _lifetime; +} + +} // namespace Calls diff --git a/Telegram/SourceFiles/calls/calls_panel_background.h b/Telegram/SourceFiles/calls/calls_panel_background.h new file mode 100644 index 0000000000..e4c00770ea --- /dev/null +++ b/Telegram/SourceFiles/calls/calls_panel_background.h @@ -0,0 +1,75 @@ +// This file is part of Desktop App Toolkit, +// a set of libraries for developing nice desktop applications. +// +// For license and copyright information please follow this link: +// https://github.com/desktop-app/legal/blob/master/LEGAL +// +#pragma once + +#include "data/data_peer_colors.h" + +class DocumentData; +class PeerData; + +namespace Data { +class CustomEmoji; +} // namespace Data + +namespace Ui { +namespace Text { +class CustomEmoji; +} // namespace Text +} // namespace Ui + +namespace Calls { + +class PanelBackground final { +public: + explicit PanelBackground( + not_null peer, + Fn updateCallback); + + void paint( + QPainter &p, + QSize widgetSize, + int bodyTop, + int photoTop, + int photoSize, + const QRegion ®ion); + + [[nodiscard]] rpl::lifetime &lifetime(); + + [[nodiscard]] std::optional textColorOverride( + const style::color &defaultColor) const; + +private: + void updateBrush( + QSize widgetSize, + QPoint center, + float64 radius, + const std::vector &colors); + void renderPattern(const QRect &rect, DocumentId emojiId); + void updateColors(); + void updateEmojiId(); + [[nodiscard]] std::optional edgeColor() const; + + const not_null _peer; + const Fn _updateCallback; + + QBrush _brush; + QSize _brushSize; + + std::optional _colors; + + std::unique_ptr _emoji; + base::flat_map _cache; + QImage _cachedImage; + QRect _cachedRect; + DocumentId _cachedEmojiId = 0; + DocumentId _currentEmojiId = 0; + + rpl::lifetime _lifetime; + +}; + +} // namespace Calls From 7ce7b88a40650c87090d820d52aa8e52af6c5b85 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 9 Dec 2025 04:14:10 +0300 Subject: [PATCH 012/136] Implemented adaptive drawing algorithm with smoothing in image editor. - Adaptive point filtering - zoom-based minimum distance (3px / zoom) prevents point overflow during fast movements. - Speed-based pressure simulation - exponential smoothing (decay 0.95) creates variable line thickness: pressure = clamp(1.0 - speed * 0.1). - Two-pass weighted averaging - smoothed = current * 0.5 + neighbors * 0.25 eliminates jagged lines while preserving initial direction. - Incremental rendering with 3-point overlap - draws only new segments, reduces complexity from O(n^2) to O(n). - QPainterPath with quadratic Bezier curves - single fillPath() call instead of multiple drawEllipse(). --- Telegram/SourceFiles/editor/scene/scene.cpp | 1 + .../editor/scene/scene_item_canvas.cpp | 253 ++++++++++++------ .../editor/scene/scene_item_canvas.h | 20 +- 3 files changed, 194 insertions(+), 80 deletions(-) diff --git a/Telegram/SourceFiles/editor/scene/scene.cpp b/Telegram/SourceFiles/editor/scene/scene.cpp index 0ebb29cedd..cd19081b92 100644 --- a/Telegram/SourceFiles/editor/scene/scene.cpp +++ b/Telegram/SourceFiles/editor/scene/scene.cpp @@ -125,6 +125,7 @@ std::shared_ptr Scene::lastZ() const { } void Scene::updateZoom(float64 zoom) { + _canvas->updateZoom(zoom); for (const auto &item : items()) { if (item->type() >= ItemBase::Type) { static_cast(item.get())->updateZoom(zoom); diff --git a/Telegram/SourceFiles/editor/scene/scene_item_canvas.cpp b/Telegram/SourceFiles/editor/scene/scene_item_canvas.cpp index 21b7266f36..be0c24488d 100644 --- a/Telegram/SourceFiles/editor/scene/scene_item_canvas.cpp +++ b/Telegram/SourceFiles/editor/scene/scene_item_canvas.cpp @@ -13,66 +13,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Editor { namespace { -QRectF NormalizedRect(const QPointF& p1, const QPointF& p2) { - return QRectF( - std::min(p1.x(), p2.x()), - std::min(p1.y(), p2.y()), - std::abs(p2.x() - p1.x()) + 1, - std::abs(p2.y() - p1.y()) + 1); -} +constexpr auto kMinPointDistanceBase = 2.0; +constexpr auto kMaxPointDistance = 15.0; +constexpr auto kSmoothingStrength = 0.5; +constexpr auto kPressureDecay = 0.95; +constexpr auto kMinPressure = 0.3; +constexpr auto kBatchUpdateInterval = 16; +constexpr auto kSegmentOverlap = 3; +constexpr auto kHalfStrength = kSmoothingStrength / 2.0; +constexpr auto kInvStrength = 1.0 - kSmoothingStrength; -std::vector InterpolatedPoints( - const QPointF &startPoint, - const QPointF &endPoint) { - std::vector points; - - const auto x1 = startPoint.x(); - const auto y1 = startPoint.y(); - const auto x2 = endPoint.x(); - const auto y2 = endPoint.y(); - - // Difference of x and y values. - const auto dx = x2 - x1; - const auto dy = y2 - y1; - - // Absolute values of differences. - const auto ix = std::abs(dx); - const auto iy = std::abs(dy); - - // Larger of the x and y differences. - const auto inc = ix > iy ? ix : iy; - - // Plot location. - auto plotx = x1; - auto ploty = y1; - - auto x = 0; - auto y = 0; - - points.push_back(QPointF(plotx, ploty)); - - for (auto i = 0; i <= inc; i++) { - const auto xInc = x > inc; - const auto yInc = y > inc; - - x += ix; - y += iy; - - if (xInc) { - x -= inc; - plotx += 1 * ((dx < 0) ? -1 : 1); - } - - if (yInc) { - y -= inc; - ploty += 1 * ((dy < 0) ? -1 : 1); - } - - if (xInc || yInc) { - points.push_back(QPointF(plotx, ploty)); - } - } - return points; +[[nodiscard]] float64 PointDistance(const QPointF &a, const QPointF &b) { + const auto dx = a.x() - b.x(); + const auto dy = a.y() - b.y(); + return std::sqrt(dx * dx + dy * dy); } } // namespace @@ -115,8 +69,7 @@ void ItemCanvas::computeContentRect(const QPointF &p) { _contentRect = QRectF( QPointF( std::clamp(p.x() - _brushMargins.left(), 0., _contentRect.x()), - std::clamp(p.y() - _brushMargins.top(), 0., _contentRect.y()) - ), + std::clamp(p.y() - _brushMargins.top(), 0., _contentRect.y())), QPointF( std::clamp( p.x() + _brushMargins.right(), @@ -125,27 +78,154 @@ void ItemCanvas::computeContentRect(const QPointF &p) { std::clamp( p.y() + _brushMargins.bottom(), _contentRect.y() + _contentRect.height(), - sceneSize.height()) - )); + sceneSize.height()))); } -void ItemCanvas::drawLine( - const QPointF ¤tPoint, - const QPointF &lastPoint) { - const auto halfBrushSize = _brushData.size / 2.; - const auto points = InterpolatedPoints(lastPoint, currentPoint); - - _rectToUpdate |= NormalizedRect(currentPoint, lastPoint) + _brushMargins; - - for (const auto &point : points) { - _p->drawEllipse(point, halfBrushSize, halfBrushSize); +std::vector ItemCanvas::smoothStroke( + const std::vector &points) const { + if (points.size() < 4) { + return points; } + auto result = std::vector(); + result.reserve(points.size()); + result.push_back(points[0]); + result.push_back(points[1]); + for (auto i = 2; i < int(points.size()) - 1; ++i) { + const auto &prev = points[i - 1].pos; + const auto &curr = points[i].pos; + const auto &next = points[i + 1].pos; + const auto smoothed = curr * kInvStrength + + (prev + next) * kHalfStrength; + result.push_back({ + .pos = smoothed, + .pressure = points[i].pressure, + .time = points[i].time, + }); + } + result.push_back(points.back()); + return result; +} + +void ItemCanvas::renderSegment( + const std::vector &points, + int startIdx) { + if (points.size() < 2 || startIdx >= int(points.size()) - 1) { + return; + } + auto path = QPainterPath(); + const auto effectiveStart = std::max(0, startIdx); + path.moveTo(points[effectiveStart].pos); + for (auto i = effectiveStart; i < int(points.size()) - 1; ++i) { + const auto &p0 = points[i].pos; + const auto &p1 = points[i + 1].pos; + const auto ctrl = (p0 + p1) / 2.0; + if (i == effectiveStart) { + path.lineTo(ctrl); + } else { + path.quadTo(p0, ctrl); + } + } + path.lineTo(points.back().pos); + const auto avgPressure = std::accumulate( + points.begin() + std::max(0, startIdx), + points.end(), + 0.0, + [](float64 sum, const StrokePoint &p) { + return sum + p.pressure; + }) / (points.size() - std::max(0, startIdx)); + const auto width = _brushData.size * avgPressure; + auto stroker = QPainterPathStroker(); + stroker.setWidth(width); + stroker.setCapStyle(Qt::RoundCap); + stroker.setJoinStyle(Qt::RoundJoin); + const auto outline = stroker.createStroke(path); + _p->fillPath(outline, _brushData.color); + _rectToUpdate |= outline.boundingRect() + _brushMargins; +} + +void ItemCanvas::drawIncrementalStroke() { + if (_currentStroke.size() < 2) { + return; + } + const auto startIdx = std::max( + 0, + _lastRenderedIndex - kSegmentOverlap); + auto segment = std::vector( + _currentStroke.begin() + startIdx, + _currentStroke.end()); + if (segment.size() < 2) { + return; + } + if (segment.size() >= 4) { + for (auto i = 0; i < 2; ++i) { + segment = smoothStroke(segment); + } + } + renderSegment( + segment, + std::min(kSegmentOverlap, int(segment.size()) - 1)); + _lastRenderedIndex = _currentStroke.size() - kSegmentOverlap; +} + +void ItemCanvas::addStrokePoint(const QPointF &point, int64 time) { + if (!_currentStroke.empty()) { + const auto distance = PointDistance( + point, + _currentStroke.back().pos); + const auto minDistance = kMinPointDistanceBase * std::min(1.0, _zoom); + if (distance < minDistance) { + return; + } + if (distance > kMaxPointDistance) { + const auto steps = int(std::ceil(distance / kMaxPointDistance)); + const auto &lastPos = _currentStroke.back().pos; + const auto &lastPressure = _currentStroke.back().pressure; + for (auto i = 1; i < steps; ++i) { + const auto t = float64(i) / steps; + const auto interpolated = lastPos * (1.0 - t) + point * t; + const auto interpTime = _lastPointTime + + int64((time - _lastPointTime) * t); + _currentStroke.push_back({ + .pos = interpolated, + .pressure = lastPressure, + .time = interpTime, + }); + } + } + } + const auto timeDelta = _lastPointTime + ? (time - _lastPointTime) + : kBatchUpdateInterval; + const auto speed = !_currentStroke.empty() + ? PointDistance(point, _currentStroke.back().pos) / timeDelta + : 0.0; + const auto pressureFromSpeed = std::clamp( + 1.0 - speed * 0.1, + kMinPressure, + 1.0); + const auto pressure = _currentStroke.empty() + ? 1.0 + : _currentStroke.back().pressure * kPressureDecay + + pressureFromSpeed * (1.0 - kPressureDecay); + _currentStroke.push_back({ + .pos = point, + .pressure = pressure, + .time = time, + }); + _lastPointTime = time; + computeContentRect(point); } void ItemCanvas::handleMousePressEvent( not_null e) { _lastPoint = e->scenePos(); - _contentRect = QRectF(_lastPoint, _lastPoint); + _rectToUpdate = QRectF(); + _currentStroke.clear(); + _lastRenderedIndex = 0; + _lastPointTime = 0; + const auto now = crl::now(); + addStrokePoint(_lastPoint, now); + _contentRect = QRectF(_lastPoint, _lastPoint) + _brushMargins; _drawing = true; } @@ -155,10 +235,13 @@ void ItemCanvas::handleMouseMoveEvent( return; } const auto scenePos = e->scenePos(); - drawLine(scenePos, _lastPoint); - update(_rectToUpdate); - computeContentRect(scenePos); + const auto now = crl::now(); + addStrokePoint(scenePos, now); _lastPoint = scenePos; + if (_currentStroke.size() - _lastRenderedIndex >= 3) { + drawIncrementalStroke(); + update(_rectToUpdate); + } } void ItemCanvas::handleMouseReleaseEvent( @@ -167,19 +250,23 @@ void ItemCanvas::handleMouseReleaseEvent( return; } _drawing = false; - + drawIncrementalStroke(); + update(_rectToUpdate); if (_contentRect.isValid()) { const auto scaledContentRect = QRectF( _contentRect.x() * style::DevicePixelRatio(), _contentRect.y() * style::DevicePixelRatio(), _contentRect.width() * style::DevicePixelRatio(), _contentRect.height() * style::DevicePixelRatio()); - _grabContentRequests.fire({ .pixmap = _pixmap.copy(scaledContentRect.toRect()), .position = _contentRect.topLeft(), }); } + _currentStroke.clear(); + _lastRenderedIndex = 0; + _lastPointTime = 0; + _currentPath = QPainterPath(); clearPixmap(); update(); } @@ -211,11 +298,19 @@ bool ItemCanvas::collidesWithPath( void ItemCanvas::cancelDrawing() { _drawing = false; + _currentStroke.clear(); + _lastRenderedIndex = 0; + _lastPointTime = 0; + _currentPath = QPainterPath(); _contentRect = QRectF(); clearPixmap(); update(); } +void ItemCanvas::updateZoom(float64 zoom) { + _zoom = zoom; +} + ItemCanvas::~ItemCanvas() { _hq = nullptr; _p = nullptr; diff --git a/Telegram/SourceFiles/editor/scene/scene_item_canvas.h b/Telegram/SourceFiles/editor/scene/scene_item_canvas.h index d93261dd7b..28380e6114 100644 --- a/Telegram/SourceFiles/editor/scene/scene_item_canvas.h +++ b/Telegram/SourceFiles/editor/scene/scene_item_canvas.h @@ -28,6 +28,7 @@ public: void applyBrush(const QColor &color, float size); void clearPixmap(); void cancelDrawing(); + void updateZoom(float64 zoom); QRectF boundingRect() const override; void paint( @@ -50,10 +51,26 @@ protected: const QPainterPath &, Qt::ItemSelectionMode) const override; private: + struct StrokePoint { + QPointF pos; + float64 pressure = 1.0; + int64 time = 0; + }; + void computeContentRect(const QPointF &p); - void drawLine(const QPointF ¤tPoint, const QPointF &lastPoint); + void addStrokePoint(const QPointF &point, int64 time); + void drawIncrementalStroke(); + std::vector smoothStroke( + const std::vector &points) const; + void renderSegment( + const std::vector &points, + int startIdx); bool _drawing = false; + std::vector _currentStroke; + int _lastRenderedIndex = 0; + float64 _zoom = 1.0; + int64 _lastPointTime = 0; std::unique_ptr _hq; std::unique_ptr _p; @@ -65,6 +82,7 @@ private: QPointF _lastPoint; QPixmap _pixmap; + QPainterPath _currentPath; struct { float size = 1.; From 52d78ef7249c533eb52eb08a27e6fe21b151c6d8 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 9 Dec 2025 11:33:30 +0300 Subject: [PATCH 013/136] Increased round radius for popup menu. --- Telegram/SourceFiles/boxes/choose_filter_box.cpp | 3 ++- Telegram/lib_ui | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/boxes/choose_filter_box.cpp b/Telegram/SourceFiles/boxes/choose_filter_box.cpp index 4cd55628b0..17450b8000 100644 --- a/Telegram/SourceFiles/boxes/choose_filter_box.cpp +++ b/Telegram/SourceFiles/boxes/choose_filter_box.cpp @@ -99,7 +99,8 @@ protected: p.drawImage( width() - size.width() - - st::menuWithIcons.itemPadding.right(), + - st::menuWithIcons.itemPadding.right() + - st::popupMenuWithIcons.shadow.extend.right(), (height() - size.height()) / 2, _icon); } diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 258a928d83..bfca125f40 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 258a928d83c9b69ee2e5ab65a2e1aa4f384d7a46 +Subproject commit bfca125f4053880eecd6faef9a0fe41e32a13b20 From 9fb4f4b5565d6446b43526771a442e9b50b976a2 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 10 Dec 2025 06:49:54 +0300 Subject: [PATCH 014/136] Fixed display of original date with nearest days in self. --- .../history/view/history_view_bottom_info.cpp | 2 +- Telegram/SourceFiles/ui/text/format_values.cpp | 18 +++--------------- Telegram/SourceFiles/ui/text/format_values.h | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp b/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp index 736451e67d..7beea5230d 100644 --- a/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp +++ b/Telegram/SourceFiles/history/view/history_view_bottom_info.cpp @@ -454,7 +454,7 @@ void BottomInfo::layoutDateText() { const auto author = _data.author; const auto prefix = !author.isEmpty() ? u", "_q : QString(); const auto date = edited + ((_data.flags & Data::Flag::ForwardedDate) - ? Ui::FormatDateTimeSavedFrom(_data.date, true) + ? Ui::FormatDateTimeSavedFrom(_data.date) : QLocale().toString(_data.date.time(), QLocale::ShortFormat)); const auto afterAuthor = prefix + date; const auto afterAuthorWidth = st::msgDateFont->width(afterAuthor); diff --git a/Telegram/SourceFiles/ui/text/format_values.cpp b/Telegram/SourceFiles/ui/text/format_values.cpp index 17baeee3f5..7b70065e1f 100644 --- a/Telegram/SourceFiles/ui/text/format_values.cpp +++ b/Telegram/SourceFiles/ui/text/format_values.cpp @@ -103,7 +103,7 @@ QString FormatDateTime(QDateTime date) { } } -QString FormatDateTimeSavedFrom(QDateTime dateTime, bool shortFormat) { +QString FormatDateTimeSavedFrom(QDateTime dateTime) { const auto current = QDate::currentDate(); const auto date = dateTime.date(); const auto timeStr = QLocale().toString( @@ -111,21 +111,9 @@ QString FormatDateTimeSavedFrom(QDateTime dateTime, bool shortFormat) { QLocale::ShortFormat); if (date == current) { - return shortFormat - ? timeStr - : tr::lng_mediaview_date_time( - tr::now, - lt_date, - tr::lng_weekday7(tr::now), - lt_time, - timeStr); + return tr::lng_mediaview_today(tr::now, lt_time, timeStr); } else if (date == current.addDays(-1)) { - return tr::lng_mediaview_date_time( - tr::now, - lt_date, - tr::lng_weekday6(tr::now), - lt_time, - timeStr); + return tr::lng_mediaview_yesterday(tr::now, lt_time, timeStr); } const auto diff = std::abs( base::unixtime::now() - base::unixtime::serialize(dateTime)); diff --git a/Telegram/SourceFiles/ui/text/format_values.h b/Telegram/SourceFiles/ui/text/format_values.h index 129a8fbabf..ae7029e571 100644 --- a/Telegram/SourceFiles/ui/text/format_values.h +++ b/Telegram/SourceFiles/ui/text/format_values.h @@ -19,7 +19,7 @@ inline const QString kCreditsCurrency = u"XTR"_q; [[nodiscard]] QString FormatDownloadText(qint64 ready, qint64 total); [[nodiscard]] QString FormatProgressText(qint64 ready, qint64 total); [[nodiscard]] QString FormatDateTime(QDateTime date); -[[nodiscard]] QString FormatDateTimeSavedFrom(QDateTime date, bool shortDate); +[[nodiscard]] QString FormatDateTimeSavedFrom(QDateTime date); [[nodiscard]] QString FormatDurationText(qint64 duration); [[nodiscard]] QString FormatDurationWords(qint64 duration); [[nodiscard]] QString FormatDurationWordsSlowmode(qint64 duration); From b9a109c1469336431ef0e2131f2f43f61b8ba9c4 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 10 Dec 2025 09:12:06 +0300 Subject: [PATCH 015/136] Added ability to set custom animation duration for MediaPreviewWidget. --- .../SourceFiles/window/window_media_preview.cpp | 14 ++++++++++++-- Telegram/SourceFiles/window/window_media_preview.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/window/window_media_preview.cpp b/Telegram/SourceFiles/window/window_media_preview.cpp index 1a1c3e16b3..e71e98aac1 100644 --- a/Telegram/SourceFiles/window/window_media_preview.cpp +++ b/Telegram/SourceFiles/window/window_media_preview.cpp @@ -243,7 +243,10 @@ void MediaPreviewWidget::startShow() { Window::GifPauseReason::MediaPreview); } _hiding = false; - _a_shown.start([=] { update(); }, 0., 1., st::stickerPreviewDuration); + const auto duration = _customDuration + ? _customDuration + : st::stickerPreviewDuration; + _a_shown.start([=] { update(); }, 0., 1., duration); } else { update(); } @@ -257,7 +260,10 @@ void MediaPreviewWidget::hidePreview() { _cache = currentImage(); } _hiding = true; - _a_shown.start([=] { update(); }, 1., 0., st::stickerPreviewDuration); + const auto duration = _customDuration + ? _customDuration + : st::stickerPreviewDuration; + _a_shown.start([=] { update(); }, 1., 0., duration); _photo = nullptr; _photoMedia = nullptr; _document = nullptr; @@ -309,6 +315,10 @@ void MediaPreviewWidget::setCustomRadius(int radius) { update(); } +void MediaPreviewWidget::setCustomDuration(crl::time duration) { + _customDuration = duration; +} + QSize MediaPreviewWidget::currentDimensions() const { if (!_cachedSize.isEmpty()) { return _cachedSize; diff --git a/Telegram/SourceFiles/window/window_media_preview.h b/Telegram/SourceFiles/window/window_media_preview.h index f1b5eeacbc..5927cd6071 100644 --- a/Telegram/SourceFiles/window/window_media_preview.h +++ b/Telegram/SourceFiles/window/window_media_preview.h @@ -41,6 +41,7 @@ public: void setCustomPadding(const QMargins &padding = QMargins()); void setBackgroundMargins(const QMargins &margins = QMargins()); void setCustomRadius(int radius); + void setCustomDuration(crl::time duration); ~MediaPreviewWidget(); @@ -93,6 +94,7 @@ private: QMargins _customPadding; QMargins _backgroundMargins; int _customRadius = 0; + crl::time _customDuration = 0; }; From 7f586507942ca7d928927b2269ea96899fe2f884 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 10 Dec 2025 08:12:05 +0300 Subject: [PATCH 016/136] Added preview of reaction to posts on right click. --- Telegram/CMakeLists.txt | 2 + .../history/history_inner_widget.cpp | 6 + .../view/history_view_reaction_preview.cpp | 164 ++++++++++++++++++ .../view/history_view_reaction_preview.h | 25 +++ 4 files changed, 197 insertions(+) create mode 100644 Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp create mode 100644 Telegram/SourceFiles/history/view/history_view_reaction_preview.h diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 5bf0f0a7b3..7b609c610d 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -924,6 +924,8 @@ PRIVATE history/view/history_view_pinned_tracker.h history/view/history_view_quick_action.cpp history/view/history_view_quick_action.h + history/view/history_view_reaction_preview.cpp + history/view/history_view_reaction_preview.h history/view/history_view_reply.cpp history/view/history_view_reply.h history/view/history_view_requests_bar.cpp diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 567ef58189..560d757b8e 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/view/history_view_service_message.h" #include "history/view/history_view_cursor_state.h" #include "history/view/history_view_context_menu.h" +#include "history/view/history_view_reaction_preview.h" #include "history/view/history_view_quick_action.h" #include "history/view/history_view_emoji_interactions.h" #include "history/history_item_components.h" @@ -2373,6 +2374,11 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { _whoReactedMenuLifetime); e->accept(); return; + } else if (HistoryView::ShowReactionPreview( + _controller, + leaderOrSelf->fullId(), + clickedReaction)) { + return; } } if (!linkPhoneNumber.isEmpty()) { diff --git a/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp b/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp new file mode 100644 index 0000000000..5bb2faa6c3 --- /dev/null +++ b/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp @@ -0,0 +1,164 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#include "history/view/history_view_reaction_preview.h" + +#include "base/call_delayed.h" +#include "boxes/sticker_set_box.h" +#include "data/data_document.h" +#include "data/data_message_reactions.h" +#include "data/data_session.h" +#include "data/stickers/data_custom_emoji.h" +#include "lang/lang_keys.h" +#include "main/main_session.h" +#include "mainwindow.h" +#include "ui/cached_special_layer_shadow_corners.h" +#include "ui/effects/show_animation.h" +#include "ui/widgets/buttons.h" +#include "ui/widgets/labels.h" +#include "ui/widgets/shadow.h" +#include "ui/painter.h" +#include "ui/rect.h" +#include "ui/text/text_utilities.h" +#include "window/window_media_preview.h" +#include "window/window_session_controller.h" +#include "styles/style_chat.h" +#include "styles/style_layers.h" + +namespace HistoryView { + +bool ShowReactionPreview( + not_null controller, + FullMsgId origin, + Data::ReactionId reactionId) { + auto document = (DocumentData*)(nullptr); + if (const auto custom = reactionId.custom()) { + document = controller->session().data().document(custom); + } else if (const auto resolved + = controller->session().data().reactions().lookupTemporary( + reactionId)) { + document = resolved->selectAnimation; + } + if (!document) { + return false; + } + struct State { + base::unique_qptr mediaPreview; + base::unique_qptr clickable; + base::unique_qptr background; + base::unique_qptr label; + }; + const auto state = std::make_shared(); + + const auto mainwidget = controller->widget(); + state->mediaPreview = base::make_unique_q( + mainwidget, + controller); + state->mediaPreview->setCustomDuration(st::defaultToggle.duration); + state->clickable = base::make_unique_q(mainwidget); + const auto hideAll = [=] { + state->clickable->setAttribute(Qt::WA_TransparentForMouseEvents); + state->mediaPreview->hidePreview(); + if (state->label && state->background) { + Ui::Animations::HideWidgets({ + state->background.get(), + state->label.get(), + }); + } + base::call_delayed( + st::defaultToggle.duration, + crl::guard(state->clickable.get(), [=] { + state->clickable.reset(); + })); + }; + state->clickable->setClickedCallback(hideAll); + state->mediaPreview->showPreview(origin, document); + state->clickable->show(); + const auto mediaPreviewRaw = state->mediaPreview.get(); + const auto clickableRaw = state->clickable.get(); + const auto shadowExtend = st::boxRoundShadow.extend; + + if (reactionId.custom() && document->sticker()) { + const auto setId = document->sticker()->set; + const auto packName + = document->owner().customEmojiManager().lookupSetName(setId.id); + if (!packName.isEmpty()) { + state->background = base::make_unique_q( + mainwidget); + const auto show = controller->uiShow(); + state->background->setClickedCallback([=] { + hideAll(); + show->show(Box( + show, + setId, + Data::StickersType::Emoji)); + }); + state->label = base::make_unique_q( + state->background.get(), + tr::lng_context_animated_reaction( + lt_name, + rpl::single(Ui::Text::Colorized(packName)), + Ui::Text::RichLangValue)); + state->label->setAttribute(Qt::WA_TransparentForMouseEvents); + const auto backgroundRaw = state->background.get(); + const auto labelRaw = state->label.get(); + + backgroundRaw->paintOn([=](QPainter &p) { + const auto innerRect = backgroundRaw->rect() - shadowExtend; + Ui::Shadow::paint( + p, + innerRect, + backgroundRaw->width(), + st::boxRoundShadow, + Ui::SpecialLayerShadowCorners(), + RectPart::Full); + auto hq = PainterHighQualityEnabler(p); + p.setPen(Qt::NoPen); + p.setBrush(st::windowBg); + p.drawRoundedRect( + innerRect, + st::boxRadius, + st::boxRadius); + }); + + labelRaw->show(); + Ui::Animations::ShowWidgets({ backgroundRaw }); + } + } + const auto backgroundRaw = state->background.get(); + const auto labelRaw = state->label.get(); + + mainwidget->sizeValue() | rpl::start_with_next([=](QSize size) { + mediaPreviewRaw->setGeometry(Rect(size)); + clickableRaw->setGeometry(Rect(size)); + clickableRaw->raise(); + + if (backgroundRaw && labelRaw) { + const auto maxLabelWidth = labelRaw->textMaxWidth() / 2; + labelRaw->resizeToWidth(maxLabelWidth); + const auto labelHeight = labelRaw->height() * 2; + const auto padding = st::msgServicePadding; + const auto innerWidth = maxLabelWidth + rect::m::sum::h(padding); + const auto innerHeight = labelHeight + rect::m::sum::v(padding); + const auto bgWidth = innerWidth + rect::m::sum::h(shadowExtend); + const auto bgHeight = innerHeight + rect::m::sum::v(shadowExtend); + const auto bgX = (size.width() - bgWidth) / 2; + const auto bgY = (size.height() * 3 / 4) - (bgHeight / 2); + + backgroundRaw->setGeometry(bgX, bgY, bgWidth, bgHeight); + labelRaw->setGeometry( + shadowExtend.left() + padding.left(), + shadowExtend.top() + padding.top(), + maxLabelWidth, + labelHeight); + backgroundRaw->raise(); + } + }, mediaPreviewRaw->lifetime()); + return true; +} + +} // namespace HistoryView diff --git a/Telegram/SourceFiles/history/view/history_view_reaction_preview.h b/Telegram/SourceFiles/history/view/history_view_reaction_preview.h new file mode 100644 index 0000000000..daf6664ccb --- /dev/null +++ b/Telegram/SourceFiles/history/view/history_view_reaction_preview.h @@ -0,0 +1,25 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +namespace Data { +struct ReactionId; +} // namespace Data + +namespace Window { +class SessionController; +} // namespace Window + +namespace HistoryView { + +[[nodiscard]] bool ShowReactionPreview( + not_null controller, + FullMsgId origin, + Data::ReactionId reactionId); + +} // namespace HistoryView From 2f528a98530ae3bad31792d533f19e84bee28a26 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Dec 2025 12:09:06 +0400 Subject: [PATCH 017/136] Fix seconds phrase for auctions. --- Telegram/Resources/langs/lang.strings | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index d011499ed3..f0cb8cddb7 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -4094,8 +4094,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_auction_rounds_label" = "Rounds"; "lng_auction_rounds_exact" = "Round {n}"; "lng_auction_rounds_range" = "Rounds {n}-{last}"; -"lng_auction_rounds_seconds#one" = "{count} minute each"; -"lng_auction_rounds_seconds#other" = "{count} minutes each"; +"lng_auction_rounds_seconds#one" = "{count} second each"; +"lng_auction_rounds_seconds#other" = "{count} seconds each"; "lng_auction_rounds_minutes#one" = "{count} minute each"; "lng_auction_rounds_minutes#other" = "{count} minutes each"; "lng_auction_rounds_hours#one" = "{count} hour each"; From 924e9a21b5b2b47164c23c25bd9bd14affbb0472 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Dec 2025 12:30:42 +0400 Subject: [PATCH 018/136] Don't offer View Profile / Send Message in private chat. --- Telegram/SourceFiles/history/history_widget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 6ffd509a83..9737f0aec4 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -8852,6 +8852,10 @@ void HistoryWidget::editMessage( void HistoryWidget::fillSenderUserpicMenu( not_null menu, not_null peer) { + if (!_peer || _peer->isUser()) { + // No need to offer View Profile / Send Message in private chat. + return; + } const auto inGroup = _peer && (_peer->isChat() || _peer->isMegagroup()); Window::FillSenderUserpicMenu( controller(), From 506c8ff73c938572930d0452b7767eb79e8c228e Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Dec 2025 13:38:54 +0400 Subject: [PATCH 019/136] Don't show upgrade costs for free upgrades. --- Telegram/SourceFiles/boxes/star_gift_box.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index dab64bf0c8..8469352336 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -4371,6 +4371,7 @@ void UpgradeBox( && !args.giftPrepayUpgradeHash.isEmpty(); const auto preview = !args.savedId && !gifting; const auto showPrices = !preview + && (args.cost > 0) && (args.prices.size() > 1) && (args.nextPrices.size() > 1); auto prices = args.prices; From 10d5cc0d24b3c7301d0c923b3043f79d2735365e Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Dec 2025 14:10:55 +0400 Subject: [PATCH 020/136] Fix appConfig refresh on DC change. --- Telegram/SourceFiles/main/main_app_config.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Telegram/SourceFiles/main/main_app_config.cpp b/Telegram/SourceFiles/main/main_app_config.cpp index 02deb2d55a..e8a2de5cc4 100644 --- a/Telegram/SourceFiles/main/main_app_config.cpp +++ b/Telegram/SourceFiles/main/main_app_config.cpp @@ -39,6 +39,7 @@ void AppConfig::start() { _account->mtpMainSessionValue( ) | rpl::start_with_next([=](not_null instance) { _api.emplace(instance); + _requestId = 0; refresh(); _frozenTrackLifetime = instance->frozenErrorReceived( From 03e1e5cca9bf6868e94af5c5147fb0fc8107f985 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Dec 2025 14:26:09 +0400 Subject: [PATCH 021/136] Fix login with passkey link display. --- Telegram/SourceFiles/intro/intro_qr.cpp | 61 +++++++++++++++---------- Telegram/SourceFiles/intro/intro_qr.h | 2 +- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/Telegram/SourceFiles/intro/intro_qr.cpp b/Telegram/SourceFiles/intro/intro_qr.cpp index 47b054b012..57f8d8af0a 100644 --- a/Telegram/SourceFiles/intro/intro_qr.cpp +++ b/Telegram/SourceFiles/intro/intro_qr.cpp @@ -211,7 +211,12 @@ QrWidget::QrWidget( refreshCode(); }, lifetime()); - _passkeyPossible = account->appConfig().settingsDisplayPasskeys(); + account->appConfig().value( + ) | rpl::filter([=] { + return !_passkey; + }) | rpl::start_with_next([=] { + setupPasskeyLink(); + }, lifetime()); } QString QrWidget::accessibilityName() { @@ -336,42 +341,51 @@ void QrWidget::setupControls() { _skip = Ui::CreateChild( this, tr::lng_intro_qr_phone(tr::now)); - if (Platform::WebAuthn::IsSupported() && _passkeyPossible) { - _passkey = Ui::CreateChild( - this, - tr::lng_intro_qr_passkey(tr::now)); - } rpl::combine( sizeValue(), - _skip->widthValue(), - _passkey ? _passkey->widthValue() : rpl::single(0) - ) | rpl::start_with_next([=]( - QSize size, - int skipWidth, - int passkeyWidth) { + _skip->widthValue() + ) | rpl::start_with_next([=](QSize size, int skipWidth) { _skip->moveToLeft( (size.width() - skipWidth) / 2, contentTop() + st::introQrSkipTop); - if (_passkey) { - _passkey->moveToLeft( - (size.width() - passkeyWidth) / 2, - contentTop() - + st::introQrSkipTop + 1.5 * st::normalFont->height); - } }, _skip->lifetime()); _skip->setClickedCallback([=] { submit(); }); - if (_passkey) { - _passkey->setClickedCallback([=] { +} + +void QrWidget::setupPasskeyLink() { + Expects(!_passkey); + + if (!account().appConfig().settingsDisplayPasskeys() + || !Platform::WebAuthn::IsSupported()) { + return; + } + _passkey = Ui::CreateChild( + this, + tr::lng_intro_qr_passkey(tr::now)); + _passkey->show(); + rpl::combine( + sizeValue(), + _passkey->widthValue() + ) | rpl::start_with_next([=](QSize size, int passkeyWidth) { + _passkey->moveToLeft( + (size.width() - passkeyWidth) / 2, + (contentTop() + + st::introQrSkipTop + + 1.5 * st::normalFont->height)); + }, _passkey->lifetime()); + + _passkey->setClickedCallback([=] { const auto initialDc = api().instance().mainDcId(); ::Data::InitPasskeyLogin(api(), [=]( - const ::Data::Passkey::LoginData &loginData) { + const ::Data::Passkey::LoginData &loginData) { Platform::WebAuthn::Login(loginData, [=]( Platform::WebAuthn::LoginResult result) { if (result.userHandle.isEmpty()) { using Error = Platform::WebAuthn::Error; if (result.error == Error::UnsignedBuild) { - showError(tr::lng_settings_passkeys_unsigned_error()); + showError( + tr::lng_settings_passkeys_unsigned_error()); } return; } @@ -387,10 +401,9 @@ void QrWidget::setupControls() { showError(rpl::single(error)); } }); - }); }); }); - } + }); } void QrWidget::refreshCode() { diff --git a/Telegram/SourceFiles/intro/intro_qr.h b/Telegram/SourceFiles/intro/intro_qr.h index 4b5a56a4d1..ec9ea3e9f6 100644 --- a/Telegram/SourceFiles/intro/intro_qr.h +++ b/Telegram/SourceFiles/intro/intro_qr.h @@ -43,6 +43,7 @@ private: void sendCheckPasswordRequest(); void setupControls(); + void setupPasskeyLink(); void refreshCode(); void checkForTokenUpdate(const MTPUpdates &updates); void checkForTokenUpdate(const MTPUpdate &update); @@ -58,7 +59,6 @@ private: base::Timer _refreshTimer; mtpRequestId _requestId = 0; bool _forceRefresh = false; - bool _passkeyPossible = false; }; From 03df5b85463282dad04f47ab1ee2b75294d6344a Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Dec 2025 14:27:05 +0400 Subject: [PATCH 022/136] rpl::type_erased() -> rpl::type_erased. --- Telegram/SourceFiles/api/api_blocked_peers.cpp | 2 +- Telegram/SourceFiles/api/api_cloud_password.cpp | 2 +- Telegram/SourceFiles/apiwrap.cpp | 2 +- Telegram/SourceFiles/boxes/gift_premium_box.cpp | 2 +- Telegram/SourceFiles/boxes/language_box.cpp | 4 ++-- .../SourceFiles/boxes/moderate_messages_box.cpp | 4 ++-- .../SourceFiles/boxes/peers/edit_contact_box.cpp | 2 +- .../SourceFiles/boxes/peers/edit_peer_info_box.cpp | 4 ++-- .../boxes/peers/prepare_short_info_box.cpp | 2 +- Telegram/SourceFiles/boxes/share_box.cpp | 4 ++-- .../SourceFiles/boxes/star_gift_auction_box.cpp | 2 +- Telegram/SourceFiles/calls/calls_top_bar.cpp | 6 +++--- .../calls/group/calls_group_members.cpp | 14 +++++++------- .../group/ui/calls_group_scheduled_labels.cpp | 8 ++++---- .../SourceFiles/chat_helpers/tabbed_selector.cpp | 4 ++-- Telegram/SourceFiles/data/data_channel.cpp | 2 +- Telegram/SourceFiles/data/data_peer.h | 2 +- Telegram/SourceFiles/data/data_peer_values.cpp | 4 ++-- .../SourceFiles/dialogs/dialogs_inner_widget.cpp | 4 ++-- Telegram/SourceFiles/editor/editor_paint.cpp | 2 +- .../export/view/export_view_progress.cpp | 2 +- .../SourceFiles/history/history_inner_widget.cpp | 2 +- Telegram/SourceFiles/history/history_item.cpp | 2 +- .../controls/history_view_compose_controls.cpp | 2 +- .../history/view/history_view_chat_section.cpp | 4 ++-- .../history/view/history_view_contact_status.cpp | 6 +++--- .../history/view/history_view_group_call_bar.cpp | 2 +- .../view/history_view_scheduled_section.cpp | 4 ++-- .../view/history_view_translate_tracker.cpp | 2 +- .../bot/starref/info_bot_starref_join_widget.cpp | 2 +- .../bot/starref/info_bot_starref_setup_widget.cpp | 2 +- .../boosts/create_giveaway_box.cpp | 14 +++++++------- .../earn/info_channel_earn_list.cpp | 2 +- .../SourceFiles/info/media/info_media_provider.cpp | 2 +- .../info/peer_gifts/info_peer_gifts_common.cpp | 6 +++--- .../info/profile/info_profile_actions.cpp | 2 +- .../info/profile/info_profile_top_bar.cpp | 2 +- .../info/profile/info_profile_values.cpp | 8 ++++---- .../info/saved/info_saved_music_common.cpp | 2 +- .../media/stories/media_stories_reply.cpp | 2 +- .../media/stories/media_stories_stealth.cpp | 2 +- .../streaming/media_streaming_video_track.cpp | 6 +++--- .../passport/passport_panel_controller.cpp | 2 +- .../payments/ui/payments_reaction_box.cpp | 4 ++-- Telegram/SourceFiles/platform/linux/tray_linux.cpp | 2 +- .../SourceFiles/settings/settings_business.cpp | 2 +- Telegram/SourceFiles/settings/settings_credits.cpp | 2 +- Telegram/SourceFiles/settings/settings_premium.cpp | 2 +- Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp | 4 ++-- Telegram/SourceFiles/ui/controls/stars_rating.cpp | 4 ++-- .../ui/widgets/expandable_peer_list.cpp | 2 +- Telegram/SourceFiles/window/window_main_menu.cpp | 2 +- .../window/window_session_controller.cpp | 2 +- Telegram/lib_rpl | 2 +- Telegram/lib_ui | 2 +- 55 files changed, 93 insertions(+), 93 deletions(-) diff --git a/Telegram/SourceFiles/api/api_blocked_peers.cpp b/Telegram/SourceFiles/api/api_blocked_peers.cpp index 0a79eb733b..ca8c953ec1 100644 --- a/Telegram/SourceFiles/api/api_blocked_peers.cpp +++ b/Telegram/SourceFiles/api/api_blocked_peers.cpp @@ -204,7 +204,7 @@ auto BlockedPeers::slice() -> rpl::producer { } return _slice ? _changes.events_starting_with_copy(*_slice) - : (_changes.events() | rpl::type_erased()); + : (_changes.events() | rpl::type_erased); } void BlockedPeers::request(int offset, Fn done) { diff --git a/Telegram/SourceFiles/api/api_cloud_password.cpp b/Telegram/SourceFiles/api/api_cloud_password.cpp index c87b9fc15f..359e9ad08f 100644 --- a/Telegram/SourceFiles/api/api_cloud_password.cpp +++ b/Telegram/SourceFiles/api/api_cloud_password.cpp @@ -68,7 +68,7 @@ void CloudPassword::clearUnconfirmedPassword() { rpl::producer CloudPassword::state() const { return _state ? _stateChanges.events_starting_with_copy(*_state) - : (_stateChanges.events() | rpl::type_erased()); + : (_stateChanges.events() | rpl::type_erased); } auto CloudPassword::stateCurrent() const diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 122f851d1f..08f8364162 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -4776,7 +4776,7 @@ rpl::producer ApiWrap::contactSignupSilent() const { return _contactSignupSilent ? _contactSignupSilentChanges.events_starting_with_copy( *_contactSignupSilent) - : (_contactSignupSilentChanges.events() | rpl::type_erased()); + : (_contactSignupSilentChanges.events() | rpl::type_erased); } std::optional ApiWrap::contactSignupSilentCurrent() const { diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 8ed8781e1a..7de7888ad7 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -459,7 +459,7 @@ void AddTable( ? tr::lng_gift_link_reason_giveaway : tr::lng_gift_link_reason_unclaimed)( Ui::Text::WithEntities - ) | rpl::type_erased()) + ) | rpl::type_erased) : tr::lng_gift_link_reason_chosen(Ui::Text::WithEntities))); reason->setClickHandlerFilter([=](const auto &...) { if (const auto window = show->resolveWindow()) { diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index b8a917316f..4efbef7503 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -1048,7 +1048,7 @@ void Content::setupContent( }; _activations = [=] { if (!main && !other) { - return rpl::never() | rpl::type_erased(); + return rpl::never() | rpl::type_erased; } else if (!main) { return other->activations(); } else if (!other) { @@ -1057,7 +1057,7 @@ void Content::setupContent( return rpl::merge( main->activations(), other->activations() - ) | rpl::type_erased(); + ) | rpl::type_erased; }; _changeChosen = [=](const QString &chosen) { if (main) { diff --git a/Telegram/SourceFiles/boxes/moderate_messages_box.cpp b/Telegram/SourceFiles/boxes/moderate_messages_box.cpp index ec249bf5ef..6ac54d7f7e 100644 --- a/Telegram/SourceFiles/boxes/moderate_messages_box.cpp +++ b/Telegram/SourceFiles/boxes/moderate_messages_box.cpp @@ -386,7 +386,7 @@ void CreateModerateMessagesBox( rpl::conditional( (ownedWrap ? ownedWrap->toggledValue() - : rpl::single(false) | rpl::type_erased()), + : rpl::single(false) | rpl::type_erased), tr::lng_restrict_user( lt_count, rpl::single(participants.size()) | tr::to_count()), @@ -627,7 +627,7 @@ void DeleteChatBox(not_null box, not_null peer) { ? tr::lng_profile_delete_conversation() | Ui::Text::ToBold() : rpl::single( userpicPeer->name() - ) | Ui::Text::ToBold() | rpl::type_erased(), + ) | Ui::Text::ToBold() | rpl::type_erased, box->getDelegate()->style().title)); Ui::AddSkip(container); diff --git a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp index a55c575100..7c908edf5c 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp @@ -496,7 +496,7 @@ void Controller::setupPhotoButtons() { })) | rpl::map([=](const QString &text) { return text.isEmpty() ? Ui::kQEllipsis : text; }) - : rpl::single(_user->shortName()) | rpl::type_erased(); + : rpl::single(_user->shortName()) | rpl::type_erased; const auto inner = _box->verticalLayout(); Ui::AddSkip(inner); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index 74bbfab03b..f0f2c92411 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -1069,13 +1069,13 @@ void Controller::fillDiscussionLinkButton() { ? _discussionLinkUpdates.events( ) | rpl::map([](ChannelData *chat) { return chat ? chat->name() : QString(); - }) | rpl::type_erased() + }) | rpl::type_erased : rpl::combine( tr::lng_manage_discussion_group_add(), _discussionLinkUpdates.events() ) | rpl::map([=](const QString &add, ChannelData *chat) { return chat ? chat->name() : add; - }) | rpl::type_erased(); + }) | rpl::type_erased; AddButtonWithText( _controls.buttonsLayout, std::move(text), diff --git a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp index 3525db6611..8b7898e8c0 100644 --- a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp @@ -556,7 +556,7 @@ PreparedShortInfoUserpic PrepareShortInfoFallbackUserpic( 1, 1, 1)) - : (rpl::never() | rpl::type_erased()); + : (rpl::never() | rpl::type_erased); auto process = [=](not_null state) { if (photoId) { ProcessFullPhoto(peer, state, peer->owner().photo(*photoId)); diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index cd3274b6b3..00568e0616 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -238,7 +238,7 @@ void ShareBox::prepareCommentField() { _comment->heightValue(), (_bottomWidget ? _bottomWidget->heightValue() - : (rpl::single(0) | rpl::type_erased())) + : (rpl::single(0) | rpl::type_erased)) ) | rpl::start_with_next([=](int height, int comment, int bottom) { _comment->moveToLeft(0, height - bottom - comment); if (_bottomWidget) { @@ -323,7 +323,7 @@ void ShareBox::prepare() { _comment->heightValue(), (_bottomWidget ? _bottomWidget->heightValue() - : rpl::single(0) | rpl::type_erased()) + : rpl::single(0) | rpl::type_erased) ) | rpl::start_with_next([=] { updateScrollSkips(); }, _comment->lifetime()); diff --git a/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp b/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp index 0b553a0b8c..88b6cf3eb8 100644 --- a/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp @@ -996,7 +996,7 @@ void AuctionBidBox(not_null box, AuctionBidBoxArgs &&args) { const auto preview = (now.startDate > base::unixtime::now()); const auto name = now.gift->resellTitle; state->finished = now.finished() - ? (rpl::single(true) | rpl::type_erased()) + ? (rpl::single(true) | rpl::type_erased) : (MinutesLeftTillValue(now.endDate) | rpl::map(!rpl::mappers::_1)); const auto date = [&](TimeId time) { diff --git a/Telegram/SourceFiles/calls/calls_top_bar.cpp b/Telegram/SourceFiles/calls/calls_top_bar.cpp index 75cf5fd3d0..74baba438f 100644 --- a/Telegram/SourceFiles/calls/calls_top_bar.cpp +++ b/Telegram/SourceFiles/calls/calls_top_bar.cpp @@ -319,12 +319,12 @@ void TopBar::initControls() { _call->mutedValue() | rpl::map(mapToState), rpl::single(GroupCall::InstanceState::Connected), rpl::single(TimeId(0)) - ) | rpl::type_erased() + ) | rpl::type_erased : rpl::combine( (_groupCall->mutedValue() | MapPushToTalkToActive() | rpl::distinct_until_changed() - | rpl::type_erased()), + | rpl::type_erased), rpl::single( _groupCall->instanceState() ) | rpl::then(_groupCall->instanceStateValue() | rpl::filter( @@ -584,7 +584,7 @@ void TopBar::subscribeToMembersChanges(not_null call) { const auto group = _groupCall.get(); const auto conference = group && group->conference(); auto realValue = conference - ? (rpl::single(group->sharedCall().get()) | rpl::type_erased()) + ? (rpl::single(group->sharedCall().get()) | rpl::type_erased) : peer->session().changes().peerFlagsValue( peer, Data::PeerUpdate::Flag::GroupCall diff --git a/Telegram/SourceFiles/calls/group/calls_group_members.cpp b/Telegram/SourceFiles/calls/group/calls_group_members.cpp index 41da9b5483..7a04d1a7b9 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_members.cpp @@ -1587,7 +1587,7 @@ void Members::Controller::addMuteActionsToContextMenu( || (muteState == Row::State::RaisedHand); const auto mutedByMe = row->mutedByMe(); - auto mutesFromVolume = rpl::never() | rpl::type_erased(); + auto mutesFromVolume = rpl::never() | rpl::type_erased; const auto addVolumeItem = (!muted || isMe(participantPeer)); if (addVolumeItem) { @@ -1825,24 +1825,24 @@ void Members::setupAddMember(not_null call) { const auto conference = call->conference(); const auto canAddByPeer = [=](not_null peer) { if (conference) { - return rpl::single(true) | rpl::type_erased(); + return rpl::single(true) | rpl::type_erased; } else if (peer->isBroadcast()) { - return rpl::single(false) | rpl::type_erased(); + return rpl::single(false) | rpl::type_erased; } return rpl::combine( Data::CanSendValue(peer, ChatRestriction::SendOther, false), _call->joinAsValue() ) | rpl::map([=](bool can, not_null joinAs) { return can && joinAs->isSelf(); - }) | rpl::type_erased(); + }) | rpl::type_erased; }; const auto canInviteByLinkByPeer = [=](not_null peer) { if (conference) { - return rpl::single(true) | rpl::type_erased(); + return rpl::single(true) | rpl::type_erased; } const auto channel = peer->asChannel(); if (!channel) { - return rpl::single(false) | rpl::type_erased(); + return rpl::single(false) | rpl::type_erased; } return rpl::single( false @@ -1851,7 +1851,7 @@ void Members::setupAddMember(not_null call) { return Data::PeerFlagValue( channel, ChannelDataFlag::Username); - }) | rpl::flatten_latest()) | rpl::type_erased(); + }) | rpl::flatten_latest()) | rpl::type_erased; }; _canAddMembers = canAddByPeer(peer); _canInviteByLink = canInviteByLinkByPeer(peer); diff --git a/Telegram/SourceFiles/calls/group/ui/calls_group_scheduled_labels.cpp b/Telegram/SourceFiles/calls/group/ui/calls_group_scheduled_labels.cpp index 708cf3cdeb..3398089b62 100644 --- a/Telegram/SourceFiles/calls/group/ui/calls_group_scheduled_labels.cpp +++ b/Telegram/SourceFiles/calls/group/ui/calls_group_scheduled_labels.cpp @@ -42,7 +42,7 @@ rpl::producer StartsWhenText(rpl::producer date) { rpl::single(langDayOfMonthFull(dateDay.date())), lt_time, rpl::single(time) - ) | rpl::type_erased(); + ) | rpl::type_erased; auto tomorrow = tr::lng_group_call_starts_short_tomorrow( lt_time, rpl::single(time)); @@ -56,7 +56,7 @@ rpl::producer StartsWhenText(rpl::producer date) { std::min(tillAfter, kDay) * crl::time(1000) ) | rpl::map([=] { return rpl::duplicate(exact); - })) | rpl::flatten_latest() | rpl::type_erased(); + })) | rpl::flatten_latest() | rpl::type_erased; auto tomorrowAndAfter = rpl::single( std::move(tomorrow) @@ -64,7 +64,7 @@ rpl::producer StartsWhenText(rpl::producer date) { std::min(tillToday, kDay) * crl::time(1000) ) | rpl::map([=] { return rpl::duplicate(todayAndAfter); - })) | rpl::flatten_latest() | rpl::type_erased(); + })) | rpl::flatten_latest() | rpl::type_erased; auto full = rpl::single( rpl::duplicate(exact) @@ -72,7 +72,7 @@ rpl::producer StartsWhenText(rpl::producer date) { tillTomorrow * crl::time(1000) ) | rpl::map([=] { return rpl::duplicate(tomorrowAndAfter); - })) | rpl::flatten_latest() | rpl::type_erased(); + })) | rpl::flatten_latest() | rpl::type_erased; if (tillTomorrow > 0) { return full; diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index 25505715bf..a576c6f040 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -458,7 +458,7 @@ TabbedSelector::TabbedSelector( rpl::merge( (hasStickersTab() ? stickers()->scrollUpdated() | rpl::map_to(0) - : rpl::never() | rpl::type_erased()), + : rpl::never() | rpl::type_erased), _scroll->scrollTopChanges() ) | rpl::start_with_next([=] { handleScroll(); @@ -709,7 +709,7 @@ rpl::producer TabbedSelector::customEmojiChosen() const { rpl::producer TabbedSelector::fileChosen() const { auto never = rpl::never( - ) | rpl::type_erased(); + ) | rpl::type_erased; return rpl::merge( hasStickersTab() ? stickers()->chosen() : never, hasGifsTab() ? gifs()->fileChosen() : never, diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index 5306f059e2..b8cd47c2a0 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -1010,7 +1010,7 @@ rpl::producer ChannelData::unrestrictedByBoostsValue() const { return mgInfo ? mgInfo->unrestrictedByBoostsChanges.events_starting_with( unrestrictedByBoosts()) - : (rpl::single(false) | rpl::type_erased()); + : (rpl::single(false) | rpl::type_erased); } void ChannelData::setBoostsUnrestrict(int applied, int unrestrict) { diff --git a/Telegram/SourceFiles/data/data_peer.h b/Telegram/SourceFiles/data/data_peer.h index ea21b562eb..a70b036362 100644 --- a/Telegram/SourceFiles/data/data_peer.h +++ b/Telegram/SourceFiles/data/data_peer.h @@ -489,7 +489,7 @@ public: [[nodiscard]] auto barSettingsValue() const { return (_barSettings.current() & PeerBarSetting::Unknown) ? _barSettings.changes() - : (_barSettings.value() | rpl::type_erased()); + : (_barSettings.value() | rpl::type_erased); } [[nodiscard]] int paysPerMessage() const; void clearPaysPerMessage(); diff --git a/Telegram/SourceFiles/data/data_peer_values.cpp b/Telegram/SourceFiles/data/data_peer_values.cpp index 6af9a53c53..3828d03ee9 100644 --- a/Telegram/SourceFiles/data/data_peer_values.cpp +++ b/Telegram/SourceFiles/data/data_peer_values.cpp @@ -380,11 +380,11 @@ rpl::producer CanManageGroupCallValue(not_null peer) { return rpl::single(user->isSelf()); } else if (const auto chat = peer->asChat()) { return chat->amCreator() - ? (rpl::single(true) | rpl::type_erased()) + ? (rpl::single(true) | rpl::type_erased) : AdminRightValue(chat, flag); } else if (const auto channel = peer->asChannel()) { return channel->amCreator() - ? (rpl::single(true) | rpl::type_erased()) + ? (rpl::single(true) | rpl::type_erased) : AdminRightValue(channel, flag); } return rpl::single(false); diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 4926a27929..ac1273e4a9 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -3639,12 +3639,12 @@ void InnerWidget::trackResultsHistory(not_null history) { 1 ) | rpl::filter([=](const UserData::Flags::Change &change) { return change.diff & UserDataFlag::Forum; - }) | rpl::to_empty | rpl::type_erased() + }) | rpl::to_empty | rpl::type_erased : peer->asChannel()->flagsValue() | rpl::skip( 1 ) | rpl::filter([=](const ChannelData::Flags::Change &change) { return (change.diff & ChannelDataFlag::Forum); - }) | rpl::to_empty | rpl::type_erased(); + }) | rpl::to_empty | rpl::type_erased; std::move(changes) | rpl::start_with_next([=] { for (const auto &row : _searchResults) { if (row->item()->history()->peer == peer) { diff --git a/Telegram/SourceFiles/editor/editor_paint.cpp b/Telegram/SourceFiles/editor/editor_paint.cpp index 5f858ae27e..e10058239c 100644 --- a/Telegram/SourceFiles/editor/editor_paint.cpp +++ b/Telegram/SourceFiles/editor/editor_paint.cpp @@ -110,7 +110,7 @@ Paint::Paint( controllers->stickersPanelController ? controllers->stickersPanelController->stickerChosen( ) | rpl::to_empty - : rpl::never<>() | rpl::type_erased(), + : rpl::never<>() | rpl::type_erased, _scene->addsItem() ) | rpl::start_with_next([=] { clearRedoList(); diff --git a/Telegram/SourceFiles/export/view/export_view_progress.cpp b/Telegram/SourceFiles/export/view/export_view_progress.cpp index c7d28c7d47..c3639b24ff 100644 --- a/Telegram/SourceFiles/export/view/export_view_progress.cpp +++ b/Telegram/SourceFiles/export/view/export_view_progress.cpp @@ -289,7 +289,7 @@ rpl::producer ProgressWidget::skipFileClicks() const { rpl::producer<> ProgressWidget::cancelClicks() const { return _cancel ? (_cancel->clicks() | rpl::to_empty) - : (rpl::never<>() | rpl::type_erased()); + : (rpl::never<>() | rpl::type_erased); } rpl::producer<> ProgressWidget::doneClicks() const { diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 560d757b8e..13c7ffa55e 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -509,7 +509,7 @@ void HistoryInner::setupSharingDisallowed() { : Data::PeerFlagValue( channel, ChannelDataFlag::NoForwards - ) | rpl::type_erased(); + ) | rpl::type_erased; auto rights = chat ? chat->adminRightsValue() diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 6251e2ad09..a59c65647e 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -4763,7 +4763,7 @@ void HistoryItem::createServiceFromMtp(const MTPDmessageService &message) { : (*has) ? PeerHasThisCallValue( peer, - id) | rpl::skip(1) | rpl::type_erased() + id) | rpl::skip(1) | rpl::type_erased : rpl::producer(); if (!hasLink) { RemoveComponents(HistoryServiceOngoingCall::Bit()); diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index 67a5903847..d2e41245e3 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -4317,7 +4317,7 @@ rpl::producer SendDisabledBySlowmode(not_null peer) { using namespace rpl::mappers; const auto channel = peer->asChannel(); return (!channel || channel->amCreator()) - ? (rpl::single(false) | rpl::type_erased()) + ? (rpl::single(false) | rpl::type_erased) : rpl::combine( channel->slowmodeAppliedValue(), std::move(hasSendingMessage), diff --git a/Telegram/SourceFiles/history/view/history_view_chat_section.cpp b/Telegram/SourceFiles/history/view/history_view_chat_section.cpp index 502e5e1cc8..d054f5a1be 100644 --- a/Telegram/SourceFiles/history/view/history_view_chat_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_chat_section.cpp @@ -265,7 +265,7 @@ ChatWidget::ChatWidget( session().scheduledMessages().updates(_topic->owningHistory()) ) | rpl::map([=] { return session().scheduledMessages().hasFor(_topic); - }) | rpl::type_erased() + }) | rpl::type_erased : rpl::single(false), })) , _translateBar( @@ -756,7 +756,7 @@ void ChatWidget::setupComposeControls() { Data::CanSendAnythingValue(_peer), (_repliesRootId ? std::move(topicWriteRestrictions) - : (rpl::single(Data::SendError()) | rpl::type_erased())) + : (rpl::single(Data::SendError()) | rpl::type_erased)) ) | rpl::map([=]( const Main::FreezeInfo &info, auto, diff --git a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp index 8553a4bd65..b4ead445b8 100644 --- a/Telegram/SourceFiles/history/view/history_view_contact_status.cpp +++ b/Telegram/SourceFiles/history/view/history_view_contact_status.cpp @@ -640,7 +640,7 @@ void ContactStatus::setupState(not_null peer, bool showInForum) { PeerCustomStatus(peer), ((channel && !showInForum) ? Data::PeerFlagValue(channel, ChannelData::Flag::Forum) - : (rpl::single(false) | rpl::type_erased())) + : (rpl::single(false) | rpl::type_erased)) ) | rpl::start_with_next([=]( State state, TextWithEntities status, @@ -1111,9 +1111,9 @@ TopicReopenBar::TopicReopenBar( void TopicReopenBar::setupState() { const auto channel = _topic->channel(); auto canToggle = !channel - ? (rpl::single(false) | rpl::type_erased()) + ? (rpl::single(false) | rpl::type_erased) : (_topic->my() || channel->amCreator()) - ? (rpl::single(true) | rpl::type_erased()) + ? (rpl::single(true) | rpl::type_erased) : channel->adminRightsValue( ) | rpl::map([=] { return _topic->canToggleClosed(); }); diff --git a/Telegram/SourceFiles/history/view/history_view_group_call_bar.cpp b/Telegram/SourceFiles/history/view/history_view_group_call_bar.cpp index 68d952d869..95cb34fe41 100644 --- a/Telegram/SourceFiles/history/view/history_view_group_call_bar.cpp +++ b/Telegram/SourceFiles/history/view/history_view_group_call_bar.cpp @@ -389,7 +389,7 @@ rpl::producer GroupCallBarContentByPeer( Data::PeerUpdate::Flag::GroupCall), Core::App().calls().currentGroupCallValue(), ((showInForum || !channel) - ? (rpl::single(false) | rpl::type_erased()) + ? (rpl::single(false) | rpl::type_erased) : Data::PeerFlagValue(channel, ChannelData::Flag::Forum)) ) | rpl::map([=](auto, Calls::GroupCall *current, bool hiddenByForum) { const auto call = peer->groupCall(); diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 398e78c6d8..b5264dae0a 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -308,7 +308,7 @@ void ScheduledWidget::setupComposeControls() { .type = Controls::WriteRestrictionType::Rights, .boostsToLift = text.boostsToLift, } : Controls::WriteRestriction(); - }) | rpl::type_erased(); + }) | rpl::type_erased; }() : [&] { return rpl::combine( @@ -342,7 +342,7 @@ void ScheduledWidget::setupComposeControls() { .type = Controls::WriteRestrictionType::Rights, .boostsToLift = text.boostsToLift, } : Controls::WriteRestriction(); - }) | rpl::type_erased(); + }) | rpl::type_erased; }(); _composeControls->setHistory({ .history = _history.get(), diff --git a/Telegram/SourceFiles/history/view/history_view_translate_tracker.cpp b/Telegram/SourceFiles/history/view/history_view_translate_tracker.cpp index d16eee60e6..f91dea0a9e 100644 --- a/Telegram/SourceFiles/history/view/history_view_translate_tracker.cpp +++ b/Telegram/SourceFiles/history/view/history_view_translate_tracker.cpp @@ -55,7 +55,7 @@ void TranslateTracker::setup() { const auto channel = peer->asChannel(); auto autoTranslationValue = (channel - ? (channel->flagsValue() | rpl::type_erased()) + ? (channel->flagsValue() | rpl::type_erased) : rpl::single(Data::Flags::Change({}, {})) ) | rpl::map([=](Data::Flags::Change data) { return (data.value & ChannelDataFlag::AutoTranslation); diff --git a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_join_widget.cpp b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_join_widget.cpp index 0343af54bf..87d91dae82 100644 --- a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_join_widget.cpp +++ b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_join_widget.cpp @@ -1040,7 +1040,7 @@ std::unique_ptr Widget::setupTop() { st::infoTopBarScale); _back->setDuration(0); _back->toggleOn(isLayer - ? _backEnabled.value() | rpl::type_erased() + ? _backEnabled.value() | rpl::type_erased : rpl::single(true)); _back->entity()->addClickHandler([=] { controller->showBackFromStack(); diff --git a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_setup_widget.cpp b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_setup_widget.cpp index 46183eb688..30296e9cfa 100644 --- a/Telegram/SourceFiles/info/bot/starref/info_bot_starref_setup_widget.cpp +++ b/Telegram/SourceFiles/info/bot/starref/info_bot_starref_setup_widget.cpp @@ -952,7 +952,7 @@ std::unique_ptr Widget::setupTop() { st::infoTopBarScale); _back->setDuration(0); _back->toggleOn(isLayer - ? _backEnabled.value() | rpl::type_erased() + ? _backEnabled.value() | rpl::type_erased : rpl::single(true)); _back->entity()->addClickHandler([=] { controller->showBackFromStack(); diff --git a/Telegram/SourceFiles/info/channel_statistics/boosts/create_giveaway_box.cpp b/Telegram/SourceFiles/info/channel_statistics/boosts/create_giveaway_box.cpp index 2e0458f308..a04bd064aa 100644 --- a/Telegram/SourceFiles/info/channel_statistics/boosts/create_giveaway_box.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/boosts/create_giveaway_box.cpp @@ -307,7 +307,7 @@ void CreateGiveawayBox( return rpl::combine( state->typeValue.value(), state->toAwardAmountChanged.events_starting_with( - rpl::empty_value()) | rpl::type_erased() + rpl::empty_value()) | rpl::type_erased ) | rpl::map([=](GiveawayType type, auto) { return (type == GiveawayType::Credits) || !isSpecificUsers(); }); @@ -323,7 +323,7 @@ void CreateGiveawayBox( tr::lng_giveaway_award()), rpl::conditional( isPrepaidCredits - ? rpl::single(true) | rpl::type_erased() + ? rpl::single(true) | rpl::type_erased : state->typeValue.value() | rpl::map( rpl::mappers::_1 == GiveawayType::Credits), (peer->isMegagroup() @@ -1144,20 +1144,20 @@ void CreateGiveawayBox( Ui::AddSkip(additionalWrap); auto monthsValue = prepaid - ? (rpl::single(prepaid->months) | rpl::type_erased()) + ? (rpl::single(prepaid->months) | rpl::type_erased) : state->chosenMonths.value(); const auto usersCountByType = [=](GiveawayType type) { if (!isSpecificUsers()) { - return state->sliderValue.value() | rpl::type_erased(); + return state->sliderValue.value() | rpl::type_erased; } return state->toAwardAmountChanged.events_starting_with_copy( rpl::empty ) | rpl::map([=] { return int(state->selectedToAward.size()); - }) | rpl::type_erased(); + }) | rpl::type_erased; }; auto usersCountValue = prepaid - ? (rpl::single(prepaid->quantity) | rpl::type_erased()) + ? (rpl::single(prepaid->quantity) | rpl::type_erased) : state->typeValue.value( ) | rpl::map(usersCountByType) | rpl::flatten_latest(); @@ -1354,7 +1354,7 @@ void CreateGiveawayBox( tr::lng_giveaway_start(), tr::lng_giveaway_award()), (prepaid && prepaid->boosts) - ? rpl::single(prepaid->boosts) | rpl::type_erased() + ? rpl::single(prepaid->boosts) | rpl::type_erased : rpl::conditional( state->typeValue.value( ) | rpl::map(rpl::mappers::_1 == GiveawayType::Credits), diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp index d15bbc9bf8..681604aa0d 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp @@ -393,7 +393,7 @@ void InnerWidget::fill() { ); auto creditsStateValue = bot - ? rpl::single(Data::CreditsEarnStatistics()) | rpl::type_erased() + ? rpl::single(Data::CreditsEarnStatistics()) | rpl::type_erased : rpl::single(creditsData) | rpl::then( _stateUpdated.events( ) | rpl::map([this] { return _state.creditsEarn; }) diff --git a/Telegram/SourceFiles/info/media/info_media_provider.cpp b/Telegram/SourceFiles/info/media/info_media_provider.cpp index 14553f7958..81359358f9 100644 --- a/Telegram/SourceFiles/info/media/info_media_provider.cpp +++ b/Telegram/SourceFiles/info/media/info_media_provider.cpp @@ -100,7 +100,7 @@ rpl::producer Provider::hasSelectRestrictionChanges() { : Data::PeerFlagValue( channel, ChannelDataFlag::NoForwards - ) | rpl::type_erased(); + ) | rpl::type_erased; auto rights = chat ? chat->adminRightsValue() diff --git a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_common.cpp b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_common.cpp index 3f4e4d66fe..215fb11d79 100644 --- a/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_common.cpp +++ b/Telegram/SourceFiles/info/peer_gifts/info_peer_gifts_common.cpp @@ -1151,7 +1151,7 @@ rpl::producer> GiftStickerValue( packs.load(); if (const auto result = packs.lookup(months)) { return result->sticker() - ? (rpl::single(not_null(result)) | rpl::type_erased()) + ? (rpl::single(not_null(result)) | rpl::type_erased) : rpl::never>(); } return packs.updated( @@ -1161,9 +1161,9 @@ rpl::producer> GiftStickerValue( return document && document->sticker(); }) | rpl::take(1) | rpl::map([=](DocumentData *document) { return not_null(document); - }) | rpl::type_erased(); + }) | rpl::type_erased; }, [&](GiftTypeStars data) { - return rpl::single(data.info.document) | rpl::type_erased(); + return rpl::single(data.info.document) | rpl::type_erased; }); } diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 64bfff3ec6..586aadb6c8 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -2174,7 +2174,7 @@ void DetailsFiller::addReportReaction( Info::Profile::IsContactValue(user), forceHidden->value(), !rpl::mappers::_1 && !rpl::mappers::_2 - ) | rpl::type_erased() + ) | rpl::type_erased : (forceHidden->value() | rpl::map(!rpl::mappers::_1)); const auto sent = [=] { *forceHidden = true; diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp index e094d74d65..bbf587bab6 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp @@ -1856,7 +1856,7 @@ void TopBar::setupButtons( _back->QWidget::show(); _back->setDuration(0); _back->toggleOn(isLayer || isSide - ? (_backToggles.value() | rpl::type_erased()) + ? (_backToggles.value() | rpl::type_erased) : rpl::single(wrap == Wrap::Narrow)); _back->entity()->clicks() | rpl::to_empty | rpl::start_to_stream( _backClicks, diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.cpp b/Telegram/SourceFiles/info/profile/info_profile_values.cpp index 6f0bb4599c..0a21f12a91 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -65,9 +65,9 @@ auto PlainPrimaryUsernameValue(not_null peer) { peer ) | rpl::map([=](std::vector usernames) { if (!usernames.empty()) { - return rpl::single(usernames.front().text) | rpl::type_erased(); + return rpl::single(usernames.front().text) | rpl::type_erased; } else { - return PlainUsernameValue(peer) | rpl::type_erased(); + return PlainUsernameValue(peer) | rpl::type_erased; } }) | rpl::flatten_latest(); } @@ -161,7 +161,7 @@ rpl::producer UsernameValue( bool primary) { return (primary ? PlainPrimaryUsernameValue(peer) - : (PlainUsernameValue(peer) | rpl::type_erased()) + : (PlainUsernameValue(peer) | rpl::type_erased) ) | rpl::map([](QString &&username) { return username.isEmpty() ? QString() @@ -260,7 +260,7 @@ rpl::producer LinkValue( MsgId rootId) { return (primary ? PlainPrimaryUsernameValue(peer) - : PlainUsernameValue(peer) | rpl::type_erased() + : PlainUsernameValue(peer) | rpl::type_erased ) | rpl::map([=](QString &&username) { if (username.isEmpty()) { if (const auto topic diff --git a/Telegram/SourceFiles/info/saved/info_saved_music_common.cpp b/Telegram/SourceFiles/info/saved/info_saved_music_common.cpp index 53a46281b6..9fd915d7fc 100644 --- a/Telegram/SourceFiles/info/saved/info_saved_music_common.cpp +++ b/Telegram/SourceFiles/info/saved/info_saved_music_common.cpp @@ -44,7 +44,7 @@ void SetupSavedMusic( 1 ) | rpl::map([=](const Data::SavedMusicSlice &data) { return data.size() ? data[0].get() : nullptr; - }) | rpl::type_erased() + }) | rpl::type_erased : rpl::single((HistoryItem*)(nullptr)); const auto divider = container->add( diff --git a/Telegram/SourceFiles/media/stories/media_stories_reply.cpp b/Telegram/SourceFiles/media/stories/media_stories_reply.cpp index f88ca8a82c..73e422bc27 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_reply.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_reply.cpp @@ -932,7 +932,7 @@ void ReplyArea::show( .text = tr::lng_video_stream_comments_disabled(tr::now), .type = WriteRestrictionType::Rights, }; - }) | rpl::type_erased() + }) | rpl::type_erased : Data::CanSendAnythingValue( peer ) | rpl::map([=](bool can) { diff --git a/Telegram/SourceFiles/media/stories/media_stories_stealth.cpp b/Telegram/SourceFiles/media/stories/media_stories_stealth.cpp index 789deb84bc..731b57c8f9 100644 --- a/Telegram/SourceFiles/media/stories/media_stories_stealth.cpp +++ b/Telegram/SourceFiles/media/stories/media_stories_stealth.cpp @@ -234,7 +234,7 @@ struct State { tr::now, lt_left, TimeLeftText(left)); - }) | rpl::type_erased(); + }) | rpl::type_erased; }) | rpl::flatten_latest(); auto result = object_ptr( diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_video_track.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_video_track.cpp index b9518125fd..bf5521c2cd 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_video_track.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_video_track.cpp @@ -198,15 +198,15 @@ VideoTrackObject::VideoTrackObject( rpl::producer<> VideoTrackObject::checkNextFrame() const { return interrupted() - ? (rpl::complete<>() | rpl::type_erased()) + ? (rpl::complete<>() | rpl::type_erased) : !_shared->firstPresentHappened() - ? (_checkNextFrame.events() | rpl::type_erased()) + ? (_checkNextFrame.events() | rpl::type_erased) : _checkNextFrame.events_starting_with({}); } rpl::producer<> VideoTrackObject::waitingForData() const { return interrupted() - ? (rpl::never() | rpl::type_erased()) + ? (rpl::never() | rpl::type_erased) : _waitingForData.events(); } diff --git a/Telegram/SourceFiles/passport/passport_panel_controller.cpp b/Telegram/SourceFiles/passport/passport_panel_controller.cpp index 1abfa686be..14b1a37336 100644 --- a/Telegram/SourceFiles/passport/passport_panel_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_controller.cpp @@ -1343,7 +1343,7 @@ void PanelController::processVerificationNeeded( return field->verification.call != nullptr; }) | rpl::map([=](not_null field) { return field->verification.call->getText(); - })) : (rpl::single(QString()) | rpl::type_erased()), + })) : (rpl::single(QString()) | rpl::type_erased), rpl::duplicate( update diff --git a/Telegram/SourceFiles/payments/ui/payments_reaction_box.cpp b/Telegram/SourceFiles/payments/ui/payments_reaction_box.cpp index 00dae69e09..1588b0095c 100644 --- a/Telegram/SourceFiles/payments/ui/payments_reaction_box.cpp +++ b/Telegram/SourceFiles/payments/ui/payments_reaction_box.cpp @@ -547,10 +547,10 @@ void PaidReactionsBox( colorings, (videoStreamAdmin ? rpl::single(state->chosen.current()) - : state->chosen.value() | rpl::type_erased()), + : state->chosen.value() | rpl::type_erased), (videoStreamAdmin ? rpl::single(state->shownPeer.current()) - : state->shownPeer.value() | rpl::type_erased()), + : state->shownPeer.value() | rpl::type_erased), [=](uint64 barePeerId) { state->shownPeer = state->savedShownPeer = barePeerId; }, diff --git a/Telegram/SourceFiles/platform/linux/tray_linux.cpp b/Telegram/SourceFiles/platform/linux/tray_linux.cpp index e15c297ced..906278f458 100644 --- a/Telegram/SourceFiles/platform/linux/tray_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/tray_linux.cpp @@ -387,7 +387,7 @@ rpl::producer<> Tray::aboutToShowRequests() const { _aboutToShowRequests.events(), _menu ? base::qt_signal_producer(_menu.get(), &QMenu::aboutToShow) - : rpl::never<>() | rpl::type_erased()); + : rpl::never<>() | rpl::type_erased); } rpl::producer<> Tray::showFromTrayRequests() const { diff --git a/Telegram/SourceFiles/settings/settings_business.cpp b/Telegram/SourceFiles/settings/settings_business.cpp index bc6c1172fa..498081852e 100644 --- a/Telegram/SourceFiles/settings/settings_business.cpp +++ b/Telegram/SourceFiles/settings/settings_business.cpp @@ -682,7 +682,7 @@ base::weak_qptr Business::createPinnedToTop( st::infoTopBarScale); _back->setDuration(0); _back->toggleOn(isLayer - ? _backToggles.value() | rpl::type_erased() + ? _backToggles.value() | rpl::type_erased : rpl::single(true)); _back->entity()->addClickHandler([=] { _showBack.fire({}); diff --git a/Telegram/SourceFiles/settings/settings_credits.cpp b/Telegram/SourceFiles/settings/settings_credits.cpp index 5ec6605795..796a4694e5 100644 --- a/Telegram/SourceFiles/settings/settings_credits.cpp +++ b/Telegram/SourceFiles/settings/settings_credits.cpp @@ -869,7 +869,7 @@ base::weak_qptr Credits::createPinnedToTop( st::infoTopBarScale); _back->setDuration(0); _back->toggleOn(isLayer - ? _backToggles.value() | rpl::type_erased() + ? _backToggles.value() | rpl::type_erased : rpl::single(true)); _back->entity()->addClickHandler([=] { _showBack.fire({}); diff --git a/Telegram/SourceFiles/settings/settings_premium.cpp b/Telegram/SourceFiles/settings/settings_premium.cpp index 97d2900ce5..dd60153664 100644 --- a/Telegram/SourceFiles/settings/settings_premium.cpp +++ b/Telegram/SourceFiles/settings/settings_premium.cpp @@ -1314,7 +1314,7 @@ base::weak_qptr Premium::createPinnedToTop( st::infoTopBarScale); _back->setDuration(0); _back->toggleOn(isLayer - ? _backToggles.value() | rpl::type_erased() + ? _backToggles.value() | rpl::type_erased : rpl::single(true)); _back->entity()->addClickHandler([=] { _showBack.fire({}); diff --git a/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp b/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp index dcdc020e4f..3b111f31b7 100644 --- a/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp @@ -457,7 +457,7 @@ void FillPeerQrBox( const auto usernameValue = [=] { return (customLink || !peer) - ? (rpl::single(QString()) | rpl::type_erased()) + ? (rpl::single(QString()) | rpl::type_erased) : Info::Profile::UsernameValue(peer, true) | rpl::map( [](const auto &username) { return username.text; }); }; @@ -467,7 +467,7 @@ void FillPeerQrBox( : peer ? Info::Profile::LinkValue(peer, true) | rpl::map( [](const auto &link) { return link.text; }) - : (rpl::single(QString()) | rpl::type_erased()); + : (rpl::single(QString()) | rpl::type_erased); }; const auto userpic = Ui::CreateChild(box); diff --git a/Telegram/SourceFiles/ui/controls/stars_rating.cpp b/Telegram/SourceFiles/ui/controls/stars_rating.cpp index 10d8d02085..cb8f449e4c 100644 --- a/Telegram/SourceFiles/ui/controls/stars_rating.cpp +++ b/Telegram/SourceFiles/ui/controls/stars_rating.cpp @@ -239,9 +239,9 @@ void AboutRatingBox( ? tr::lng_stars_rating_about( lt_name, rpl::single(TextWithEntities{ name }), - Text::RichLangValue) | rpl::type_erased() + Text::RichLangValue) | rpl::type_erased : tr::lng_stars_rating_about_your( - Text::RichLangValue) | rpl::type_erased(); + Text::RichLangValue) | rpl::type_erased; if (data.level < 0) { auto text = (data.stars < 0) diff --git a/Telegram/SourceFiles/ui/widgets/expandable_peer_list.cpp b/Telegram/SourceFiles/ui/widgets/expandable_peer_list.cpp index a033a17b64..ee3c6d33a9 100644 --- a/Telegram/SourceFiles/ui/widgets/expandable_peer_list.cpp +++ b/Telegram/SourceFiles/ui/widgets/expandable_peer_list.cpp @@ -169,7 +169,7 @@ void AddExpandablePeerList( (u"(%1) "_q).arg(it->second) }.append(richName); }) - : std::move(name) | rpl::type_erased(), + : std::move(name) | rpl::type_erased, st::defaultBoxCheckbox, std::make_unique( st::defaultCheck, diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index b2cea95471..66d6ac88bf 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -545,7 +545,7 @@ void MainMenu::setupArchive() { const auto now = folder(); auto folderValue = now - ? (rpl::single(now) | rpl::type_erased()) + ? (rpl::single(now) | rpl::type_erased) : controller->session().data().chatsListChanges( ) | rpl::filter([](Data::Folder *folder) { return folder && (folder->id() == Data::Folder::kId); diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index 03c62c8c9f..857986c1ba 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -3406,7 +3406,7 @@ void SessionController::cacheChatThemeDone( rpl::merge( session().downloaderTaskFinished(), ((giftSymbol && !giftSymbol->ready()) - ? (_giftSymbolLoaded.events() | rpl::type_erased()) + ? (_giftSymbolLoaded.events() | rpl::type_erased) : rpl::never()) ) | rpl::filter([=] { const auto i = _customChatThemes.find(key); diff --git a/Telegram/lib_rpl b/Telegram/lib_rpl index f4eb411668..724b79e83c 160000 --- a/Telegram/lib_rpl +++ b/Telegram/lib_rpl @@ -1 +1 @@ -Subproject commit f4eb411668573d32fc430e27260728be0376ea6c +Subproject commit 724b79e83cb2a97968aae5ade48807e6794e2011 diff --git a/Telegram/lib_ui b/Telegram/lib_ui index bfca125f40..fb004e6d2a 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit bfca125f4053880eecd6faef9a0fe41e32a13b20 +Subproject commit fb004e6d2a92212edd10f832cffeaad19efef3c4 From c31d9ded271ad42737a9a4d15a73111754e94407 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Dec 2025 14:27:34 +0400 Subject: [PATCH 023/136] No price decrease countdown for free upgrades. --- Telegram/SourceFiles/boxes/star_gift_box.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index 8469352336..a89d309530 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -4475,14 +4475,16 @@ void UpgradeBox( ? u"%1:%2:%3"_q .arg(hours).arg(padded(minutes)).arg(padded(seconds)) : u"%2:%3"_q.arg(padded(minutes)).arg(padded(seconds)); - }) | Ui::Text::ToWithEntities(); + }) | rpl::map(tr::marked); + auto subtext = tr::lng_gift_upgrade_decreases( + lt_time, + std::move(tillNext), + tr::marked + ) | rpl::type_erased; Ui::SetButtonTwoLabels( button, costText(), - tr::lng_gift_upgrade_decreases( - lt_time, - std::move(tillNext), - Ui::Text::WithEntities), + showPrices ? std::move(subtext) : rpl::single(tr::marked()), st::resaleButtonTitle, st::resaleButtonSubtitle); state->cost->tillNextValue() | rpl::filter([=](TimeId left) { From 3f3b2cb2bab4f77e6f09cfc0e27c86f1174a4380 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 10 Dec 2025 11:12:12 +0300 Subject: [PATCH 024/136] Fixed display of passkey button in privacy settings section. --- .../settings/settings_privacy_security.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/settings/settings_privacy_security.cpp b/Telegram/SourceFiles/settings/settings_privacy_security.cpp index a9902fa1de..43d57dc156 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_security.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_security.cpp @@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_global_privacy.h" #include "api/api_websites.h" #include "data/components/passkeys.h" +#include "platform/platform_webauthn.h" #include "settings/cloud_password/settings_cloud_password_email_confirm.h" #include "settings/cloud_password/settings_cloud_password_input.h" #include "settings/cloud_password/settings_cloud_password_login_email.h" @@ -583,6 +584,10 @@ void SetupPasskeys( if (!session->passkeys().possible()) { return; } + const auto wrap = container->add( + object_ptr>( + container, + object_ptr(container))); auto label = rpl::combine( tr::lng_profile_loading(), (rpl::single(rpl::empty_value()) @@ -597,7 +602,7 @@ void SetupPasskeys( : tr::lng_settings_cloud_password_off(tr::now); }); AddButtonWithLabel( - container, + wrap->entity(), tr::lng_settings_passkeys_title(), std::move(label), st::settingsButton, @@ -620,6 +625,13 @@ void SetupPasskeys( controller->showSettings(PasskeysId()); } }); + wrap->toggleOn( + (rpl::single(rpl::empty_value()) + | rpl::then(session->passkeys().requestList())) | rpl::map([=] { + return Platform::WebAuthn::IsSupported() + || !session->passkeys().list().empty(); + })); + wrap->finishAnimating(); } void SetupLoginEmail( From 29b714dd5f6c5362469c16499464c2f59bcaead3 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 10 Dec 2025 11:15:56 +0300 Subject: [PATCH 025/136] Used fallback name for passkeys without name in list from settings. --- Telegram/Resources/langs/lang.strings | 2 +- Telegram/SourceFiles/settings/settings_passkeys.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index f0cb8cddb7..6743b796a7 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1273,7 +1273,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_settings_passkeys_created" = "Created {date}"; "lng_settings_passkeys_last_used" = "Last used {date}"; "lng_settings_passkeys_unsigned_error" = "Passkeys are not available in unsigned builds. Please use an official signed version of Telegram Desktop."; - +"lng_settings_passkey_unknown" = "Passkey"; "lng_settings_quick_dialog_action_title" = "Chat list quick action"; "lng_settings_quick_dialog_action_about" = "Choose the action you want to perform when you middle-click or swipe left in the chat list."; diff --git a/Telegram/SourceFiles/settings/settings_passkeys.cpp b/Telegram/SourceFiles/settings/settings_passkeys.cpp index 9d1067f8e4..99292e29b3 100644 --- a/Telegram/SourceFiles/settings/settings_passkeys.cpp +++ b/Telegram/SourceFiles/settings/settings_passkeys.cpp @@ -317,17 +317,24 @@ void Passkeys::setupContent( lt_date, formatDateTime(passkey.date)); const auto nameText = button->lifetime().make_state< - Ui::Text::String>(*nameStyle, passkey.name); + Ui::Text::String>( + *nameStyle, + passkey.name.isEmpty() + ? tr::lng_settings_passkey_unknown(tr::now) + : passkey.name); const auto dateText = button->lifetime().make_state< Ui::Text::String>(st::defaultTextStyle, date); button->paintOn([=](QPainter &p) { + const auto iconTop = (st.height - iconSize) / 2; if (emojiPtr) { - const auto emojiY = (st.height - iconSize) / 2; emojiPtr->paint(p, { .textColor = st.nameFg->c, .now = crl::now(), - .position = QPoint(iconLeft, emojiY), + .position = QPoint(iconLeft, iconTop), }); + } else { + const auto w = button->width(); + st::settingsIconPasskeys.paint(p, iconLeft, iconTop, w); } const auto textLeft = st::settingsButton.padding.left(); const auto textWidth = button->width() - textLeft From eca8dfb0ec6a8350caf5063571c064f2238e841e Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 10 Dec 2025 20:51:57 +0300 Subject: [PATCH 026/136] Renamed rpl::start_with_ with rpl::on_. --- .cursor/rules/rpl_guide.mdc | 20 +- .../SourceFiles/api/api_authorizations.cpp | 2 +- Telegram/SourceFiles/api/api_bot.cpp | 2 +- Telegram/SourceFiles/api/api_chat_filters.cpp | 18 +- Telegram/SourceFiles/api/api_chat_invite.cpp | 10 +- .../SourceFiles/api/api_confirm_phone.cpp | 6 +- Telegram/SourceFiles/api/api_earn.cpp | 2 +- .../SourceFiles/api/api_global_privacy.cpp | 2 +- .../api/api_messages_search_merged.cpp | 4 +- Telegram/SourceFiles/api/api_peer_photo.cpp | 2 +- Telegram/SourceFiles/api/api_premium.cpp | 2 +- Telegram/SourceFiles/api/api_ringtones.cpp | 2 +- Telegram/SourceFiles/api/api_suggest_post.cpp | 2 +- Telegram/SourceFiles/api/api_updates.cpp | 8 +- Telegram/SourceFiles/api/api_user_names.cpp | 2 +- Telegram/SourceFiles/api/api_who_reacted.cpp | 10 +- Telegram/SourceFiles/apiwrap.cpp | 6 +- Telegram/SourceFiles/boxes/about_box.cpp | 6 +- .../SourceFiles/boxes/about_sponsored_box.cpp | 2 +- .../SourceFiles/boxes/add_contact_box.cpp | 28 +-- .../SourceFiles/boxes/auto_download_box.cpp | 2 +- Telegram/SourceFiles/boxes/auto_lock_box.cpp | 4 +- Telegram/SourceFiles/boxes/background_box.cpp | 14 +- .../boxes/background_preview_box.cpp | 30 +-- .../SourceFiles/boxes/choose_filter_box.cpp | 2 +- Telegram/SourceFiles/boxes/connection_box.cpp | 36 +-- .../SourceFiles/boxes/create_poll_box.cpp | 60 ++--- .../SourceFiles/boxes/delete_messages_box.cpp | 8 +- .../boxes/dictionaries_manager.cpp | 16 +- .../SourceFiles/boxes/edit_caption_box.cpp | 28 +-- .../SourceFiles/boxes/edit_privacy_box.cpp | 28 +-- .../SourceFiles/boxes/edit_todo_list_box.cpp | 54 ++-- .../boxes/filters/edit_filter_box.cpp | 46 ++-- .../boxes/filters/edit_filter_chats_list.cpp | 8 +- .../boxes/filters/edit_filter_links.cpp | 18 +- .../SourceFiles/boxes/gift_premium_box.cpp | 16 +- Telegram/SourceFiles/boxes/language_box.cpp | 22 +- .../SourceFiles/boxes/local_storage_box.cpp | 6 +- Telegram/SourceFiles/boxes/max_invite_box.cpp | 2 +- .../boxes/moderate_messages_box.cpp | 14 +- Telegram/SourceFiles/boxes/passcode_box.cpp | 24 +- Telegram/SourceFiles/boxes/peer_list_box.cpp | 16 +- .../boxes/peer_list_controllers.cpp | 36 +-- .../SourceFiles/boxes/peer_list_widgets.cpp | 4 +- Telegram/SourceFiles/boxes/peer_lists_box.cpp | 6 +- .../boxes/peers/add_bot_to_chat_box.cpp | 8 +- .../boxes/peers/add_participants_box.cpp | 22 +- .../boxes/peers/choose_peer_box.cpp | 6 +- .../boxes/peers/edit_contact_box.cpp | 22 +- .../boxes/peers/edit_discussion_link_box.cpp | 2 +- .../boxes/peers/edit_forum_topic_box.cpp | 32 +-- .../boxes/peers/edit_members_visible.cpp | 2 +- .../boxes/peers/edit_participant_box.cpp | 8 +- .../boxes/peers/edit_participants_box.cpp | 22 +- .../boxes/peers/edit_peer_color_box.cpp | 82 +++--- .../edit_peer_history_visibility_box.cpp | 2 +- .../boxes/peers/edit_peer_info_box.cpp | 44 ++-- .../boxes/peers/edit_peer_invite_link.cpp | 32 +-- .../boxes/peers/edit_peer_invite_links.cpp | 16 +- .../boxes/peers/edit_peer_permissions_box.cpp | 38 +-- .../boxes/peers/edit_peer_reactions.cpp | 22 +- .../boxes/peers/edit_peer_type_box.cpp | 14 +- .../boxes/peers/edit_peer_usernames_list.cpp | 12 +- .../boxes/peers/peer_short_info_box.cpp | 14 +- .../boxes/peers/prepare_short_info_box.cpp | 14 +- .../boxes/peers/replace_boost_box.cpp | 22 +- .../boxes/peers/toggle_topics_box.cpp | 8 +- .../boxes/peers/verify_peers_box.cpp | 2 +- .../SourceFiles/boxes/premium_limits_box.cpp | 8 +- .../SourceFiles/boxes/premium_preview_box.cpp | 52 ++-- .../boxes/reactions_settings_box.cpp | 20 +- .../SourceFiles/boxes/report_messages_box.cpp | 4 +- Telegram/SourceFiles/boxes/ringtones_box.cpp | 8 +- .../boxes/self_destruction_box.cpp | 4 +- .../SourceFiles/boxes/send_credits_box.cpp | 22 +- Telegram/SourceFiles/boxes/send_files_box.cpp | 52 ++-- .../boxes/send_gif_with_caption_box.cpp | 16 +- Telegram/SourceFiles/boxes/share_box.cpp | 42 ++-- .../boxes/star_gift_auction_box.cpp | 40 +-- Telegram/SourceFiles/boxes/star_gift_box.cpp | 116 ++++----- .../boxes/star_gift_preview_box.cpp | 14 +- .../boxes/star_gift_resale_box.cpp | 22 +- .../SourceFiles/boxes/sticker_set_box.cpp | 22 +- Telegram/SourceFiles/boxes/stickers_box.cpp | 16 +- .../SourceFiles/boxes/transfer_gift_box.cpp | 6 +- Telegram/SourceFiles/boxes/translate_box.cpp | 10 +- Telegram/SourceFiles/boxes/url_auth_box.cpp | 2 +- Telegram/SourceFiles/boxes/username_box.cpp | 8 +- .../calls/calls_box_controller.cpp | 12 +- Telegram/SourceFiles/calls/calls_call.cpp | 16 +- .../calls/calls_controller_webrtc.cpp | 2 +- .../calls/calls_emoji_fingerprint.cpp | 16 +- Telegram/SourceFiles/calls/calls_instance.cpp | 10 +- Telegram/SourceFiles/calls/calls_panel.cpp | 44 ++-- .../calls/calls_panel_background.cpp | 4 +- .../SourceFiles/calls/calls_signal_bars.cpp | 2 +- Telegram/SourceFiles/calls/calls_top_bar.cpp | 28 +-- Telegram/SourceFiles/calls/calls_userpic.cpp | 8 +- .../SourceFiles/calls/calls_video_bubble.cpp | 6 +- .../calls/calls_video_incoming.cpp | 2 +- .../calls/group/calls_choose_join_as.cpp | 6 +- .../calls/group/calls_cover_item.cpp | 2 +- .../calls/group/calls_group_call.cpp | 46 ++-- .../calls/group/calls_group_common.cpp | 12 +- .../group/calls_group_invite_controller.cpp | 26 +- .../calls/group/calls_group_members.cpp | 64 ++--- .../calls/group/calls_group_members_row.cpp | 4 +- .../calls/group/calls_group_menu.cpp | 10 +- .../calls/group/calls_group_message_field.cpp | 32 +-- .../calls/group/calls_group_messages.cpp | 2 +- .../calls/group/calls_group_messages_ui.cpp | 22 +- .../calls/group/calls_group_panel.cpp | 116 ++++----- .../calls/group/calls_group_rtmp.cpp | 6 +- .../calls/group/calls_group_settings.cpp | 12 +- .../calls/group/calls_group_toasts.cpp | 12 +- .../calls/group/calls_group_viewport.cpp | 8 +- .../group/calls_group_viewport_opengl.cpp | 2 +- .../calls/group/calls_group_viewport_tile.cpp | 6 +- .../calls/group/calls_volume_item.cpp | 10 +- .../group/ui/calls_group_recording_box.cpp | 16 +- .../group/ui/calls_group_scheduled_labels.cpp | 4 +- .../ui/desktop_capture_choose_source.cpp | 26 +- .../calls/ui/calls_device_menu.cpp | 4 +- .../chat_helpers/emoji_interactions.cpp | 4 +- .../chat_helpers/emoji_keywords.cpp | 4 +- .../chat_helpers/emoji_list_widget.cpp | 20 +- .../chat_helpers/emoji_sets_manager.cpp | 14 +- .../chat_helpers/emoji_suggestions_widget.cpp | 8 +- .../chat_helpers/field_autocomplete.cpp | 36 +-- .../chat_helpers/gifs_list_widget.cpp | 12 +- .../chat_helpers/message_field.cpp | 40 +-- .../chat_helpers/spellchecker_common.cpp | 12 +- .../chat_helpers/stickers_emoji_pack.cpp | 6 +- .../chat_helpers/stickers_list_footer.cpp | 6 +- .../chat_helpers/stickers_list_widget.cpp | 16 +- .../SourceFiles/chat_helpers/tabbed_panel.cpp | 10 +- .../chat_helpers/tabbed_selector.cpp | 20 +- .../chat_helpers/ttl_media_layer_widget.cpp | 20 +- Telegram/SourceFiles/core/application.cpp | 42 ++-- Telegram/SourceFiles/core/changelogs.cpp | 2 +- .../SourceFiles/core/crash_report_window.cpp | 12 +- .../SourceFiles/core/local_url_handlers.cpp | 6 +- .../SourceFiles/core/phone_click_handler.cpp | 4 +- Telegram/SourceFiles/core/sandbox.cpp | 2 +- Telegram/SourceFiles/core/update_checker.cpp | 18 +- .../countries/countries_manager.cpp | 4 +- .../data/business/data_shortcut_messages.cpp | 2 +- .../SourceFiles/data/components/credits.cpp | 2 +- .../data/components/factchecks.cpp | 2 +- .../data/components/gift_auctions.cpp | 4 +- .../data/components/promo_suggestions.cpp | 2 +- .../data/components/scheduled_messages.cpp | 2 +- .../data/components/sponsored_messages.cpp | 2 +- .../SourceFiles/data/components/top_peers.cpp | 2 +- Telegram/SourceFiles/data/data_channel.cpp | 6 +- Telegram/SourceFiles/data/data_chat.cpp | 2 +- .../SourceFiles/data/data_chat_filters.cpp | 2 +- Telegram/SourceFiles/data/data_cloud_file.cpp | 2 +- .../SourceFiles/data/data_cloud_themes.cpp | 4 +- Telegram/SourceFiles/data/data_document.cpp | 2 +- .../data/data_download_manager.cpp | 14 +- .../SourceFiles/data/data_emoji_statuses.cpp | 2 +- Telegram/SourceFiles/data/data_folder.cpp | 6 +- .../SourceFiles/data/data_forum_topic.cpp | 4 +- Telegram/SourceFiles/data/data_group_call.cpp | 4 +- .../data/data_history_messages.cpp | 10 +- .../SourceFiles/data/data_media_preload.cpp | 2 +- .../data/data_message_reactions.cpp | 8 +- .../SourceFiles/data/data_peer_values.cpp | 4 +- .../SourceFiles/data/data_replies_list.cpp | 18 +- .../SourceFiles/data/data_saved_music.cpp | 2 +- .../SourceFiles/data/data_saved_sublist.cpp | 8 +- .../data/data_search_controller.cpp | 10 +- Telegram/SourceFiles/data/data_session.cpp | 30 +-- .../SourceFiles/data/data_shared_media.cpp | 20 +- Telegram/SourceFiles/data/data_sparse_ids.cpp | 4 +- Telegram/SourceFiles/data/data_stories.cpp | 2 +- .../SourceFiles/data/data_stories_ids.cpp | 2 +- Telegram/SourceFiles/data/data_user.cpp | 6 +- .../SourceFiles/data/data_user_photos.cpp | 8 +- .../data/notify/data_notify_settings.cpp | 4 +- .../data/stickers/data_custom_emoji.cpp | 6 +- .../dialogs/dialogs_inner_widget.cpp | 68 ++--- .../SourceFiles/dialogs/dialogs_main_list.cpp | 4 +- .../dialogs_search_from_controllers.cpp | 2 +- .../dialogs/dialogs_search_posts.cpp | 2 +- .../dialogs/dialogs_search_tags.cpp | 4 +- .../dialogs/dialogs_top_bar_suggestion.cpp | 28 +-- .../SourceFiles/dialogs/dialogs_widget.cpp | 156 ++++++------ .../dialogs/ui/chat_search_empty.cpp | 2 +- .../SourceFiles/dialogs/ui/chat_search_in.cpp | 8 +- .../dialogs/ui/dialogs_message_view.cpp | 2 +- .../dialogs/ui/dialogs_stories_content.cpp | 6 +- .../dialogs/ui/dialogs_stories_list.cpp | 8 +- .../dialogs/ui/dialogs_suggestions.cpp | 112 ++++----- .../ui/dialogs_top_bar_suggestion_content.cpp | 12 +- .../dialogs/ui/posts_search_intro.cpp | 6 +- .../dialogs/ui/top_peers_strip.cpp | 14 +- Telegram/SourceFiles/editor/color_picker.cpp | 6 +- .../controllers/stickers_panel_controller.cpp | 4 +- Telegram/SourceFiles/editor/editor_crop.cpp | 2 +- .../editor/editor_layer_widget.cpp | 6 +- Telegram/SourceFiles/editor/editor_paint.cpp | 8 +- Telegram/SourceFiles/editor/photo_editor.cpp | 26 +- .../editor/photo_editor_content.cpp | 4 +- .../editor/photo_editor_controls.cpp | 20 +- Telegram/SourceFiles/editor/scene/scene.cpp | 2 +- .../editor/scene/scene_item_sticker.cpp | 4 +- .../SourceFiles/export/export_controller.cpp | 8 +- .../SourceFiles/export/export_manager.cpp | 4 +- .../view/export_view_panel_controller.cpp | 24 +- .../export/view/export_view_progress.cpp | 6 +- .../export/view/export_view_settings.cpp | 26 +- .../admin_log/history_admin_log_inner.cpp | 18 +- .../admin_log/history_admin_log_section.cpp | 24 +- Telegram/SourceFiles/history/history.cpp | 8 +- .../SourceFiles/history/history_drag_area.cpp | 4 +- .../history/history_inner_widget.cpp | 38 +-- Telegram/SourceFiles/history/history_item.cpp | 4 +- .../history/history_item_helpers.cpp | 6 +- .../SourceFiles/history/history_widget.cpp | 234 +++++++++--------- .../history_view_characters_limit.cpp | 2 +- .../history_view_compose_controls.cpp | 148 +++++------ ...istory_view_compose_media_edit_manager.cpp | 2 +- .../controls/history_view_compose_search.cpp | 74 +++--- .../controls/history_view_draft_options.cpp | 34 +-- .../controls/history_view_forward_panel.cpp | 8 +- .../controls/history_view_suggest_options.cpp | 26 +- .../view/controls/history_view_ttl_button.cpp | 2 +- .../history_view_voice_record_bar.cpp | 88 +++---- .../history_view_voice_record_button.cpp | 10 +- .../history_view_webpage_processor.cpp | 8 +- .../view/history_view_chat_preview.cpp | 24 +- .../view/history_view_chat_section.cpp | 132 +++++----- .../view/history_view_contact_status.cpp | 42 ++-- .../view/history_view_context_menu.cpp | 10 +- .../view/history_view_corner_buttons.cpp | 2 +- .../history/view/history_view_element.cpp | 2 +- .../view/history_view_emoji_interactions.cpp | 12 +- .../view/history_view_empty_list_bubble.cpp | 2 +- .../view/history_view_group_call_bar.cpp | 8 +- .../history_view_group_members_widget.cpp | 4 +- .../history/view/history_view_list_widget.cpp | 32 +-- .../view/history_view_paid_reaction_toast.cpp | 14 +- .../history/view/history_view_pinned_bar.cpp | 4 +- .../view/history_view_pinned_section.cpp | 22 +- .../view/history_view_pinned_tracker.cpp | 4 +- .../view/history_view_reaction_preview.cpp | 2 +- .../view/history_view_requests_bar.cpp | 6 +- .../view/history_view_schedule_box.cpp | 2 +- .../view/history_view_scheduled_section.cpp | 56 ++--- .../history_view_self_forwards_tagger.cpp | 22 +- .../view/history_view_sticker_toast.cpp | 8 +- .../view/history_view_subsection_tabs.cpp | 40 +-- .../view/history_view_top_bar_widget.cpp | 34 +-- .../view/history_view_translate_bar.cpp | 18 +- .../view/history_view_translate_tracker.cpp | 4 +- .../view/media/history_view_document.cpp | 4 +- .../history/view/media/history_view_gif.cpp | 6 +- .../view/media/history_view_media_common.cpp | 10 +- .../history/view/media/history_view_photo.cpp | 2 +- .../view/media/history_view_premium_gift.cpp | 2 +- .../view/media/history_view_service_box.cpp | 4 +- .../media/history_view_sticker_player.cpp | 2 +- .../media/history_view_theme_document.cpp | 2 +- .../media/history_view_userpic_suggestion.cpp | 2 +- .../history_view_reactions_button.cpp | 14 +- .../reactions/history_view_reactions_list.cpp | 2 +- .../history_view_reactions_selector.cpp | 32 +-- .../history_view_reactions_strip.cpp | 6 +- .../reactions/history_view_reactions_tabs.cpp | 4 +- .../info/bot/earn/info_bot_earn_list.cpp | 14 +- .../info/bot/earn/info_bot_earn_widget.cpp | 4 +- .../bot/starref/info_bot_starref_common.cpp | 30 +-- .../starref/info_bot_starref_join_widget.cpp | 28 +-- .../starref/info_bot_starref_setup_widget.cpp | 42 ++-- .../boosts/create_giveaway_box.cpp | 52 ++-- .../boosts/giveaway/boost_badge.cpp | 14 +- .../giveaway/giveaway_list_controllers.cpp | 2 +- .../boosts/giveaway/giveaway_type_row.cpp | 4 +- .../boosts/giveaway/select_countries_box.cpp | 2 +- .../boosts/info_boosts_inner_widget.cpp | 16 +- .../boosts/info_boosts_widget.cpp | 4 +- .../earn/info_channel_earn_list.cpp | 38 +-- .../earn/info_channel_earn_widget.cpp | 4 +- .../info_common_groups_inner_widget.cpp | 8 +- .../downloads/info_downloads_inner_widget.cpp | 8 +- .../downloads/info_downloads_provider.cpp | 14 +- .../info/downloads/info_downloads_widget.cpp | 2 +- .../info_global_media_inner_widget.cpp | 6 +- .../info_global_media_provider.cpp | 6 +- .../global_media/info_global_media_widget.cpp | 2 +- .../SourceFiles/info/info_content_widget.cpp | 18 +- Telegram/SourceFiles/info/info_controller.cpp | 6 +- .../SourceFiles/info/info_flexible_scroll.cpp | 12 +- .../SourceFiles/info/info_layer_widget.cpp | 6 +- Telegram/SourceFiles/info/info_memento.cpp | 4 +- .../SourceFiles/info/info_section_widget.cpp | 4 +- Telegram/SourceFiles/info/info_top_bar.cpp | 20 +- .../SourceFiles/info/info_wrap_widget.cpp | 24 +- .../info/media/info_media_buttons.cpp | 2 +- .../info/media/info_media_empty_widget.cpp | 2 +- .../info/media/info_media_inner_widget.cpp | 8 +- .../info/media/info_media_list_widget.cpp | 30 +-- .../info/media/info_media_provider.cpp | 8 +- .../info/media/info_media_widget.cpp | 2 +- .../info_peer_gifts_collections.cpp | 2 +- .../peer_gifts/info_peer_gifts_common.cpp | 14 +- .../peer_gifts/info_peer_gifts_widget.cpp | 46 ++-- .../polls/info_polls_results_inner_widget.cpp | 18 +- .../info/polls/info_polls_results_widget.cpp | 4 +- .../info/profile/info_profile_actions.cpp | 70 +++--- .../info/profile/info_profile_badge.cpp | 6 +- .../info/profile/info_profile_cover.cpp | 36 +-- .../info_profile_emoji_status_panel.cpp | 10 +- .../profile/info_profile_inner_widget.cpp | 10 +- .../info/profile/info_profile_members.cpp | 18 +- .../info/profile/info_profile_phone_menu.cpp | 2 +- .../info/profile/info_profile_text.cpp | 2 +- .../info/profile/info_profile_top_bar.cpp | 56 ++--- .../info/profile/info_profile_widget.cpp | 12 +- .../info_reactions_list_widget.cpp | 10 +- .../info_requests_list_widget.cpp | 8 +- .../info/saved/info_saved_music_common.cpp | 2 +- .../info/saved/info_saved_music_provider.cpp | 6 +- .../info/saved/info_saved_music_widget.cpp | 4 +- .../info/saved/info_saved_sublists_widget.cpp | 4 +- .../info/settings/info_settings_widget.cpp | 20 +- .../info_similar_peers_widget.cpp | 14 +- .../info_statistics_inner_widget.cpp | 18 +- .../info_statistics_recent_message.cpp | 2 +- .../statistics/info_statistics_widget.cpp | 4 +- .../info/stories/info_stories_albums.cpp | 2 +- .../stories/info_stories_inner_widget.cpp | 24 +- .../info/stories/info_stories_provider.cpp | 6 +- .../info/stories/info_stories_widget.cpp | 20 +- .../info/userpic/info_userpic_bubble_wrap.cpp | 2 +- .../userpic/info_userpic_colors_editor.cpp | 10 +- .../userpic/info_userpic_emoji_builder.cpp | 4 +- .../info_userpic_emoji_builder_menu_item.cpp | 6 +- .../info_userpic_emoji_builder_preview.cpp | 2 +- .../info_userpic_emoji_builder_widget.cpp | 32 +-- .../inline_bots/bot_attach_web_view.cpp | 24 +- .../inline_bot_confirm_prepared.cpp | 12 +- .../inline_bots/inline_bot_downloads.cpp | 4 +- .../inline_bot_layout_internal.cpp | 2 +- .../inline_bots/inline_results_inner.cpp | 8 +- .../inline_bots/inline_results_widget.cpp | 8 +- Telegram/SourceFiles/intro/intro_code.cpp | 4 +- Telegram/SourceFiles/intro/intro_email.cpp | 10 +- .../intro/intro_password_check.cpp | 10 +- Telegram/SourceFiles/intro/intro_phone.cpp | 14 +- Telegram/SourceFiles/intro/intro_qr.cpp | 24 +- Telegram/SourceFiles/intro/intro_signup.cpp | 2 +- Telegram/SourceFiles/intro/intro_step.cpp | 8 +- Telegram/SourceFiles/intro/intro_widget.cpp | 26 +- Telegram/SourceFiles/iv/iv_controller.cpp | 50 ++-- Telegram/SourceFiles/iv/iv_instance.cpp | 18 +- .../SourceFiles/lang/lang_cloud_manager.cpp | 10 +- Telegram/SourceFiles/main/main_account.cpp | 12 +- Telegram/SourceFiles/main/main_app_config.cpp | 6 +- Telegram/SourceFiles/main/main_domain.cpp | 12 +- Telegram/SourceFiles/main/main_session.cpp | 8 +- .../main/session/send_as_peers.cpp | 2 +- Telegram/SourceFiles/mainwidget.cpp | 52 ++-- Telegram/SourceFiles/mainwindow.cpp | 12 +- .../SourceFiles/media/audio/media_audio.cpp | 4 +- .../media/audio/media_audio_track.cpp | 2 +- .../media/player/media_player_dropdown.cpp | 30 +-- .../media/player/media_player_float.cpp | 22 +- .../media/player/media_player_instance.cpp | 26 +- .../media/player/media_player_panel.cpp | 12 +- .../player/media_player_volume_controller.cpp | 6 +- .../media/player/media_player_widget.cpp | 22 +- .../media_stories_caption_full_view.cpp | 6 +- .../stories/media_stories_controller.cpp | 32 +-- .../media/stories/media_stories_header.cpp | 32 +-- .../media/stories/media_stories_reactions.cpp | 42 ++-- .../stories/media_stories_recent_views.cpp | 26 +- .../media/stories/media_stories_reply.cpp | 22 +- .../stories/media_stories_repost_view.cpp | 2 +- .../media/stories/media_stories_sibling.cpp | 6 +- .../media/stories/media_stories_slider.cpp | 6 +- .../media/stories/media_stories_stealth.cpp | 10 +- .../streaming/media_streaming_audio_track.cpp | 2 +- .../streaming/media_streaming_document.cpp | 4 +- .../streaming/media_streaming_player.cpp | 10 +- .../streaming/media_streaming_reader.cpp | 2 +- .../media/system_media_controls_manager.cpp | 28 +-- .../media/view/media_view_overlay_opengl.cpp | 6 +- .../media/view/media_view_overlay_widget.cpp | 58 ++--- .../SourceFiles/media/view/media_view_pip.cpp | 22 +- .../media/view/media_view_pip_opengl.cpp | 2 +- .../view/media_view_playback_controls.cpp | 2 +- .../view/media_view_playback_sponsored.cpp | 8 +- .../media/view/media_view_video_stream.cpp | 12 +- .../menu/menu_antispam_validator.cpp | 4 +- Telegram/SourceFiles/menu/menu_check_item.cpp | 4 +- .../menu/menu_item_download_files.cpp | 2 +- .../menu/menu_item_rate_transcribe.cpp | 8 +- Telegram/SourceFiles/menu/menu_mute.cpp | 4 +- Telegram/SourceFiles/menu/menu_send.cpp | 10 +- Telegram/SourceFiles/menu/menu_sponsored.cpp | 12 +- Telegram/SourceFiles/menu/menu_ttl.cpp | 4 +- .../SourceFiles/mtproto/connection_tcp.cpp | 10 +- .../mtproto/dedicated_file_loader.cpp | 2 +- Telegram/SourceFiles/mtproto/mtp_instance.cpp | 8 +- Telegram/SourceFiles/mtproto/session.cpp | 6 +- .../passport/passport_edit_identity_box.cpp | 4 +- .../passport/passport_form_controller.cpp | 14 +- .../SourceFiles/passport/passport_panel.cpp | 6 +- .../passport/passport_panel_controller.cpp | 24 +- .../passport/passport_panel_edit_contact.cpp | 20 +- .../passport/passport_panel_edit_document.cpp | 8 +- .../passport/passport_panel_edit_scans.cpp | 14 +- .../passport/passport_panel_form.cpp | 4 +- .../passport/passport_panel_password.cpp | 6 +- .../passport/ui/passport_details_row.cpp | 20 +- .../payments/payments_checkout_process.cpp | 16 +- .../SourceFiles/payments/payments_form.cpp | 2 +- .../payments/payments_non_panel_process.cpp | 2 +- .../payments/payments_reaction_process.cpp | 2 +- .../payments/ui/payments_edit_card.cpp | 8 +- .../payments/ui/payments_edit_information.cpp | 4 +- .../payments/ui/payments_field.cpp | 18 +- .../payments/ui/payments_form_summary.cpp | 12 +- .../payments/ui/payments_panel.cpp | 30 +-- .../payments/ui/payments_reaction_box.cpp | 36 +-- .../SourceFiles/platform/linux/tray_linux.cpp | 8 +- .../platform/mac/notifications_manager_mac.mm | 2 +- .../platform/mac/overlay_widget_mac.mm | 6 +- .../touchbar/items/mac_pinned_chats_item.mm | 22 +- .../mac/touchbar/items/mac_scrubber_item.mm | 8 +- .../mac/touchbar/mac_touchbar_audio.mm | 2 +- .../mac/touchbar/mac_touchbar_controls.mm | 8 +- .../mac/touchbar/mac_touchbar_manager.mm | 6 +- .../mac/touchbar/mac_touchbar_media_view.mm | 2 +- Telegram/SourceFiles/platform/mac/tray_mac.mm | 8 +- .../platform/platform_overlay_widget.cpp | 6 +- .../platform/win/main_window_win.cpp | 6 +- .../win/notifications_manager_win.cpp | 2 +- .../SourceFiles/platform/win/tray_win.cpp | 6 +- .../profile/profile_back_button.cpp | 4 +- .../business/settings_away_message.cpp | 4 +- .../settings/business/settings_chat_intro.cpp | 26 +- .../settings/business/settings_chat_links.cpp | 18 +- .../settings/business/settings_chatbots.cpp | 14 +- .../settings/business/settings_greeting.cpp | 2 +- .../settings/business/settings_location.cpp | 14 +- .../business/settings_quick_replies.cpp | 6 +- .../business/settings_recipients_helper.cpp | 16 +- .../business/settings_shortcut_messages.cpp | 50 ++-- .../business/settings_working_hours.cpp | 20 +- .../settings_cloud_password_common.cpp | 10 +- .../settings_cloud_password_email.cpp | 6 +- .../settings_cloud_password_email_confirm.cpp | 20 +- .../settings_cloud_password_hint.cpp | 6 +- .../settings_cloud_password_input.cpp | 32 +-- .../settings_cloud_password_login_email.cpp | 4 +- ...ngs_cloud_password_login_email_confirm.cpp | 4 +- .../settings_cloud_password_manage.cpp | 8 +- .../settings_cloud_password_validate_icon.cpp | 2 +- .../settings/settings_active_sessions.cpp | 24 +- .../settings/settings_advanced.cpp | 64 ++--- .../settings/settings_blocked_peers.cpp | 14 +- .../settings/settings_business.cpp | 34 +-- .../SourceFiles/settings/settings_calls.cpp | 18 +- .../SourceFiles/settings/settings_chat.cpp | 54 ++-- .../SourceFiles/settings/settings_common.cpp | 16 +- .../SourceFiles/settings/settings_credits.cpp | 32 +-- .../settings/settings_credits_graphics.cpp | 94 +++---- .../settings/settings_experimental.cpp | 2 +- .../SourceFiles/settings/settings_folders.cpp | 24 +- .../settings/settings_global_ttl.cpp | 8 +- .../settings/settings_information.cpp | 52 ++-- .../SourceFiles/settings/settings_intro.cpp | 12 +- .../settings/settings_local_passcode.cpp | 16 +- .../SourceFiles/settings/settings_main.cpp | 24 +- .../settings/settings_notifications.cpp | 50 ++-- .../settings/settings_notifications_type.cpp | 14 +- .../settings/settings_passkeys.cpp | 10 +- .../settings/settings_power_saving.cpp | 4 +- .../SourceFiles/settings/settings_premium.cpp | 56 ++--- .../settings/settings_privacy_controllers.cpp | 34 +-- .../settings/settings_privacy_security.cpp | 40 +-- .../settings/settings_scale_preview.cpp | 6 +- .../settings/settings_shortcuts.cpp | 4 +- .../settings/settings_websites.cpp | 12 +- .../SourceFiles/statistics/chart_widget.cpp | 32 +-- .../widgets/point_details_widget.cpp | 4 +- .../storage/download_manager_mtproto.cpp | 4 +- .../SourceFiles/storage/file_download_web.cpp | 2 +- Telegram/SourceFiles/storage/file_upload.cpp | 14 +- .../storage/storage_cloud_blob.cpp | 4 +- .../storage/storage_user_photos.cpp | 2 +- .../storage/streamed_file_downloader.cpp | 2 +- .../support/support_autocomplete.cpp | 16 +- .../SourceFiles/support/support_helper.cpp | 10 +- .../SourceFiles/support/support_templates.cpp | 4 +- Telegram/SourceFiles/tests/test_text.cpp | 2 +- Telegram/SourceFiles/tray.cpp | 8 +- .../ui/boxes/auto_delete_settings.cpp | 8 +- Telegram/SourceFiles/ui/boxes/boost_box.cpp | 20 +- .../SourceFiles/ui/boxes/calendar_box.cpp | 30 +-- .../SourceFiles/ui/boxes/choose_date_time.cpp | 18 +- .../SourceFiles/ui/boxes/choose_font_box.cpp | 14 +- .../ui/boxes/choose_language_box.cpp | 4 +- Telegram/SourceFiles/ui/boxes/choose_time.cpp | 12 +- .../ui/boxes/collectible_info_box.cpp | 12 +- Telegram/SourceFiles/ui/boxes/confirm_box.cpp | 8 +- .../ui/boxes/confirm_phone_box.cpp | 2 +- .../ui/boxes/country_select_box.cpp | 4 +- .../ui/boxes/edit_birthday_box.cpp | 8 +- .../ui/boxes/edit_factcheck_box.cpp | 4 +- .../SourceFiles/ui/boxes/edit_invite_link.cpp | 2 +- .../ui/boxes/edit_invite_link_session.cpp | 6 +- Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp | 26 +- .../SourceFiles/ui/boxes/rate_call_box.cpp | 6 +- .../ui/boxes/report_box_graphics.cpp | 6 +- .../ui/boxes/show_or_premium_box.cpp | 8 +- .../SourceFiles/ui/boxes/time_picker_box.cpp | 4 +- .../SourceFiles/ui/cached_round_corners.cpp | 2 +- .../ui/chat/attach/attach_bot_downloads.cpp | 6 +- .../ui/chat/attach/attach_bot_webview.cpp | 58 ++--- .../ui/chat/attach/attach_controls.cpp | 2 +- .../attach_item_single_file_preview.cpp | 2 +- .../attach_item_single_media_preview.cpp | 4 +- .../attach/attach_single_media_preview.cpp | 2 +- Telegram/SourceFiles/ui/chat/chat_style.cpp | 4 +- .../SourceFiles/ui/chat/choose_send_as.cpp | 8 +- .../ui/chat/choose_theme_controller.cpp | 30 +-- .../ui/chat/forward_options_box.cpp | 4 +- .../SourceFiles/ui/chat/group_call_bar.cpp | 16 +- .../ui/chat/group_call_userpics.cpp | 4 +- Telegram/SourceFiles/ui/chat/message_bar.cpp | 6 +- .../SourceFiles/ui/chat/more_chats_bar.cpp | 10 +- Telegram/SourceFiles/ui/chat/pinned_bar.cpp | 14 +- Telegram/SourceFiles/ui/chat/requests_bar.cpp | 12 +- .../ui/chat/sponsored_message_bar.cpp | 16 +- .../SourceFiles/ui/controls/button_labels.cpp | 4 +- .../ui/controls/call_mute_button.cpp | 28 +-- .../ui/controls/chat_service_checkbox.cpp | 4 +- .../delete_message_context_action.cpp | 2 +- .../SourceFiles/ui/controls/download_bar.cpp | 6 +- .../ui/controls/emoji_button_factory.cpp | 6 +- .../SourceFiles/ui/controls/feature_list.cpp | 2 +- .../ui/controls/filter_link_header.cpp | 10 +- .../ui/controls/invite_link_buttons.cpp | 8 +- .../ui/controls/invite_link_label.cpp | 6 +- .../ui/controls/location_picker.cpp | 34 +-- .../ui/controls/round_video_recorder.cpp | 6 +- .../SourceFiles/ui/controls/send_button.cpp | 2 +- .../SourceFiles/ui/controls/silent_toggle.cpp | 2 +- .../SourceFiles/ui/controls/stars_rating.cpp | 4 +- .../ui/controls/subsection_tabs_slider.cpp | 4 +- .../subsection_tabs_slider_reorder.cpp | 2 +- .../SourceFiles/ui/controls/swipe_handler.cpp | 8 +- .../SourceFiles/ui/controls/tabbed_search.cpp | 30 +-- .../SourceFiles/ui/controls/table_rows.cpp | 22 +- .../SourceFiles/ui/controls/ton_common.cpp | 2 +- .../ui/controls/userpic_button.cpp | 20 +- .../controls/who_reacted_context_action.cpp | 16 +- .../ui/controls/window_outdated_bar.cpp | 2 +- Telegram/SourceFiles/ui/countryinput.cpp | 4 +- .../SourceFiles/ui/dynamic_thumbnails.cpp | 6 +- .../ui/effects/credits_graphics.cpp | 10 +- .../ui/effects/emoji_fly_animation.cpp | 4 +- .../ui/effects/loading_element.cpp | 6 +- .../message_sending_animation_controller.cpp | 14 +- .../SourceFiles/ui/effects/premium_bubble.cpp | 14 +- .../ui/effects/premium_graphics.cpp | 22 +- .../ui/effects/premium_top_bar.cpp | 6 +- .../SourceFiles/ui/effects/round_checkbox.cpp | 2 +- .../ui/effects/scroll_content_shadow.cpp | 2 +- .../SourceFiles/ui/effects/toggle_arrow.cpp | 2 +- Telegram/SourceFiles/ui/filter_icon_panel.cpp | 6 +- Telegram/SourceFiles/ui/new_badges.cpp | 6 +- Telegram/SourceFiles/ui/peer/color_sample.cpp | 6 +- .../ui/peer/video_userpic_player.cpp | 2 +- Telegram/SourceFiles/ui/resize_area.h | 4 +- .../ui/search_field_controller.cpp | 8 +- .../SourceFiles/ui/unread_badge_paint.cpp | 2 +- .../ui/widgets/chat_filters_tabs_slider.cpp | 4 +- .../chat_filters_tabs_slider_reorder.cpp | 2 +- .../ui/widgets/chat_filters_tabs_strip.cpp | 22 +- .../SourceFiles/ui/widgets/color_editor.cpp | 2 +- .../ui/widgets/expandable_peer_list.cpp | 12 +- .../ui/widgets/horizontal_fit_container.cpp | 2 +- .../SourceFiles/ui/widgets/multi_select.cpp | 8 +- .../SourceFiles/ui/widgets/peer_bubble.cpp | 4 +- .../ui/widgets/sent_code_field.cpp | 2 +- .../ui/widgets/vertical_drum_picker.cpp | 6 +- Telegram/SourceFiles/window/main_window.cpp | 16 +- .../window/notifications_manager.cpp | 6 +- .../window/notifications_manager_default.cpp | 20 +- .../SourceFiles/window/section_widget.cpp | 4 +- .../window/themes/window_theme.cpp | 10 +- .../window/themes/window_theme_editor.cpp | 10 +- .../themes/window_theme_editor_block.cpp | 10 +- .../window/themes/window_theme_editor_box.cpp | 6 +- .../themes/window_themes_cloud_list.cpp | 6 +- .../window/window_chat_preview.cpp | 6 +- .../window/window_chat_switch_process.cpp | 14 +- .../window/window_connecting_widget.cpp | 14 +- .../SourceFiles/window/window_controller.cpp | 20 +- .../window/window_filters_menu.cpp | 18 +- .../window/window_history_hider.cpp | 2 +- .../window/window_lock_widgets.cpp | 16 +- .../SourceFiles/window/window_main_menu.cpp | 36 +-- .../window/window_main_menu_helpers.cpp | 14 +- .../window/window_media_preview.cpp | 8 +- .../SourceFiles/window/window_peer_menu.cpp | 48 ++-- .../window/window_session_controller.cpp | 42 ++-- .../SourceFiles/window/window_setup_email.cpp | 10 +- .../SourceFiles/window/window_top_bar_wrap.h | 4 +- Telegram/lib_base | 2 +- Telegram/lib_crl | 2 +- Telegram/lib_lottie | 2 +- Telegram/lib_rpl | 2 +- Telegram/lib_spellcheck | 2 +- Telegram/lib_ui | 2 +- Telegram/lib_webrtc | 2 +- Telegram/lib_webview | 2 +- 623 files changed, 4524 insertions(+), 4524 deletions(-) diff --git a/.cursor/rules/rpl_guide.mdc b/.cursor/rules/rpl_guide.mdc index 628a1d7e50..733584ad0b 100644 --- a/.cursor/rules/rpl_guide.mdc +++ b/.cursor/rules/rpl_guide.mdc @@ -60,7 +60,7 @@ rpl::lifetime &parentLifetime = /* ... get lifetime from context ... */; To consume values from a producer, you start a pipeline using one of the `rpl::start_...` methods. These methods subscribe to the producer and execute callbacks for the events they handle. -The most common method is `rpl::start_with_next`: +The most common method is `rpl::on_next`: ```cpp auto counter = /* ... */; // Type: rpl::producer @@ -69,20 +69,20 @@ rpl::lifetime lifetime; // Counter is consumed here, use std::move if it's an l-value. std::move( counter -) | rpl::start_with_next([=]\(int nextValue) { +) | rpl::on_next([=]\(int nextValue) { // Process the next integer value emitted by the producer. qDebug() << "Received: " << nextValue; }, lifetime); // Pass the lifetime to manage the subscription. // Note: `counter` is now in a moved-from state and likely invalid. // If you need to start the same producer multiple times, duplicate it: -// rpl::duplicate(counter) | rpl::start_with_next(...); +// rpl::duplicate(counter) | rpl::on_next(...); // If you DON'T pass a lifetime to a start_... method: auto counter2 = /* ... */; // Type: rpl::producer rpl::lifetime subscriptionLifetime = std::move( counter2 -) | rpl::start_with_next([=]\(int nextValue) { /* ... */ }); +) | rpl::on_next([=]\(int nextValue) { /* ... */ }); // The returned lifetime MUST be stored. If it's discarded immediately, // the subscription stops instantly. // `counter2` is also moved-from here. @@ -98,7 +98,7 @@ rpl::lifetime lifetime; // If it's the only use, std::move(dataStream) would be preferred. rpl::duplicate( dataStream -) | rpl::start_with_error([=]\(Error &&error) { +) | rpl::on_error([=]\(Error &&error) { // Handle the error signaled by the producer. qDebug() << "Error: " << error.text(); }, lifetime); @@ -106,7 +106,7 @@ rpl::duplicate( // Using dataStream again, perhaps duplicated again or moved if last use. rpl::duplicate( dataStream -) | rpl::start_with_done([=] { +) | rpl::on_done([=] { // Execute when the producer signals it's finished emitting values. qDebug() << "Stream finished."; }, lifetime); @@ -114,7 +114,7 @@ rpl::duplicate( // Last use of dataStream, so we move it. std::move( dataStream -) | rpl::start_with_next_error_done( +) | rpl::on_next_error_done( [=]\(QString &&value) { /* handle next value */ }, [=]\(Error &&error) { /* handle error */ }, [=] { /* handle done */ }, @@ -169,7 +169,7 @@ You can combine multiple producers into one: // The lambda receives unpacked arguments, not the tuple itself. std::move( combined - ) | rpl::start_with_next([=]\(int count, const QString &text) { + ) | rpl::on_next([=]\(int count, const QString &text) { // No need for std::get<0>(latest), etc. qDebug() << "Combined: Count=" << count << ", Text=" << text; }, lifetime); @@ -181,7 +181,7 @@ You can combine multiple producers into one: return count > 0 && !text.isEmpty(); }) | rpl::map([=]\(int count, const QString &text) { return text.repeated(count); - }) | rpl::start_with_next([=]\(const QString &result) { + }) | rpl::on_next([=]\(const QString &result) { qDebug() << "Mapped & Filtered: " << result; }, lifetime); ``` @@ -197,7 +197,7 @@ You can combine multiple producers into one: // Starting the merged producer consumes it. std::move( merged - ) | rpl::start_with_next([=]\(QString &&value) { + ) | rpl::on_next([=]\(QString &&value) { // Receives values from either sourceA or sourceB as they arrive. qDebug() << "Merged value: " << value; }, lifetime); diff --git a/Telegram/SourceFiles/api/api_authorizations.cpp b/Telegram/SourceFiles/api/api_authorizations.cpp index 985cdde1a8..9652e7fedd 100644 --- a/Telegram/SourceFiles/api/api_authorizations.cpp +++ b/Telegram/SourceFiles/api/api_authorizations.cpp @@ -100,7 +100,7 @@ Authorizations::Authorizations(not_null api) _unreviewed = api->session().settings().unreviewed(); crl::on_main(&api->session(), [=] { removeExpiredUnreviewed(); }); Core::App().settings().deviceModelChanges( - ) | rpl::start_with_next([=](const QString &model) { + ) | rpl::on_next([=](const QString &model) { auto changed = false; for (auto &entry : _list) { if (!entry.hash) { diff --git a/Telegram/SourceFiles/api/api_bot.cpp b/Telegram/SourceFiles/api/api_bot.cpp index 5eeddb0a18..5592dd0269 100644 --- a/Telegram/SourceFiles/api/api_bot.cpp +++ b/Telegram/SourceFiles/api/api_bot.cpp @@ -227,7 +227,7 @@ void SendBotCallbackDataWithPassword( api->cloudPassword().state( ) | rpl::take( 1 - ) | rpl::start_with_next([=](const Core::CloudPasswordState &state) mutable { + ) | rpl::on_next([=](const Core::CloudPasswordState &state) mutable { if (lifetime) { base::take(lifetime)->destroy(); } diff --git a/Telegram/SourceFiles/api/api_chat_filters.cpp b/Telegram/SourceFiles/api/api_chat_filters.cpp index 55bbabbc57..a3ef0d82e5 100644 --- a/Telegram/SourceFiles/api/api_chat_filters.cpp +++ b/Telegram/SourceFiles/api/api_chat_filters.cpp @@ -174,13 +174,13 @@ void InitFilterLinkHeader( box->setAddedTopScrollSkip(max); std::move( header.wheelEvents - ) | rpl::start_with_next([=](not_null e) { + ) | rpl::on_next([=](not_null e) { box->sendScrollViewportEvent(e); }, widget->lifetime()); std::move( header.closeRequests - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { box->closeBox(); }, widget->lifetime()); @@ -193,7 +193,7 @@ void InitFilterLinkHeader( box->scrolls( ) | rpl::filter([=] { return !state->processing; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { state->processing = true; const auto guard = gsl::finally([&] { state->processing = false; }); @@ -470,7 +470,7 @@ void ToggleChatsController::adjust( void ToggleChatsController::setRealContentHeight(rpl::producer value) { std::move( value - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { const auto desired = _desiredHeight.current(); if (height <= computeListSt().item.height) { return; @@ -644,7 +644,7 @@ void ProcessFilterInvite( const auto button = owned.data(); box->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto &padding = st::filterInviteBox.buttonPadding; button->resizeToWidth(width - padding.left() @@ -662,7 +662,7 @@ void ProcessFilterInvite( const auto state = box->lifetime().make_state(); raw->selectedValue( - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( base::flat_set> &&peers) { button->setClickedCallback([=] { if (peers.empty()) { @@ -777,7 +777,7 @@ void CheckFilterInvite( if (notLoaded) { const auto lifetime = std::make_shared(); owner.chatsFilters().changed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { lifetime->destroy(); ProcessFilterInvite( weak, @@ -873,7 +873,7 @@ void ProcessFilterRemove( const auto button = owned.data(); box->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto &padding = st::filterInviteBox.buttonPadding; button->resizeToWidth(width - padding.left() @@ -886,7 +886,7 @@ void ProcessFilterRemove( HandleEnterInBox(box); raw->selectedValue( - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( base::flat_set> &&peers) { button->setClickedCallback([=] { done(peers | ranges::to_vector); diff --git a/Telegram/SourceFiles/api/api_chat_invite.cpp b/Telegram/SourceFiles/api/api_chat_invite.cpp index 415c1a8296..ccbab9fca1 100644 --- a/Telegram/SourceFiles/api/api_chat_invite.cpp +++ b/Telegram/SourceFiles/api/api_chat_invite.cpp @@ -159,7 +159,7 @@ void ConfirmSubscriptionBox( state->frame.setDevicePixelRatio(style::DevicePixelRatio()); const auto options = Images::Option::RoundCircle; userpic->paintRequest( - ) | rpl::start_with_next([=, small = Data::PhotoSize::Small] { + ) | rpl::on_next([=, small = Data::PhotoSize::Small] { state->frame.fill(Qt::transparent); { auto p = QPainter(&state->frame); @@ -194,7 +194,7 @@ void ConfirmSubscriptionBox( state->photoMedia->wanted(Data::PhotoSize::Small, Data::FileOrigin()); if (!state->photoMedia->image(Data::PhotoSize::Small)) { session->downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { userpic->update(); }, userpic->lifetime()); } @@ -260,7 +260,7 @@ void ConfirmSubscriptionBox( rpl::combine( balance->sizeValue(), content->sizeValue() - ) | rpl::start_with_next([=](const QSize &, const QSize &) { + ) | rpl::on_next([=](const QSize &, const QSize &) { balance->moveToRight( st::creditsHistoryRightSkip * 2, st::creditsHistoryRightSkip); @@ -408,7 +408,7 @@ void CheckChatInvite( box->boxClosing( ) | rpl::filter([=] { return !invitePeekChannel->amIn(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { if (const auto strong = weak.get()) { strong->clearSectionStack(Window::SectionShow( Window::SectionShow::Way::ClearStack, @@ -527,7 +527,7 @@ ConfirmInviteBox::ConfirmInviteBox( _photo->wanted(Data::PhotoSize::Small, Data::FileOrigin()); if (!_photo->image(Data::PhotoSize::Small)) { _session->downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); }, lifetime()); } diff --git a/Telegram/SourceFiles/api/api_confirm_phone.cpp b/Telegram/SourceFiles/api/api_confirm_phone.cpp index 7379681138..a080571a0e 100644 --- a/Telegram/SourceFiles/api/api_confirm_phone.cpp +++ b/Telegram/SourceFiles/api/api_confirm_phone.cpp @@ -95,7 +95,7 @@ void ConfirmPhone::resolve( codeHandles->fire_copy(code); }); box->resendRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _api.request(MTPauth_ResendCode( MTP_flags(0), MTP_string(phone), @@ -110,7 +110,7 @@ void ConfirmPhone::resolve( rpl::merge( codeHandles->events(), box->checkRequests() - ) | rpl::start_with_next([=](const QString &code) { + ) | rpl::on_next([=](const QString &code) { if (_checkRequestId) { return; } @@ -142,7 +142,7 @@ void ConfirmPhone::resolve( }).handleFloodErrors().send(); }, box->lifetime()); box->boxClosing( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { controller->session().account().setHandleLoginCode(nullptr); }, box->lifetime()); diff --git a/Telegram/SourceFiles/api/api_earn.cpp b/Telegram/SourceFiles/api/api_earn.cpp index 3b8272fc4e..ef509eddde 100644 --- a/Telegram/SourceFiles/api/api_earn.cpp +++ b/Telegram/SourceFiles/api/api_earn.cpp @@ -69,7 +69,7 @@ void HandleWithdrawalButton( state->lifetime = session->api().cloudPassword().state( ) | rpl::take( 1 - ) | rpl::start_with_next([=](const Core::CloudPasswordState &pass) { + ) | rpl::on_next([=](const Core::CloudPasswordState &pass) { state->loading = false; auto fields = PasscodeBox::CloudFields::From(pass); diff --git a/Telegram/SourceFiles/api/api_global_privacy.cpp b/Telegram/SourceFiles/api/api_global_privacy.cpp index 3dbce0425a..82c35e5a73 100644 --- a/Telegram/SourceFiles/api/api_global_privacy.cpp +++ b/Telegram/SourceFiles/api/api_global_privacy.cpp @@ -68,7 +68,7 @@ void GlobalPrivacy::reload(Fn callback) { }).send(); _session->appConfig().value( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _showArchiveAndMute = _session->appConfig().get( u"autoarchive_setting_available"_q, false); diff --git a/Telegram/SourceFiles/api/api_messages_search_merged.cpp b/Telegram/SourceFiles/api/api_messages_search_merged.cpp index 5a26e4386b..8e15f5255a 100644 --- a/Telegram/SourceFiles/api/api_messages_search_merged.cpp +++ b/Telegram/SourceFiles/api/api_messages_search_merged.cpp @@ -36,7 +36,7 @@ MessagesSearchMerged::MessagesSearchMerged(not_null history) }; _apiSearch.messagesFounds( - ) | rpl::start_with_next([=](const FoundMessages &data) { + ) | rpl::on_next([=](const FoundMessages &data) { if (data.nextToken == _concatedFound.nextToken) { addFound(data); checkFull(data); @@ -50,7 +50,7 @@ MessagesSearchMerged::MessagesSearchMerged(not_null history) if (_migratedSearch) { _migratedSearch->messagesFounds( - ) | rpl::start_with_next([=](const FoundMessages &data) { + ) | rpl::on_next([=](const FoundMessages &data) { if (_isFull) { addFound(data); } diff --git a/Telegram/SourceFiles/api/api_peer_photo.cpp b/Telegram/SourceFiles/api/api_peer_photo.cpp index 9c8a470fa9..e333565aa0 100644 --- a/Telegram/SourceFiles/api/api_peer_photo.cpp +++ b/Telegram/SourceFiles/api/api_peer_photo.cpp @@ -153,7 +153,7 @@ PeerPhoto::PeerPhoto(not_null api) // You can't use _session->lifetime() in the constructor, // only queued, because it is not constructed yet. _session->uploader().photoReady( - ) | rpl::start_with_next([=](const Storage::UploadedMedia &data) { + ) | rpl::on_next([=](const Storage::UploadedMedia &data) { ready(data.fullId, data.info.file, std::nullopt); }, _session->lifetime()); }); diff --git a/Telegram/SourceFiles/api/api_premium.cpp b/Telegram/SourceFiles/api/api_premium.cpp index 316681746a..713458b275 100644 --- a/Telegram/SourceFiles/api/api_premium.cpp +++ b/Telegram/SourceFiles/api/api_premium.cpp @@ -95,7 +95,7 @@ Premium::Premium(not_null api) // only queued, because it is not constructed yet. Data::AmPremiumValue( _session - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { reload(); if (_session->premium()) { reloadCloudSet(); diff --git a/Telegram/SourceFiles/api/api_ringtones.cpp b/Telegram/SourceFiles/api/api_ringtones.cpp index 307ba580a7..203984ab69 100644 --- a/Telegram/SourceFiles/api/api_ringtones.cpp +++ b/Telegram/SourceFiles/api/api_ringtones.cpp @@ -66,7 +66,7 @@ Ringtones::Ringtones(not_null api) // You can't use _session->lifetime() in the constructor, // only queued, because it is not constructed yet. _session->uploader().documentReady( - ) | rpl::start_with_next([=](const Storage::UploadedMedia &data) { + ) | rpl::on_next([=](const Storage::UploadedMedia &data) { ready(data.fullId, data.info.file); }, _session->lifetime()); }); diff --git a/Telegram/SourceFiles/api/api_suggest_post.cpp b/Telegram/SourceFiles/api/api_suggest_post.cpp index cb5aa52e3c..b72a245700 100644 --- a/Telegram/SourceFiles/api/api_suggest_post.cpp +++ b/Telegram/SourceFiles/api/api_suggest_post.cpp @@ -351,7 +351,7 @@ void RequestDeclineComment( } }; reason->submits( - ) | rpl::start_with_next([=](Qt::KeyboardModifiers modifiers) { + ) | rpl::on_next([=](Qt::KeyboardModifiers modifiers) { if (!(modifiers & Qt::ShiftModifier)) { (*callback)(); } diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index 56b2b333cb..352e80a355 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -246,12 +246,12 @@ Updates::Updates(not_null session) _ptsWaiter.setRequesting(true); session->account().mtpUpdates( - ) | rpl::start_with_next([=](const MTPUpdates &updates) { + ) | rpl::on_next([=](const MTPUpdates &updates) { mtpUpdateReceived(updates); }, _lifetime); session->account().mtpNewSessionCreated( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { mtpNewSessionCreated(); }, _lifetime); @@ -265,7 +265,7 @@ Updates::Updates(not_null session) Data::PeerUpdate::Flag::FullInfo ) | rpl::filter([](const Data::PeerUpdate &update) { return update.peer->isChat() || update.peer->isMegagroup(); - }) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + }) | rpl::on_next([=](const Data::PeerUpdate &update) { const auto peer = update.peer; if (const auto list = _pendingSpeakingCallParticipants.take(peer)) { if (const auto call = peer->groupCall()) { @@ -766,7 +766,7 @@ void Updates::addActiveChat(rpl::producer chat) { const auto key = _activeChats.empty() ? 0 : _activeChats.back().first + 1; std::move( chat - ) | rpl::start_with_next_done([=](PeerData *peer) { + ) | rpl::on_next_done([=](PeerData *peer) { auto &active = _activeChats[key]; const auto was = active.peer; if (was != peer) { diff --git a/Telegram/SourceFiles/api/api_user_names.cpp b/Telegram/SourceFiles/api/api_user_names.cpp index ec84d719ae..e1a44c2f9d 100644 --- a/Telegram/SourceFiles/api/api_user_names.cpp +++ b/Telegram/SourceFiles/api/api_user_names.cpp @@ -251,7 +251,7 @@ void Usernames::requestToCache(not_null peer) { const auto lifetime = std::make_shared(); *lifetime = loadUsernames( peer - ) | rpl::start_with_next([=, id = peer->id](Data::Usernames usernames) { + ) | rpl::on_next([=, id = peer->id](Data::Usernames usernames) { _tinyCache = std::make_pair(id, std::move(usernames)); lifetime->destroy(); }); diff --git a/Telegram/SourceFiles/api/api_who_reacted.cpp b/Telegram/SourceFiles/api/api_who_reacted.cpp index b3070fba0d..f2117e3c74 100644 --- a/Telegram/SourceFiles/api/api_who_reacted.cpp +++ b/Telegram/SourceFiles/api/api_who_reacted.cpp @@ -174,7 +174,7 @@ struct State { } session->changes().messageUpdates( Data::MessageUpdate::Flag::Destroyed - ) | rpl::start_with_next([=](const Data::MessageUpdate &update) { + ) | rpl::on_next([=](const Data::MessageUpdate &update) { const auto i = context->cachedRead.find(update.item); if (i != end(context->cachedRead)) { session->api().request(i->second.requestId).cancel(); @@ -192,7 +192,7 @@ struct State { session ) | rpl::skip(1) | rpl::filter( rpl::mappers::_1 - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { for (auto &[item, cache] : context->cachedRead) { if (cache.data.current().state == Ui::WhoReadState::MyHidden) { cache.data = Peers{ .state = Ui::WhoReadState::Unknown }; @@ -202,7 +202,7 @@ struct State { session->api().globalPrivacy().hideReadTime( ) | rpl::skip(1) | rpl::filter( !rpl::mappers::_1 - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { for (auto &[item, cache] : context->cachedRead) { if (cache.data.current().state == Ui::WhoReadState::MyHidden) { cache.data = Peers{ .state = Ui::WhoReadState::Unknown }; @@ -590,7 +590,7 @@ rpl::producer WhoReacted( } std::move( idsWithReactions - ) | rpl::start_with_next([=](PeersWithReactions &&peers) { + ) | rpl::on_next([=](PeersWithReactions &&peers) { if (peers.state == WhoReadState::Unknown) { state->userpics.clear(); consumer.put_next(Ui::WhoReadContent{ @@ -624,7 +624,7 @@ rpl::producer WhoReacted( item->history()->session().downloaderTaskFinished( ) | rpl::filter([=] { return state->someUserpicsNotLoaded && !state->scheduled; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { for (const auto &userpic : state->userpics) { if (userpic.peer->userpicUniqueKey(userpic.view) != userpic.uniqueKey) { diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 08f8364162..e982a1a779 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -199,7 +199,7 @@ ApiWrap::ApiWrap(not_null session) _session->data().chatsFilters().changed( ) | rpl::filter([=] { return _session->data().chatsFilters().archiveNeeded(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { requestMoreDialogsIfNeeded(); }, _session->lifetime()); @@ -248,7 +248,7 @@ void ApiWrap::setupSupportMode() { } _session->settings().supportChatsTimeSliceValue( - ) | rpl::start_with_next([=](int seconds) { + ) | rpl::on_next([=](int seconds) { _dialogsLoadTill = seconds ? std::max(base::unixtime::now() - seconds, 0) : 0; refreshDialogsLoadBlocked(); }, _session->lifetime()); @@ -1902,7 +1902,7 @@ void ApiWrap::updateNotifySettingsDelayed( } if (_updateNotifyTopics.emplace(topic).second) { topic->destroyed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _updateNotifyTopics.remove(topic); }, _updateNotifyQueueLifetime); _updateNotifyTimer.callOnce(kNotifySettingSaveTimeout); diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index f270788877..664799d0f1 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -186,7 +186,7 @@ void ArchiveHintBox( owned->setNaturalWidth(rect.width()); const auto widget = box->addRow(std::move(owned), style::al_top); widget->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = Painter(widget); auto hq = PainterHighQualityEnabler(p); p.setPen(Qt::NoPen); @@ -263,13 +263,13 @@ void ArchiveHintBox( const auto left = Ui::CreateChild( box->verticalLayout().get()); left->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = Painter(left); icon.paint(p, 0, 0, left->width()); }, left->lifetime()); left->resize(icon.size()); top->geometryValue( - ) | rpl::start_with_next([=](const QRect &g) { + ) | rpl::on_next([=](const QRect &g) { left->moveToLeft( (g.left() - left->width()) / 2, g.top() + st::channelEarnHistoryThreeSkip); diff --git a/Telegram/SourceFiles/boxes/about_sponsored_box.cpp b/Telegram/SourceFiles/boxes/about_sponsored_box.cpp index e4e3515c04..e7751ac67b 100644 --- a/Telegram/SourceFiles/boxes/about_sponsored_box.cpp +++ b/Telegram/SourceFiles/boxes/about_sponsored_box.cpp @@ -42,7 +42,7 @@ void AboutSponsoredBox(not_null box) { rpl::combine( row->sizeValue(), button->sizeValue() - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( const QSize &rowSize, const QSize &buttonSize) { button->moveToLeft( diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index 72e71e0ba7..514d7bc43a 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -324,9 +324,9 @@ void AddContactBox::prepare() { const auto submitted = [=] { submit(); }; _first->submits( - ) | rpl::start_with_next(submitted, _first->lifetime()); + ) | rpl::on_next(submitted, _first->lifetime()); _last->submits( - ) | rpl::start_with_next(submitted, _last->lifetime()); + ) | rpl::on_next(submitted, _last->lifetime()); connect(_phone, &Ui::PhoneInput::submitted, [=] { submit(); }); setDimensions( @@ -598,13 +598,13 @@ void GroupInfoBox::prepare() { Core::App().settings().sendSubmitWay()); _description->heightChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { descriptionResized(); }, _description->lifetime()); _description->submits( - ) | rpl::start_with_next([=] { submit(); }, _description->lifetime()); + ) | rpl::on_next([=] { submit(); }, _description->lifetime()); _description->cancelled( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { closeBox(); }, _description->lifetime()); @@ -614,7 +614,7 @@ void GroupInfoBox::prepare() { &_navigation->session()); } _title->submits( - ) | rpl::start_with_next([=] { submitName(); }, _title->lifetime()); + ) | rpl::on_next([=] { submitName(); }, _title->lifetime()); addButton( ((_type != Type::Group || _canAddBot) @@ -920,7 +920,7 @@ void GroupInfoBox::checkInviteLink() { _createdChannel->session().changes().peerUpdates( _createdChannel, Data::PeerUpdate::Flag::FullInfo - ) | rpl::take(1) | rpl::start_with_next([=] { + ) | rpl::take(1) | rpl::on_next([=] { checkInviteLink(); }, lifetime()); } @@ -1063,11 +1063,11 @@ void SetupChannelBox::prepare() { _channel->session().changes().peerUpdates( _channel, Data::PeerUpdate::Flag::InviteLinks - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { rtlupdate(_invitationLink); }, lifetime()); - boxClosing() | rpl::start_with_next([=] { + boxClosing() | rpl::on_next([=] { if (!_mustBePublic) { AddParticipantsBoxController::Start(_navigation, _channel); } @@ -1495,7 +1495,7 @@ void SetupChannelBox::showRevokePublicLinkBoxForEdit() { Box(PublicLinksLimitBox, navigation, callback)); const auto session = &navigation->session(); revoker->boxClosing( - ) | rpl::start_with_next(crl::guard(session, [=] { + ) | rpl::on_next(crl::guard(session, [=] { base::call_delayed(200, session, [=] { if (*revoked) { return; @@ -1563,19 +1563,19 @@ void EditNameBox::prepare() { _last->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName); _first->submits( - ) | rpl::start_with_next([=] { submit(); }, _first->lifetime()); + ) | rpl::on_next([=] { submit(); }, _first->lifetime()); _last->submits( - ) | rpl::start_with_next([=] { submit(); }, _last->lifetime()); + ) | rpl::on_next([=] { submit(); }, _last->lifetime()); _first->customTab(true); _last->customTab(true); _first->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _last->setFocus(); }, _first->lifetime()); _last->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _first->setFocus(); }, _last->lifetime()); } diff --git a/Telegram/SourceFiles/boxes/auto_download_box.cpp b/Telegram/SourceFiles/boxes/auto_download_box.cpp index 3617a9eb65..ac54402b17 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_download_box.cpp @@ -116,7 +116,7 @@ void AutoDownloadBox::setupContent() { ))->toggleOn( rpl::single(value > 0) )->toggledChanges( - ) | rpl::start_with_next([=](bool enabled) { + ) | rpl::on_next([=](bool enabled) { (*values)[type] = enabled ? 1 : 0; }, content->lifetime()); values->emplace(type, value); diff --git a/Telegram/SourceFiles/boxes/auto_lock_box.cpp b/Telegram/SourceFiles/boxes/auto_lock_box.cpp index cc7cdb4271..eb3d44bb85 100644 --- a/Telegram/SourceFiles/boxes/auto_lock_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_lock_box.cpp @@ -102,7 +102,7 @@ void AutoLockBox::prepare() { }; timeInput->focuses( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { group->setValue(kCustom); }, lifetime()); @@ -119,7 +119,7 @@ void AutoLockBox::prepare() { [=] { return group->current() == kCustom; } ), timeInput->submitRequests() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (const auto result = collect()) { durationChanged(result); } else { diff --git a/Telegram/SourceFiles/boxes/background_box.cpp b/Telegram/SourceFiles/boxes/background_box.cpp index 8723572da2..358cc12bb7 100644 --- a/Telegram/SourceFiles/boxes/background_box.cpp +++ b/Telegram/SourceFiles/boxes/background_box.cpp @@ -211,12 +211,12 @@ void BackgroundBox::prepare() { setInnerTopSkip(st::lineWidth); _inner->chooseEvents( - ) | rpl::start_with_next([=](const Data::WallPaper &paper) { + ) | rpl::on_next([=](const Data::WallPaper &paper) { chosen(paper); }, _inner->lifetime()); _inner->removeRequests( - ) | rpl::start_with_next([=](const Data::WallPaper &paper) { + ) | rpl::on_next([=](const Data::WallPaper &paper) { removePaper(paper); }, _inner->lifetime()); } @@ -396,30 +396,30 @@ BackgroundBox::Inner::Inner( + st::backgroundPadding)); Window::Theme::IsNightModeValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updatePapers(); }, lifetime()); requestPapers(); _session->downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); }, lifetime()); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _check->invalidateCache(); }, lifetime()); if (forChannel()) { _session->data().cloudThemes().chatThemesUpdated( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updatePapers(); }, lifetime()); } else { using Update = Window::Theme::BackgroundUpdate; Window::Theme::Background()->updates( - ) | rpl::start_with_next([=](const Update &update) { + ) | rpl::on_next([=](const Update &update) { if (update.type == Update::Type::New) { sortPapers(); requestPapers(); diff --git a/Telegram/SourceFiles/boxes/background_preview_box.cpp b/Telegram/SourceFiles/boxes/background_preview_box.cpp index 24d4fd1835..68877dc03d 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/background_preview_box.cpp @@ -225,18 +225,18 @@ BackgroundPreviewBox::BackgroundPreviewBox( } generateBackground(); _controller->session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); }, lifetime()); _appNightMode.changes( - ) | rpl::start_with_next([=](bool night) { + ) | rpl::on_next([=](bool night) { _boxDarkMode = night; update(); }, lifetime()); _boxDarkMode.changes( - ) | rpl::start_with_next([=](bool dark) { + ) | rpl::on_next([=](bool dark) { applyDarkMode(dark); }, lifetime()); @@ -373,7 +373,7 @@ void BackgroundPreviewBox::createDimmingSlider(bool dark) { _dimmingContent->resize(inner->size()); _dimmingContent->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { auto p = QPainter(_dimmingContent); const auto palette = (dark ? _darkPalette : _lightPalette).get(); p.fillRect(clip, equals ? st::boxBg : palette->boxBg()); @@ -386,13 +386,13 @@ void BackgroundPreviewBox::createDimmingSlider(bool dark) { heightValue(), _dimmingWrap->heightValue(), rpl::mappers::_1 - rpl::mappers::_2 - ) | rpl::start_with_next([=](int top) { + ) | rpl::on_next([=](int top) { _dimmingWrap->move(0, top); }, _dimmingWrap->lifetime()); _dimmingWrap->toggle(dark, anim::type::instant); _dimmingHeight = _dimmingWrap->heightValue(); - _dimmingHeight.changes() | rpl::start_with_next([=] { + _dimmingHeight.changes() | rpl::on_next([=] { update(); }, _dimmingWrap->lifetime()); } @@ -554,7 +554,7 @@ void BackgroundPreviewBox::recreateBlurCheckbox() { sizeValue(), _blur->sizeValue(), _dimmingHeight.value() - ) | rpl::start_with_next([=](QSize outer, QSize inner, int dimming) { + ) | rpl::on_next([=](QSize outer, QSize inner, int dimming) { const auto bottom = st::historyPaddingBottom; _blur->move( (outer.width() - inner.width()) / 2, @@ -562,7 +562,7 @@ void BackgroundPreviewBox::recreateBlurCheckbox() { }, _blur->lifetime()); _blur->checkedChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { checkBlurAnimationStart(); update(); }, _blur->lifetime()); @@ -607,7 +607,7 @@ void BackgroundPreviewBox::uploadForPeer(bool both) { document->size); session->uploader().documentProgress( - ) | rpl::start_with_next([=](const FullMsgId &fullId) { + ) | rpl::on_next([=](const FullMsgId &fullId) { if (fullId != _uploadId) { return; } @@ -619,7 +619,7 @@ void BackgroundPreviewBox::uploadForPeer(bool both) { }, _uploadLifetime); session->uploader().documentReady( - ) | rpl::start_with_next([=](const Storage::UploadedMedia &data) { + ) | rpl::on_next([=](const Storage::UploadedMedia &data) { if (data.fullId != _uploadId) { return; } @@ -742,13 +742,13 @@ void BackgroundPreviewBox::applyForPeer() { object_ptr(this)); const auto overlay = _forBothOverlay->entity(); - sizeValue() | rpl::start_with_next([=](QSize size) { + sizeValue() | rpl::on_next([=](QSize size) { _forBothOverlay->setGeometry({ QPoint(), size }); overlay->setGeometry({ QPoint(), size }); }, _forBothOverlay->lifetime()); overlay->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { auto p = QPainter(overlay); p.drawImage(0, 0, bg); p.fillRect(clip, QColor(0, 0, 0, 64)); @@ -787,7 +787,7 @@ void BackgroundPreviewBox::applyForPeer() { const auto raw = _forBothOverlay.release(); raw->shownValue() | rpl::filter( !rpl::mappers::_1 - ) | rpl::take(1) | rpl::start_with_next(crl::guard(raw, [=] { + ) | rpl::take(1) | rpl::on_next(crl::guard(raw, [=] { delete raw; }), raw->lifetime()); raw->toggle(false, anim::type::normal); @@ -797,7 +797,7 @@ void BackgroundPreviewBox::applyForPeer() { cancel->setTextTransform(RoundButton::TextTransform::NoTransform); overlay->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto padding = st::backgroundConfirmPadding; const auto width = size.width() - padding.left() @@ -1063,7 +1063,7 @@ void BackgroundPreviewBox::updateServiceBg(const std::vector &bg) { } _serviceBgLifetime = _paletteServiceBg.value( - ) | rpl::start_with_next([=](QColor color) { + ) | rpl::on_next([=](QColor color) { _serviceBg = Ui::ThemeAdjustedColor( color, QColor(red / count, green / count, blue / count)); diff --git a/Telegram/SourceFiles/boxes/choose_filter_box.cpp b/Telegram/SourceFiles/boxes/choose_filter_box.cpp index 17450b8000..fbefdce76d 100644 --- a/Telegram/SourceFiles/boxes/choose_filter_box.cpp +++ b/Telegram/SourceFiles/boxes/choose_filter_box.cpp @@ -345,7 +345,7 @@ void FillChooseFilterMenu( } history->owner().chatsFilters().changed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { menu->hideMenu(); }, menu->lifetime()); } diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 49e134861c..5a954eb0f5 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -754,7 +754,7 @@ ProxiesBox::ProxiesBox( , _settings(settings) , _initialWrap(this) { _controller->views( - ) | rpl::start_with_next([=](View &&view) { + ) | rpl::on_next([=](View &&view) { applyView(std::move(view)); }, lifetime()); } @@ -883,17 +883,17 @@ void ProxiesBox::setupContent() { refreshProxyForCalls(); }); _tryIPv6->checkedChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { _controller->setTryIPv6(checked); }, _tryIPv6->lifetime()); _controller->proxySettingsValue( - ) | rpl::start_with_next([=](ProxyData::Settings value) { + ) | rpl::on_next([=](ProxyData::Settings value) { _proxySettings->setValue(value); }, inner->lifetime()); _proxyForCalls->entity()->checkedChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { _controller->setProxyForCalls(checked); }, _proxyForCalls->lifetime()); @@ -930,7 +930,7 @@ void ProxiesBox::setupContent() { + 3 * rowHeight()), st::boxMaxListHeight); }) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { setDimensions(st::boxWideWidth, height); }, inner->lifetime()); } @@ -1005,7 +1005,7 @@ void ProxiesBox::createNoRowsLabel() { tr::lng_proxy_description(tr::now), st::proxyEmptyListLabel); _noRows->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { label->resizeToWidth(width); label->moveToLeft(0, 0); }, label->lifetime()); @@ -1013,29 +1013,29 @@ void ProxiesBox::createNoRowsLabel() { void ProxiesBox::setupButtons(int id, not_null button) { button->deleteClicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _controller->deleteItem(id); }, button->lifetime()); button->restoreClicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _controller->restoreItem(id); }, button->lifetime()); button->editClicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { getDelegate()->show(_controller->editItemBox(id)); }, button->lifetime()); rpl::merge( button->shareClicks() | rpl::map_to(false), button->showQrClicks() | rpl::map_to(true) - ) | rpl::start_with_next([=](bool qr) { + ) | rpl::on_next([=](bool qr) { _controller->shareItem(id, qr); }, button->lifetime()); button->clicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _controller->applyItem(id); }, button->lifetime()); } @@ -1071,7 +1071,7 @@ void ProxyBox::prepare() { }); }); _port.data()->events( - ) | rpl::start_with_next([=](not_null e) { + ) | rpl::on_next([=](not_null e) { if (e->type() == QEvent::KeyPress && (static_cast(e.get())->key() == Qt::Key_Backspace) && _port->cursorPosition() == 0) { @@ -1181,7 +1181,7 @@ void ProxyBox::setupSocketAddress(const ProxyData &data) { data.port ? QString::number(data.port) : QString(), 65535); address->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { _port->moveToRight(0, 0); _host->resize( width - _port->width() - st::proxyEditSkip, @@ -1213,11 +1213,11 @@ void ProxyBox::setupCredentials(const ProxyData &data) { (data.type == Type::Mtproto) ? QString() : data.password); _password->move(0, 0); _password->heightValue( - ) | rpl::start_with_next([=, wrap = passwordWrap.data()](int height) { + ) | rpl::on_next([=, wrap = passwordWrap.data()](int height) { wrap->resize(wrap->width(), height); }, _password->lifetime()); passwordWrap->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { _password->resize(width, _password->height()); }, _password->lifetime()); credentials->add(std::move(passwordWrap), st::proxyEditInputPadding); @@ -1239,11 +1239,11 @@ void ProxyBox::setupMtprotoCredentials(const ProxyData &data) { (data.type == Type::Mtproto) ? data.password : QString()); _secret->move(0, 0); _secret->heightValue( - ) | rpl::start_with_next([=, wrap = secretWrap.data()](int height) { + ) | rpl::on_next([=, wrap = secretWrap.data()](int height) { wrap->resize(wrap->width(), height); }, _secret->lifetime()); secretWrap->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { _secret->resize(width, _secret->height()); }, _secret->lifetime()); mtproto->add(std::move(secretWrap), st::proxyEditInputPadding); @@ -1305,7 +1305,7 @@ ProxiesBoxController::ProxiesBoxController(not_null account) }) | ranges::to_vector; _settings.connectionTypeChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _proxySettingsChanges.fire_copy(_settings.settings()); const auto i = findByProxy(_settings.selected()); if (i != end(_list)) { diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index 290da2d72e..d885b2ca06 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -198,7 +198,7 @@ not_null CreateWarningLabel( st::createPollWarning); result->setAttribute(Qt::WA_TransparentForMouseEvents); field->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Ui::PostponeCall(crl::guard(field, [=] { const auto length = field->getLastText().size(); const auto value = valueLimit - length; @@ -251,17 +251,17 @@ Options::Option::Option( _wrap->hide(anim::type::instant); _content->widthValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateFieldGeometry(); }, _field->lifetime()); _field->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { _content->resize(_content->width(), height); }, _field->lifetime()); _field->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Ui::PostponeCall(crl::guard(_field, [=] { if (_hasCorrect) { _correct->toggle(isGood(), anim::type::normal); @@ -293,7 +293,7 @@ void Options::Option::createShadow() { _shadow.reset(Ui::CreateChild(field().get())); _shadow->show(); field()->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto left = st::createPollFieldPadding.left(); _shadow->setGeometry( left, @@ -322,7 +322,7 @@ void Options::Option::createRemove() { _removeAlways = lifetime.make_state>(false); field->changes( - ) | rpl::start_with_next([field, toggle] { + ) | rpl::on_next([field, toggle] { // Don't capture 'this'! Because Option is a value type. *toggle = !field->getLastText().isEmpty(); }, field->lifetime()); @@ -331,13 +331,13 @@ void Options::Option::createRemove() { toggle->value(), _removeAlways->value(), _1 || _2 - ) | rpl::start_with_next([=](bool shown) { + ) | rpl::on_next([=](bool shown) { remove->toggle(shown, anim::type::normal); }, remove->lifetime()); #endif field->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { remove->moveToRight( st::createPollOptionRemovePosition.x(), st::createPollOptionRemovePosition.y(), @@ -359,7 +359,7 @@ void Options::Option::createWarning() { rpl::combine( field->sizeValue(), warning->sizeValue() - ) | rpl::start_with_next([=](QSize size, QSize label) { + ) | rpl::on_next([=](QSize size, QSize label) { warning->moveToLeft( (size.width() - label.width() @@ -431,7 +431,7 @@ void Options::Option::enableChooseCorrect( button->entity()->height()); button->hide(anim::type::instant); _content->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto left = st::createPollFieldPadding.left(); button->moveToLeft( left, @@ -688,19 +688,19 @@ void Options::addEmptyOption() { QPoint( -st::createPollOptionFieldPremium.textMargins.right(), st::createPollOptionEmojiPositionSkip)); - emojiToggle->shownValue() | rpl::start_with_next([=](bool shown) { + emojiToggle->shownValue() | rpl::on_next([=](bool shown) { if (!shown) { return; } _emojiPanelLifetime.destroy(); emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { if (field->hasFocus()) { Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji); } }, _emojiPanelLifetime); emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { if (field->hasFocus()) { Data::InsertCustomEmoji(field, data.document); } @@ -708,24 +708,24 @@ void Options::addEmptyOption() { }, emojiToggle->lifetime()); } field->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto index = findField(field); if (_list[index]->isGood() && index + 1 < _list.size()) { _list[index + 1]->setFocus(); } }, field->lifetime()); field->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Ui::PostponeCall(crl::guard(field, [=] { validateState(); })); }, field->lifetime()); field->focusedChanges( - ) | rpl::filter(rpl::mappers::_1) | rpl::start_with_next([=] { + ) | rpl::filter(rpl::mappers::_1) | rpl::on_next([=] { _scrollToWidget.fire_copy(field); }, field->lifetime()); field->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto index = findField(field); if (index + 1 < _list.size()) { _list[index + 1]->setFocus(); @@ -753,7 +753,7 @@ void Options::addEmptyOption() { }); _list.back()->removeClicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Ui::PostponeCall(crl::guard(field, [=] { Expects(!_list.empty()); @@ -891,13 +891,13 @@ not_null CreatePollBox::setupQuestion( emojiPanel, st::createPollOptionFieldPremiumEmojiPosition); emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { if (question->hasFocus()) { Ui::InsertEmojiAtCursor(question->textCursor(), data.emoji); } }, emojiToggle->lifetime()); emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { if (question->hasFocus()) { Data::InsertCustomEmoji(question, data.document); } @@ -912,7 +912,7 @@ not_null CreatePollBox::setupQuestion( rpl::combine( question->geometryValue(), warning->sizeValue() - ) | rpl::start_with_next([=](QRect geometry, QSize label) { + ) | rpl::on_next([=](QRect geometry, QSize label) { warning->moveToLeft( (container->width() - label.width() @@ -978,7 +978,7 @@ not_null CreatePollBox::setupSolution( rpl::combine( solution->geometryValue(), warning->sizeValue() - ) | rpl::start_with_next([=](QRect geometry, QSize label) { + ) | rpl::on_next([=](QRect geometry, QSize label) { warning->moveToLeft( (inner->width() - label.width() @@ -1048,7 +1048,7 @@ object_ptr CreatePollBox::setupContent() { st::createPollLimitPadding)); question->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { options->focusFirst(); }, question->lifetime()); @@ -1088,7 +1088,7 @@ object_ptr CreatePollBox::setupContent() { rpl::single(quiz->checked()) | rpl::then(quiz->checkedChanges())); options->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (quiz->checked()) { solution->setFocus(); } else { @@ -1097,7 +1097,7 @@ object_ptr CreatePollBox::setupContent() { }, question->lifetime()); solution->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { question->setFocus(); }, solution->lifetime()); @@ -1109,14 +1109,14 @@ object_ptr CreatePollBox::setupContent() { ) | rpl::filter([=](not_null e) { return (e->type() == QEvent::MouseButtonPress) && quiz->checked(); - }) | rpl::start_with_next([show = uiShow()] { + }) | rpl::on_next([show = uiShow()] { show->showToast(tr::lng_polls_create_one_answer(tr::now)); }, multiple->lifetime()); } using namespace rpl::mappers; quiz->checkedChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { if (multiple) { if (checked && multiple->checked()) { multiple->setChecked(false); @@ -1132,7 +1132,7 @@ object_ptr CreatePollBox::setupContent() { return !text.isEmpty() && (text.size() <= kQuestionLimit); }; question->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (isValidQuestion()) { options->focusFirst(); } @@ -1216,12 +1216,12 @@ object_ptr CreatePollBox::setupContent() { crl::guard(this, send)); options->scrollToWidget( - ) | rpl::start_with_next([=](not_null widget) { + ) | rpl::on_next([=](not_null widget) { scrollToWidget(widget); }, lifetime()); options->backspaceInFront( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { FocusAtEnd(question); }, lifetime()); diff --git a/Telegram/SourceFiles/boxes/delete_messages_box.cpp b/Telegram/SourceFiles/boxes/delete_messages_box.cpp index 5636cc020a..c4bd9751ef 100644 --- a/Telegram/SourceFiles/boxes/delete_messages_box.cpp +++ b/Telegram/SourceFiles/boxes/delete_messages_box.cpp @@ -164,7 +164,7 @@ void DeleteMessagesBox::prepare() { appendDetails(std::move(revoke->description)); if (!peer->isUser() && !_wipeHistoryJustClear) { _revoke->checkedValue( - ) | rpl::start_with_next([=](bool revokeForAll) { + ) | rpl::on_next([=](bool revokeForAll) { *deleteText = revokeForAll ? tr::lng_box_delete() : tr::lng_box_leave(); @@ -251,13 +251,13 @@ void DeleteMessagesBox::prepare() { st::defaultBoxCheckbox)); _revokeRemember->hide(anim::type::instant); _revoke->checkedValue( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { _revokeRemember->toggle( checked != revokeByDefault, anim::type::normal); }, _revokeRemember->lifetime()); _revokeRemember->heightValue( - ) | rpl::start_with_next([=](int h) { + ) | rpl::on_next([=](int h) { setDimensions(st::boxWidth, _fullHeight + h); }, lifetime()); appendDetails(std::move(revoke->description)); @@ -320,7 +320,7 @@ void DeleteMessagesBox::prepare() { rpl::combine( widthValue(), _text->naturalWidthValue() - ) | rpl::start_with_next([=](int full, int) { + ) | rpl::on_next([=](int full, int) { _text->resizeToNaturalWidth(full - padding.left() - padding.right()); auto fullHeight = st::boxPadding.top() diff --git a/Telegram/SourceFiles/boxes/dictionaries_manager.cpp b/Telegram/SourceFiles/boxes/dictionaries_manager.cpp index 8881449fcb..13fddb7e2b 100644 --- a/Telegram/SourceFiles/boxes/dictionaries_manager.cpp +++ b/Telegram/SourceFiles/boxes/dictionaries_manager.cpp @@ -143,7 +143,7 @@ auto AddButtonWithLoader( std::move( query - ) | rpl::start_with_next([=](auto string) { + ) | rpl::on_next([=](auto string) { wrap->toggle( ranges::any_of(indexList, [&](const QString &s) { return s.startsWith(string, Qt::CaseInsensitive); @@ -198,7 +198,7 @@ auto AddButtonWithLoader( }; Spellchecker::GlobalLoaderChanged( - ) | rpl::start_with_next([=](int langId) { + ) | rpl::on_next([=](int langId) { if (!langId && rawGlobalLoaderPtr()) { setGlobalLoaderPtr(nullptr); } else if (langId == id) { @@ -215,14 +215,14 @@ auto AddButtonWithLoader( rpl::combine( button->widthValue(), label->widthValue() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { label->moveToLeft( st::settingsUpdateStatePosition.x(), st::settingsUpdateStatePosition.y()); }, label->lifetime()); buttonState->value( - ) | rpl::start_with_next([=](const DictState &state) { + ) | rpl::on_next([=](const DictState &state) { const auto isToggledSet = v::is(state); const auto toggled = isToggledSet ? 1. : 0.; const auto over = !button->isDisabled() @@ -279,7 +279,7 @@ auto AddButtonWithLoader( }); button->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { const auto &state = buttonState->current(); if (toggled && (v::is(state) || v::is(state))) { const auto weak = base::make_weak(button); @@ -353,7 +353,7 @@ void Inner::setupContent( ranges::contains(enabledDictionaries, id), queryStream->events()); row->toggledValue( - ) | rpl::start_with_next([=](auto enabled) { + ) | rpl::on_next([=](auto enabled) { if (enabled) { _enabledRows.push_back(id); } else { @@ -420,7 +420,7 @@ void ManageDictionariesBox::prepare() { }); addButton(tr::lng_close(), [=] { closeBox(); }); - boxClosing() | rpl::start_with_next([=] { + boxClosing() | rpl::on_next([=] { Core::App().settings().setDictionariesEnabled( FilterEnabledDict(initialEnabledRows)); Core::App().saveSettingsDelayed(); @@ -434,7 +434,7 @@ void ManageDictionariesBox::prepare() { inner->heightValue(), multiSelect->heightValue(), _1 + _2 - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { using std::min; accumulate_max(*max, height); setDimensions(st::boxWidth, min(*max, st::boxMaxListHeight), true); diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 24c3ab7d3a..cf4ae2ddcb 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -262,7 +262,7 @@ EditCaptionBox::EditCaptionBox( _controller->session().data().itemRemoved( _historyItem->fullId() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { closeBox(); }, lifetime()); } @@ -490,7 +490,7 @@ void EditCaptionBox::rebuildPreview() { const auto withCheckbox = _isPhoto && CanBeCompressed(_albumType); if (media && (!withCheckbox || !_asFile)) { media->spoileredChanges( - ) | rpl::start_with_next([=](bool spoilered) { + ) | rpl::on_next([=](bool spoilered) { _mediaEditManager.apply({ .type = spoilered ? SendMenu::ActionType::SpoilerOn : SendMenu::ActionType::SpoilerOff @@ -512,7 +512,7 @@ void EditCaptionBox::rebuildPreview() { _footerHeight.value(), rpl::single(st::boxPhotoPadding.top()), rpl::mappers::_1 + rpl::mappers::_2 + rpl::mappers::_3 - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { setDimensions( st::boxWideWidth, std::min(st::sendMediaPreviewHeightMax, height), @@ -525,11 +525,11 @@ void EditCaptionBox::rebuildPreview() { _content->modifyRequests( ) | rpl::start_to_stream(_photoEditorOpens, _content->lifetime()); - _content->editCoverRequests() | rpl::start_with_next([=] { + _content->editCoverRequests() | rpl::on_next([=] { setupEditCoverHandler(); }, _content->lifetime()); - _content->clearCoverRequests() | rpl::start_with_next([=] { + _content->clearCoverRequests() | rpl::on_next([=] { setupClearCoverHandler(); }, _content->lifetime()); @@ -566,13 +566,13 @@ void EditCaptionBox::setupField() { _field->setMaxHeight(st::defaultComposeFiles.caption.heightMax); _field->submits( - ) | rpl::start_with_next([=] { save(); }, _field->lifetime()); + ) | rpl::on_next([=] { save(); }, _field->lifetime()); _field->cancelled( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { closeBox(); }, _field->lifetime()); _field->heightChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { captionResized(); }, _field->lifetime()); _field->setMimeDataHook([=]( @@ -656,7 +656,7 @@ void EditCaptionBox::setInitialText() { } }); _field->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _checkChangedTimer.callOnce(kChangesDebounceTimeout); setCloseByOutsideClick(false); }, _field->lifetime()); @@ -696,7 +696,7 @@ void EditCaptionBox::setupControls() { }), anim::type::instant )->entity()->checkedChanges( - ) | rpl::start_with_next([&](bool checked) { + ) | rpl::on_next([&](bool checked) { applyChanges(); _asFile = !checked; rebuildPreview(); @@ -707,7 +707,7 @@ void EditCaptionBox::setupControls() { void EditCaptionBox::setupEditEventHandler() { _editMediaClicks.events( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { ChooseReplacement(_controller, _albumType, crl::guard(this, [=]( Ui::PreparedList &&list) { setPreparedList(std::move(list)); @@ -718,7 +718,7 @@ void EditCaptionBox::setupEditEventHandler() { void EditCaptionBox::setupPhotoEditorEventHandler() { const auto openedOnce = lifetime().make_state(false); _photoEditorOpens.events( - ) | rpl::start_with_next([=, controller = _controller] { + ) | rpl::on_next([=, controller = _controller] { if (_preparedList.files.empty() && (!_photoMedia || !_photoMedia->image(Data::PhotoSize::Large))) { @@ -880,11 +880,11 @@ void EditCaptionBox::setupEmojiPanel() { _emojiPanel->hide(); _emojiPanel->selector()->setCurrentPeer(_historyItem->history()->peer); _emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { Ui::InsertEmojiAtCursor(_field->textCursor(), data.emoji); }, lifetime()); _emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { const auto info = data.document->sticker(); if (info && info->setType == Data::StickersType::Emoji diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index 8b004eb6d0..0d88dae9dc 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -111,11 +111,11 @@ void CreateRadiobuttonLock( lock->resize(st::defaultRadio.diameter, st::defaultRadio.diameter); widget->sizeValue( - ) | rpl::start_with_next([=, &st](QSize size) { + ) | rpl::on_next([=, &st](QSize size) { lock->move(st.checkPosition); }, lock->lifetime()); - lock->paintRequest() | rpl::start_with_next([=] { + lock->paintRequest() | rpl::on_next([=] { auto p = QPainter(lock); auto hq = PainterHighQualityEnabler(p); const auto &icon = st::messagePrivacyLock; @@ -138,7 +138,7 @@ void AddPremiumRequiredRow( const auto row = Ui::CreateChild(widget.get()); widget->sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { row->resize(s); }, row->lifetime()); row->setClickedCallback(std::move(clickedCallback)); @@ -147,7 +147,7 @@ void AddPremiumRequiredRow( Data::AmPremiumValue( session - ) | rpl::start_with_next([=](bool premium) { + ) | rpl::on_next([=](bool premium) { row->setVisible(!premium); if (!premium) { setDefaultOption(); @@ -382,7 +382,7 @@ auto PrivacyExceptionsBoxController::prepareSpecialRowList( tr::lng_edit_privacy_users_and_groups())); controller->specialChanges( - ) | rpl::start_with_next([=](bool chosen) { + ) | rpl::on_next([=](bool chosen) { if (type == SpecialRowType::Premiums) { _selected.premiums = chosen; } else { @@ -391,7 +391,7 @@ auto PrivacyExceptionsBoxController::prepareSpecialRowList( }, lifetime); controller->rowSelectionChanges( - ) | rpl::start_with_next([=](RowSelectionChange update) { + ) | rpl::on_next([=](RowSelectionChange update) { this->delegate()->peerListSetForeignRowChecked( update.row, update.checked, @@ -543,7 +543,7 @@ auto PrivacyExceptionsBoxController::createRow(not_null history) updateByValue(value); valueFinished(value); }; - style::PaletteChanged() | rpl::start_with_next([=] { + style::PaletteChanged() | rpl::on_next([=] { min->setTextColorOverride(st::windowSubTextFg->c); max->setTextColorOverride(st::windowSubTextFg->c); }, raw->lifetime()); @@ -559,7 +559,7 @@ auto PrivacyExceptionsBoxController::createRow(not_null history) state->indexMin); slider->resize(slider->width(), sliderStyle->seekSize.height()); - raw->widthValue() | rpl::start_with_next([=](int width) { + raw->widthValue() | rpl::on_next([=](int width) { labels->resizeToWidth(width); updateByIndex(); }, slider->lifetime()); @@ -939,7 +939,7 @@ void EditPrivacyBox::setupContent() { + st::settingsButtonNoIcon.padding.bottom(); widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { content->resizeToWidth(width); }, content->lifetime()); @@ -947,7 +947,7 @@ void EditPrivacyBox::setupContent() { ) | rpl::map([=](int height) { return height - always->height() - never->height() + 2 * linkHeight; }) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { setDimensions(st::boxWideWidth, height); }, content->lifetime()); } @@ -1076,7 +1076,7 @@ void EditMessagesPrivacyBox( key ) | rpl::take( 1 - ) | rpl::start_with_next([=](const Api::UserPrivacy::Rule &value) { + ) | rpl::on_next([=](const Api::UserPrivacy::Rule &value) { EditNoPaidMessagesExceptions(controller, value); }); }); @@ -1233,7 +1233,7 @@ rpl::producer SetupChargeSlider( const auto details = container->add( object_ptr(container)); - state->stars.value() | rpl::start_with_next([=](int stars) { + state->stars.value() | rpl::on_next([=](int stars) { while (details->count()) { delete details->widgetAt(0); } @@ -1313,7 +1313,7 @@ void EditDirectMessagesPriceBox( savedValue, channel->session().appConfig().paidMessageChannelStarsDefault(), true - ) | rpl::start_with_next([=](int stars) { + ) | rpl::on_next([=](int stars) { *result = stars; }, box->lifetime()); @@ -1358,7 +1358,7 @@ void EditDirectMessagesPriceBox( label->take(), st::inviteLinkFieldPadding); - label->clicks() | rpl::start_with_next(copyLink, label->lifetime()); + label->clicks() | rpl::on_next(copyLink, label->lifetime()); Ui::AddSkip(inner); diff --git a/Telegram/SourceFiles/boxes/edit_todo_list_box.cpp b/Telegram/SourceFiles/boxes/edit_todo_list_box.cpp index 886566bba6..acf1f03859 100644 --- a/Telegram/SourceFiles/boxes/edit_todo_list_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_todo_list_box.cpp @@ -227,7 +227,7 @@ not_null CreateWarningLabel( st::createPollWarning); result->setAttribute(Qt::WA_TransparentForMouseEvents); field->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Ui::PostponeCall(crl::guard(field, [=] { const auto length = field->getLastText().size(); const auto value = valueLimit - length; @@ -310,12 +310,12 @@ Tasks::Task::Task( _wrap->hide(anim::type::instant); _content->widthValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateFieldGeometry(); }, _field->lifetime()); _field->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { _content->resize(_content->width(), height); }, _field->lifetime()); @@ -340,7 +340,7 @@ void Tasks::Task::createShadow() { _shadow.reset(Ui::CreateChild(field().get())); _shadow->show(); field()->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto left = st::createPollFieldPadding.left(); _shadow->setGeometry( left, @@ -369,7 +369,7 @@ void Tasks::Task::createRemove() { _removeAlways = lifetime.make_state>(false); field->changes( - ) | rpl::start_with_next([field, toggle] { + ) | rpl::on_next([field, toggle] { // Don't capture 'this'! Because Option is a value type. *toggle = !field->getLastText().isEmpty(); }, field->lifetime()); @@ -378,13 +378,13 @@ void Tasks::Task::createRemove() { toggle->value(), _removeAlways->value(), _1 || _2 - ) | rpl::start_with_next([=](bool shown) { + ) | rpl::on_next([=](bool shown) { remove->toggle(shown, anim::type::normal); }, remove->lifetime()); #endif field->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { remove->moveToRight( st::createPollOptionRemovePosition.x(), st::createPollOptionRemovePosition.y(), @@ -406,7 +406,7 @@ void Tasks::Task::createWarning() { rpl::combine( field->sizeValue(), warning->sizeValue() - ) | rpl::start_with_next([=](QSize size, QSize label) { + ) | rpl::on_next([=](QSize size, QSize label) { warning->moveToLeft( (size.width() - label.width() @@ -717,19 +717,19 @@ void Tasks::initTaskField(not_null task, TextWithEntities text) { QPoint( -st::createPollOptionFieldPremium.textMargins.right(), st::createPollOptionEmojiPositionSkip)); - emojiToggle->shownValue() | rpl::start_with_next([=](bool shown) { + emojiToggle->shownValue() | rpl::on_next([=](bool shown) { if (!shown) { return; } _emojiPanelLifetime.destroy(); emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { if (field->hasFocus()) { Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji); } }, _emojiPanelLifetime); emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { if (field->hasFocus()) { Data::InsertCustomEmoji(field, data.document); } @@ -741,14 +741,14 @@ void Tasks::initTaskField(not_null task, TextWithEntities text) { TextUtilities::ConvertEntitiesToTextTags(text.entities) }); field->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto index = findField(field); if (_list[index]->isGood() && index + 1 < _list.size()) { _list[index + 1]->setFocus(); } }, field->lifetime()); field->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto list = ParsePastedList(field->getLastText()); if (!list.empty()) { field->setText(list.front()); @@ -762,11 +762,11 @@ void Tasks::initTaskField(not_null task, TextWithEntities text) { })); }, field->lifetime()); field->focusedChanges( - ) | rpl::filter(rpl::mappers::_1) | rpl::start_with_next([=] { + ) | rpl::filter(rpl::mappers::_1) | rpl::on_next([=] { _scrollToWidget.fire_copy(field); }, field->lifetime()); field->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto index = findField(field); if (index + 1 < _list.size()) { _list[index + 1]->setFocus(); @@ -794,7 +794,7 @@ void Tasks::initTaskField(not_null task, TextWithEntities text) { }); task->removeClicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Ui::PostponeCall(crl::guard(field, [=] { Expects(!_list.empty()); @@ -895,7 +895,7 @@ EditTodoListBox::EditTodoListBox( , _titleLimit(controller->session().appConfig().todoListTitleLimit()) { _controller->session().changes().messageUpdates( Data::MessageUpdate::Flag::Destroyed - ) | rpl::start_with_next([=](const Data::MessageUpdate &update) { + ) | rpl::on_next([=](const Data::MessageUpdate &update) { if (update.item == item) { closeBox(); } @@ -946,13 +946,13 @@ not_null EditTodoListBox::setupTitle( _emojiPanel.get(), st::createPollOptionFieldPremiumEmojiPosition); _emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { if (title->hasFocus()) { Ui::InsertEmojiAtCursor(title->textCursor(), data.emoji); } }, emojiToggle->lifetime()); _emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { if (title->hasFocus()) { Data::InsertCustomEmoji(title, data.document); } @@ -976,7 +976,7 @@ not_null EditTodoListBox::setupTitle( rpl::combine( title->geometryValue(), warning->sizeValue() - ) | rpl::start_with_next([=](QRect geometry, QSize label) { + ) | rpl::on_next([=](QRect geometry, QSize label) { warning->moveToLeft( (container->width() - label.width() @@ -1044,7 +1044,7 @@ object_ptr EditTodoListBox::setupContent() { st::createPollLimitPadding)); title->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { tasks->focusFirst(); }, title->lifetime()); @@ -1067,7 +1067,7 @@ object_ptr EditTodoListBox::setupContent() { st::createPollCheckboxMargin); tasks->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { title->setFocus(); }, title->lifetime()); @@ -1076,7 +1076,7 @@ object_ptr EditTodoListBox::setupContent() { return !text.isEmpty() && (text.size() <= _titleLimit); }; title->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (isValidTitle()) { tasks->focusFirst(); } @@ -1146,12 +1146,12 @@ object_ptr EditTodoListBox::setupContent() { crl::guard(this, send)); tasks->scrollToWidget( - ) | rpl::start_with_next([=](not_null widget) { + ) | rpl::on_next([=](not_null widget) { scrollToWidget(widget); }, lifetime()); tasks->backspaceInFront( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { FocusAtEnd(title); }, lifetime()); @@ -1201,7 +1201,7 @@ AddTodoListTasksBox::AddTodoListTasksBox( , _item(item) { _controller->session().changes().messageUpdates( Data::MessageUpdate::Flag::Destroyed - ) | rpl::start_with_next([=](const Data::MessageUpdate &update) { + ) | rpl::on_next([=](const Data::MessageUpdate &update) { if (update.item == item) { closeBox(); } @@ -1266,7 +1266,7 @@ object_ptr AddTodoListTasksBox::setupContent() { }; tasks->scrollToWidget( - ) | rpl::start_with_next([=](not_null widget) { + ) | rpl::on_next([=](not_null widget) { scrollToWidget(widget); }, lifetime()); diff --git a/Telegram/SourceFiles/boxes/filters/edit_filter_box.cpp b/Telegram/SourceFiles/boxes/filters/edit_filter_box.cpp index 248c170af6..34d4c04408 100644 --- a/Telegram/SourceFiles/boxes/filters/edit_filter_box.cpp +++ b/Telegram/SourceFiles/boxes/filters/edit_filter_box.cpp @@ -94,7 +94,7 @@ not_null SetupChatsPreview( (rules.*peers)())); preview->flagRemoved( - ) | rpl::start_with_next([=](Flag flag) { + ) | rpl::on_next([=](Flag flag) { const auto rules = data->current(); auto computed = Data::ChatFilter( rules.id(), @@ -110,7 +110,7 @@ not_null SetupChatsPreview( }, preview->lifetime()); preview->peerRemoved( - ) | rpl::start_with_next([=](not_null history) { + ) | rpl::on_next([=](not_null history) { const auto rules = data->current(); auto always = rules.always(); auto pinned = rules.pinned(); @@ -220,13 +220,13 @@ void CreateIconSelector( data->value( ) | rpl::map([=](const Data::ChatFilter &filter) { return Ui::ComputeFilterIcon(filter); - }) | rpl::start_with_next([=](Ui::FilterIcon icon) { + }) | rpl::on_next([=](Ui::FilterIcon icon) { *type = icon; toggle->update(); }, toggle->lifetime()); input->geometryValue( - ) | rpl::start_with_next([=](QRect geometry) { + ) | rpl::on_next([=](QRect geometry) { const auto left = geometry.x() + geometry.width() - toggle->width(); const auto position = st::windowFilterIconTogglePosition; toggle->move( @@ -235,7 +235,7 @@ void CreateIconSelector( }, toggle->lifetime()); toggle->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(toggle); const auto icons = Ui::LookupFilterIcon(*type); icons.normal->paintInCenter( @@ -253,7 +253,7 @@ void CreateIconSelector( panel->chosen( ) | rpl::filter([=](Ui::FilterIcon icon) { return icon != Ui::ComputeFilterIcon(data->current()); - }) | rpl::start_with_next([=](Ui::FilterIcon icon) { + }) | rpl::on_next([=](Ui::FilterIcon icon) { panel->hideAnimated(); const auto rules = data->current(); *data = Data::ChatFilter( @@ -382,7 +382,7 @@ void EditFilterBox( }); state->hasLinks.value() | rpl::filter( _1 - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { state->chatlist = true; }, box->lifetime()); @@ -391,7 +391,7 @@ void EditFilterBox( owner->chatsFilters().isChatlistChanged( ) | rpl::filter([=](FilterId id) { return (id == data->current().id()); - }) | rpl::start_with_next([=](FilterId id) { + }) | rpl::on_next([=](FilterId id) { const auto filters = &owner->chatsFilters(); const auto &list = filters->list(); const auto i = ranges::find(list, id, &Data::ChatFilter::id); @@ -414,7 +414,7 @@ void EditFilterBox( const auto session = &window->session(); Data::AmPremiumValue( session - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); @@ -458,7 +458,7 @@ void EditFilterBox( staticTitle->setClickedCallback([=] { state->staticTitle = !state->staticTitle.current(); }); - state->staticTitle.value() | rpl::start_with_next([=](bool value) { + state->staticTitle.value() | rpl::on_next([=](bool value) { staticTitle->setText(value ? tr::lng_filters_enable_animations(tr::now) : tr::lng_filters_disable_animations(tr::now)); @@ -480,7 +480,7 @@ void EditFilterBox( rpl::combine( staticTitle->widthValue(), name->widthValue() - ) | rpl::start_with_next([=](int inner, int outer) { + ) | rpl::on_next([=](int inner, int outer) { staticTitle->moveToRight( st::windowFilterStaticTitlePosition.x(), st::windowFilterStaticTitlePosition.y(), @@ -488,7 +488,7 @@ void EditFilterBox( }, staticTitle->lifetime()); state->creating.value( - ) | rpl::filter(!_1) | rpl::start_with_next([=] { + ) | rpl::filter(!_1) | rpl::on_next([=] { nameEditing->custom = true; }, box->lifetime()); @@ -508,11 +508,11 @@ void EditFilterBox( state->emojiPanel->hide(); state->emojiPanel->selector()->setCurrentPeer(window->session().user()); state->emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { Ui::InsertEmojiAtCursor(name->textCursor(), data.emoji); }, name->lifetime()); state->emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { const auto info = data.document->sticker(); if (info && info->setType == Data::StickersType::Emoji @@ -534,7 +534,7 @@ void EditFilterBox( emojiButton->show(); name->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!nameEditing->settingDefault) { nameEditing->custom = true; } @@ -558,7 +558,7 @@ void EditFilterBox( }; state->title.value( - ) | rpl::start_with_next([=](const TextWithEntities &value) { + ) | rpl::on_next([=](const TextWithEntities &value) { staticTitle->setVisible(!value.entities.isEmpty()); }, staticTitle->lifetime()); @@ -666,7 +666,7 @@ void EditFilterBox( rpl::combine( title->sizeValue(), titleWrap->widthValue() - ) | rpl::start_with_next([=](const QSize &s, int w) { + ) | rpl::on_next([=](const QSize &s, int w) { const auto h = st::normalFont->height; const auto left = padding.left() + s.width() @@ -687,7 +687,7 @@ void EditFilterBox( const auto tag = preview->lifetime().make_state(); tag->context.textContext = Core::TextContext({ .session = session }); const auto shift = st::settingsFilterTagPreviewSkip / 2; - preview->paintRequest() | rpl::start_with_next([=] { + preview->paintRequest() | rpl::on_next([=] { auto p = QPainter(preview); p.setOpacity(tag->alpha); const auto size = tag->frame.size() / style::DevicePixelRatio(); @@ -725,7 +725,7 @@ void EditFilterBox( return value; }; state->title.changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { tag->context.color = palette(state->colorIndex.current())->c; tag->frame = Ui::ChatsFilterTag( upperTitle(), @@ -785,7 +785,7 @@ void EditFilterBox( }); } } - line->sizeValue() | rpl::start_with_next([=](const QSize &size) { + line->sizeValue() | rpl::on_next([=](const QSize &size) { const auto totalWidth = buttons.size() * side; const auto spacing = (size.width() - totalWidth) / (buttons.size() - 1); @@ -799,7 +799,7 @@ void EditFilterBox( const auto last = buttons.back(); const auto icon = Ui::CreateChild(last); icon->resize(side, side); - icon->paintRequest() | rpl::start_with_next([=] { + icon->paintRequest() | rpl::on_next([=] { auto p = QPainter(icon); (session->premium() ? st::windowFilterSmallRemove.icon @@ -853,7 +853,7 @@ void EditFilterBox( tr::lng_filters_link_has(), tr::lng_filters_link())); - state->hasLinks.changes() | rpl::start_with_next([=] { + state->hasLinks.changes() | rpl::on_next([=] { content->resizeToWidth(content->widthNoMargins()); }, content->lifetime()); @@ -886,7 +886,7 @@ void EditFilterBox( addLink->clicks() ) | rpl::filter( (rpl::mappers::_1 == Qt::LeftButton) - ) | rpl::start_with_next([=](Qt::MouseButton button) { + ) | rpl::on_next([=](Qt::MouseButton button) { const auto result = collect(); if (!result || !GoodForExportFilterLink(window, *result)) { return; diff --git a/Telegram/SourceFiles/boxes/filters/edit_filter_chats_list.cpp b/Telegram/SourceFiles/boxes/filters/edit_filter_chats_list.cpp index a200bcecb6..0b3c2fe73c 100644 --- a/Telegram/SourceFiles/boxes/filters/edit_filter_chats_list.cpp +++ b/Telegram/SourceFiles/boxes/filters/edit_filter_chats_list.cpp @@ -384,7 +384,7 @@ object_ptr CreatePeerListSectionSubtitle( const auto raw = result.data(); raw->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { auto p = QPainter(raw); p.fillRect(clip, st::searchedBarBg); }, raw->lifetime()); @@ -394,7 +394,7 @@ object_ptr CreatePeerListSectionSubtitle( std::move(text), st::windowFilterChatsSectionSubtitle); raw->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto padding = st::windowFilterChatsSectionSubtitlePadding; const auto available = width - padding.left() - padding.right(); label->resizeToNaturalWidth(available); @@ -533,12 +533,12 @@ object_ptr EditFilterChatsListController::prepareTypesList() { tr::lng_filters_edit_chats())); controller->selectedChanges( - ) | rpl::start_with_next([=](Flags selected) { + ) | rpl::on_next([=](Flags selected) { _selected = selected; }, _lifetime); controller->rowSelectionChanges( - ) | rpl::start_with_next([=](RowSelectionChange update) { + ) | rpl::on_next([=](RowSelectionChange update) { this->delegate()->peerListSetForeignRowChecked( update.row, update.checked, diff --git a/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp b/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp index d420be8351..6a583d8b8c 100644 --- a/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp +++ b/Telegram/SourceFiles/boxes/filters/edit_filter_links.cpp @@ -531,7 +531,7 @@ void LinkController::addHeader(not_null container) { }, st::settingsFilterIconPadding); _showFinished.events( - ) | rpl::start_with_next([animate = std::move(icon.animate)] { + ) | rpl::on_next([animate = std::move(icon.animate)] { animate(anim::repeat::once); }, verticalLayout->lifetime()); verticalLayout->add(std::move(icon.widget)); @@ -558,7 +558,7 @@ void LinkController::addHeader(not_null container) { style::al_top)->setTryMakeSimilarLines(true); verticalLayout->geometryValue( - ) | rpl::start_with_next([=](const QRect &r) { + ) | rpl::on_next([=](const QRect &r) { divider->setGeometry(r); }, divider->lifetime()); } @@ -647,7 +647,7 @@ void LinkController::addLinkBlock(not_null container) { st::inviteLinkFieldPadding); label->clicks( - ) | rpl::start_with_next(copyLink, label->lifetime()); + ) | rpl::on_next(copyLink, label->lifetime()); AddCopyShareLinkButtons(container, copyLink, shareLink); @@ -785,7 +785,7 @@ void LinkController::setupAboveWidget() { [=](bool select) { toggleAllSelected(select); }); // Fix label cutting on text change from smaller to longer. - _selected.changes() | rpl::start_with_next([=] { + _selected.changes() | rpl::on_next([=] { container->resizeToWidth(container->widthNoMargins()); }, container->lifetime()); @@ -825,7 +825,7 @@ LinksController::LinksController( , _currentFilter(std::move(currentFilter)) , _rows(std::move(content)) { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { for (auto &image : _icons) { image = QImage(); } @@ -834,7 +834,7 @@ LinksController::LinksController( void LinksController::prepare() { _rows.value( - ) | rpl::start_with_next([=](const std::vector &rows) { + ) | rpl::on_next([=](const std::vector &rows) { rebuild(rows); }, _lifetime); } @@ -1078,7 +1078,7 @@ object_ptr ShowLinkBox( const auto saving = std::make_shared(false); raw->hasChangesValue( - ) | rpl::start_with_next([=](bool has) { + ) | rpl::on_next([=](bool has) { box->setCloseByOutsideClick(!has); box->setCloseByEscape(!has); box->clearButtons(); @@ -1182,7 +1182,7 @@ void AddFilterSubtitleWithToggles( const auto canSelect = link->lifetime().make_state>( std::move(selectedCount) | rpl::map(_1 < selectableCount)); canSelect->value( - ) | rpl::start_with_next([=](bool can) { + ) | rpl::on_next([=](bool can) { link->setText(can ? tr::lng_filters_by_link_select(tr::now) : tr::lng_filters_by_link_deselect(tr::now)); @@ -1195,7 +1195,7 @@ void AddFilterSubtitleWithToggles( container->widthValue(), title->topValue(), link->widthValue() - ) | rpl::start_with_next([=](int outer, int y, int width) { + ) | rpl::on_next([=](int outer, int y, int width) { link->move(outer - st::boxRowPadding.right() - width, y); }, link->lifetime()); } diff --git a/Telegram/SourceFiles/boxes/gift_premium_box.cpp b/Telegram/SourceFiles/boxes/gift_premium_box.cpp index 7de7888ad7..87afacfe8d 100644 --- a/Telegram/SourceFiles/boxes/gift_premium_box.cpp +++ b/Telegram/SourceFiles/boxes/gift_premium_box.cpp @@ -151,7 +151,7 @@ using Ui::TableRowTooltipData; auto result = object_ptr(parent); const auto raw = result.data(); - raw->paintRequest() | rpl::start_with_next([=] { + raw->paintRequest() | rpl::on_next([=] { auto p = QPainter(raw); const auto &icon = st::giveawayGiftCodeLinkCopy; const auto left = (raw->width() - icon.width()) / 2; @@ -640,7 +640,7 @@ void GiftCodeBox( box->closeBox(); }); box->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { close->moveToRight(0, 0); }, box->lifetime()); @@ -727,7 +727,7 @@ void GiftCodePendingBox( spoiler->update(); })->start(); linkLabel->sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { spoiler->setGeometry(Rect(s)); }, spoiler->lifetime()); const auto spoilerCached = Ui::SpoilerMessCached( @@ -735,7 +735,7 @@ void GiftCodePendingBox( st::giveawayGiftCodeLink.textFg->c); const auto textHeight = st::giveawayGiftCodeLink.style.font->height; spoiler->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(spoiler); const auto rect = spoiler->rect(); const auto r = rect @@ -769,7 +769,7 @@ void GiftCodePendingBox( const auto closeCallback = [=] { box->closeBox(); }; close->setClickedCallback(closeCallback); box->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { close->moveToRight(0, 0); }, box->lifetime()); @@ -862,7 +862,7 @@ void GiveawayInfoBox( std::move(label), QMargins(0, skip, 0, skip)), style::al_justify); - result->paintRequest() | rpl::start_with_next([=] { + result->paintRequest() | rpl::on_next([=] { auto p = QPainter(result); p.setPen(Qt::NoPen); p.setBrush(st::boxDividerBg); @@ -1059,7 +1059,7 @@ void GiveawayInfoBox( const auto bg = wrap->lifetime().make_state( st::boxRadius, st::attentionBoxButton.textBgOver); - wrap->paintRequest() | rpl::start_with_next([=] { + wrap->paintRequest() | rpl::on_next([=] { auto p = QPainter(wrap); bg->paint(p, wrap->rect()); }, wrap->lifetime()); @@ -1141,7 +1141,7 @@ struct AddedUniqueDetails { const auto icon = Ui::CreateChild( raw, st::giveawayGiftMessageRemove); - raw->widthValue() | rpl::start_with_next([=](int outer) { + raw->widthValue() | rpl::on_next([=](int outer) { label->resizeToWidth(outer - icon->width()); const auto height = std::max(label->height(), icon->height()); diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index 4efbef7503..7a13939ebc 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -908,7 +908,7 @@ void Content::setupContent( inner, st::defaultBox.margin.top())); - rows->isEmpty() | rpl::start_with_next([=](bool empty) { + rows->isEmpty() | rpl::on_next([=](bool empty) { wrap->toggle(!empty, anim::type::instant); }, rows->lifetime()); @@ -931,7 +931,7 @@ void Content::setupContent( tr::lng_languages_none(), st::membersAbout); empty->entity()->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { label->move( (size.width() - label->width()) / 2, (size.height() - label->height()) / 2); @@ -951,7 +951,7 @@ void Content::setupContent( main->isEmpty(), other->isEmpty(), _1 || _2 - ) | rpl::start_with_next([=](bool empty) { + ) | rpl::on_next([=](bool empty) { divider->toggle(!empty, anim::type::instant); }, divider->lifetime()); @@ -959,7 +959,7 @@ void Content::setupContent( a->hasSelection( ) | rpl::filter( _1 - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { b->setSelected(-1); }, a->lifetime()); }; @@ -1134,12 +1134,12 @@ void LanguageBox::prepare() { inner->heightValue(), topContainer->heightValue(), _1 + _2 - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { accumulate_max(*max, height); setDimensions(st::boxWidth, qMin(*max, st::boxMaxListHeight)); }, inner->lifetime()); topContainer->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { setInnerTopSkip(height); }, inner->lifetime()); @@ -1154,7 +1154,7 @@ void LanguageBox::prepare() { }); inner->activations( - ) | rpl::start_with_next([=](const Language &language) { + ) | rpl::on_next([=](const Language &language) { // "#custom" is applied each time it's passed to switchToLanguage(). // So we check that the language really has changed. const auto currentId = [] { @@ -1190,7 +1190,7 @@ void LanguageBox::setupTop(not_null container) { translateEnabled->toggledValue( ) | rpl::filter([](bool checked) { return (checked != Core::App().settings().translateButtonEnabled()); - }) | rpl::start_with_next([=](bool checked) { + }) | rpl::on_next([=](bool checked) { Core::App().settings().setTranslateButtonEnabled(checked); Core::App().saveSettingsDelayed(); }, translateEnabled->lifetime()); @@ -1207,7 +1207,7 @@ void LanguageBox::setupTop(not_null container) { rpl::duplicate(premium), _1 && _2), _translateChatTurnOff.events())); - std::move(premium) | rpl::start_with_next([=](bool value) { + std::move(premium) | rpl::on_next([=](bool value) { translateChat->setToggleLocked(!value); }, translateChat->lifetime()); @@ -1222,7 +1222,7 @@ void LanguageBox::setupTop(not_null container) { } return premium && (checked != Core::App().settings().translateChatEnabled()); - }) | rpl::start_with_next([=](bool checked) { + }) | rpl::on_next([=](bool checked) { Core::App().settings().setTranslateChatEnabled(checked); Core::App().saveSettingsDelayed(); }, translateChat->lifetime()); @@ -1300,7 +1300,7 @@ base::binary_guard LanguageBox::Show(Window::SessionController *controller) { manager.languageListChanged( ) | rpl::take( 1 - ) | rpl::start_with_next([=]() mutable { + ) | rpl::on_next([=]() mutable { const auto show = guard->alive(); if (lifetime) { base::take(lifetime)->destroy(); diff --git a/Telegram/SourceFiles/boxes/local_storage_box.cpp b/Telegram/SourceFiles/boxes/local_storage_box.cpp index ade6a4ee1c..4432a32349 100644 --- a/Telegram/SourceFiles/boxes/local_storage_box.cpp +++ b/Telegram/SourceFiles/boxes/local_storage_box.cpp @@ -288,7 +288,7 @@ void LocalStorageBox::Show(not_null controller) { rpl::combine( controller->session().data().cache().statsOnMain(), controller->session().data().cacheBigFile().statsOnMain() - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( Database::Stats &&stats, Database::Stats &&statsBig) { weak->update(std::move(stats), std::move(statsBig)); @@ -379,7 +379,7 @@ void LocalStorageBox::setupControls() { const auto shown = (data.count && data.totalSize) || !tag; result->toggle(shown, anim::type::instant); result->entity()->clearRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { clearByTag(tag); }, result->lifetime()); _rows.emplace(tag, result); @@ -431,7 +431,7 @@ void LocalStorageBox::setupControls() { ); container->resizeToWidth(st::boxWidth); container->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { setDimensions(st::boxWidth, height); }, container->lifetime()); } diff --git a/Telegram/SourceFiles/boxes/max_invite_box.cpp b/Telegram/SourceFiles/boxes/max_invite_box.cpp index 3159285f42..6433501abc 100644 --- a/Telegram/SourceFiles/boxes/max_invite_box.cpp +++ b/Telegram/SourceFiles/boxes/max_invite_box.cpp @@ -77,7 +77,7 @@ void MaxInviteBox::prepare() { _channel->session().changes().peerUpdates( _channel, Data::PeerUpdate::Flag::InviteLinks - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { rtlupdate(_invitationLink); }, lifetime()); } diff --git a/Telegram/SourceFiles/boxes/moderate_messages_box.cpp b/Telegram/SourceFiles/boxes/moderate_messages_box.cpp index 6ac54d7f7e..75086cad2b 100644 --- a/Telegram/SourceFiles/boxes/moderate_messages_box.cpp +++ b/Telegram/SourceFiles/boxes/moderate_messages_box.cpp @@ -118,7 +118,7 @@ ModerateOptions CalculateModerateOptions(const HistoryItemsList &items) { const auto peer = from[state->index]; const auto peerId = peer->id; state->apiLifetime = search->messagesFounds( - ) | rpl::start_with_next([=](const Api::FoundMessages &found) { + ) | rpl::on_next([=](const Api::FoundMessages &found) { state->messagesCounts[peerId] = found.total; state->index++; repeat(repeat); @@ -201,7 +201,7 @@ void CreateModerateMessagesBox( not_null checkbox, not_null controller, Request request) { - confirms->events() | rpl::start_with_next([=] { + confirms->events() | rpl::on_next([=] { if (checkbox->checked() && controller->collectRequests) { sequentiallyRequest(request, controller->collectRequests()); } @@ -354,7 +354,7 @@ void CreateModerateMessagesBox( } return float64(result); }) - ) | rpl::start_with_next([=](const QString &text) { + ) | rpl::on_next([=](const QString &text) { title->setText(text); title->resizeToWidth(inner->width() - rect::m::sum::h(st::boxRowPadding)); @@ -432,7 +432,7 @@ void CreateModerateMessagesBox( } wrap->toggle(!wrap->toggled(), anim::type::normal); { - inner->heightValue() | rpl::start_with_next([=] { + inner->heightValue() | rpl::on_next([=] { if (!wrap->animating()) { scrollLifetime->destroy(); Ui::PostponeCall(crl::guard(box, [=] { @@ -458,7 +458,7 @@ void CreateModerateMessagesBox( rpl::single(toggled ? emojiUp : emojiDown), Ui::Text::WithEntities); }) | rpl::flatten_latest( - ) | rpl::start_with_next([=](const TextWithEntities &text) { + ) | rpl::on_next([=](const TextWithEntities &text) { raw->setMarkedText(Ui::Text::Link(text, u"internal:"_q)); }, label->lifetime()); @@ -509,7 +509,7 @@ void CreateModerateMessagesBox( disabledMessages, { .isForum = peer->isForum() }); computeRestrictions = getRestrictions; - std::move(changes) | rpl::start_with_next([=] { + std::move(changes) | rpl::on_next([=] { ban->setChecked(true); }, ban->lifetime()); Ui::AddSkip(container); @@ -519,7 +519,7 @@ void CreateModerateMessagesBox( } // Handle confirmation manually. - confirms->events() | rpl::start_with_next([=] { + confirms->events() | rpl::on_next([=] { if (ban->checked() && controller->collectRequests) { const auto kick = !wrap || !wrap->toggled(); const auto restrictions = computeRestrictions diff --git a/Telegram/SourceFiles/boxes/passcode_box.cpp b/Telegram/SourceFiles/boxes/passcode_box.cpp index a235dc2d7a..6f7a202e1c 100644 --- a/Telegram/SourceFiles/boxes/passcode_box.cpp +++ b/Telegram/SourceFiles/boxes/passcode_box.cpp @@ -47,7 +47,7 @@ void SetCloudPassword( not_null box, not_null session) { session->api().cloudPassword().state( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { using namespace Settings; const auto weak = base::make_weak(box); if (CheckEditCloudPassword(session)) { @@ -120,7 +120,7 @@ void StartPendingReset( }; session->api().cloudPassword().resetPassword( - ) | rpl::start_with_next_error_done([=]( + ) | rpl::on_next_error_done([=]( Api::CloudPassword::ResetRetryDate retryDate) { constexpr auto kMinute = 60; constexpr auto kHour = 3600; @@ -309,11 +309,11 @@ void PasscodeBox::prepare() { connect(_newPasscode, &Ui::MaskedInputField::changed, [=] { newChanged(); }); connect(_reenterPasscode, &Ui::MaskedInputField::changed, [=] { newChanged(); }); _passwordHint->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { newChanged(); }, _passwordHint->lifetime()); _recoverEmail->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!_emailError.isEmpty()) { _emailError = QString(); update(); @@ -325,9 +325,9 @@ void PasscodeBox::prepare() { connect(_newPasscode, &Ui::MaskedInputField::submitted, fieldSubmit); connect(_reenterPasscode, &Ui::MaskedInputField::submitted, fieldSubmit); _passwordHint->submits( - ) | rpl::start_with_next(fieldSubmit, _passwordHint->lifetime()); + ) | rpl::on_next(fieldSubmit, _passwordHint->lifetime()); _recoverEmail->submits( - ) | rpl::start_with_next(fieldSubmit, _recoverEmail->lifetime()); + ) | rpl::on_next(fieldSubmit, _recoverEmail->lifetime()); _recover->addClickHandler([=] { recoverByEmail(); }); @@ -607,7 +607,7 @@ void PasscodeBox::validateEmail( box->boxClosing( ) | rpl::filter([=] { return !*set; - }) | start_with_next([=, weak = base::make_weak(this)] { + }) | on_next([=, weak = base::make_weak(this)] { if (weak) { weak->_clearUnconfirmedPassword.fire({}); } @@ -1117,7 +1117,7 @@ void PasscodeBox::recover() { ) | rpl::start_to_stream(_newPasswordSet, lifetime()); box->recoveryExpired( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { recoverExpired(); }, lifetime()); @@ -1207,11 +1207,11 @@ void RecoverBox::prepare() { updateHeight(); _recoverCode->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { codeChanged(); }, _recoverCode->lifetime()); _recoverCode->submits( - ) | rpl::start_with_next([=] { submit(); }, _recoverCode->lifetime()); + ) | rpl::on_next([=] { submit(); }, _recoverCode->lifetime()); } void RecoverBox::paintEvent(QPaintEvent *e) { @@ -1342,7 +1342,7 @@ void RecoverBox::proceedToChange(const QString &code) { auto box = Box(_session, fields); box->boxClosing( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto weak = base::make_weak(this); if (const auto onstack = _closeParent) { onstack(); @@ -1353,7 +1353,7 @@ void RecoverBox::proceedToChange(const QString &code) { }, lifetime()); box->newPasswordSet( - ) | rpl::start_with_next([=](QByteArray &&password) { + ) | rpl::on_next([=](QByteArray &&password) { _newPasswordSet.fire(std::move(password)); }, lifetime()); diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index 6cc1b5d05a..3f16259456 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -113,7 +113,7 @@ void PeerListBox::createMultiSelect() { tr::lng_participant_filter()); _select.create(this, std::move(entity)); _select->heightValue( - ) | rpl::start_with_next( + ) | rpl::on_next( [this] { updateScrollSkips(); }, lifetime()); _select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) { @@ -191,7 +191,7 @@ void PeerListBox::prepare() { _controller->setDelegate(this); _controller->boxHeightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { setDimensions(_controller->contentWidth(), height); }, lifetime()); @@ -203,7 +203,7 @@ void PeerListBox::prepare() { } content()->scrollToRequests( - ) | rpl::start_with_next([this](Ui::ScrollToRequest request) { + ) | rpl::on_next([this](Ui::ScrollToRequest request) { scrollToY(request.ymin, request.ymax); }, lifetime()); @@ -1002,14 +1002,14 @@ PeerListContent::PeerListContent( , _controller(controller) , _rowHeight(_st.item.height) { _controller->session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); }, lifetime()); using UpdateFlag = Data::PeerUpdate::Flag; _controller->session().changes().peerUpdates( UpdateFlag::Name | UpdateFlag::Photo | UpdateFlag::EmojiStatus - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { if (update.flags & UpdateFlag::Name) { handleNameChanged(update.peer); } @@ -1019,7 +1019,7 @@ PeerListContent::PeerListContent( }, lifetime()); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { invalidatePixmapsCache(); }, lifetime()); @@ -1387,10 +1387,10 @@ void PeerListContent::initDecorateWidget(Ui::RpWidget *widget) { widget->events( ) | rpl::filter([=](not_null e) { return (e->type() == QEvent::Enter) && widget->isVisible(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { mouseLeftGeometry(); }, widget->lifetime()); - widget->heightValue() | rpl::skip(1) | rpl::start_with_next([=] { + widget->heightValue() | rpl::skip(1) | rpl::on_next([=] { resizeToWidth(width()); }, widget->lifetime()); } diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index e6d54fc826..ad9e2becca 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -117,7 +117,7 @@ object_ptr PrepareContactsBox( }); raw->setSortMode(Mode::Online); - raw->wheelClicks() | rpl::start_with_next([=](not_null p) { + raw->wheelClicks() | rpl::on_next([=](not_null p) { sessionController->showInNewWindow(p); }, box->lifetime()); }; @@ -385,7 +385,7 @@ void TrackMessageMoneyRestrictionsChanges( rpl::merge( Data::AmPremiumValue(session) | rpl::to_empty, session->api().premium().someMessageMoneyRestrictionsResolved() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto st = &controller->computeListSt().item; const auto delegate = controller->delegate(); const auto process = [&](not_null raw) { @@ -431,18 +431,18 @@ void ChatsListBoxController::prepare() { session().data().chatsListLoadedEvents( ) | rpl::filter([=](Data::Folder *folder) { return !folder; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { checkForEmptyRows(); }, lifetime()); } session().data().chatsListChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { rebuildRows(); }, lifetime()); session().data().contactsLoaded().value( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { rebuildRows(); }, lifetime()); } @@ -586,14 +586,14 @@ void PeerListStories::prepare(not_null delegate) { _delegate = delegate; _unreadBrush = PeerListStoriesGradient(_controller->computeListSt()); - style::PaletteChanged() | rpl::start_with_next([=] { + style::PaletteChanged() | rpl::on_next([=] { _unreadBrush = PeerListStoriesGradient(_controller->computeListSt()); updateColors(); }, _lifetime); _session->changes().peerUpdates( Data::PeerUpdate::Flag::StoriesState - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { const auto id = update.peer->id.value; if (const auto row = _delegate->peerListFindRow(id)) { process(row); @@ -601,7 +601,7 @@ void PeerListStories::prepare(not_null delegate) { }, _lifetime); const auto stories = &_session->data().stories(); - stories->sourceChanged() | rpl::start_with_next([=](PeerId id) { + stories->sourceChanged() | rpl::on_next([=](PeerId id) { const auto source = stories->source(id); const auto info = source ? source->info() @@ -662,7 +662,7 @@ void ContactsBoxController::prepare() { } session().data().contactsLoaded().value( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { rebuildRows(); }, lifetime()); } @@ -724,7 +724,7 @@ void ContactsBoxController::setSortMode(SortMode mode) { ) | rpl::filter([=](const Data::PeerUpdate &update) { return !_sortByOnlineTimer.isActive() && delegate()->peerListFindRow(update.peer->id.value); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { _sortByOnlineTimer.callOnce(kSortByOnlineThrottle); }, _sortByOnlineLifetime); } else { @@ -874,7 +874,7 @@ void ChooseRecipientBoxController::rowClicked(not_null row) { }); forum->destroyed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); }); @@ -913,7 +913,7 @@ void ChooseRecipientBoxController::rowClicked(not_null row) { }); monoforum->destroyed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); }); @@ -1098,12 +1098,12 @@ ChooseTopicBoxController::ChooseTopicBoxController( setStyleOverrides(&st::chooseTopicList); _forum->chatsListChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshRows(); }, lifetime()); _forum->topicDestroyed( - ) | rpl::start_with_next([=](not_null topic) { + ) | rpl::on_next([=](not_null topic) { const auto id = PeerListRowId(topic->rootId().bare); if (const auto row = delegate()->peerListFindRow(id)) { delegate()->peerListRemoveRow(row); @@ -1133,7 +1133,7 @@ void ChooseTopicBoxController::prepare() { session().changes().entryUpdates( Data::EntryUpdate::Flag::Repaint - ) | rpl::start_with_next([=](const Data::EntryUpdate &update) { + ) | rpl::on_next([=](const Data::EntryUpdate &update) { if (const auto topic = update.entry->asTopic()) { if (topic->forum() == _forum) { const auto id = topic->rootId().bare; @@ -1200,12 +1200,12 @@ ChooseSublistBoxController::ChooseSublistBoxController( setStyleOverrides(&st::chooseTopicList); _monoforum->chatsListChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshRows(); }, lifetime()); _monoforum->sublistDestroyed( - ) | rpl::start_with_next([=](not_null sublist) { + ) | rpl::on_next([=](not_null sublist) { const auto id = sublist->sublistPeer()->id.value; if (const auto row = delegate()->peerListFindRow(id)) { delegate()->peerListRemoveRow(row); @@ -1235,7 +1235,7 @@ void ChooseSublistBoxController::prepare() { session().changes().entryUpdates( Data::EntryUpdate::Flag::Repaint - ) | rpl::start_with_next([=](const Data::EntryUpdate &update) { + ) | rpl::on_next([=](const Data::EntryUpdate &update) { if (const auto sublist = update.entry->asSublist()) { if (sublist->parent() == _monoforum) { const auto id = sublist->sublistPeer()->id.value; diff --git a/Telegram/SourceFiles/boxes/peer_list_widgets.cpp b/Telegram/SourceFiles/boxes/peer_list_widgets.cpp index dfa729eb6e..806e30590f 100644 --- a/Telegram/SourceFiles/boxes/peer_list_widgets.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_widgets.cpp @@ -25,7 +25,7 @@ PeerListWidgets::PeerListWidgets( , _controller(controller) , _st(controller->computeListSt()) { _content = base::make_unique_q(this); - parent->sizeValue() | rpl::start_with_next([this](const QSize &size) { + parent->sizeValue() | rpl::on_next([this](const QSize &size) { _content->resizeToWidth(size.width()); resize(size.width(), _content->height()); }, lifetime()); @@ -129,7 +129,7 @@ void PeerListWidgets::appendRow(std::unique_ptr row) { st.button.ripple, st.button.textBgOver))); widget->resize(widget->width(), st.height); - widget->paintRequest() | rpl::start_with_next([=, this] { + widget->paintRequest() | rpl::on_next([=, this] { auto p = Painter(widget); const auto selected = widget->isOver() || widget->isDown(); paintRow(p, crl::now(), selected, raw); diff --git a/Telegram/SourceFiles/boxes/peer_lists_box.cpp b/Telegram/SourceFiles/boxes/peer_lists_box.cpp index 9929840ab2..8a8a71ec9b 100644 --- a/Telegram/SourceFiles/boxes/peer_lists_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_lists_box.cpp @@ -90,7 +90,7 @@ void PeerListsBox::createMultiSelect() { tr::lng_participant_filter()); _select.create(this, std::move(entity)); _select->heightValue( - ) | rpl::start_with_next( + ) | rpl::on_next( [this] { updateScrollSkips(); }, lifetime()); _select->entity()->setSubmittedCallback([=](Qt::KeyboardModifiers) { @@ -158,7 +158,7 @@ void PeerListsBox::prepare() { list.controller->setDelegate(list.delegate.get()); content->scrollToRequests( - ) | rpl::start_with_next([=](Ui::ScrollToRequest request) { + ) | rpl::on_next([=](Ui::ScrollToRequest request) { const auto skip = content->y(); scrollToY( skip + request.ymin, @@ -168,7 +168,7 @@ void PeerListsBox::prepare() { content->selectedIndexValue( ) | rpl::filter([=](int index) { return (index >= 0); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { for (const auto &list : _lists) { if (list.content && list.content != content) { list.content->clearSelection(); diff --git a/Telegram/SourceFiles/boxes/peers/add_bot_to_chat_box.cpp b/Telegram/SourceFiles/boxes/peers/add_bot_to_chat_box.cpp index e3cf2a2dd5..cabefcd950 100644 --- a/Telegram/SourceFiles/boxes/peers/add_bot_to_chat_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_bot_to_chat_box.cpp @@ -65,7 +65,7 @@ Controller::Controller( , _callback(std::move(callback)) { std::move( add - ) | rpl::start_with_next([=](not_null peer) { + ) | rpl::on_next([=](not_null peer) { if (_prepared) { addRow(peer); } else { @@ -359,7 +359,7 @@ object_ptr AddBotToGroupBoxController::prepareAdminnedChats() { delegate->setContent(content); controller->setDelegate(delegate); - items.events() | rpl::take(1) | rpl::start_with_next([=] { + items.events() | rpl::take(1) | rpl::on_next([=] { wrap->show(anim::type::instant); }, inner->lifetime()); }; @@ -373,7 +373,7 @@ object_ptr AddBotToGroupBoxController::prepareAdminnedChats() { rpl::merge( _groups.events(), _channels.events() - ) | rpl::take(1) | rpl::start_with_next([=] { + ) | rpl::take(1) | rpl::on_next([=] { container->add(CreatePeerListSectionSubtitle( container, tr::lng_bot_groups())); @@ -403,7 +403,7 @@ void AddBotToGroupBoxController::prepareViewHook() { session().data().chatsListLoadedEvents( ) | rpl::filter([=](Data::Folder *folder) { return !folder; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { updateLabels(); }, lifetime()); } diff --git a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp index 2ece4c18aa..a2c635810d 100644 --- a/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_participants_box.cpp @@ -273,7 +273,7 @@ void SimpleForbiddenBox( Data::AmPremiumValue( &peer->session() - ) | rpl::skip(1) | rpl::start_with_next([=] { + ) | rpl::skip(1) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); } @@ -555,7 +555,7 @@ void InviteForbiddenController::setComplexCover() { void InviteForbiddenController::prepare() { session().api().premium().someMessageMoneyRestrictionsResolved( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto stars = 0; const auto process = [&](not_null raw) { const auto row = static_cast(raw.get()); @@ -667,7 +667,7 @@ void InviteForbiddenController::send( if (!waiting.empty()) { session().changes().peerUpdates( Data::PeerUpdate::Flag::FullInfo - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { if (waiting.contains(update.peer)) { withPaymentApproved(alreadyApproved); } @@ -677,7 +677,7 @@ void InviteForbiddenController::send( session().credits().loadedValue( ) | rpl::filter( rpl::mappers::_1 - ) | rpl::take(1) | rpl::start_with_next([=] { + ) | rpl::take(1) | rpl::on_next([=] { withPaymentApproved(alreadyApproved); }, _paymentCheckLifetime); } @@ -750,7 +750,7 @@ void InviteForbiddenController::send( _peer->session().changes().peerUpdates( _peer, Data::PeerUpdate::Flag::FullInfo - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { sendForFull(); }, lifetime()); } @@ -926,7 +926,7 @@ void AddParticipantsBoxController::addInviteLinkButton() { st::inviteViaLinkIcon, QPoint()); button->entity()->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { icon->moveToLeft( st::inviteViaLinkIconPosition.x(), (height - st::inviteViaLinkIcon.height()) / 2); @@ -938,7 +938,7 @@ void AddParticipantsBoxController::addInviteLinkButton() { button->entity()->events( ) | rpl::filter([=](not_null e) { return (e->type() == QEvent::Enter); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { delegate()->peerListMouseLeftGeometry(); }, button->lifetime()); delegate()->peerListSetAboveWidget(std::move(button)); @@ -1062,7 +1062,7 @@ void AddParticipantsBoxController::Start( [=] { box->closeBox(); }); if (justCreated) { const auto weak = base::make_weak(parent); - box->boxClosing() | rpl::start_with_next([=] { + box->boxClosing() | rpl::on_next([=] { auto params = Window::SectionShow(); params.activation = anim::activation::background; if (const auto strong = weak.get()) { @@ -1145,7 +1145,7 @@ bool ChatInviteForbidden( ) | rpl::map( rpl::mappers::_1 > 0 ) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](bool has) { + ) | rpl::on_next([=](bool has) { box->clearButtons(); if (has) { const auto send = box->addButton(tr::lng_via_link_send(), [=] { @@ -1165,7 +1165,7 @@ bool ChatInviteForbidden( Data::AmPremiumValue( &peer->session() - ) | rpl::skip(1) | rpl::start_with_next([=] { + ) | rpl::skip(1) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); }; @@ -1272,7 +1272,7 @@ void AddSpecialBoxController::prepareChatRows(not_null chat) { chat->session().changes().peerUpdates( chat, UpdateFlag::Members | UpdateFlag::Admins - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { _additional.fillFromPeer(); if (update.flags & UpdateFlag::Members) { rebuildChatRows(chat); diff --git a/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp b/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp index f8362cedb7..bf831f0282 100644 --- a/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/choose_peer_box.cpp @@ -373,7 +373,7 @@ void ChoosePeerBoxController::prepareRestrictions() { st, QPoint()); button->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { icon->moveToLeft( st::choosePeerCreateIconLeft, (height - st::inviteViaLinkIcon.height()) / 2); @@ -387,7 +387,7 @@ void ChoosePeerBoxController::prepareRestrictions() { button->events( ) | rpl::filter([=](not_null e) { return (e->type() == QEvent::Enter); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { delegate()->peerListMouseLeftGeometry(); }, button->lifetime()); return button; @@ -522,7 +522,7 @@ void ShowChoosePeerBox( query, std::move(callback)); auto initBox = [=, ptr = controller.get()](not_null box) { - ptr->selectedCountValue() | rpl::start_with_next([=](int count) { + ptr->selectedCountValue() | rpl::on_next([=](int count) { box->clearButtons(); if (limit > 1) { box->setAdditionalTitle(rpl::single(u"%1 / %2"_q.arg(count).arg(limit))); diff --git a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp index 7c908edf5c..a435c5ffc9 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_contact_box.cpp @@ -348,8 +348,8 @@ void Controller::initNameFields( _save(); } }; - first->submits() | rpl::start_with_next(submit, first->lifetime()); - last->submits() | rpl::start_with_next(submit, last->lifetime()); + first->submits() | rpl::on_next(submit, first->lifetime()); + last->submits() | rpl::on_next(submit, last->lifetime()); first->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName); first->setMaxLength(Ui::EditPeer::kMaxUserFirstLastName); } @@ -418,11 +418,11 @@ void Controller::setupNotesField() { _emojiPanel->hide(); _emojiPanel->selector()->setCurrentPeer(_window->session().user()); _emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { Ui::InsertEmojiAtCursor(_notesField->textCursor(), data.emoji); }, _notesField->lifetime()); _emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { const auto info = data.document->sticker(); if (info && info->setType == Data::StickersType::Emoji @@ -464,7 +464,7 @@ void Controller::setupNotesField() { rpl::combine( limitState->charsLimitation->geometryValue(), _notesField->geometryValue() - ) | rpl::start_with_next([=](QRect limit, QRect field) { + ) | rpl::on_next([=](QRect limit, QRect field) { limitState->charsLimitation->setVisible( (w->mapToGlobal(limit.bottomLeft()).y() - border) < w->mapToGlobal(field.bottomLeft()).y()); @@ -474,7 +474,7 @@ void Controller::setupNotesField() { limitState->charsLimitation->setLeft(remove); }; - _notesField->changes() | rpl::start_with_next([=] { + _notesField->changes() | rpl::on_next([=] { checkCharsLimitation(); }, _notesField->lifetime()); @@ -558,7 +558,7 @@ void Controller::setupPhotoButtons() { _suggestIconWidget = Ui::CreateChild(suggestButton); _suggestIconWidget->resize(iconPlaceholder); - _suggestIconWidget->paintRequest() | rpl::start_with_next([=] { + _suggestIconWidget->paintRequest() | rpl::on_next([=] { if (_suggestIcon && _suggestIcon->valid()) { auto p = QPainter(_suggestIconWidget); const auto frame = _suggestIcon->frame(st::lightButtonFg->c); @@ -566,7 +566,7 @@ void Controller::setupPhotoButtons() { } }, _suggestIconWidget->lifetime()); - suggestButton->sizeValue() | rpl::start_with_next([=](QSize size) { + suggestButton->sizeValue() | rpl::on_next([=](QSize size) { _suggestIconWidget->move( st::settingsButtonLight.iconLeft - iconPlaceholder.width() / 4, (size.height() - _suggestIconWidget->height()) / 2); @@ -590,7 +590,7 @@ void Controller::setupPhotoButtons() { _cameraIconWidget = Ui::CreateChild(setButton); _cameraIconWidget->resize(iconPlaceholder); - _cameraIconWidget->paintRequest() | rpl::start_with_next([=] { + _cameraIconWidget->paintRequest() | rpl::on_next([=] { if (_cameraIcon && _cameraIcon->valid()) { auto p = QPainter(_cameraIconWidget); const auto frame = _cameraIcon->frame(st::lightButtonFg->c); @@ -598,7 +598,7 @@ void Controller::setupPhotoButtons() { } }, _cameraIconWidget->lifetime()); - setButton->sizeValue() | rpl::start_with_next([=](QSize size) { + setButton->sizeValue() | rpl::on_next([=](QSize size) { _cameraIconWidget->move( st::settingsButtonLight.iconLeft - iconPlaceholder.width() / 4, (size.height() - _cameraIconWidget->height()) / 2); @@ -635,7 +635,7 @@ void Controller::setupPhotoButtons() { userpicButton->setAttribute(Qt::WA_TransparentForMouseEvents); resetButton->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { userpicButton->move( st::settingsButtonLight.iconLeft, (size.height() - userpicButton->height()) / 2); diff --git a/Telegram/SourceFiles/boxes/peers/edit_discussion_link_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_discussion_link_box.cpp index 7b9779e5ba..9a2896d52e 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_discussion_link_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_discussion_link_box.cpp @@ -81,7 +81,7 @@ Controller::Controller( Data::PeerUpdate::Flag::FullInfo ) | rpl::filter([=](const Data::PeerUpdate &update) { return (update.peer == _waitForFull); - }) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + }) | rpl::on_next([=](const Data::PeerUpdate &update) { choose(std::exchange(_waitForFull, nullptr)); }, lifetime()); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp index aee6a5248b..24fe773fca 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_forum_topic_box.cpp @@ -73,7 +73,7 @@ DefaultIconEmoji::DefaultIconEmoji( Fn repaint, Data::CustomEmojiSizeTag tag) : _tag(tag) { - std::move(value) | rpl::start_with_next([=](DefaultIcon value) { + std::move(value) | rpl::on_next([=](DefaultIcon value) { _icon = value; _image = QImage(); if (repaint) { @@ -164,7 +164,7 @@ bool DefaultIconEmoji::readyInDefaultState() { std::move( iconId - ) | rpl::start_with_next([=](DocumentId id) { + ) | rpl::on_next([=](DocumentId id) { const auto owner = &controller->session().data(); state->icon = id ? owner->customEmojiManager().create( @@ -177,7 +177,7 @@ bool DefaultIconEmoji::readyInDefaultState() { std::move( defaultIcon - ) | rpl::start_with_next([=](DefaultIcon icon) { + ) | rpl::on_next([=](DefaultIcon icon) { state->defaultIcon = Data::ForumTopicIconFrame( icon.colorId, icon.title, @@ -189,7 +189,7 @@ bool DefaultIconEmoji::readyInDefaultState() { result->paintRequest( ) | rpl::filter([=] { return !paintIconFrame(result); - }) | rpl::start_with_next([=](QRect clip) { + }) | rpl::on_next([=](QRect clip) { auto args = Ui::Text::CustomEmoji::Context{ .textColor = st::windowFg->c, .now = crl::now(), @@ -222,7 +222,7 @@ bool DefaultIconEmoji::readyInDefaultState() { rpl::single(rpl::empty) | rpl::then( style::PaletteChanged() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { state->frame = Data::ForumTopicGeneralIconFrame( st::largeForumTopicIcon.size, st::windowSubTextFg->c); @@ -231,7 +231,7 @@ bool DefaultIconEmoji::readyInDefaultState() { result->resize(size, size); result->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { auto p = QPainter(result); const auto skip = (size - st::largeForumTopicIcon.size) / 2; p.drawImage(skip, skip, state->frame); @@ -300,7 +300,7 @@ struct IconSelector { icons->requestDefaultIfUnknown(); icons->defaultUpdates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { selector->provideRecent(DocumentListToRecent(recent())); }, selector->lifetime()); @@ -312,14 +312,14 @@ struct IconSelector { rpl::combine( rpl::duplicate(coverHeight), selector->widthValue() - ) | rpl::start_with_next([=](int top, int width) { + ) | rpl::on_next([=](int top, int width) { shadow->setGeometry(0, top, width, st::lineWidth); }, shadow->lifetime()); selector->refreshEmoji(); selector->scrollToRequests( - ) | rpl::start_with_next([=](int y) { + ) | rpl::on_next([=](int y) { box->scrollToY(y); shadow->update(); }, selector->lifetime()); @@ -328,7 +328,7 @@ struct IconSelector { box->heightValue(), std::move(coverHeight), rpl::mappers::_1 - rpl::mappers::_2 - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { selector->setMinimalHeight(selector->width(), height); }, body->lifetime()); @@ -345,7 +345,7 @@ struct IconSelector { }; selector->customChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { const auto owner = &controller->session().data(); const auto document = data.document; const auto id = document->id; @@ -465,14 +465,14 @@ void EditForumTopicBox( paintIconFrame); title->geometryValue( - ) | rpl::start_with_next([=](QRect geometry) { + ) | rpl::on_next([=](QRect geometry) { icon->move( st::editTopicIconPosition.x(), st::editTopicIconPosition.y()); }, icon->lifetime()); state->iconId.value( - ) | rpl::start_with_next([=](DocumentId iconId) { + ) | rpl::on_next([=](DocumentId iconId) { icon->setAttribute( Qt::WA_TransparentForMouseEvents, created || (iconId != 0)); @@ -486,13 +486,13 @@ void EditForumTopicBox( }; }); title->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { state->defaultIcon = DefaultIcon{ title->getLastText().trimmed(), state->defaultIcon.current().colorId, }; }, title->lifetime()); - title->submits() | rpl::start_with_next([box] { + title->submits() | rpl::on_next([box] { box->triggerButton(0); }, title->lifetime()); @@ -515,7 +515,7 @@ void EditForumTopicBox( state->paintIconFrame = std::move(selector.paintIconFrame); std::move( selector.iconIdValue - ) | rpl::start_with_next([=](DocumentId iconId) { + ) | rpl::on_next([=](DocumentId iconId) { state->iconId = (iconId != kDefaultIconId) ? iconId : 0; }, box->lifetime()); } diff --git a/Telegram/SourceFiles/boxes/peers/edit_members_visible.cpp b/Telegram/SourceFiles/boxes/peers/edit_members_visible.cpp index 216a0431d7..88c720c2d2 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_members_visible.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_members_visible.cpp @@ -62,7 +62,7 @@ namespace { Ui::AddDividerText(container, tr::lng_profile_hide_participants_about()); button->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { megagroup->session().api().request( MTPchannels_ToggleParticipantsHidden( megagroup->inputChannel, diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp index 612d438f7e..b00ec51539 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp @@ -94,7 +94,7 @@ EditParticipantBox::Inner::Inner( , _hasAdminRights(hasAdminRights) , _rows(this) { _rows->heightValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { resizeToWidth(width()); }, lifetime()); @@ -282,7 +282,7 @@ void EditAdminBox::prepare() { true)), st::rightsToggleMargin + (st::rightsDividerMargin / 2)); _addAsAdmin->checkedChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { _adminControlsWrap->toggle(checked, anim::type::normal); refreshButtons(); }, _addAsAdmin->lifetime()); @@ -530,7 +530,7 @@ not_null EditAdminBox::addRankInput( result->setMaxLength(kAdminRoleLimit); result->setInstantReplaces(Ui::InstantReplaces::TextOnly()); result->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto text = result->getLastText(); const auto removed = TextUtilities::RemoveEmoji(text); if (removed != text) { @@ -654,7 +654,7 @@ void EditAdminBox::requestTransferPassword(not_null channel) { peer()->session().api().cloudPassword().state( ) | rpl::take( 1 - ) | rpl::start_with_next([=](const Core::CloudPasswordState &state) { + ) | rpl::on_next([=](const Core::CloudPasswordState &state) { auto fields = PasscodeBox::CloudFields::From(state); fields.customTitle = tr::lng_rights_transfer_password_title(); fields.customDescription diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index 15a5f1aee1..626c3baf8e 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -296,7 +296,7 @@ void SubscribeToMigration( return (channel != nullptr); }) | rpl::take( 1 - ) | rpl::start_with_next([=](not_null channel) { + ) | rpl::on_next([=](not_null channel) { const auto onstack = base::duplicate(migrate); onstack(channel); }, lifetime); @@ -812,7 +812,7 @@ ParticipantsOnlineSorter::ParticipantsOnlineSorter( , _sortByOnlineTimer([=] { sort(); }) { peer->session().changes().peerUpdates( Data::PeerUpdate::Flag::OnlineStatus - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { const auto peerId = update.peer->id; if (const auto row = _delegate->peerListFindRow(peerId.value)) { row->refreshStatus(); @@ -910,7 +910,7 @@ void ParticipantsBoxController::setupListChangeViewers() { channel->owner().megagroupParticipantAdded( channel - ) | rpl::start_with_next([=](not_null user) { + ) | rpl::on_next([=](not_null user) { if (delegate()->peerListFullRowsCount() > 0) { if (delegate()->peerListRowAt(0)->peer() == user) { return; @@ -935,7 +935,7 @@ void ParticipantsBoxController::setupListChangeViewers() { channel->owner().megagroupParticipantRemoved( channel - ) | rpl::start_with_next([=](not_null user) { + ) | rpl::on_next([=](not_null user) { if (const auto row = delegate()->peerListFindRow(user->id.value)) { delegate()->peerListRemoveRow(row); } @@ -1127,13 +1127,13 @@ auto ParticipantsBoxController::saveState() const chat->session().changes().peerUpdates( chat, Data::PeerUpdate::Flag::Members - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { weak->controllerState = nullptr; }, my->lifetime); } else if (const auto channel = _peer->asMegagroup()) { channel->owner().megagroupParticipantAdded( channel - ) | rpl::start_with_next([=](not_null user) { + ) | rpl::on_next([=](not_null user) { if (!weak->list.empty()) { if (weak->list[0] == user) { return; @@ -1150,7 +1150,7 @@ auto ParticipantsBoxController::saveState() const channel->owner().megagroupParticipantRemoved( channel - ) | rpl::start_with_next([=](not_null user) { + ) | rpl::on_next([=](not_null user) { weak->list.erase(std::remove( weak->list.begin(), weak->list.end(), @@ -1257,7 +1257,7 @@ void ParticipantsBoxController::prepare() { auto visible = _peer->isMegagroup() ? Info::Profile::CanViewParticipantsValue(_peer->asMegagroup()) : rpl::single(true); - std::move(visible) | rpl::start_with_next([=](bool visible) { + std::move(visible) | rpl::on_next([=](bool visible) { if (!visible) { _onlineCountValue = 0; _onlineSorter = nullptr; @@ -1275,7 +1275,7 @@ void ParticipantsBoxController::prepare() { } _peer->session().changes().chatAdminChanges( - ) | rpl::start_with_next([=](const Data::ChatAdminChange &update) { + ) | rpl::on_next([=](const Data::ChatAdminChange &update) { if (update.peer != _peer) { return; } @@ -1347,7 +1347,7 @@ void ParticipantsBoxController::prepareChatRows(not_null chat) { chat->session().changes().peerUpdates( chat, UpdateFlag::Members | UpdateFlag::Admins - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { _additional.fillFromPeer(); if ((update.flags & UpdateFlag::Members) || (_role == Role::Admins)) { @@ -2201,7 +2201,7 @@ void ParticipantsBoxController::subscribeToCreatorChange( return (change.diff & ChannelDataFlag::Creator); }) | rpl::filter([=] { return (isCreator != channel->amCreator()); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { if (channel->isBroadcast()) { fullListRefresh(); return; diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp index 9457279ddf..825430e4af 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp @@ -142,7 +142,7 @@ base::unique_qptr CreateEmptyPlaceholder( container->resize(width, totalHeight); container->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto totalContentHeight = iconWidget->height() + st::normalFont->height + emptyLabel->height() + (emptyNextLabel @@ -313,17 +313,17 @@ PreviewWrap::PreviewWrap( _style->apply(_theme.get()); _fake->setName(peer->name(), QString()); - std::move(colorIndexValue) | rpl::start_with_next([=](uint8 index) { + std::move(colorIndexValue) | rpl::on_next([=](uint8 index) { if (index != kUnsetColorIndex) { _fake->changeColorIndex(index); update(); } }, lifetime()); - std::move(backgroundEmojiId) | rpl::start_with_next([=](DocumentId id) { + std::move(backgroundEmojiId) | rpl::on_next([=](DocumentId id) { _fake->changeBackgroundEmojiId(id); update(); }, lifetime()); - std::move(colorCollectible) | rpl::start_with_next([=]( + std::move(colorCollectible) | rpl::on_next([=]( std::optional &&collectible) { if (collectible) { _fake->changeColorCollectible(std::move(*collectible)); @@ -335,7 +335,7 @@ PreviewWrap::PreviewWrap( const auto session = &_history->session(); session->data().viewRepaintRequest( - ) | rpl::start_with_next([=](not_null view) { + ) | rpl::on_next([=](not_null view) { if (view == _element.get()) { update(); } @@ -391,7 +391,7 @@ void PreviewWrap::initElements() { widthValue( ) | rpl::filter([=](int width) { return width > st::msgMinWidth; - }) | rpl::start_with_next([=](int width) { + }) | rpl::on_next([=](int width) { const auto height = _position.y() + _element->resizeGetHeight(width) + st::msgMargin.top(); @@ -749,11 +749,11 @@ void Apply( }; const auto state = right->lifetime().make_state(); state->panel.someCustomChosen( - ) | rpl::start_with_next([=](EmojiStatusPanel::CustomChosen chosen) { + ) | rpl::on_next([=](EmojiStatusPanel::CustomChosen chosen) { emojiIdChosen(chosen.id.documentId); }, raw->lifetime()); - std::move(colorIndexValue) | rpl::start_with_next([=](uint8 index) { + std::move(colorIndexValue) | rpl::on_next([=](uint8 index) { state->index = index; if (state->emoji) { right->update(); @@ -762,7 +762,7 @@ void Apply( const auto session = &show->session(); const auto added = st::lineWidth * 2; - std::move(emojiIdValue) | rpl::start_with_next([=](DocumentId emojiId) { + std::move(emojiIdValue) | rpl::on_next([=](DocumentId emojiId) { state->emojiId = emojiId; state->emoji = emojiId ? session->data().customEmojiManager().create( @@ -778,14 +778,14 @@ void Apply( rpl::combine( raw->sizeValue(), right->widthValue() - ) | rpl::start_with_next([=](QSize outer, int width) { + ) | rpl::on_next([=](QSize outer, int width) { right->resize(width, outer.height()); const auto skip = st::settingsButton.padding.right(); right->moveToRight(skip - button.added, 0, outer.width()); }, right->lifetime()); right->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (state->panel.paintBadgeFrame(right)) { return; } @@ -893,12 +893,12 @@ void Apply( }; const auto state = right->lifetime().make_state(); state->panel.someCustomChosen( - ) | rpl::start_with_next([=](EmojiStatusPanel::CustomChosen chosen) { + ) | rpl::on_next([=](EmojiStatusPanel::CustomChosen chosen) { statusIdChosen({ chosen.id }, chosen.until); }, raw->lifetime()); const auto session = &show->session(); - std::move(statusIdValue) | rpl::start_with_next([=](EmojiStatusId id) { + std::move(statusIdValue) | rpl::on_next([=](EmojiStatusId id) { state->statusId = id; state->emoji = id ? session->data().customEmojiManager().create( @@ -914,14 +914,14 @@ void Apply( rpl::combine( raw->sizeValue(), right->widthValue() - ) | rpl::start_with_next([=](QSize outer, int width) { + ) | rpl::on_next([=](QSize outer, int width) { right->resize(width, outer.height()); const auto skip = st::settingsButton.padding.right(); right->moveToRight(skip - button.added, 0, outer.width()); }, right->lifetime()); right->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (state->panel.paintBadgeFrame(right)) { return; } @@ -1007,7 +1007,7 @@ void Apply( rpl::combine( raw->sizeValue(), right->widthValue() - ) | rpl::start_with_next([=](QSize outer, int width) { + ) | rpl::on_next([=](QSize outer, int width) { right->resize(width, outer.height()); const auto skip = st::settingsButton.padding.right(); right->moveToRight(skip - button.added, 0, outer.width()); @@ -1016,7 +1016,7 @@ void Apply( right->paintRequest( ) | rpl::filter([=] { return state->icon != nullptr; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { auto p = QPainter(right); const auto x = button.added; const auto y = (right->height() - button.emojiWidth) / 2; @@ -1076,7 +1076,7 @@ void Apply( return wrapLoaded(sets->find(id)); })); }) | rpl::flatten_latest( - ) | rpl::start_with_next([=](DocumentData *icon) { + ) | rpl::on_next([=](DocumentData *icon) { if (state->icon != icon) { state->icon = icon; state->custom = nullptr; @@ -1111,7 +1111,7 @@ Fn AddColorGiftTabs( GiftsStars( session, session->user() - ) | rpl::start_with_next([=](const std::vector &list) { + ) | rpl::on_next([=](const std::vector &list) { auto filtered = std::vector(); for (const auto &gift : list) { if ((profile || gift.info.peerColorAvailable) && gift.resale) { @@ -1122,7 +1122,7 @@ Fn AddColorGiftTabs( }, container->lifetime()); state->list.value( - ) | rpl::start_with_next([=](const std::vector &list) { + ) | rpl::on_next([=](const std::vector &list) { auto tabs = std::vector(); tabs.push_back({ .id = u"my"_q, @@ -1152,7 +1152,7 @@ Fn AddColorGiftTabs( context)); state->tabs->activated( - ) | rpl::start_with_next([=](const QString &id) { + ) | rpl::on_next([=](const QString &id) { state->tabs->setActiveTab(id); chosen(id.toULongLong()); }, state->tabs->lifetime()); @@ -1228,7 +1228,7 @@ void AddGiftSelector( shownGiftId, {}, state->current->offset - ) | rpl::start_with_next([=](Data::ResaleGiftsDescriptor slice) { + ) | rpl::on_next([=](Data::ResaleGiftsDescriptor slice) { auto &entry = state->lists[shownGiftId]; entry.loading.destroy(); entry.offset = slice.offset; @@ -1254,7 +1254,7 @@ void AddGiftSelector( session, Data::MyUniqueType::OwnedAndHosted, state->current->offset - ) | rpl::start_with_next([=](Data::MyGiftsDescriptor slice) { + ) | rpl::on_next([=](Data::MyGiftsDescriptor slice) { auto &entry = state->lists[shownGiftId]; entry.loading.destroy(); entry.offset = slice.offset; @@ -1393,7 +1393,7 @@ void AddGiftSelector( }; state->selected.value( - ) | rpl::combine_previous() | rpl::start_with_next([=]( + ) | rpl::combine_previous() | rpl::on_next([=]( uint64 wasCollectibleId, uint64 nowCollectibleId) { if (wasCollectibleId) { @@ -1409,7 +1409,7 @@ void AddGiftSelector( }, raw->lifetime()); state->selectedGiftId.value( - ) | rpl::combine_previous() | rpl::start_with_next([=]( + ) | rpl::combine_previous() | rpl::on_next([=]( uint64 wasGiftId, uint64 nowGiftId) { if (wasGiftId) { @@ -1465,7 +1465,7 @@ void AddGiftSelector( }; state->showingGiftId.value( - ) | rpl::start_with_next([=](uint64 showingId) { + ) | rpl::on_next([=](uint64 showingId) { state->current = &state->lists[showingId]; state->buttons.clear(); if (state->emptyPlaceholder) { @@ -1479,7 +1479,7 @@ void AddGiftSelector( state->visibleRange = raw->visibleRange(); state->visibleRange.value( - ) | rpl::start_with_next(state->rebuild, raw->lifetime()); + ) | rpl::on_next(state->rebuild, raw->lifetime()); } Fn CreateTabsWidget( @@ -1544,7 +1544,7 @@ Fn CreateTabsWidget( const auto penWidth = st::lineWidth * 2; - tabsContainer->paintRequest() | rpl::start_with_next([=] { + tabsContainer->paintRequest() | rpl::on_next([=] { auto p = QPainter(tabsContainer); auto hq = PainterHighQualityEnabler(p); const auto r = tabsContainer->rect(); @@ -1639,14 +1639,14 @@ void CreateBoostLevelContainer( }; const auto state = boostLevelContainer->lifetime().make_state(); - boostLevelContainer->paintRequest() | rpl::start_with_next([=] { + boostLevelContainer->paintRequest() | rpl::on_next([=] { auto p = QPainter(boostLevelContainer); const auto bg = state->currentColor.value_or(st::boxDividerBg->c); p.fillRect(boostLevelContainer->rect(), bg); p.fillRect(boostLevelContainer->rect(), st::shadowFg); }, boostLevelContainer->lifetime()); - std::move(colorProducer) | rpl::start_with_next([=]( + std::move(colorProducer) | rpl::on_next([=]( std::optional color) { const auto colorChanged = (state->currentColor != color) || !state->label; @@ -1672,7 +1672,7 @@ void CreateBoostLevelContainer( style); state->label->show(); boostLevelContainer->sizeValue( - ) | rpl::start_with_next([=](QSize s) { + ) | rpl::on_next([=](QSize s) { state->label->moveToLeft( (s.width() - state->label->width()) / 2, (s.height() - state->label->height()) / 2); @@ -1707,7 +1707,7 @@ void AddLevelBadge( rpl::combine( button->sizeValue(), std::move(text) - ) | rpl::start_with_next([=](const QSize &s, const QString &) { + ) | rpl::on_next([=](const QSize &s, const QString &) { if (s.isNull()) { return; } @@ -1771,7 +1771,7 @@ void EditPeerColorSection( state->preview->setPatternEmojiId( state->profileEmojiId.current()); } - state->statusId.value() | rpl::start_with_next([=](EmojiStatusId id) { + state->statusId.value() | rpl::on_next([=](EmojiStatusId id) { state->preview->setLocalEmojiStatusId(std::move(id)); }, state->preview->lifetime()); const auto peerColors = &peer->session().api().peerColors(); @@ -1835,7 +1835,7 @@ void EditPeerColorSection( true)); state->profileIndex.value( - ) | rpl::start_with_next([=](uint8 index) { + ) | rpl::on_next([=](uint8 index) { selector->updateSelection(index); }, selector->lifetime()); @@ -2126,7 +2126,7 @@ void EditPeerColorSection( })); }); state->collectible.value( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto buy = state->buyCollectible.get(); while (!button->children().isEmpty()) { delete button->children().first(); @@ -2294,7 +2294,7 @@ void EditPeerProfileColorSection( }); state->index.value( - ) | rpl::start_with_next([=](uint8 index) { + ) | rpl::on_next([=](uint8 index) { if (state->selector) { state->selector->updateSelection(index); } @@ -2386,7 +2386,7 @@ void EditPeerProfileColorSection( })); }); state->wearable.value( - ) | rpl::start_with_next([=](EmojiStatusId id) { + ) | rpl::on_next([=](EmojiStatusId id) { const auto buy = state->buyCollectible.get(); while (!button->children().isEmpty()) { delete button->children().first(); @@ -2469,7 +2469,7 @@ void EditPeerColorBox( buttonContainer->widthValue(), profileButton->sizeValue(), nameButton->sizeValue() - ) | rpl::start_with_next([=](int w, QSize, QSize) { + ) | rpl::on_next([=](int w, QSize, QSize) { profileButton->resizeToWidth(w); nameButton->resizeToWidth(w); }, buttonContainer->lifetime()); @@ -2602,7 +2602,7 @@ void SetupPeerColorSample( rpl::duplicate(colorIndexValue), rpl::duplicate(colorProfileIndexValue), rpl::duplicate(emojiStatusIdValue) - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( int width, const QString &buttonText, int colorIndex, @@ -2668,7 +2668,7 @@ void SetupPeerColorSample( rpl::duplicate(colorIndexValue), rpl::duplicate(colorProfileIndexValue), rpl::duplicate(emojiStatusIdValue) - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( QSize outer, QSize inner, int colorIndex, @@ -2746,7 +2746,7 @@ void AddPeerColorButton( rpl::combine( rpl::duplicate(label), button->widthValue() - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( const QString &text, int width) { const auto space = st.style.font->spacew; diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp index 8883ad0a51..c23347df3e 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_history_visibility_box.cpp @@ -29,7 +29,7 @@ void EditPeerHistoryVisibilityBox( HistoryVisibility v) { const auto button = Ui::CreateChild(inner.get()); inner->sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { button->resize(s); }, button->lifetime()); button->setClickedCallback([=] { historyVisibility->setValue(v); }); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp index f0f2c92411..4b48cee3c8 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_info_box.cpp @@ -610,11 +610,11 @@ object_ptr Controller::createPhotoAndTitleEdit() { container, createTitleEdit()); photoWrap->heightValue( - ) | rpl::start_with_next([container](int height) { + ) | rpl::on_next([container](int height) { container->resize(container->width(), height); }, photoWrap->lifetime()); container->widthValue( - ) | rpl::start_with_next([titleEdit](int width) { + ) | rpl::on_next([titleEdit](int width) { const auto left = st::editPeerPhotoMargins.left() + st::defaultUserpicButton.size.width(); titleEdit->resizeToWidth(width - left); @@ -669,7 +669,7 @@ object_ptr Controller::createTitleEdit() { &_peer->session()); result->entity()->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { submitTitle(); }, result->entity()->lifetime()); @@ -699,7 +699,7 @@ object_ptr Controller::createTitleEdit() { emojiPanel->hide(); emojiPanel->selector()->setCurrentPeer(_peer); emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { Ui::InsertEmojiAtCursor(field->textCursor(), data.emoji); field->setFocus(); }, field->lifetime()); @@ -733,7 +733,7 @@ object_ptr Controller::createTitleEdit() { }); }()); - field->widthValue() | rpl::start_with_next([=](int width) { + field->widthValue() | rpl::on_next([=](int width) { const auto &p = st::editPeerTitleEmojiPosition; emojiToggle->moveToRight(p.x(), p.y(), width); updateEmojiPanelGeometry(); @@ -779,7 +779,7 @@ object_ptr Controller::createDescriptionEdit() { &_peer->session()); result->entity()->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { submitDescription(); }, result->entity()->lifetime()); @@ -893,7 +893,7 @@ void Controller::showEditPeerTypeBox( _typeDataSavedValue, error)); box->boxClosing( - ) | rpl::start_with_next([peer = _peer] { + ) | rpl::on_next([peer = _peer] { peer->session().api().usernames().requestToCache(peer); }, box->lifetime()); } @@ -1242,12 +1242,12 @@ void Controller::fillAutoTranslateButton() { .data = Ui::AskBoostAutotranslate{ .requiredLevel = requiredLevel }, }; - state->isLocked.value() | rpl::start_with_next([=](bool locked) { + state->isLocked.value() | rpl::on_next([=](bool locked) { autotranslate->setToggleLocked(locked); }, autotranslate->lifetime()); autotranslate->toggledChanges( - ) | rpl::start_with_next([=](bool value) { + ) | rpl::on_next([=](bool value) { if (!state->isLocked.current()) { _autotranslateSavedValue = value; } else if (value) { @@ -1269,7 +1269,7 @@ void Controller::fillAutoTranslateButton() { }, autotranslate->lifetime()); autotranslate->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { _autotranslateSavedValue = toggled; }, _controls.buttonsLayout->lifetime()); } @@ -1306,12 +1306,12 @@ void Controller::fillSignaturesButton() { profiles->entity()->toggleOn(rpl::single( channel->addsSignature() && channel->signatureProfiles() ))->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { _signatureProfilesSavedValue = toggled; }, profiles->entity()->lifetime()); signs->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { _signaturesSavedValue = toggled; if (!toggled) { _signatureProfilesSavedValue = false; @@ -1782,7 +1782,7 @@ void Controller::fillPendingRequestsButton() { { &st::menuIconInvite }); std::move( pendingRequestsCount - ) | rpl::start_with_next([=](int count) { + ) | rpl::on_next([=](int count) { wrap->toggle(count > 0, anim::type::instant); }, wrap->lifetime()); } @@ -1878,7 +1878,7 @@ void Controller::fillBotCurrencyButton() { const auto currencyLoad = button->lifetime().make_state(_peer); currencyLoad->request( - ) | rpl::start_with_error_done([=](const QString &error) { + ) | rpl::on_error_done([=](const QString &error) { }, [=] { const auto balance = currencyLoad->data().currentBalance; if (balance) { @@ -1891,13 +1891,13 @@ void Controller::fillBotCurrencyButton() { const auto icon = Ui::CreateChild(button); icon->resize(st::menuIconLinks.size()); const auto image = Ui::Earn::MenuIconCurrency(icon->size()); - icon->paintRequest() | rpl::start_with_next([=] { + icon->paintRequest() | rpl::on_next([=] { auto p = QPainter(icon); p.drawImage(0, 0, image); }, icon->lifetime()); button->sizeValue( - ) | rpl::start_with_next([=](const QSize &size) { + ) | rpl::on_next([=](const QSize &size) { icon->moveToLeft( button->st().iconLeft, (size.height() - icon->height()) / 2); @@ -1947,13 +1947,13 @@ void Controller::fillBotCreditsButton() { const auto icon = Ui::CreateChild(button); const auto image = Ui::Earn::MenuIconCredits(); icon->resize(image.size() / style::DevicePixelRatio()); - icon->paintRequest() | rpl::start_with_next([=] { + icon->paintRequest() | rpl::on_next([=] { auto p = QPainter(icon); p.drawImage(0, 0, image); }, icon->lifetime()); button->sizeValue( - ) | rpl::start_with_next([=](const QSize &size) { + ) | rpl::on_next([=](const QSize &size) { icon->moveToLeft( button->st().iconLeft, (size.height() - icon->height()) / 2); @@ -2302,7 +2302,7 @@ void Controller::saveUsernamesOrder() { _peer->session().api().usernames().reorder( _peer, newUsernames - ) | rpl::start_with_done([=] { + ) | rpl::on_done([=] { channel->setUsernames(ranges::views::all( newUsernames ) | ranges::views::transform([&](QString username) { @@ -2875,7 +2875,7 @@ void EditPeerInfoBox::prepare() { this, _peer); _focusRequests.events( - ) | rpl::start_with_next( + ) | rpl::on_next( [=] { controller->setFocus(); }, lifetime()); auto content = controller->createContent(); @@ -2939,7 +2939,7 @@ object_ptr EditPeerInfoBox::CreateButton( rpl::duplicate(text), std::move(labelText), button->widthValue() - ) | rpl::start_with_next([&st, label]( + ) | rpl::on_next([&st, label]( const QString &text, const TextWithEntities &labelText, int width) { @@ -2961,7 +2961,7 @@ object_ptr EditPeerInfoBox::CreateButton( std::move(text), label->widthValue(), button->widthValue() - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( const QString &text, int labelWidth, int width) { diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 3058d4c815..67184f0688 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp @@ -379,11 +379,11 @@ void QrBox( const auto button = Ui::CreateChild(container); button->resize(size, size); button->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { QPainter(button).drawImage(QRect(0, 0, size, size), qr); }, button->lifetime()); container->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { button->move((width - size) / 2, st::inviteLinkQrSkip); }, button->lifetime()); button->setClickedCallback(copyCallback); @@ -506,7 +506,7 @@ void Controller::addHeaderBlock(not_null container) { st::inviteLinkFieldPadding); label->clicks( - ) | rpl::start_with_next(copyLink, label->lifetime()); + ) | rpl::on_next(copyLink, label->lifetime()); const auto reactivateWrap = container->add( object_ptr>( @@ -566,7 +566,7 @@ void Controller::addHeaderBlock(not_null container) { Ui::AddSkip(container); dataValue( - ) | rpl::start_with_next([=](const LinkData &data) { + ) | rpl::on_next([=](const LinkData &data) { const auto now = base::unixtime::now(); const auto expired = IsExpiredLink(data, now); reactivateWrap->toggle( @@ -641,7 +641,7 @@ not_null*> Controller::addRequestedListBlock( controller->setDelegate(delegate); controller->processed( - ) | rpl::start_with_next([=](Processed processed) { + ) | rpl::on_next([=](Processed processed) { updateWithProcessed(processed); }, lifetime()); @@ -755,7 +755,7 @@ void Controller::setupAboveJoinedWidget() { const auto currency = u"USD"_q; const auto allCredits = current.subscription.credits * current.usage; widget->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = Painter(widget); p.setBrush(Qt::NoBrush); p.setPen(st.nameFg); @@ -864,7 +864,7 @@ void Controller::setupAboveJoinedWidget() { std::move(remainingText), st::inviteLinkTitleRight); dataValue( - ) | rpl::start_with_next([=](const LinkData &data) { + ) | rpl::on_next([=](const LinkData &data) { remaining->setTextColorOverride( (data.usageLimit && (data.usageLimit <= data.usage) ? std::make_optional(st::boxTextFgError->c) @@ -882,7 +882,7 @@ void Controller::setupAboveJoinedWidget() { listTitle->positionValue(), remaining->widthValue(), listHeader->widthValue() - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( QPoint position, int width, int outerWidth) { @@ -1006,7 +1006,7 @@ void Controller::rowClicked(not_null row) { style::al_top); session->credits().rateValue( channel - ) | rpl::start_with_next([=, currency = u"USD"_q](float64 rate) { + ) | rpl::on_next([=, currency = u"USD"_q](float64 rate) { subtitle2->setText( tr::lng_credits_subscriber_subtitle( tr::now, @@ -1169,7 +1169,7 @@ void SingleRowController::prepare() { if (_status) { std::move( _status - ) | rpl::start_with_next([=](const QString &status) { + ) | rpl::on_next([=](const QString &status) { raw->setCustomStatus(status); delegate()->peerListUpdateRow(raw); }, _lifetime); @@ -1178,7 +1178,7 @@ void SingleRowController::prepare() { delegate()->peerListRefreshRows(); if (topic) { - topic->destroyed() | rpl::start_with_next([=] { + topic->destroyed() | rpl::on_next([=] { while (delegate()->peerListFullRowsCount()) { delegate()->peerListRemoveRow(delegate()->peerListRowAt(0)); } @@ -1275,7 +1275,7 @@ void AddPermanentLinkBlock( } else { rpl::duplicate( fromList - ) | rpl::start_with_next([=](const Api::InviteLink &link) { + ) | rpl::on_next([=](const Api::InviteLink &link) { *currentLinkFields = link; }, container->lifetime()); @@ -1351,7 +1351,7 @@ void AddPermanentLinkBlock( st::inviteLinkFieldPadding); label->clicks( - ) | rpl::start_with_next(copyLink, label->lifetime()); + ) | rpl::on_next(copyLink, label->lifetime()); AddCopyShareLinkButtons(container, copyLink, shareLink); @@ -1388,7 +1388,7 @@ void AddPermanentLinkBlock( data.link, data.usage); }) | rpl::flatten_latest( - ) | rpl::start_with_next([=](const Api::JoinedByLinkSlice &slice) { + ) | rpl::on_next([=](const Api::JoinedByLinkSlice &slice) { auto list = std::vector(); list.reserve(slice.users.size()); for (const auto &item : slice.users) { @@ -1410,7 +1410,7 @@ void AddPermanentLinkBlock( peer->session().downloaderTaskFinished( ) | rpl::filter([=] { return !state->allUserpicsLoaded; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { auto pushing = false; state->allUserpicsLoaded = true; for (const auto &element : state->list) { @@ -1701,7 +1701,7 @@ object_ptr ShowInviteLinkBox( not_null box) { rpl::duplicate( data - ) | rpl::start_with_next([=](const LinkData &link) { + ) | rpl::on_next([=](const LinkData &link) { if (ClosingLinkBox(link, revoked)) { box->closeBox(); return; diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp index e3f387062d..b0dc66986d 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_links.cpp @@ -441,7 +441,7 @@ LinksController::LinksController( , _count(count) , _updateExpiringTimer([=] { expiringProgressTimer(); }) { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { for (auto &image : _icons) { image = QImage(); } @@ -450,7 +450,7 @@ LinksController::LinksController( peer->session().api().inviteLinks().updates( peer, admin - ) | rpl::start_with_next([=](const Api::InviteLinkUpdate &update) { + ) | rpl::on_next([=](const Api::InviteLinkUpdate &update) { const auto now = base::unixtime::now(); if (!update.now || update.now->revoked != _revoked) { if (removeRow(update.was)) { @@ -472,7 +472,7 @@ LinksController::LinksController( peer->session().api().inviteLinks().allRevokedDestroyed( peer, admin - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _requesting = false; _allLoaded = true; while (delegate()->peerListFullRowsCount()) { @@ -961,7 +961,7 @@ void ManageInviteLinksBox( *countValue = controller->fullCountValue(); controller->permanentFound( - ) | rpl::start_with_next([=](InviteLinkData &&data) { + ) | rpl::on_next([=](InviteLinkData &&data) { permanentFromList->fire(std::move(data)); }, container->lifetime()); @@ -1013,7 +1013,7 @@ void ManageInviteLinksBox( rpl::combine( revokedHeader->topValue(), container->widthValue() - ) | rpl::start_with_next([=](int top, int outerWidth) { + ) | rpl::on_next([=](int top, int outerWidth) { deleteAll->moveToRight( st::inviteLinkRevokedTitlePadding.left(), top + st::inviteLinkRevokedTitlePadding.top(), @@ -1027,7 +1027,7 @@ void ManageInviteLinksBox( list->heightValue(), admins->heightValue(), revoked->heightValue() - ) | rpl::start_with_next([=](int list, int admins, int revoked) { + ) | rpl::on_next([=](int list, int admins, int revoked) { if (otherHeader) { otherHeader->toggle(list > 0, anim::type::instant); } @@ -1058,7 +1058,7 @@ object_ptr MakeCreateLinkButton( icon->resize(size, size); raw->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { const auto &st = st::inviteLinkList.item; icon->move( st.photoPosition.x() + (st.photoSize - size) / 2, @@ -1066,7 +1066,7 @@ object_ptr MakeCreateLinkButton( }, icon->lifetime()); icon->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(icon); p.setPen(Qt::NoPen); p.setBrush(st::windowBgActive); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp index c0e7443375..5a2df335e5 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp @@ -407,14 +407,14 @@ not_null AddInnerToggle( { const auto separator = Ui::CreateChild(container.get()); separator->paintRequest( - ) | rpl::start_with_next([=, bg = st.textBgOver] { + ) | rpl::on_next([=, bg = st.textBgOver] { auto p = QPainter(separator); p.fillRect(separator->rect(), bg); }, separator->lifetime()); const auto separatorHeight = 2 * st.toggle.border + st.toggle.diameter; button->geometryValue( - ) | rpl::start_with_next([=](const QRect &r) { + ) | rpl::on_next([=](const QRect &r) { const auto w = st::rightsButtonToggleWidth; toggleButton->setGeometry( r.x() + r.width() - w, @@ -431,12 +431,12 @@ not_null AddInnerToggle( const auto checkWidget = Ui::CreateChild(toggleButton); checkWidget->resize(checkView->getSize()); checkWidget->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(checkWidget); checkView->paint(p, 0, 0, checkWidget->width()); }, checkWidget->lifetime()); toggleButton->sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { checkWidget->moveToRight( st.toggleSkip, (s.height() - checkWidget->height()) / 2); @@ -444,7 +444,7 @@ not_null AddInnerToggle( } state->anyChanges.events_starting_with( rpl::empty_value() - ) | rpl::map(countChecked) | rpl::start_with_next([=](int count) { + ) | rpl::map(countChecked) | rpl::on_next([=](int count) { checkView->setChecked(count > 0, anim::type::normal); }, toggleButton->lifetime()); checkView->setLocked(locked.has_value()); @@ -471,7 +471,7 @@ not_null AddInnerToggle( const auto &icon = st::permissionsExpandIcon; arrow->resize(icon.size()); arrow->paintRequest( - ) | rpl::start_with_next([=, &icon] { + ) | rpl::on_next([=, &icon] { auto p = QPainter(arrow); const auto center = QPointF( icon.width() / 2., @@ -489,7 +489,7 @@ not_null AddInnerToggle( }, arrow->lifetime()); } button->sizeValue( - ) | rpl::start_with_next([=, &st](const QSize &s) { + ) | rpl::on_next([=, &st](const QSize &s) { const auto labelLeft = st.padding.left(); const auto labelRight = s.width() - toggleButton->width(); @@ -504,7 +504,7 @@ not_null AddInnerToggle( (s.height() - arrow->height()) / 2); }, button->lifetime()); wrap->toggledValue( - ) | rpl::skip(1) | rpl::start_with_next([=](bool toggled) { + ) | rpl::skip(1) | rpl::on_next([=](bool toggled) { state->animation.start( [=] { arrow->update(); }, toggled ? 0. : 1., @@ -521,14 +521,14 @@ not_null AddInnerToggle( }; button->clicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!handleLocked()) { wrap->toggle(!wrap->toggled(), anim::type::normal); } }, button->lifetime()); toggleButton->clicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!handleLocked()) { const auto checked = !checkView->checked(); for (const auto &innerCheck : state->innerChecks) { @@ -563,7 +563,7 @@ template }); state->forceDisabled.value( - ) | rpl::start_with_next([=](bool disabled) { + ) | rpl::on_next([=](bool disabled) { if (disabled) { for (const auto &[flags, checkView] : state->checkViews) { checkView->setChecked(false, anim::type::normal); @@ -629,7 +629,7 @@ template rpl::combine( verticalLayout->widthValue(), checkbox->geometryValue() - ) | rpl::start_with_next([=](int w, const QRect &r) { + ) | rpl::on_next([=](int w, const QRect &r) { button->setGeometry(0, r.y(), w, r.height()); }, button->lifetime()); checkbox->setAttribute(Qt::WA_TransparentForMouseEvents); @@ -659,12 +659,12 @@ template [=] { toggle->update(); }); toggle->resize(checkView->getSize()); toggle->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(toggle); checkView->paint(p, 0, 0, toggle->width()); }, toggle->lifetime()); button->sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { toggle->moveToRight( st.toggleSkip, (s.height() - toggle->height()) / 2); @@ -680,7 +680,7 @@ template }(); state->checkViews.emplace(flags, checkView); checkView->checkedChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { if (checked && state->forceDisabled.current()) { if (!state->toast) { state->toast = Ui::Toast::Show(container, { @@ -742,7 +742,7 @@ template { nestedWithLabel.nested.front().icon }); container->add(std::move(wrap)); container->widthValue( - ) | rpl::start_with_next([=](int w) { + ) | rpl::on_next([=](int w) { raw->resizeToWidth(w); }, raw->lifetime()); } @@ -780,7 +780,7 @@ void AddSlowmodeLabels( rpl::combine( labels->widthValue(), label->widthValue() - ) | rpl::start_with_next([=](int outer, int inner) { + ) | rpl::on_next([=](int outer, int inner) { const auto skip = st::localStorageLimitMargin; const auto size = st::localStorageLimitSlider.seekSize; const auto available = outer @@ -903,7 +903,7 @@ void AddBoostsUnrestrictLabels(not_null container) { rpl::combine( labels->widthValue(), label->widthValue() - ) | rpl::start_with_next([=](int outer, int inner) { + ) | rpl::on_next([=](int outer, int inner) { const auto skip = st::localStorageLimitMargin; const auto size = st::localStorageLimitSlider.seekSize; const auto available = outer @@ -948,7 +948,7 @@ rpl::producer AddBoostsUnrestrictSlider( tr::lng_rights_boosts_no_restrict(), st::defaultSettingsButton ))->toggleOn(rpl::duplicate(enabled))->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { if (toggled && !boostsUnrestrict->current()) { *boostsUnrestrict = 1; } else if (!toggled && boostsUnrestrict->current()) { diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp index fdc31618f7..cd26e9cf21 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_reactions.cpp @@ -235,7 +235,7 @@ void SetupOnlyCustomEmojiField( const auto state = field->lifetime().make_state(); field->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { state->pending = true; if (state->processing) { return; @@ -420,7 +420,7 @@ object_ptr AddReactionsSelector( applyFromState(); std::move( args.paid - ) | rpl::start_with_next([=](bool paid) { + ) | rpl::on_next([=](bool paid) { const auto id = Data::ReactionId::Paid(); if (paid && !ranges::contains(state->reactions, id)) { state->reactions.insert(begin(state->reactions), id); @@ -440,7 +440,7 @@ object_ptr AddReactionsSelector( using SelectorState = ReactionsSelectorState; std::move( args.stateValue - ) | rpl::start_with_next([=](SelectorState value) { + ) | rpl::on_next([=](SelectorState value) { switch (value) { case SelectorState::Active: state->overlay = nullptr; @@ -455,10 +455,10 @@ object_ptr AddReactionsSelector( case SelectorState::Disabled: state->overlay = std::make_unique(parent); state->overlay->show(); - raw->geometryValue() | rpl::start_with_next([=](QRect rect) { + raw->geometryValue() | rpl::on_next([=](QRect rect) { state->overlay->setGeometry(rect); }, state->overlay->lifetime()); - state->overlay->paintRequest() | rpl::start_with_next([=](QRect clip) { + state->overlay->paintRequest() | rpl::on_next([=](QRect clip) { auto color = st::boxBg->c; color.setAlphaF(0.5); QPainter(state->overlay.get()).fillRect( @@ -472,7 +472,7 @@ object_ptr AddReactionsSelector( } raw->setDisabled(true); raw->focusedChanges( - ) | rpl::start_with_next([=](bool focused) { + ) | rpl::on_next([=](bool focused) { if (focused) { raw->parentWidget()->setFocus(); } @@ -503,7 +503,7 @@ object_ptr AddReactionsSelector( st::emojiPanMinHeight); panel->hide(); panel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { Data::InsertCustomEmoji(raw, data.document); }, panel->lifetime()); @@ -540,7 +540,7 @@ object_ptr AddReactionsSelector( panel->toggleAnimated(); }); - raw->geometryValue() | rpl::start_with_next([=](QRect geometry) { + raw->geometryValue() | rpl::on_next([=](QRect geometry) { toggle->move( geometry.x() + geometry.width() - toggle->width(), geometry.y() + geometry.height() - toggle->height()); @@ -669,7 +669,7 @@ void EditAllowedReactionsBox( if (enabled) { enabled->toggleOn(rpl::single(optionInitial != Option::None)); enabled->toggledValue( - ) | rpl::start_with_next([=](bool value) { + ) | rpl::on_next([=](bool value) { state->selectorState = value ? SelectorState::Active : SelectorState::Disabled; @@ -836,7 +836,7 @@ void EditAllowedReactionsBox( left->sizeValue(), center->sizeValue(), right->sizeValue() - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( const QSize &s, const QSize &leftSize, const QSize ¢erSize, @@ -901,7 +901,7 @@ void EditAllowedReactionsBox( st::manageGroupNoIconButton.button)); paid->toggleOn(state->paidEnabled.value()); paid->toggledValue( - ) | rpl::start_with_next([=](bool value) { + ) | rpl::on_next([=](bool value) { state->paidEnabled = value; }, paid->lifetime()); Ui::AddSkip(inner); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp index 2b3665aac6..4e718520c1 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.cpp @@ -234,7 +234,7 @@ void Controller::createContent() { _controls.joinToWrite->toggleOn( rpl::single(_dataSavedValue->joinToWrite) )->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { _dataSavedValue->joinToWrite = toggled; }, wrap->lifetime()); } else { @@ -261,7 +261,7 @@ void Controller::createContent() { _controls.requestToJoin->toggleOn( rpl::single(_dataSavedValue->requestToJoin) )->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { _dataSavedValue->requestToJoin = toggled; }, wrap->lifetime()); @@ -287,7 +287,7 @@ void Controller::createContent() { _controls.noForwards->toggleOn( rpl::single(_dataSavedValue->noForwards) )->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { _dataSavedValue->noForwards = toggled; }, _wrap->lifetime()); Ui::AddSkip(_wrap.get()); @@ -441,11 +441,11 @@ object_ptr Controller::createUsernameEdit() { username, _peer->session().createInternalLink(QString()))); _controls.usernameInput->heightValue( - ) | rpl::start_with_next([placeholder](int height) { + ) | rpl::on_next([placeholder](int height) { placeholder->resize(placeholder->width(), height); }, placeholder->lifetime()); placeholder->widthValue( - ) | rpl::start_with_next([this](int width) { + ) | rpl::on_next([this](int width) { _controls.usernameInput->resize( width, _controls.usernameInput->height()); @@ -739,11 +739,11 @@ void EditPeerTypeBox::prepare() { _useLocationPhrases, _dataSavedValue); controller->scrollToRequests( - ) | rpl::start_with_next([=, raw = content.data()](int y) { + ) | rpl::on_next([=, raw = content.data()](int y) { scrollToY(raw->y() + y); }, lifetime()); _focusRequests.events( - ) | rpl::start_with_next( + ) | rpl::on_next( [=] { controller->setFocusUsername(); if (_usernameError.has_value()) { diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_usernames_list.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_usernames_list.cpp index b520397c9a..af4682511c 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_usernames_list.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_usernames_list.cpp @@ -131,7 +131,7 @@ UsernamesList::Row::Row( _rightAction->setVisible(data.active); sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { _rightAction->moveToLeft( s.width() - _rightAction->width() - st::inviteLinkThreeDotsSkip, (s.height() - _rightAction->height()) / 2); @@ -219,7 +219,7 @@ UsernamesList::UsernamesList( peer->session().changes().peerFlagsValue( peer, Data::PeerUpdate::Flag::Usernames) - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { load(); }, lifetime()); } @@ -227,7 +227,7 @@ UsernamesList::UsernamesList( void UsernamesList::load() { _loadLifetime = _peer->session().api().usernames().loadUsernames( _peer - ) | rpl::start_with_next([=](const Data::Usernames &usernames) { + ) | rpl::on_next([=](const Data::Usernames &usernames) { if (usernames.empty()) { _container = nullptr; resize(0, 0); @@ -320,13 +320,13 @@ void UsernamesList::rebuild(const Data::Usernames &usernames) { _toggleLifetime = api.usernames().reorder( _peer, order() - ) | rpl::start_with_done([=] { + ) | rpl::on_done([=] { auto &api = _peer->session().api(); _toggleLifetime = api.usernames().toggle( _peer, username.username, !username.active - ) | rpl::start_with_error_done([=]( + ) | rpl::on_error_done([=]( Api::Usernames::Error error) { if (error == Api::Usernames::Error::TooMuch) { constexpr auto kMaxUsernames = 10.; @@ -378,7 +378,7 @@ void UsernamesList::rebuild(const Data::Usernames &usernames) { _reorder->start(); _reorder->updates( - ) | rpl::start_with_next([=](Ui::VerticalLayoutReorder::Single data) { + ) | rpl::on_next([=](Ui::VerticalLayoutReorder::Single data) { using State = Ui::VerticalLayoutReorder::State; if (data.state == State::Started) { ++_reordering; diff --git a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp index 3672b557a1..b76358e454 100644 --- a/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/peer_short_info_box.cpp @@ -115,18 +115,18 @@ PeerShortInfoCover::PeerShortInfoCover( std::move( userpic - ) | rpl::start_with_next([=](PeerShortInfoUserpic &&value) { + ) | rpl::on_next([=](PeerShortInfoUserpic &&value) { applyUserpic(std::move(value)); applyAdditionalStatus(value.additionalStatus); }, lifetime()); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshBarImages(); }, lifetime()); _widget->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(_widget.get()); paint(p); }, lifetime()); @@ -478,7 +478,7 @@ void PeerShortInfoCover::applyUserpic(PeerShortInfoUserpic &&value) { _videoStartPosition = value.videoStartPosition; _videoInstance->lockPlayer(); _videoInstance->player().updates( - ) | rpl::start_with_next_error([=](Update &&update) { + ) | rpl::on_next_error([=](Update &&update) { handleStreamingUpdate(std::move(update)); }, [=](Error &&error) { handleStreamingError(std::move(error)); @@ -685,7 +685,7 @@ PeerShortInfoBox::PeerShortInfoBox( _rows->add(_cover.takeOwned()); _scroll->scrolls( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _cover.setScrollTop(_scroll->scrollTop()); }, _cover.lifetime()); } @@ -720,7 +720,7 @@ void PeerShortInfoBox::prepare() { _topRoundBackground->resize(st::shortInfoWidth, st::boxRadius); _topRoundBackground->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (const auto use = fillRoundedTopHeight()) { const auto width = _topRoundBackground->width(); const auto top = _topRoundBackground->height() - use; @@ -763,7 +763,7 @@ void PeerShortInfoBox::prepareRows() { rpl::combine( std::move(label), std::move(text) - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _rows->resizeToWidth(st::shortInfoWidth); }, _rows->lifetime()); diff --git a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp index 8b7898e8c0..91a05d3f0a 100644 --- a/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/prepare_short_info_box.cpp @@ -410,13 +410,13 @@ bool ProcessCurrent( UpdateFlag::Photo | UpdateFlag::FullInfo ) | rpl::filter([=](const Data::PeerUpdate &update) { return (update.flags & UpdateFlag::Photo) || state->waitingFull; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { push(); }, lifetime); rpl::duplicate( slices - ) | rpl::start_with_next([=](UserPhotosSlice &&slice) { + ) | rpl::on_next([=](UserPhotosSlice &&slice) { state->userSlice = std::move(slice); push(); }, lifetime); @@ -424,7 +424,7 @@ bool ProcessCurrent( moveRequests->events( ) | rpl::filter([=] { return (state->current.count > 1); - }) | rpl::start_with_next([=](int shift) { + }) | rpl::on_next([=](int shift) { state->current.index = std::clamp( ((state->current.index + shift + state->current.count) % state->current.count), @@ -439,7 +439,7 @@ bool ProcessCurrent( && (state->photoView ? (!!state->photoView->image(Data::PhotoSize::Large)) : (!Ui::PeerUserpicLoading(state->userpicView))); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { push(); }, lifetime); @@ -472,16 +472,16 @@ object_ptr PrepareShortInfoBox( if (menuFiller) { result->fillMenuRequests( - ) | rpl::start_with_next([=](Ui::Menu::MenuCallback callback) { + ) | rpl::on_next([=](Ui::Menu::MenuCallback callback) { menuFiller(std::move(callback)); }, result->lifetime()); } result->openRequests( - ) | rpl::start_with_next(open, result->lifetime()); + ) | rpl::on_next(open, result->lifetime()); result->moveRequests( - ) | rpl::start_with_next(userpic.move, result->lifetime()); + ) | rpl::on_next(userpic.move, result->lifetime()); return result; } diff --git a/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp b/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp index 1990af38cd..dd2d8d24dd 100644 --- a/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp @@ -382,7 +382,7 @@ object_ptr ReassignBoostSingleBox( result->boxClosing() | rpl::filter([=] { return !*reassigned; - }) | rpl::start_with_next(cancel, result->lifetime()); + }) | rpl::on_next(cancel, result->lifetime()); return result; } @@ -551,7 +551,7 @@ object_ptr ReassignBoostsBox( const auto raw = controller.get(); auto initBox = [=](not_null box) { raw->selectedValue( - ) | rpl::start_with_next([=](std::vector slots) { + ) | rpl::on_next([=](std::vector slots) { box->clearButtons(); if (!slots.empty()) { const auto sources = SourcesCount(to, from, slots); @@ -567,7 +567,7 @@ object_ptr ReassignBoostsBox( box->boxClosing() | rpl::filter([=] { return !*reassigned; - }) | rpl::start_with_next(cancel, box->lifetime()); + }) | rpl::on_next(cancel, box->lifetime()); }; return Box(std::move(controller), std::move(initBox)); } @@ -597,7 +597,7 @@ object_ptr CreateUserpicsTransfer( const auto state = raw->lifetime().make_state(); std::move( from - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( const std::vector> &list) { auto was = base::take(state->from); auto buttons = base::take(state->buttons); @@ -628,7 +628,7 @@ object_ptr CreateUserpicsTransfer( rpl::combine( raw->widthValue(), state->count.value() - ) | rpl::start_with_next([=](int width, int count) { + ) | rpl::on_next([=](int width, int count) { const auto skip = st::boostReplaceUserpicsSkip; const auto left = width - 2 * right->width() - skip; const auto shift = std::min( @@ -651,7 +651,7 @@ object_ptr CreateUserpicsTransfer( overlay->paintRequest( ) | rpl::filter([=] { return !state->buttons.empty(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { const auto outerw = overlay->width(); const auto ratio = style::DevicePixelRatio(); if (state->layer.size() != QSize(outerw, full) * ratio) { @@ -737,7 +737,7 @@ object_ptr CreateUserpicsWithMoreBadge( const auto state = raw->lifetime().make_state(); std::move( peers - ) | rpl::start_with_next([=, &st]( + ) | rpl::on_next([=, &st]( const std::vector> &list) { auto was = base::take(state->from); auto buttons = base::take(state->buttons); @@ -774,7 +774,7 @@ object_ptr CreateUserpicsWithMoreBadge( rpl::combine( raw->widthValue(), state->count.value() - ) | rpl::start_with_next([=, &st](int width, int count) { + ) | rpl::on_next([=, &st](int width, int count) { const auto single = st.button.size.width(); const auto left = width - single; const auto used = std::min(count, int(state->buttons.size())); @@ -793,7 +793,7 @@ object_ptr CreateUserpicsWithMoreBadge( overlay->paintRequest( ) | rpl::filter([=] { return !state->buttons.empty(); - }) | rpl::start_with_next([=, &st] { + }) | rpl::on_next([=, &st] { const auto outerw = overlay->width(); const auto ratio = style::DevicePixelRatio(); if (state->layer.size() != QSize(outerw, full) * ratio) { @@ -986,7 +986,7 @@ object_ptr CreateGiftTransfer( overlay->update(); raw->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto skip = st::boostReplaceUserpicsSkip; const auto total = right->width() + skip + right->width(); auto x = (width - total) / 2; @@ -997,7 +997,7 @@ object_ptr CreateGiftTransfer( }, raw->lifetime()); overlay->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto outerw = overlay->width(); const auto ratio = style::DevicePixelRatio(); if (state->layer.size() != QSize(outerw, full) * ratio) { diff --git a/Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp b/Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp index 4d6d5454dd..721d1e191c 100644 --- a/Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/toggle_topics_box.cpp @@ -83,7 +83,7 @@ LayoutButton::LayoutButton( group->setValue(type); iconAnimate(anim::repeat::once); }); - group->value() | rpl::start_with_next([=](LayoutType value) { + group->value() | rpl::on_next([=](LayoutType value) { const auto active = (value == type); _text.setTextColorOverride(active ? st::windowFgActive->c @@ -99,7 +99,7 @@ LayoutButton::LayoutButton( }, _active ? 0. : 1., _active ? 0. : 1., st::fadeWrapDuration); }, lifetime()); - _text.paintRequest() | rpl::start_with_next([=](QRect clip) { + _text.paintRequest() | rpl::on_next([=](QRect clip) { if (_active) { auto p = QPainter(&_text); auto hq = PainterHighQualityEnabler(p); @@ -197,7 +197,7 @@ void ToggleTopicsBox( group); buttons->resize(container->width(), tabsButton->height()); - buttons->widthValue() | rpl::start_with_next([=](int outer) { + buttons->widthValue() | rpl::on_next([=](int outer) { const auto skip = st::boxRowPadding.left() - st::boxRadius; tabsButton->moveToLeft(skip, 0, outer); listButton->moveToRight(skip, 0, outer); @@ -209,7 +209,7 @@ void ToggleTopicsBox( layoutWrap->toggle(enabled, anim::type::instant); toggle->toggledChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { layoutWrap->toggle(checked, anim::type::normal); }, layoutWrap->lifetime()); diff --git a/Telegram/SourceFiles/boxes/peers/verify_peers_box.cpp b/Telegram/SourceFiles/boxes/peers/verify_peers_box.cpp index 546ef3c979..a3f77c3749 100644 --- a/Telegram/SourceFiles/boxes/peers/verify_peers_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/verify_peers_box.cpp @@ -183,7 +183,7 @@ void Controller::confirmAdd(not_null peer) { Ui::AddSkip(box->verticalLayout()); - field->changes() | rpl::start_with_next([=] { + field->changes() | rpl::on_next([=] { state->description = field->getLastText(); }, field->lifetime()); diff --git a/Telegram/SourceFiles/boxes/premium_limits_box.cpp b/Telegram/SourceFiles/boxes/premium_limits_box.cpp index f88a525d9f..88611c63f6 100644 --- a/Telegram/SourceFiles/boxes/premium_limits_box.cpp +++ b/Telegram/SourceFiles/boxes/premium_limits_box.cpp @@ -596,12 +596,12 @@ void ChannelsLimitBox( using namespace rpl::mappers; controller->countValue( - ) | rpl::filter(_1 > 0) | rpl::start_with_next([=] { + ) | rpl::filter(_1 > 0) | rpl::on_next([=] { delete placeholder; }, placeholder->lifetime()); delegate->selectedCountChanges( - ) | rpl::start_with_next([=](int count) { + ) | rpl::on_next([=](int count) { const auto leave = [=](const base::flat_set &ids) { for (const auto rowId : ids) { const auto id = peerToChannel(PeerId(rowId)); @@ -687,7 +687,7 @@ void PublicLinksLimitBox( using namespace rpl::mappers; controller->countValue( - ) | rpl::filter(_1 > 0) | rpl::start_with_next([=] { + ) | rpl::filter(_1 > 0) | rpl::on_next([=] { delete placeholder; }, placeholder->lifetime()); } @@ -1162,7 +1162,7 @@ void AccountsLimitBox( return; } *switchingLifetime = session->domain().activeSessionChanges( - ) | rpl::start_with_next([=](Main::Session *session) mutable { + ) | rpl::on_next([=](Main::Session *session) mutable { if (session) { Settings::ShowPremium(session, ref); } diff --git a/Telegram/SourceFiles/boxes/premium_preview_box.cpp b/Telegram/SourceFiles/boxes/premium_preview_box.cpp index 58688763b2..b5fc60ce6e 100644 --- a/Telegram/SourceFiles/boxes/premium_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/premium_preview_box.cpp @@ -245,7 +245,7 @@ void PreloadSticker(const std::shared_ptr &media) { const auto raw = result.data(); raw->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(raw); p.drawImage(0, 0, back); }, raw->lifetime()); @@ -269,7 +269,7 @@ void PreloadSticker(const std::shared_ptr &media) { result->show(); parent->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { result->setGeometry(QRect( QPoint( (size.width() - effectSize.width()) / 2, @@ -323,8 +323,8 @@ void PreloadSticker(const std::shared_ptr &media) { result->update(); }; auto &lifetime = result->lifetime(); - state->lottie->updates() | rpl::start_with_next(update, lifetime); - state->effect->updates() | rpl::start_with_next(update, lifetime); + state->lottie->updates() | rpl::on_next(update, lifetime); + state->effect->updates() | rpl::on_next(update, lifetime); }; createLottieIfReady(); if (!state->lottie || !state->effect) { @@ -341,7 +341,7 @@ void PreloadSticker(const std::shared_ptr &media) { rpl::never<>()); result->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { createLottieIfReady(); auto p = QPainter(result); @@ -399,7 +399,7 @@ void PreloadSticker(const std::shared_ptr &media) { result->show(); parent->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { result->setGeometry(QRect(QPoint(), size)); }, result->lifetime()); auto &lifetime = result->lifetime(); @@ -425,7 +425,7 @@ void PreloadSticker(const std::shared_ptr &media) { outer->show(); result->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { outer->resize(size); }, outer->lifetime()); @@ -495,7 +495,7 @@ void PreloadSticker(const std::shared_ptr &media) { result->shownValue( ) | rpl::filter([=](bool shown) { return shown && state->toggleTimerPending; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { state->toggleTimerPending = false; state->toggleTimer.callOnce(kToggleStickerTimeout); }, result->lifetime()); @@ -515,7 +515,7 @@ void PreloadSticker(const std::shared_ptr &media) { fill(); if (state->medias.empty()) { premium->stickersUpdated( - ) | rpl::take(1) | rpl::start_with_next(fill, lifetime); + ) | rpl::take(1) | rpl::on_next(fill, lifetime); } return result; @@ -637,7 +637,7 @@ struct VideoPreviewDocument { result->show(); parent->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { result->setGeometry(parent->rect()); }, result->lifetime()); auto &lifetime = result->lifetime(); @@ -707,7 +707,7 @@ struct VideoPreviewDocument { } }; state->instance.player().updates( - ) | rpl::start_with_next_error([=](Media::Streaming::Update &&update) { + ) | rpl::on_next_error([=](Media::Streaming::Update &&update) { if (v::is(update.data) || v::is(update.data)) { if (!state->readyInvoked && readyCallback) { @@ -727,7 +727,7 @@ struct VideoPreviewDocument { }); result->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(result); const auto paintFrame = [&](QColor color, float64 thickness) { auto hq = PainterHighQualityEnabler(p); @@ -799,7 +799,7 @@ struct VideoPreviewDocument { result->show(); parent->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { result->setGeometry(QRect(QPoint(), size)); }, result->lifetime()); auto &lifetime = result->lifetime(); @@ -825,7 +825,7 @@ struct VideoPreviewDocument { create(); if (!state->single) { session->api().premium().videosUpdated( - ) | rpl::take(1) | rpl::start_with_next(create, lifetime); + ) | rpl::take(1) | rpl::on_next(create, lifetime); } return result; @@ -874,7 +874,7 @@ struct VideoPreviewDocument { const auto section = order[i]; const auto button = Ui::CreateChild(raw); parent->widthValue( - ) | rpl::start_with_next([=](int outer) { + ) | rpl::on_next([=](int outer) { const auto full = width * count; const auto left = (outer - full) / 2 + (i * width); button->setGeometry(left, 0, width, height); @@ -883,7 +883,7 @@ struct VideoPreviewDocument { *selected = section; }); button->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(button); auto hq = PainterHighQualityEnabler(p); p.setBrush((selected->current() == section) @@ -896,7 +896,7 @@ struct VideoPreviewDocument { button->rect().marginsRemoved(st::premiumDotPadding)); }, button->lifetime()); selected->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { button->update(); }, button->lifetime()); } @@ -1021,7 +1021,7 @@ void PreviewBox( } buttonsParent->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto outerHeight = st::premiumPreviewHeight; close->moveToRight(0, 0, width); if (left) { @@ -1072,7 +1072,7 @@ void PreviewBox( state->selected.value( ) | rpl::combine_previous( - ) | rpl::start_with_next([=](PremiumFeature was, PremiumFeature now) { + ) | rpl::on_next([=](PremiumFeature was, PremiumFeature now) { const auto animationCallback = [=] { if (!state->animation.animating()) { for (const auto &hiding : base::take(state->hiding)) { @@ -1235,13 +1235,13 @@ void PreviewBox( if (descriptor.fromSettings) { Data::AmPremiumValue( &show->session() - ) | rpl::skip(1) | rpl::start_with_next([=] { + ) | rpl::skip(1) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); } box->events( - ) | rpl::start_with_next([=](not_null e) { + ) | rpl::on_next([=](not_null e) { if (e->type() == QEvent::KeyPress) { const auto key = static_cast(e.get())->key(); if (key == Qt::Key_Left) { @@ -1253,7 +1253,7 @@ void PreviewBox( }, box->lifetime()); if (const auto &hidden = descriptor.hiddenCallback) { - box->boxClosing() | rpl::start_with_next(hidden, box->lifetime()); + box->boxClosing() | rpl::on_next(hidden, box->lifetime()); } } @@ -1299,13 +1299,13 @@ void DecorateListPromoBox( if (!descriptor.hideSubscriptionButton) { Data::AmPremiumValue( session - ) | rpl::skip(1) | rpl::start_with_next([=] { + ) | rpl::skip(1) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); } if (const auto &hidden = descriptor.hiddenCallback) { - box->boxClosing() | rpl::start_with_next(hidden, box->lifetime()); + box->boxClosing() | rpl::on_next(hidden, box->lifetime()); } if (session->premium() || descriptor.hideSubscriptionButton) { @@ -1325,7 +1325,7 @@ void DecorateListPromoBox( box->setStyle(st::premiumPreviewDoubledLimitsBox); box->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto &padding = st::premiumPreviewDoubledLimitsBox.buttonPadding; button->resizeToWidth(width @@ -1764,7 +1764,7 @@ object_ptr CreateUnlockButton( rpl::combine( result->widthValue(), label->widthValue() - ) | rpl::start_with_next([=](int outer, int width) { + ) | rpl::on_next([=](int outer, int width) { label->moveToLeft( (outer - width) / 2, st::premiumPreviewBox.button.textTop, diff --git a/Telegram/SourceFiles/boxes/reactions_settings_box.cpp b/Telegram/SourceFiles/boxes/reactions_settings_box.cpp index 8a71e395b8..4454c29926 100644 --- a/Telegram/SourceFiles/boxes/reactions_settings_box.cpp +++ b/Telegram/SourceFiles/boxes/reactions_settings_box.cpp @@ -118,7 +118,7 @@ void AddMessage( widget->widthValue( ) | rpl::filter( rpl::mappers::_1 >= (st::historyMinimalWidth / 2) - ) | rpl::start_with_next(updateWidgetSize, widget->lifetime()); + ) | rpl::on_next(updateWidgetSize, widget->lifetime()); updateWidgetSize(width); const auto rightSize = st::settingsReactionCornerSize; @@ -135,7 +135,7 @@ void AddMessage( }; widget->paintRequest( - ) | rpl::start_with_next([=](const QRect &rect) { + ) | rpl::on_next([=](const QRect &rect) { Window::SectionWidget::PaintBackground( controller, controller->defaultChatTheme().get(), // #TODO themes @@ -173,7 +173,7 @@ void AddMessage( auto selectedId = rpl::duplicate(idValue); std::move( selectedId - ) | rpl::start_with_next([ + ) | rpl::on_next([ =, idValue = std::move(idValue), iconSize = st::settingsReactionMessageSize @@ -242,14 +242,14 @@ not_null AddReactionIconWrap( std::move( iconPositionValue - ) | rpl::start_with_next([=](const QPoint &point) { + ) | rpl::on_next([=](const QPoint &point) { widget->moveToLeft(point.x(), point.y()); }, widget->lifetime()); const auto update = crl::guard(widget, [=] { widget->update(); }); widget->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(widget); if (state->finalAnimation.animating()) { @@ -269,7 +269,7 @@ not_null AddReactionIconWrap( std::move( destroys - ) | rpl::take(1) | rpl::start_with_next([=, from = 0., to = 1.] { + ) | rpl::take(1) | rpl::on_next([=, from = 0., to = 1.] { state->finalAnimation.start( [=](float64 value) { update(); @@ -316,7 +316,7 @@ void AddReactionAnimatedIcon( state->select.media->checkStickerLarge(); rpl::single() | rpl::then( reaction.appearAnimation->session().downloaderTaskFinished() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto check = [&](State::Entry &entry) { if (!entry.media) { return true; @@ -367,7 +367,7 @@ void AddReactionAnimatedIcon( std::move( selects - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto select = state->select.icon.get(); if (select && !select->animating()) { select->animate(crl::guard(widget, [=] { widget->update(); })); @@ -445,7 +445,7 @@ void ReactionsSettingsBox( check->resize(st::settingsReactionCornerSize); check->setAttribute(Qt::WA_TransparentForMouseEvents); check->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Painter p(check); st::mediaPlayerMenuCheck.paintInCenter(p, check->rect()); }, check->lifetime()); @@ -510,7 +510,7 @@ void ReactionsSettingsBox( firstCheckedButton->geometryValue( ) | rpl::filter([=](const QRect &r) { return r.isValid(); - }) | rpl::take(1) | rpl::start_with_next([=] { + }) | rpl::take(1) | rpl::on_next([=] { checkButton(firstCheckedButton); }, firstCheckedButton->lifetime()); } diff --git a/Telegram/SourceFiles/boxes/report_messages_box.cpp b/Telegram/SourceFiles/boxes/report_messages_box.cpp index 8855cd581e..c66609f07c 100644 --- a/Telegram/SourceFiles/boxes/report_messages_box.cpp +++ b/Telegram/SourceFiles/boxes/report_messages_box.cpp @@ -162,7 +162,7 @@ void ShowReportMessageBox( RectPart::Top | RectPart::Bottom); background->lower(); widget->sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { background->resize(s); }, background->lifetime()); } @@ -183,7 +183,7 @@ void ShowReportMessageBox( repeatRequest(repeatRequest, std::move(copy)); }; details->submits( - ) | rpl::start_with_next(submit, details->lifetime()); + ) | rpl::on_next(submit, details->lifetime()); box->addButton(tr::lng_report_button(), submit); } else { box->addButton( diff --git a/Telegram/SourceFiles/boxes/ringtones_box.cpp b/Telegram/SourceFiles/boxes/ringtones_box.cpp index ef945ba793..364cc1245a 100644 --- a/Telegram/SourceFiles/boxes/ringtones_box.cpp +++ b/Telegram/SourceFiles/boxes/ringtones_box.cpp @@ -72,7 +72,7 @@ AudioCreator::AudioCreator() }); base::timer_each( kNoDetachTimeout - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Media::Audio::StopDetachIfNotUsedSafe(); }, _lifetime); } @@ -210,7 +210,7 @@ void RingtonesBox( }; session->api().ringtones().uploadFails( - ) | rpl::start_with_next([=](const QString &error) { + ) | rpl::on_next([=](const QString &error) { if ((error == u"RINGTONE_DURATION_TOO_LONG"_q)) { box->getDelegate()->show(Ui::MakeInformBox( tr::lng_ringtones_error_max_duration( @@ -274,10 +274,10 @@ void RingtonesBox( }; session->api().ringtones().listUpdates( - ) | rpl::start_with_next(rebuild, container->lifetime()); + ) | rpl::on_next(rebuild, container->lifetime()); session->api().ringtones().uploadDones( - ) | rpl::start_with_next([=](DocumentId id) { + ) | rpl::on_next([=](DocumentId id) { state->chosen = Data::NotifySound{ .id = id }; rebuild(); }, container->lifetime()); diff --git a/Telegram/SourceFiles/boxes/self_destruction_box.cpp b/Telegram/SourceFiles/boxes/self_destruction_box.cpp index e9946c9f5a..d8eb129717 100644 --- a/Telegram/SourceFiles/boxes/self_destruction_box.cpp +++ b/Telegram/SourceFiles/boxes/self_destruction_box.cpp @@ -48,7 +48,7 @@ void AddDeleteAccount( session->api().cloudPassword().state( ) | rpl::take( 1 - ) | rpl::start_with_next([=](const Core::CloudPasswordState &state) { + ) | rpl::on_next([=](const Core::CloudPasswordState &state) { auto fields = PasscodeBox::CloudFields::From(state); fields.customTitle = tr::lng_settings_destroy_title(); fields.customDescription = tr::lng_context_mark_read_all_sure_2( @@ -117,7 +117,7 @@ SelfDestructionBox::SelfDestructionBox( preloaded ) | rpl::take( 1 - ) | rpl::start_with_next([=](int days) { + ) | rpl::on_next([=](int days) { gotCurrent(days); }, lifetime()); } diff --git a/Telegram/SourceFiles/boxes/send_credits_box.cpp b/Telegram/SourceFiles/boxes/send_credits_box.cpp index 8cfcdc1deb..b108ef1aa2 100644 --- a/Telegram/SourceFiles/boxes/send_credits_box.cpp +++ b/Telegram/SourceFiles/boxes/send_credits_box.cpp @@ -125,7 +125,7 @@ void AddTerms( .shadowIgnoreTopSkip = stBox.shadowIgnoreTopSkip, .shadowIgnoreBottomSkip = stBox.shadowIgnoreBottomSkip, }); - button->geometryValue() | rpl::start_with_next([=](const QRect &rect) { + button->geometryValue() | rpl::on_next([=](const QRect &rect) { terms->resizeToWidth(box->width() - rect::m::sum::h(st::boxRowPadding)); terms->moveToLeft( @@ -266,7 +266,7 @@ void AddTerms( const auto radius = smaller.height() / 2.; widget->resize(size); - widget->paintRequest() | rpl::start_with_next([=] { + widget->paintRequest() | rpl::on_next([=] { auto p = QPainter(widget); auto hq = PainterHighQualityEnabler(p); p.setPen(QPen(st::premiumButtonFg, st::chatGiveawayBadgeStroke * 1.)); @@ -331,13 +331,13 @@ void SendCreditsBox( ministars->setColorOverride(Ui::Premium::CreditsIconGradientStops()); ministarsContainer->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(ministarsContainer); ministars->paint(p); }, ministarsContainer->lifetime()); box->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { ministarsContainer->resize(width, fullHeight); const auto w = fullHeight / 3 * 2; ministars->setCenter(QRect( @@ -354,7 +354,7 @@ void SendCreditsBox( thumb->setAttribute(Qt::WA_TransparentForMouseEvents); if (form->invoice.subscriptionPeriod) { const auto badge = SendCreditsBadge(content, form->invoice.amount); - thumb->geometryValue() | rpl::start_with_next([=](const QRect &r) { + thumb->geometryValue() | rpl::on_next([=](const QRect &r) { badge->moveToLeft( r.x() + (r.width() - badge->width()) / 2, rect::bottom(r) - badge->height() / 2); @@ -420,7 +420,7 @@ void SendCreditsBox( if (id == u"BOT_PRECHECKOUT_FAILED"_q) { auto error = ::Ui::MakeInformBox( tr::lng_payments_precheckout_stars_failed(tr::now)); - error->boxClosing() | rpl::start_with_next([=] { + error->boxClosing() | rpl::on_next([=] { if (const auto paybox = weak.get()) { paybox->closeBox(); } @@ -469,7 +469,7 @@ void SendCreditsBox( content, st::boxTitleClose); close->setClickedCallback([=] { box->closeBox(); }); - content->widthValue() | rpl::start_with_next([=](int) { + content->widthValue() | rpl::on_next([=](int) { close->moveToRight(0, 0); }, close->lifetime()); } @@ -484,7 +484,7 @@ void SendCreditsBox( rpl::combine( balance->sizeValue(), content->sizeValue() - ) | rpl::start_with_next([=](const QSize &, const QSize &) { + ) | rpl::on_next([=](const QSize &, const QSize &) { balance->moveToLeft( st::creditsHistoryRightSkip * 2, st::creditsHistoryRightSkip); @@ -520,17 +520,17 @@ not_null SetButtonMarkedLabel( text ) | rpl::filter([=](const TextWithEntities &text) { return !text.text.isEmpty(); - }) | rpl::start_with_next([=](const TextWithEntities &text) { + }) | rpl::on_next([=](const TextWithEntities &text) { buttonLabel->setMarkedText(text, context); }, buttonLabel->lifetime()); if (textFg) { buttonLabel->setTextColorOverride((*textFg)->c); - style::PaletteChanged() | rpl::start_with_next([=] { + style::PaletteChanged() | rpl::on_next([=] { buttonLabel->setTextColorOverride((*textFg)->c); }, buttonLabel->lifetime()); } button->sizeValue( - ) | rpl::start_with_next([=](const QSize &size) { + ) | rpl::on_next([=](const QSize &size) { buttonLabel->moveToLeft( (size.width() - buttonLabel->width()) / 2, (size.height() - buttonLabel->height()) / 2); diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index 3f4c770a9d..63042cb800 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -140,12 +140,12 @@ void EditPriceBox( price ? QString::number(price) : QString(), limit); const auto field = owned.data(); - wrap->widthValue() | rpl::start_with_next([=](int width) { + wrap->widthValue() | rpl::on_next([=](int width) { field->move(0, 0); field->resize(width, field->height()); wrap->resize(width, field->height()); }, wrap->lifetime()); - field->paintRequest() | rpl::start_with_next([=](QRect clip) { + field->paintRequest() | rpl::on_next([=](QRect clip) { auto p = QPainter(field); st::paidStarIcon.paint(p, 0, st::paidStarIconTop, field->width()); }, field->lifetime()); @@ -574,7 +574,7 @@ void SendFilesBox::initPreview() { _footerHeight.value(), _titleHeight.value(), _1 + _2 + _3 - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { setDimensions( st::boxWideWidth, std::min(st::sendMediaPreviewHeightMax, height), @@ -619,7 +619,7 @@ void SendFilesBox::prepare() { SetupShadowsToScrollContent(this, _scroll, _inner->heightValue()); setCloseByOutsideClick(false); - boxClosing() | rpl::start_with_next([=] { + boxClosing() | rpl::on_next([=] { if (!_confirmed && _cancelledCallback) { _cancelledCallback(); } @@ -838,7 +838,7 @@ void SendFilesBox::refreshPriceTag() { const auto raw = _priceTag.get(); raw->show(); - raw->paintRequest() | rpl::start_with_next([=] { + raw->paintRequest() | rpl::on_next([=] { if (_priceTagBg.isNull()) { _priceTagBg = preparePriceTagBg(raw->size()); } @@ -860,17 +860,17 @@ void SendFilesBox::refreshPriceTag() { st::paidTagLabel); std::move( text - ) | rpl::start_with_next([=](const TextWithEntities &text) { + ) | rpl::on_next([=](const TextWithEntities &text) { label->setMarkedText(text); }, label->lifetime()); label->show(); - label->sizeValue() | rpl::start_with_next([=](QSize size) { + label->sizeValue() | rpl::on_next([=](QSize size) { const auto inner = QRect(QPoint(), size); const auto rect = inner.marginsAdded(st::paidTagPadding); raw->resize(rect.size()); label->move(-rect.topLeft()); }, label->lifetime()); - _inner->sizeValue() | rpl::start_with_next([=](QSize size) { + _inner->sizeValue() | rpl::on_next([=](QSize size) { raw->move( (size.width() - raw->width()) / 2, (size.height() - raw->height()) / 2); @@ -966,7 +966,7 @@ void SendFilesBox::initSendWay() { return result; }(); _sendWay.changes( - ) | rpl::start_with_next([=](SendFilesWay value) { + ) | rpl::on_next([=](SendFilesWay value) { const auto hidden = [&] { return !_caption || _caption->isHidden(); }; @@ -1082,7 +1082,7 @@ void SendFilesBox::pushBlock(int from, int till) { block.itemDeleteRequest( ) | rpl::filter([=] { return !_removingIndex; - }) | rpl::start_with_next([=](int index) { + }) | rpl::on_next([=](int index) { applyBlockChanges(); _removingIndex = index; @@ -1104,7 +1104,7 @@ void SendFilesBox::pushBlock(int from, int till) { const auto show = uiShow(); block.itemReplaceRequest( - ) | rpl::start_with_next([=](int index) { + ) | rpl::on_next([=](int index) { applyBlockChanges(); const auto replace = [=](Ui::PreparedList list) { @@ -1181,7 +1181,7 @@ void SendFilesBox::pushBlock(int from, int till) { const auto openedOnce = widget->lifetime().make_state(false); block.itemModifyRequest( - ) | rpl::start_with_next([=, show = _show](int index) { + ) | rpl::on_next([=, show = _show](int index) { applyBlockChanges(); if (!(*openedOnce)) { @@ -1198,7 +1198,7 @@ void SendFilesBox::pushBlock(int from, int till) { }, widget->lifetime()); block.itemEditCoverRequest( - ) | rpl::start_with_next([=, show = _show](int index) { + ) | rpl::on_next([=, show = _show](int index) { applyBlockChanges(); const auto replace = [=](Ui::PreparedList list) { @@ -1261,7 +1261,7 @@ void SendFilesBox::pushBlock(int from, int till) { }, widget->lifetime()); block.itemClearCoverRequest( - ) | rpl::start_with_next([=](int index) { + ) | rpl::on_next([=](int index) { applyBlockChanges(); refreshAllAfterChanges(from, [&] { auto &entry = _list.files[index]; @@ -1269,7 +1269,7 @@ void SendFilesBox::pushBlock(int from, int till) { }); }, widget->lifetime()); - block.orderUpdated() | rpl::start_with_next([=]{ + block.orderUpdated() | rpl::on_next([=]{ if (_priceTag) { _priceTagBg = QImage(); _priceTag->update(); @@ -1302,13 +1302,13 @@ void SendFilesBox::setupSendWayControls() { _st.files.check); _sendWay.changes( - ) | rpl::start_with_next([=](SendFilesWay value) { + ) | rpl::on_next([=](SendFilesWay value) { _groupFiles->setChecked(value.groupFiles()); _sendImagesAsPhotos->setChecked(value.sendImagesAsPhotos()); }, lifetime()); _groupFiles->checkedChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { auto sendWay = _sendWay.current(); if (sendWay.groupFiles() == checked) { return; @@ -1324,7 +1324,7 @@ void SendFilesBox::setupSendWayControls() { }, lifetime()); _sendImagesAsPhotos->checkedChanges( - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { auto sendWay = _sendWay.current(); if (sendWay.sendImagesAsPhotos() == checked) { return; @@ -1349,7 +1349,7 @@ void SendFilesBox::setupSendWayControls() { rpl::combine( _groupFiles->checkedValue(), _sendImagesAsPhotos->checkedValue() - ) | rpl::start_with_next([=](bool groupFiles, bool asPhoto) { + ) | rpl::on_next([=](bool groupFiles, bool asPhoto) { _wayRemember->setVisible( (groupFiles != groupFilesFirst) || (asPhoto != asPhotosFirst)); captionResized(); @@ -1439,18 +1439,18 @@ void SendFilesBox::setupCaption() { _caption->setMaxLength(kMaxMessageLength); _caption->heightChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { captionResized(); }, _caption->lifetime()); _caption->submits( - ) | rpl::start_with_next([=](Qt::KeyboardModifiers modifiers) { + ) | rpl::on_next([=](Qt::KeyboardModifiers modifiers) { const auto ctrlShiftEnter = modifiers.testFlag(Qt::ShiftModifier) && (modifiers.testFlag(Qt::ControlModifier) || modifiers.testFlag(Qt::MetaModifier)); send({}, ctrlShiftEnter); }, _caption->lifetime()); _caption->cancelled( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { closeBox(); }, _caption->lifetime()); _caption->setMimeDataHook([=]( @@ -1469,7 +1469,7 @@ void SendFilesBox::setupCaption() { rpl::single(rpl::empty_value()) | rpl::then( _caption->changes() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { checkCharsLimitation(); refreshMessagesCount(); }, _caption->lifetime()); @@ -1543,7 +1543,7 @@ void SendFilesBox::checkCharsLimitation() { _charsLimitation->show(); Data::AmPremiumValue( &_show->session() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { checkCharsLimitation(); }, _charsLimitation->lifetime()); } @@ -1585,11 +1585,11 @@ void SendFilesBox::setupEmojiPanel() { _emojiPanel->selector()->setAllowEmojiWithoutPremium( _limits & SendFilesAllow::EmojiWithoutPremium); _emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { Ui::InsertEmojiAtCursor(_caption->textCursor(), data.emoji); }, lifetime()); _emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { const auto info = data.document->sticker(); if (info && info->setType == Data::StickersType::Emoji diff --git a/Telegram/SourceFiles/boxes/send_gif_with_caption_box.cpp b/Telegram/SourceFiles/boxes/send_gif_with_caption_box.cpp index 4e83fd7e72..e7f779c05e 100644 --- a/Telegram/SourceFiles/boxes/send_gif_with_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/send_gif_with_caption_box.cpp @@ -76,7 +76,7 @@ namespace { Qt::KeepAspectRatio).height()), st::boxRowPadding); widget->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(widget); if (state->gif && state->gif->started()) { p.drawImage( @@ -122,7 +122,7 @@ namespace { }; if (!updateThumbnail()) { document->session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (updateThumbnail()) { state->loadingLifetime.destroy(); widget->update(); @@ -175,11 +175,11 @@ namespace { emojiPanel->hide(); emojiPanel->selector()->setCurrentPeer(controller->session().user()); emojiPanel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { Ui::InsertEmojiAtCursor(input->textCursor(), data.emoji); }, input->lifetime()); emojiPanel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { const auto info = data.document->sticker(); if (info && info->setType == Data::StickersType::Emoji @@ -212,7 +212,7 @@ namespace { emojiButton, style::al_top); state->charsLimitation->show(); - Data::AmPremiumValue(session) | rpl::start_with_next([=] { + Data::AmPremiumValue(session) | rpl::on_next([=] { repeat(repeat); }, state->charsLimitation->lifetime()); } @@ -223,7 +223,7 @@ namespace { } }; - input->changes() | rpl::start_with_next([=] { + input->changes() | rpl::on_next([=] { checkCharsLimitation(checkCharsLimitation); }, input->lifetime()); @@ -342,7 +342,7 @@ void CaptionBox( box->closeBox(); }); input->submits( - ) | rpl::start_with_next([=] { send({}); }, input->lifetime()); + ) | rpl::on_next([=] { send({}); }, input->lifetime()); } } // namespace @@ -378,7 +378,7 @@ void EditCaptionBox( state->fullId = view->data()->fullId(); data->itemIdChanged( - ) | rpl::start_with_next([=](Data::Session::IdChange event) { + ) | rpl::on_next([=](Data::Session::IdChange event) { if (event.oldId == state->fullId.msg) { state->fullId = event.newId; } diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index 00568e0616..75226faea0 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -239,7 +239,7 @@ void ShareBox::prepareCommentField() { (_bottomWidget ? _bottomWidget->heightValue() : (rpl::single(0) | rpl::type_erased)) - ) | rpl::start_with_next([=](int height, int comment, int bottom) { + ) | rpl::on_next([=](int height, int comment, int bottom) { _comment->moveToLeft(0, height - bottom - comment); if (_bottomWidget) { _bottomWidget->moveToLeft(0, height - bottom); @@ -249,7 +249,7 @@ void ShareBox::prepareCommentField() { const auto field = _comment->entity(); field->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { submit({}); }, field->lifetime()); @@ -263,7 +263,7 @@ void ShareBox::prepareCommentField() { } field->setSubmitSettings(Core::App().settings().sendSubmitWay()); - field->changes() | rpl::start_with_next([=] { + field->changes() | rpl::on_next([=] { if (!field->getLastText().isEmpty()) { setCloseByOutsideClick(false); } else if (_inner->selected().empty()) { @@ -324,17 +324,17 @@ void ShareBox::prepare() { (_bottomWidget ? _bottomWidget->heightValue() : rpl::single(0) | rpl::type_erased) - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateScrollSkips(); }, _comment->lifetime()); _inner->searchRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { needSearchByUsername(); }, _inner->lifetime()); _inner->scrollToRequests( - ) | rpl::start_with_next([=](const Ui::ScrollToRequest &request) { + ) | rpl::on_next([=](const Ui::ScrollToRequest &request) { scrollTo(request); }, _inner->lifetime()); @@ -368,11 +368,11 @@ void ShareBox::prepare() { }, Window::GifPauseReason::Layer); chatsFilters->lower(); - chatsFilters->heightValue() | rpl::start_with_next([this](int h) { + chatsFilters->heightValue() | rpl::on_next([this](int h) { updateScrollSkips(); scrollToY(0); }, lifetime()); - _select->heightValue() | rpl::start_with_next([=](int h) { + _select->heightValue() | rpl::on_next([=](int h) { chatsFilters->moveToLeft(0, h); }, chatsFilters->lifetime()); _chatsFilters = chatsFilters; @@ -557,7 +557,7 @@ void ShareBox::showMenu(not_null parent) { nullptr); std::move( text - ) | rpl::start_with_next([action = item->action()](QString text) { + ) | rpl::on_next([action = item->action()](QString text) { action->setText(text); }, item->lifetime()); item->init(checked); @@ -620,7 +620,7 @@ void ShareBox::createButtons() { send->setAcceptBoth(); send->clicks( - ) | rpl::start_with_next([=](Qt::MouseButton button) { + ) | rpl::on_next([=](Qt::MouseButton button) { if (button == Qt::RightButton) { showMenu(send); } @@ -708,7 +708,7 @@ void ShareBox::submit(Api::SendOptions options) { if (!waiting.empty()) { _descriptor.session->changes().peerUpdates( Data::PeerUpdate::Flag::FullInfo - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { if (waiting.contains(update.peer)) { withPaymentApproved(alreadyApproved); } @@ -718,7 +718,7 @@ void ShareBox::submit(Api::SendOptions options) { _descriptor.session->credits().loadedValue( ) | rpl::filter( rpl::mappers::_1 - ) | rpl::take(1) | rpl::start_with_next([=] { + ) | rpl::take(1) | rpl::on_next([=] { withPaymentApproved(alreadyApproved); }, _submitLifetime); } @@ -830,7 +830,7 @@ ShareBox::Inner::Inner( rpl::merge( Data::AmPremiumValue(session) | rpl::to_empty, session->api().premium().someMessageMoneyRestrictionsResolved() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshRestrictedRows(); }, lifetime()); } @@ -863,24 +863,24 @@ ShareBox::Inner::Inner( _descriptor.session->changes().peerUpdates( Data::PeerUpdate::Flag::Photo - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { updateChat(update.peer); }, lifetime()); _descriptor.session->changes().realtimeNameUpdates( - ) | rpl::start_with_next([=](const Data::NameUpdate &update) { + ) | rpl::on_next([=](const Data::NameUpdate &update) { _defaultChatsIndexed->peerNameChanged( update.peer, update.oldFirstLetters); }, lifetime()); _descriptor.session->downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); }, lifetime()); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { invalidateCache(); }, lifetime()); } @@ -1388,7 +1388,7 @@ void ShareBox::Inner::chooseForumTopic(not_null forum) { Assert(!chat->topic); chat->topic = topic; chat->topic->destroyed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { changePeerCheckState(chat, false); }, chat->topicLifetime); updateChatName(chat); @@ -1400,7 +1400,7 @@ void ShareBox::Inner::chooseForumTopic(not_null forum) { }); forum->destroyed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); }; @@ -1436,7 +1436,7 @@ void ShareBox::Inner::chooseMonoforumSublist( Assert(!chat->sublist); chat->sublist = sublist; chat->sublist->destroyed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { changePeerCheckState(chat, false); }, chat->sublistLifetime); updateChatName(chat); @@ -1448,7 +1448,7 @@ void ShareBox::Inner::chooseMonoforumSublist( }); monoforum->destroyed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); }; diff --git a/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp b/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp index 88b6cf3eb8..a89e6c484d 100644 --- a/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_auction_box.cpp @@ -248,7 +248,7 @@ struct BidSliderValues { const auto kHuge = u"99999"_q; const auto userpicLeft = st::auctionBidPlace.style.font->width(kHuge); - std::move(data) | rpl::start_with_next([=](BidRowData bid) { + std::move(data) | rpl::on_next([=](BidRowData bid) { state->place->setTextColorOverride( BidColorOverride(bid.position, bid.winners)); if (state->user != bid.user) { @@ -274,7 +274,7 @@ struct BidSliderValues { rpl::combine( raw->widthValue(), state->stars->widthValue() - ) | rpl::start_with_next([=](int outer, int stars) { + ) | rpl::on_next([=](int outer, int stars) { const auto userpicSize = st::auctionBidUserpic.size; const auto top = (userpicSize.height() - st::normalFont->height) / 2; state->place->moveToLeft(0, top, outer); @@ -478,7 +478,7 @@ void AddBidPlaces( rpl::duplicate( value - ) | rpl::start_with_next([=](const Data::GiftAuctionState &value) { + ) | rpl::on_next([=](const Data::GiftAuctionState &value) { auto cache = std::vector(); cache.reserve(value.topBidders.size()); for (const auto &user : value.topBidders) { @@ -557,7 +557,7 @@ void AddBidPlaces( const auto myLabel = AddSubsectionTitle( box->verticalLayout(), std::move(myLabelText)); - state->my.value() | rpl::start_with_next([=](My my) { + state->my.value() | rpl::on_next([=](My my) { myLabel->setTextColorOverride( BidColorOverride(my.position, state->winners)); }, myLabel->lifetime()); @@ -707,7 +707,7 @@ void AuctionBidBox(not_null box, AuctionBidBoxArgs &&args) { }); args.peer->owner().giftAuctionGots( - ) | rpl::start_with_next([=](const Data::GiftAuctionGot &update) { + ) | rpl::on_next([=](const Data::GiftAuctionGot &update) { if (update.giftId == giftId) { box->closeBox(); @@ -741,7 +741,7 @@ void AuctionBidBox(not_null box, AuctionBidBoxArgs &&args) { const auto sliderWrap = content->add( object_ptr(content)); state->sliderValues.value( - ) | rpl::start_with_next([=](const BidSliderValues &values) { + ) | rpl::on_next([=](const BidSliderValues &values) { const auto initial = !sliderWrap->count(); if (!initial) { while (sliderWrap->count()) { @@ -772,7 +772,7 @@ void AuctionBidBox(not_null box, AuctionBidBoxArgs &&args) { activeFgOverride); bubble->setAttribute(Qt::WA_TransparentForMouseEvents, false); bubble->setClickedCallback(setCustom); - state->subtext.value() | rpl::start_with_next([=](QString &&text) { + state->subtext.value() | rpl::on_next([=](QString &&text) { bubble->setSubtext(std::move(text)); }, bubble->lifetime()); @@ -789,7 +789,7 @@ void AuctionBidBox(not_null box, AuctionBidBoxArgs &&args) { sliderWrap->resizeToWidth(st::boxWideWidth); const auto custom = CreateChild(sliderWrap); - state->chosen.changes() | rpl::start_with_next([=] { + state->chosen.changes() | rpl::on_next([=] { custom->update(); }, custom->lifetime()); custom->show(); @@ -805,7 +805,7 @@ void AuctionBidBox(not_null box, AuctionBidBoxArgs &&args) { p.fillRect(rem, rem + sub, inner, stroke, color); p.fillRect(rem + sub, rem + inner - sub, stroke, sub, color); }); - sliderWrap->sizeValue() | rpl::start_with_next([=](QSize size) { + sliderWrap->sizeValue() | rpl::on_next([=](QSize size) { custom->move( size.width() - st::boxRowPadding.right() - custom->width(), size.height() - custom->height()); @@ -1124,7 +1124,7 @@ void AuctionBidBox(not_null box, AuctionBidBoxArgs &&args) { rpl::mappers::_1 != 0 ) | rpl::take( 1 - ) | rpl::start_with_next([=](int64 price) { + ) | rpl::on_next([=](int64 price) { delete round; raw->insertRow( @@ -1311,7 +1311,7 @@ void AuctionGotGiftsBox( put(); base::timer_each( kSwitchPreviewCoverInterval / 3 - ) | rpl::start_with_next(put, lifetime); + ) | rpl::on_next(put, lifetime); return lifetime; }; @@ -1445,7 +1445,7 @@ void AuctionInfoBox( return !list.models.empty(); }) | rpl::take( 1 - ) | rpl::start_with_next([=](const UniqueGiftAttributes &list) { + ) | rpl::on_next([=](const UniqueGiftAttributes &list) { auto emoji = tr::marked(); const auto indices = RandomIndicesSubset(list.models.size(), 3); for (const auto index : indices) { @@ -1488,7 +1488,7 @@ void AuctionInfoBox( GiftTypeStars{ .info = *state->value.current().gift }, state->value.value())); sendBox->boxClosing( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); }); @@ -1539,7 +1539,7 @@ base::weak_qptr ChooseAndShowAuctionBox( }, state->value())); sendBox->boxClosing( - ) | rpl::start_with_next(close, sendBox->lifetime()); + ) | rpl::on_next(close, sendBox->lifetime()); }; const auto from = current.my.to; const auto text = (from->isSelf() @@ -1591,7 +1591,7 @@ base::weak_qptr ChooseAndShowAuctionBox( } if (const auto strong = box.get()) { strong->boxClosing( - ) | rpl::start_with_next(boxClosed, strong->lifetime()); + ) | rpl::on_next(boxClosed, strong->lifetime()); } else { boxClosed(); } @@ -1615,7 +1615,7 @@ rpl::lifetime ShowStarGiftAuction( const auto state = std::make_shared(); auto result = session->giftAuctions().state( slug - ) | rpl::start_with_next([=](Data::GiftAuctionState &&value) { + ) | rpl::on_next([=](Data::GiftAuctionState &&value) { if (const auto onstack = finishRequesting) { onstack(); } @@ -1952,7 +1952,7 @@ object_ptr MakeActiveAuctionRow( tag)); raw->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto q = QPainter(raw); sticker->paint(q, { .textColor = st::windowFg->c, @@ -1989,7 +1989,7 @@ object_ptr MakeActiveAuctionRow( st::defaultPopupMenu, helper.context()), st::auctionListTextPadding); - rpl::duplicate(value) | rpl::start_with_next([=](const Single &fields) { + rpl::duplicate(value) | rpl::on_next([=](const Single &fields) { const auto outbid = (fields.position > fields.winning); subtitle->setTextColorOverride(outbid ? st::attentionButtonFg->c @@ -2022,7 +2022,7 @@ object_ptr MakeActiveAuctionRow( window->showStarGiftAuction(slug); }); button->setFullRadius(true); - raw->widthValue() | rpl::start_with_next([=](int width) { + raw->widthValue() | rpl::on_next([=](int width) { button->setFullWidth(width); }, button->lifetime()); @@ -2093,7 +2093,7 @@ Fn ActiveAuctionsCallback( auctions->state( now.slug - ) | rpl::start_with_next([=](const GiftAuctionState &state) { + ) | rpl::on_next([=](const GiftAuctionState &state) { if (!state.my.bid) { delete row; if (const auto now = rows->current(); now > 1) { diff --git a/Telegram/SourceFiles/boxes/star_gift_box.cpp b/Telegram/SourceFiles/boxes/star_gift_box.cpp index a89d309530..0858f03f09 100644 --- a/Telegram/SourceFiles/boxes/star_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_box.cpp @@ -578,13 +578,13 @@ PreviewWrap::PreviewWrap( using namespace HistoryView; _history->owner().viewRepaintRequest( - ) | rpl::start_with_next([=](not_null view) { + ) | rpl::on_next([=](not_null view) { if (view == _item.get()) { update(); } }, lifetime()); - _history->session().downloaderTaskFinished() | rpl::start_with_next([=] { + _history->session().downloaderTaskFinished() | rpl::on_next([=] { update(); }, lifetime()); @@ -654,7 +654,7 @@ void ShowSentToast( Lottie::Quality::Default); preview->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!player->ready()) { return; } @@ -668,7 +668,7 @@ void ShowSentToast( }, preview->lifetime()); player->updates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { preview->update(); }, preview->lifetime()); } @@ -678,7 +678,7 @@ PreviewWrap::~PreviewWrap() { } void PreviewWrap::prepare(rpl::producer details) { - std::move(details) | rpl::start_with_next([=](GiftSendDetails details) { + std::move(details) | rpl::on_next([=](GiftSendDetails details) { const auto &descriptor = details.descriptor; const auto cost = v::match(descriptor, [&](GiftTypePremium data) { const auto stars = (details.byStars && data.stars) @@ -742,12 +742,12 @@ void PreviewWrap::prepare(rpl::producer details) { widthValue( ) | rpl::filter([=](int width) { return width >= st::msgMinWidth; - }) | rpl::start_with_next([=](int width) { + }) | rpl::on_next([=](int width) { resizeTo(width); }, lifetime()); _history->owner().itemResizeRequest( - ) | rpl::start_with_next([=](not_null item) { + ) | rpl::on_next([=](not_null item) { if (_item && item == _item->data() && width() >= st::msgMinWidth) { resizeTo(width()); } @@ -807,7 +807,7 @@ void PreviewWrap::paintEvent(QPaintEvent *e) { using namespace Api; const auto api = std::make_shared(peer); - api->request() | rpl::start_with_error_done([=](QString error) { + api->request() | rpl::on_error_done([=](QString error) { consumer.put_next({}); }, [=] { const auto &options = api->optionsForPeer(); @@ -975,7 +975,7 @@ struct GiftPriceTabs { }; state->prices.value( - ) | rpl::start_with_next([=](const std::vector &prices) { + ) | rpl::on_next([=](const std::vector &prices) { auto x = st::giftBoxTabsMargin.left(); auto y = st::giftBoxTabsMargin.top(); @@ -1019,13 +1019,13 @@ struct GiftPriceTabs { rpl::combine( raw->widthValue(), state->fullWidth.value() - ) | rpl::start_with_next([=](int outer, int inner) { + ) | rpl::on_next([=](int outer, int inner) { state->scrollMax = std::max(0, inner - outer); state->tabsShift = (outer - inner) / 2; }, raw->lifetime()); raw->setMouseTracking(true); - raw->events() | rpl::start_with_next([=](not_null e) { + raw->events() | rpl::on_next([=](not_null e) { const auto type = e->type(); switch (type) { case QEvent::Leave: setSelected(-1); break; @@ -1084,7 +1084,7 @@ struct GiftPriceTabs { } }, raw->lifetime()); - raw->paintRequest() | rpl::start_with_next([=] { + raw->paintRequest() | rpl::on_next([=] { auto p = QPainter(raw); auto hq = PainterHighQualityEnabler(p); const auto padding = st::giftBoxTabPadding; @@ -1159,7 +1159,7 @@ struct GiftPriceTabs { container, st::defaultComposeFiles.emoji); toggle->show(); - field->geometryValue() | rpl::start_with_next([=](QRect r) { + field->geometryValue() | rpl::on_next([=](QRect r) { toggle->move( r.x() + r.width() - toggle->width(), r.y() - st::giftBoxEmojiToggleTop); @@ -1181,11 +1181,11 @@ struct GiftPriceTabs { panel->hide(); panel->selector()->setAllowEmojiWithoutPremium(true); panel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { InsertEmojiAtCursor(field->textCursor(), data.emoji); }, field->lifetime()); panel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { Data::InsertCustomEmoji(field, data.document); }, field->lifetime()); @@ -1467,7 +1467,7 @@ void AddUpgradeButton( rpl::single(QString()), st::settingsButtonNoIcon)); button->toggleOn(rpl::single(false))->toggledValue( - ) | rpl::start_with_next(toggled, button->lifetime()); + ) | rpl::on_next(toggled, button->lifetime()); auto helper = Ui::Text::CustomEmojiHelper(); auto star = helper.paletteDependent(Ui::Earn::IconCreditsEmoji()); @@ -1484,7 +1484,7 @@ void AddUpgradeButton( helper.context()); label->show(); label->setAttribute(Qt::WA_TransparentForMouseEvents); - button->widthValue() | rpl::start_with_next([=](int outer) { + button->widthValue() | rpl::on_next([=](int outer) { const auto padding = st::settingsButtonNoIcon.padding; const auto inner = outer - padding.left() @@ -1542,7 +1542,7 @@ void AddSoldLeftSlider( state->height = st::giftLimitedPadding.top() + st::semiboldFont->height + st::giftLimitedPadding.bottom(); - above->geometryValue() | rpl::start_with_next([=](QRect geometry) { + above->geometryValue() | rpl::on_next([=](QRect geometry) { const auto space = st::giftLimitedBox.buttonPadding.top(); const auto skip = (space - state->height) / 2; slider->setGeometry( @@ -1551,7 +1551,7 @@ void AddSoldLeftSlider( geometry.width() - added.left() - added.right(), state->height); }, slider->lifetime()); - slider->paintRequest() | rpl::start_with_next([=] { + slider->paintRequest() | rpl::on_next([=] { const auto &padding = st::giftLimitedPadding; const auto left = (padding.left() * 2) + state->still.maxWidth(); const auto right = (padding.right() * 2) + state->sold.maxWidth(); @@ -1618,7 +1618,7 @@ void CheckMaybeGiftLocked( auto result = object_ptr((QWidget*)nullptr); const auto raw = result.data(); - Data::AmPremiumValue(&window->session()) | rpl::start_with_next([=] { + Data::AmPremiumValue(&window->session()) | rpl::on_next([=] { raw->update(); }, raw->lifetime()); @@ -1644,7 +1644,7 @@ void CheckMaybeGiftLocked( const auto extend = shadow.extend; auto &packs = window->session().giftBoxStickersPacks(); - packs.updated() | rpl::start_with_next([=] { + packs.updated() | rpl::on_next([=] { for (const auto &button : state->buttons) { if (const auto raw = button.get()) { raw->update(); @@ -1876,11 +1876,11 @@ void CheckMaybeGiftLocked( state->visibleRange = raw->visibleRange(); state->visibleRange.value( - ) | rpl::start_with_next(rebuild, raw->lifetime()); + ) | rpl::on_next(rebuild, raw->lifetime()); std::move( gifts - ) | rpl::start_with_next([=](const GiftsDescriptor &gifts) { + ) | rpl::on_next([=](const GiftsDescriptor &gifts) { const auto width = st::boxWideWidth; const auto padding = st::giftBoxPadding; const auto available = width - padding.left() - padding.right(); @@ -1915,7 +1915,7 @@ void CheckMaybeGiftLocked( } void FillBg(not_null box) { - box->paintRequest() | rpl::start_with_next([=] { + box->paintRequest() | rpl::on_next([=] { auto p = QPainter(box); auto hq = PainterHighQualityEnabler(p); @@ -2003,7 +2003,7 @@ void AddBlock( state->gifts.value(), !state->my.list.empty() && !peer->isSelf()); state->priceTab = std::move(tabs.priceTab); - state->priceTab.changes() | rpl::start_with_next([=](int tab) { + state->priceTab.changes() | rpl::on_next([=](int tab) { tabSelected(tab); }, tabs.widget->lifetime()); result->add(std::move(tabs.widget)); @@ -2061,7 +2061,7 @@ void AddBlock( &peer->session(), Data::MyUniqueType::OnlyOwned, state->my.offset - ) | rpl::start_with_next([=](MyGiftsDescriptor &&descriptor) { + ) | rpl::on_next([=](MyGiftsDescriptor &&descriptor) { state->myLoading.destroy(); state->my.offset = descriptor.list.empty() ? QString() @@ -2593,7 +2593,7 @@ void ChooseStarGiftRecipient( box->setTitle(tr::lng_gift_premium_or_stars()); box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); - box->noSearchSubmits() | rpl::start_with_next([=] { + box->noSearchSubmits() | rpl::on_next([=] { controllerRaw->noSearchSubmit(); }, box->lifetime()); }; @@ -2679,7 +2679,7 @@ void ShowStarGiftBox( GiftsPremium( session, peer - ) | rpl::start_with_next([=](PremiumGiftsDescriptor &&gifts) { + ) | rpl::on_next([=](PremiumGiftsDescriptor &&gifts) { auto &entry = Map[session]; entry.premiumGiftsReady = true; entry.hasPremium = !gifts.list.empty(); @@ -2697,7 +2697,7 @@ void ShowStarGiftBox( peer->session().changes().peerUpdates( peer, Data::PeerUpdate::Flag::FullInfo - ) | rpl::take(1) | rpl::start_with_next([=] { + ) | rpl::take(1) | rpl::on_next([=] { auto &entry = Map[session]; entry.fullReady = true; checkReady(); @@ -2707,7 +2707,7 @@ void ShowStarGiftBox( GiftsStars( session, peer - ) | rpl::start_with_next([=](std::vector &&gifts) { + ) | rpl::on_next([=](std::vector &&gifts) { auto &entry = Map[session]; entry.starsGiftsReady = true; for (const auto &gift : gifts) { @@ -2726,7 +2726,7 @@ void ShowStarGiftBox( Data::MyUniqueGiftsSlice( session, Data::MyUniqueType::OnlyOwned - ) | rpl::start_with_next([=](MyGiftsDescriptor &&gifts) { + ) | rpl::on_next([=](MyGiftsDescriptor &&gifts) { auto &entry = Map[session]; entry.my = std::move(gifts); entry.myReady = true; @@ -2750,7 +2750,7 @@ void SetupResalePriceButton( QString(), st::uniqueGiftResalePrice); text->setAttribute(Qt::WA_TransparentForMouseEvents); - text->sizeValue() | rpl::start_with_next([=](QSize size) { + text->sizeValue() | rpl::on_next([=](QSize size) { const auto padding = st::uniqueGiftResalePadding; const auto margin = st::uniqueGiftResaleMargin; button->resize(size.grownBy(padding + margin)); @@ -2758,7 +2758,7 @@ void SetupResalePriceButton( }, button->lifetime()); text->setTextColorOverride(QColor(255, 255, 255, 255)); - std::move(price) | rpl::start_with_next([=](CreditsAmount value) { + std::move(price) | rpl::on_next([=](CreditsAmount value) { if (value) { text->setMarkedText(value.ton() ? Ui::Text::IconEmoji(&st::tonIconEmoji).append( @@ -2774,7 +2774,7 @@ void SetupResalePriceButton( const auto bg = button->lifetime().make_state>( std::move(background)); - button->paintRequest() | rpl::start_with_next([=] { + button->paintRequest() | rpl::on_next([=] { auto p = QPainter(button); auto hq = PainterHighQualityEnabler(p); @@ -2785,7 +2785,7 @@ void SetupResalePriceButton( p.setBrush(bg->current()); p.drawRoundedRect(inner, radius, radius); }, button->lifetime()); - bg->changes() | rpl::start_with_next([=] { + bg->changes() | rpl::on_next([=] { button->update(); }, button->lifetime()); @@ -2850,7 +2850,7 @@ void AddUniqueGiftCover( { 0., anim::with_alpha(white, .3) }, { 1., white }, }); - pretitle->geometryValue() | rpl::start_with_next([=](QRect rect) { + pretitle->geometryValue() | rpl::on_next([=](QRect rect) { const auto half = rect.height() / 2; released->stars->setCenter(rect - QMargins(half, 0, half, 0)); }, pretitle->lifetime()); @@ -2918,11 +2918,11 @@ void AddUniqueGiftCover( GiftReleasedByHandler(released->by); }); subtitle->geometryValue( - ) | rpl::start_with_next([=](QRect geometry) { + ) | rpl::on_next([=](QRect geometry) { button->setGeometry( geometry.marginsAdded(st::giftBoxReleasedByMargin)); }, button->lifetime()); - button->paintRequest() | rpl::start_with_next([=] { + button->paintRequest() | rpl::on_next([=] { auto p = QPainter(button); auto hq = PainterHighQualityEnabler(p); const auto use = subtitle->textMaxWidth(); @@ -2986,7 +2986,7 @@ void AddUniqueGiftCover( }; rpl::duplicate( data - ) | rpl::start_with_next([=](const UniqueGiftCover &now) { + ) | rpl::on_next([=](const UniqueGiftCover &now) { const auto setup = [&](GiftView &to) { to.gift = now.values; to.forced = now.force; @@ -2997,7 +2997,7 @@ void AddUniqueGiftCover( document->session().downloaderTaskFinished() ) | rpl::filter([&to] { return to.media->loaded(); - }) | rpl::start_with_next([=, &to] { + }) | rpl::on_next([=, &to] { const auto lottieSize = st::creditsHistoryEntryStarGiftSize; to.lottie = ChatHelpers::LottiePlayerFromDocument( to.media.get(), @@ -3007,7 +3007,7 @@ void AddUniqueGiftCover( to.lifetime.destroy(); const auto lottie = to.lottie.get(); - lottie->updates() | rpl::start_with_next([=] { + lottie->updates() | rpl::on_next([=] { if (state->now.lottie.get() == lottie || state->crossfade.animating()) { cover->update(); @@ -3141,7 +3141,7 @@ void AddUniqueGiftCover( } updateAttrs(*state->now.gift); - cover->widthValue() | rpl::start_with_next([=](int width) { + cover->widthValue() | rpl::on_next([=](int width) { const auto skip = st::uniqueGiftBottom; if (width <= 3 * skip) { return; @@ -3181,7 +3181,7 @@ void AddUniqueGiftCover( cover->resize(width, top); }, cover->lifetime()); - cover->paintRequest() | rpl::start_with_next([=] { + cover->paintRequest() | rpl::on_next([=] { auto p = QPainter(cover); auto progress = state->crossfade.value(state->animating ? 1. : 0.); @@ -3304,7 +3304,7 @@ void AddWearGiftCover( [=] { cover->update(); }, Data::CustomEmojiSizeTag::Large); - cover->widthValue() | rpl::start_with_next([=](int width) { + cover->widthValue() | rpl::on_next([=](int width) { const auto skip = st::uniqueGiftBottom; if (width <= 3 * skip) { return; @@ -3319,7 +3319,7 @@ void AddWearGiftCover( cover->resize(width, subtitle->y() + subtitle->height() + skip); }, cover->lifetime()); - cover->paintRequest() | rpl::start_with_next([=] { + cover->paintRequest() | rpl::on_next([=] { auto p = Painter(cover); const auto width = cover->width(); @@ -3508,7 +3508,7 @@ void PreloadUniqueGiftResellPrices(not_null session) { } }; entry->requestLifetime = entry->api->requestStarGifts( - ) | rpl::start_with_error_done(finish, [=] { + ) | rpl::on_error_done(finish, [=] { const auto &gifts = entry->api->starGifts(); entry->prices.reserve(gifts.size()); for (auto &gift : gifts) { @@ -3736,7 +3736,7 @@ void UniqueGiftSellBox( st::boxDividerLabel)); Ui::AddSkip(container); - rpl::duplicate(goods) | rpl::start_with_next([=](bool good) { + rpl::duplicate(goods) | rpl::on_next([=](bool good) { details->setTextColorOverride( good ? st::windowSubTextFg->c : st::boxTextFgError->c); }, details->lifetime()); @@ -3752,7 +3752,7 @@ void UniqueGiftSellBox( }; std::move( priceInput.submits - ) | rpl::start_with_next(submit, details->lifetime()); + ) | rpl::on_next(submit, details->lifetime()); auto submitText = priceNow ? tr::lng_gift_sell_update() : tr::lng_gift_sell_put(); @@ -4005,7 +4005,7 @@ struct UpgradeArgs : StarGiftUpgradeArgs { put(); base::timer_each( kSwitchUpgradeCoverInterval / 3 - ) | rpl::start_with_next(put, lifetime); + ) | rpl::on_next(put, lifetime); return lifetime; }; @@ -4399,7 +4399,7 @@ void UpgradeBox( args.addDetailsDefault), st::defaultCheckbox.margin, style::al_top); - checkbox->checkedChanges() | rpl::start_with_next([=](bool checked) { + checkbox->checkedChanges() | rpl::on_next([=](bool checked) { state->preserveDetails = checked; }, checkbox->lifetime()); } @@ -4489,7 +4489,7 @@ void UpgradeBox( st::resaleButtonSubtitle); state->cost->tillNextValue() | rpl::filter([=](TimeId left) { return !left; - }) | rpl::take(1) | rpl::start_with_next([=] { + }) | rpl::take(1) | rpl::on_next([=] { while (!button->children().isEmpty()) { delete button->children()[0]; } @@ -4505,7 +4505,7 @@ void UpgradeBox( [](QString text) { return Ui::Text::Link(text); }), st::resalePriceTableLink); link->setTryMakeSimilarLines(true); - button->geometryValue() | rpl::start_with_next([=](QRect geometry) { + button->geometryValue() | rpl::on_next([=](QRect geometry) { const auto outer = button->parentWidget()->height(); const auto top = geometry.y() + geometry.height(); const auto available = outer - top - st::boxRadius; @@ -4577,7 +4577,7 @@ void AddUniqueCloseButton( menu->show(); menu->raise(); } - box->widthValue() | rpl::start_with_next([=](int width) { + box->widthValue() | rpl::on_next([=](int width) { close->moveToRight(0, 0, width); close->raise(); if (menu) { @@ -4647,7 +4647,7 @@ void SubmitTonForm( const auto session = &show->session(); session->credits().tonLoad(); session->credits().tonLoadedValue( - ) | rpl::filter(rpl::mappers::_1) | rpl::start_with_next([=] { + ) | rpl::filter(rpl::mappers::_1) | rpl::on_next([=] { state->lifetime.destroy(); if (session->credits().tonBalance() < ton) { @@ -4915,7 +4915,7 @@ void SendGiftBox( tr::lng_gift_send_message(), QString(), limit); - text->changes() | rpl::start_with_next([=] { + text->changes() | rpl::on_next([=] { auto now = state->details.current(); auto textWithTags = text->getTextWithAppliedMarkdown(); now.text = TextWithEntities{ @@ -4987,7 +4987,7 @@ void SendGiftBox( tr::lng_gift_send_anonymous(), st::settingsButtonNoIcon) )->toggleOn(rpl::single(peer->isSelf()))->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { auto now = state->details.current(); now.anonymous = toggled; state->details = std::move(now); @@ -5011,7 +5011,7 @@ void SendGiftBox( Ui::Text::WithEntities), st::settingsButtonNoIcon) )->toggleOn(rpl::single(false))->toggledValue( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { auto now = state->details.current(); now.byStars = toggled; state->details = std::move(now); @@ -5081,7 +5081,7 @@ void SendGiftBox( .details = std::make_unique(details), })); bidBox->boxClosing( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); return; diff --git a/Telegram/SourceFiles/boxes/star_gift_preview_box.cpp b/Telegram/SourceFiles/boxes/star_gift_preview_box.cpp index 5ab6771c50..f3711624ec 100644 --- a/Telegram/SourceFiles/boxes/star_gift_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_preview_box.cpp @@ -367,7 +367,7 @@ void AttributeButton::setDocument(not_null document) { document->session().downloaderTaskFinished() ) | rpl::filter([=] { return media->loaded(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { _mediaLifetime.destroy(); auto result = std::unique_ptr(); @@ -709,7 +709,7 @@ void Delegate::update( document->session().downloaderTaskFinished() ) | rpl::filter([=] { return media->loaded(); - }) | rpl::start_with_next([=, &model] { + }) | rpl::on_next([=, &model] { model.mediaLifetime.destroy(); auto result = std::unique_ptr(); @@ -963,7 +963,7 @@ AttributesList::AttributesList( fill(); _tab.value( - ) | rpl::start_with_next([=](Tab tab) { + ) | rpl::on_next([=](Tab tab) { _entries = [&] { switch (tab) { case Tab::Model: return &_models; @@ -977,7 +977,7 @@ AttributesList::AttributesList( refreshAbout(); }, lifetime()); - _selected.value() | rpl::combine_previous() | rpl::start_with_next([=]( + _selected.value() | rpl::combine_previous() | rpl::on_next([=]( Selection was, Selection now) { const auto tab = _tab.current(); @@ -1356,7 +1356,7 @@ void StarGiftPreviewBox( &state->attributes, state->tab.value())); state->list->selected( - ) | rpl::start_with_next([=](Selection value) { + ) | rpl::on_next([=](Selection value) { state->fixed = value; state->paused = (value.model >= 0) || (value.pattern >= 0) @@ -1381,7 +1381,7 @@ void StarGiftPreviewBox( state->tab = tab; }); const auto icon = &active; - state->tab.value() | rpl::start_with_next([=](Tab now) { + state->tab.value() | rpl::on_next([=](Tab now) { raw->setTextFgOverride((now == tab) ? st::defaultActiveButton.textFg->c : std::optional()); @@ -1408,7 +1408,7 @@ void StarGiftPreviewBox( st::uniqueAttributeModelActive, Tab::Model); - state->paused.value() | rpl::start_with_next([=](bool paused) { + state->paused.value() | rpl::on_next([=](bool paused) { if (paused) { state->pushNextTimer.cancel(); } else { diff --git a/Telegram/SourceFiles/boxes/star_gift_resale_box.cpp b/Telegram/SourceFiles/boxes/star_gift_resale_box.cpp index 3a21ec0543..49bceb8186 100644 --- a/Telegram/SourceFiles/boxes/star_gift_resale_box.cpp +++ b/Telegram/SourceFiles/boxes/star_gift_resale_box.cpp @@ -302,7 +302,7 @@ struct ResaleTabs { }; state->filter.value( - ) | rpl::start_with_next([=](const ResaleGiftsFilter &fields) { + ) | rpl::on_next([=](const ResaleGiftsFilter &fields) { auto x = st::giftBoxResaleTabsMargin.left(); auto y = st::giftBoxResaleTabsMargin.top(); @@ -356,12 +356,12 @@ struct ResaleTabs { rpl::combine( raw->widthValue(), state->fullWidth.value() - ) | rpl::start_with_next([=](int outer, int inner) { + ) | rpl::on_next([=](int outer, int inner) { state->scrollMax = std::max(0, inner - outer); }, raw->lifetime()); raw->setMouseTracking(true); - raw->events() | rpl::start_with_next([=](not_null e) { + raw->events() | rpl::on_next([=](not_null e) { const auto type = e->type(); switch (type) { case QEvent::Leave: setSelected(-1); break; @@ -420,7 +420,7 @@ struct ResaleTabs { } }, raw->lifetime()); - raw->paintRequest() | rpl::start_with_next([=] { + raw->paintRequest() | rpl::on_next([=] { auto p = QPainter(raw); auto hq = PainterHighQualityEnabler(p); const auto padding = st::giftBoxTabPadding; @@ -501,7 +501,7 @@ void GiftResaleBox( countLabel->setTextColorOverride(st::windowSubTextFg->c); const auto content = box->verticalLayout(); - content->paintRequest() | rpl::start_with_next([=](QRect clip) { + content->paintRequest() | rpl::on_next([=](QRect clip) { QPainter(content).fillRect(clip, st::boxDividerBg); }, content->lifetime()); @@ -529,7 +529,7 @@ void GiftResaleBox( tr::lng_gift_resale_switch_to_ton())); #endif - box->heightValue() | rpl::start_with_next([=](int height) { + box->heightValue() | rpl::on_next([=](int height) { if (height > state->lastMinHeight) { state->lastMinHeight = height; box->setMinHeight(height); @@ -544,14 +544,14 @@ void GiftResaleBox( state->filter = std::move(tabs.filter); content->add(std::move(tabs.widget)); - state->filter.changes() | rpl::start_with_next([=](ResaleGiftsFilter value) { + state->filter.changes() | rpl::on_next([=](ResaleGiftsFilter value) { state->data.offset = QString(); state->loading = ResaleGiftsSlice( &peer->session(), state->data.giftId, value, QString() - ) | rpl::start_with_next([=](ResaleGiftsDescriptor &&slice) { + ) | rpl::on_next([=](ResaleGiftsDescriptor &&slice) { state->loading.destroy(); state->data.offset = slice.list.empty() ? QString() @@ -562,7 +562,7 @@ void GiftResaleBox( }, content->lifetime()); peer->owner().giftUpdates( - ) | rpl::start_with_next([=](const Data::GiftUpdate &update) { + ) | rpl::on_next([=](const Data::GiftUpdate &update) { using Action = Data::GiftUpdate::Action; const auto action = update.action; if (action != Action::Transfer && action != Action::ResaleChange) { @@ -608,7 +608,7 @@ void GiftResaleBox( state->data.giftId, state->filter.current(), state->data.offset - ) | rpl::start_with_next([=](ResaleGiftsDescriptor &&slice) { + ) | rpl::on_next([=](ResaleGiftsDescriptor &&slice) { state->loading.destroy(); state->data.offset = slice.list.empty() ? QString() @@ -656,7 +656,7 @@ rpl::lifetime ShowStarGiftResale( return Data::ResaleGiftsSlice( session, giftId - ) | rpl::start_with_next([=](ResaleGiftsDescriptor &&info) { + ) | rpl::on_next([=](ResaleGiftsDescriptor &&info) { if (const auto onstack = finishRequesting) { onstack(); } diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index 6d405550fb..5c8c267871 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -220,14 +220,14 @@ StickerPremiumMark::StickerPremiumMark( : _lockIcon(lockIcon) , _part(part) { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _lockGray = QImage(); _star = QImage(); }, _lifetime); Data::AmPremiumValue( session - ) | rpl::start_with_next([=](bool premium) { + ) | rpl::on_next([=](bool premium) { _premium = premium; }, _lifetime); } @@ -519,7 +519,7 @@ void StickerSetBox::prepare() { st::stickersScroll); _session->data().stickers().updated( _type - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateButtons(); }, lifetime()); @@ -532,12 +532,12 @@ void StickerSetBox::prepare() { updateTitleAndButtons(); _inner->updateControls( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateTitleAndButtons(); }, lifetime()); _inner->setInstalled( - ) | rpl::start_with_next([=](uint64 setId) { + ) | rpl::on_next([=](uint64 setId) { if (_inner->setType() == Data::StickersType::Masks) { showToast(tr::lng_masks_installed(tr::now)); } else if (_inner->setType() == Data::StickersType::Emoji) { @@ -551,12 +551,12 @@ void StickerSetBox::prepare() { }, lifetime()); _inner->errors( - ) | rpl::start_with_next([=](Error error) { + ) | rpl::on_next([=](Error error) { handleError(error); }, lifetime()); _inner->setArchived( - ) | rpl::start_with_next([=](uint64 setId) { + ) | rpl::on_next([=](uint64 setId) { const auto type = _inner->setType(); if (type == Data::StickersType::Emoji) { return; @@ -906,7 +906,7 @@ StickerSetBox::Inner::Inner( _session->api().updateStickers(); _session->downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateItems(); }, lifetime()); @@ -1501,7 +1501,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox( animation->start(); } sticker->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = Painter(sticker); if ([[maybe_unused]] const auto strong = weak.get()) { const auto paused = On(PowerSaving::kStickersPanel) @@ -1517,7 +1517,7 @@ void StickerSetBox::Inner::fillDeleteStickerBox( tr::lng_stickers_context_delete(), box->getDelegate()->style().title); line->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { sticker->moveToLeft(st::boxRowPadding.left(), 0); const auto skip = st::defaultBoxCheckbox.textPosition.x(); label->resizeToWidth(width @@ -1656,7 +1656,7 @@ not_null StickerSetBox::Inner::getLottiePlayer() { Lottie::Quality::Default, Lottie::MakeFrameRenderer()); _lottiePlayer->updates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateItems(); }, lifetime()); } diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 65d3c400bb..4e59808196 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -355,7 +355,7 @@ StickersBox::CounterWidget::CounterWidget( std::move( count - ) | rpl::start_with_next([=](int count) { + ) | rpl::on_next([=](int count) { setCounter(count); update(); }, lifetime()); @@ -447,7 +447,7 @@ StickersBox::StickersBox( , _installed(0, this, _show, megagroup, isEmoji) , _megagroupSet(megagroup) { _installed.widget()->scrollsToY( - ) | rpl::start_with_next([=](int y) { + ) | rpl::on_next([=](int y) { scrollToY(y); }, lifetime()); } @@ -607,7 +607,7 @@ void StickersBox::prepare() { _tabs->sectionActivated( ) | rpl::filter([=] { return !_ignoreTabActivation; - }) | rpl::start_with_next( + }) | rpl::on_next( [this] { switchTab(); }, lifetime()); refreshTabs(); @@ -700,7 +700,7 @@ void StickersBox::prepare() { : _isMasks ? Data::StickersType::Masks : Data::StickersType::Stickers - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { handleStickersUpdated(); }, lifetime()); @@ -715,13 +715,13 @@ void StickersBox::prepare() { for (const auto &widget : { _installed.widget(), _masks.widget() }) { if (widget) { widget->draggingScrollDelta( - ) | rpl::start_with_next([=](int delta) { + ) | rpl::on_next([=](int delta) { scrollByDraggingDelta(delta); }, widget->lifetime()); } } if (!_megagroupSet) { - boxClosing() | rpl::start_with_next([=] { + boxClosing() | rpl::on_next([=] { saveChanges(); }, lifetime()); } @@ -1305,7 +1305,7 @@ Main::Session &StickersBox::Inner::session() const { void StickersBox::Inner::setup() { session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); readVisibleSets(); }, lifetime()); @@ -1580,7 +1580,7 @@ void StickersBox::Inner::validateLottieAnimation(not_null row) { } row->lottie = std::move(player); row->lottie->updates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateRowThumbnail(row); }, lifetime()); } diff --git a/Telegram/SourceFiles/boxes/transfer_gift_box.cpp b/Telegram/SourceFiles/boxes/transfer_gift_box.cpp index ee1add5ea8..ec5adf5727 100644 --- a/Telegram/SourceFiles/boxes/transfer_gift_box.cpp +++ b/Telegram/SourceFiles/boxes/transfer_gift_box.cpp @@ -148,7 +148,7 @@ void ExportOnBlockchain( state->lifetime = session->api().cloudPassword().state( ) | rpl::take( 1 - ) | rpl::start_with_next([=](const Core::CloudPasswordState &pass) { + ) | rpl::on_next([=](const Core::CloudPasswordState &pass) { state->lifetime.destroy(); auto fields = PasscodeBox::CloudFields::From(pass); @@ -703,7 +703,7 @@ void ShowTransferGiftBox( box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); - box->noSearchSubmits() | rpl::start_with_next([=] { + box->noSearchSubmits() | rpl::on_next([=] { controllerRaw->noSearchSubmit(); }, box->lifetime()); }; @@ -1019,7 +1019,7 @@ void ShowBuyResaleGiftBox( }, }), st::boxRowPadding + st::resaleConfirmTonOnlyMargin); - tabs->activated() | rpl::start_with_next([=](QString id) { + tabs->activated() | rpl::on_next([=](QString id) { tabs->setActiveTab(id); state->ton = (id == u"ton"_q); }, tabs->lifetime()); diff --git a/Telegram/SourceFiles/boxes/translate_box.cpp b/Telegram/SourceFiles/boxes/translate_box.cpp index e805793b96..09c3b4636f 100644 --- a/Telegram/SourceFiles/boxes/translate_box.cpp +++ b/Telegram/SourceFiles/boxes/translate_box.cpp @@ -61,7 +61,7 @@ ShowButton::ShowButton(not_null parent) : RpWidget(parent) , _button(this, tr::lng_usernames_activate_confirm(tr::now)) { _button.sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { resize( s.width() + st::defaultEmojiSuggestions.fadeRight.width(), s.height()); @@ -161,7 +161,7 @@ void TranslateBox( rpl::combine( container->widthValue(), original->geometryValue() - ) | rpl::start_with_next([=](int width, const QRect &rect) { + ) | rpl::on_next([=](int width, const QRect &rect) { show->moveToLeft( width - show->width() - st::boxRowPadding.right(), rect.y() + std::abs(lineHeight - show->height()) / 2); @@ -169,7 +169,7 @@ void TranslateBox( original->entity()->heightValue( ) | rpl::filter([](int height) { return height > 0; - }) | rpl::take(1) | rpl::start_with_next([=](int height) { + }) | rpl::take(1) | rpl::on_next([=](int height) { if (height > lineHeight) { show->show(anim::type::instant); } @@ -189,7 +189,7 @@ void TranslateBox( state->to.value() | rpl::map(LanguageName)); // Workaround. - state->to.value() | rpl::start_with_next([=] { + state->to.value() | rpl::on_next([=] { subtitle->resizeToWidth(container->width() - padding.left() - padding.right()); @@ -257,7 +257,7 @@ void TranslateBox( Ui::Text::Italic(tr::lng_translate_box_error(tr::now))); }).send(); }; - state->to.value() | rpl::start_with_next(send, box->lifetime()); + state->to.value() | rpl::on_next(send, box->lifetime()); box->addLeftButton(tr::lng_settings_language(), [=] { if (loading->toggled()) { diff --git a/Telegram/SourceFiles/boxes/url_auth_box.cpp b/Telegram/SourceFiles/boxes/url_auth_box.cpp index 3047bbb771..8316b248ed 100644 --- a/Telegram/SourceFiles/boxes/url_auth_box.cpp +++ b/Telegram/SourceFiles/boxes/url_auth_box.cpp @@ -292,7 +292,7 @@ not_null UrlAuthBox::setupContent( auth->checked() ) | rpl::then( auth->checkedChanges() - ) | rpl::start_with_next([=](bool checked) { + ) | rpl::on_next([=](bool checked) { if (!checked) { allow->setChecked(false); } diff --git a/Telegram/SourceFiles/boxes/username_box.cpp b/Telegram/SourceFiles/boxes/username_box.cpp index 24635f9074..4f1fd483d8 100644 --- a/Telegram/SourceFiles/boxes/username_box.cpp +++ b/Telegram/SourceFiles/boxes/username_box.cpp @@ -370,15 +370,15 @@ void UsernamesBox( const auto finish = [=] { list->save( - ) | rpl::start_with_done([=] { + ) | rpl::on_done([=] { editor->save( - ) | rpl::start_with_done([=] { + ) | rpl::on_done([=] { box->closeBox(); }, box->lifetime()); }, box->lifetime()); }; editor->submitted( - ) | rpl::start_with_next(finish, editor->lifetime()); + ) | rpl::on_next(finish, editor->lifetime()); if (isBot) { box->addButton(tr::lng_close(), [=] { box->closeBox(); }); @@ -410,7 +410,7 @@ void AddUsernameCheckLabel( rpl::combine( std::move(checkInfo), container->widthValue() - ) | rpl::start_with_next([=](const UsernameCheckInfo &info, int w) { + ) | rpl::on_next([=](const UsernameCheckInfo &info, int w) { using Type = UsernameCheckInfo::Type; label->setMarkedText(info.text); const auto &color = (info.type == Type::Good) diff --git a/Telegram/SourceFiles/calls/calls_box_controller.cpp b/Telegram/SourceFiles/calls/calls_box_controller.cpp index 794291dc28..167dda11ae 100644 --- a/Telegram/SourceFiles/calls/calls_box_controller.cpp +++ b/Telegram/SourceFiles/calls/calls_box_controller.cpp @@ -207,7 +207,7 @@ void ListController::prepare() { session().changes().peerUpdates( Data::PeerUpdate::Flag::GroupCall - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { processPeer(update.peer); finishProcess(); }, lifetime()); @@ -493,7 +493,7 @@ Main::Session &BoxController::session() const { void BoxController::prepare() { session().data().itemRemoved( - ) | rpl::start_with_next([=](not_null item) { + ) | rpl::on_next([=](not_null item) { if (const auto row = rowForItem(item)) { row->itemRemoved(item); if (!row->hasItems()) { @@ -511,7 +511,7 @@ void BoxController::prepare() { ) | rpl::filter([=](const Data::MessageUpdate &update) { const auto media = update.item->media(); return (media != nullptr) && (media->call() != nullptr); - }) | rpl::start_with_next([=](const Data::MessageUpdate &update) { + }) | rpl::on_next([=](const Data::MessageUpdate &update) { insertRow(update.item, InsertWay::Prepend); }, lifetime()); @@ -790,7 +790,7 @@ void ClearCallsBox( st::inviteViaLinkIcon, QPoint()); result->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { icon->moveToLeft( st::inviteViaLinkIconPosition.x(), (height - st::inviteViaLinkIcon.height()) / 2); @@ -846,7 +846,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) { button->events( ) | rpl::filter([=](not_null e) { return (e->type() == QEvent::Enter); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { state->callsDelegate.peerListMouseLeftGeometry(); }, button->lifetime()); @@ -858,7 +858,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) { box->setWidth(state->callsController.contentWidth()); state->callsController.boxHeightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { box->setMinHeight(height); }, box->lifetime()); box->setTitle(tr::lng_call_box_title()); diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index 8e862fd76e..4eef6ee22f 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -530,7 +530,7 @@ void Call::setupMediaDevices() { _playbackDeviceId.changes() | rpl::filter([=] { return _instance && _setDeviceIdCallback; - }) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) { + }) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) { _setDeviceIdCallback(deviceId); // Value doesn't matter here, just trigger reading of the new value. @@ -539,7 +539,7 @@ void Call::setupMediaDevices() { _captureDeviceId.changes() | rpl::filter([=] { return _instance && _setDeviceIdCallback; - }) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) { + }) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) { _setDeviceIdCallback(deviceId); // Value doesn't matter here, just trigger reading of the new value. @@ -557,7 +557,7 @@ void Call::setupOutgoingVideo() { _videoOutgoing->setState(Webrtc::VideoState::Inactive); } _videoOutgoing->stateValue( - ) | rpl::start_with_next([=](Webrtc::VideoState state) { + ) | rpl::on_next([=](Webrtc::VideoState state) { if (state != Webrtc::VideoState::Inactive && cameraId().isEmpty() && !_videoCaptureIsScreencast) { @@ -598,7 +598,7 @@ void Call::setupOutgoingVideo() { _cameraDeviceId.changes( ) | rpl::filter([=] { return !_videoCaptureIsScreencast; - }) | rpl::start_with_next([=](Webrtc::DeviceResolvedId deviceId) { + }) | rpl::on_next([=](Webrtc::DeviceResolvedId deviceId) { const auto &id = deviceId.value; _videoCaptureDeviceId = id; if (_videoCapture) { @@ -822,7 +822,7 @@ bool Call::handleUpdate(const MTPPhoneCall &call) { box->sends( ) | rpl::take( 1 // Instead of keeping requestId. - ) | rpl::start_with_next([=](const Ui::RateCallBox::Result &r) { + ) | rpl::on_next([=](const Ui::RateCallBox::Result &r) { sender->request(MTPphone_SetCallRating( MTP_flags(0), MTP_inputPhoneCall( @@ -1196,7 +1196,7 @@ void Call::createAndStartController(const MTPDphoneCall &call) { raw->setIncomingVideoOutput(_videoIncoming->sink()); raw->setAudioOutputDuckingEnabled(settings.callAudioDuckingEnabled()); - _state.value() | rpl::start_with_next([=](State state) { + _state.value() | rpl::on_next([=](State state) { const auto track = (state != State::FailedHangingUp) && (state != State::Failed) && (state != State::HangingUp) @@ -1207,13 +1207,13 @@ void Call::createAndStartController(const MTPDphoneCall &call) { Core::App().mediaDevices().setCaptureMuteTracker(this, track); }, _instanceLifetime); - _muted.value() | rpl::start_with_next([=](bool muted) { + _muted.value() | rpl::on_next([=](bool muted) { Core::App().mediaDevices().setCaptureMuted(muted); }, _instanceLifetime); #if 0 Core::App().batterySaving().value( - ) | rpl::start_with_next([=](bool isSaving) { + ) | rpl::on_next([=](bool isSaving) { crl::on_main(weak, [=] { if (_instance) { _instance->setIsLowBatteryLevel(isSaving); diff --git a/Telegram/SourceFiles/calls/calls_controller_webrtc.cpp b/Telegram/SourceFiles/calls/calls_controller_webrtc.cpp index 6df83c2d5b..1b10e6044e 100644 --- a/Telegram/SourceFiles/calls/calls_controller_webrtc.cpp +++ b/Telegram/SourceFiles/calls/calls_controller_webrtc.cpp @@ -150,7 +150,7 @@ void WebrtcController::setOnStateUpdated( Fn onStateUpdated) { _stateUpdatedLifetime.destroy(); _impl->state().changes( - ) | rpl::start_with_next([=](CallState state) { + ) | rpl::on_next([=](CallState state) { onStateUpdated([&] { switch (state) { case CallState::Initializing: return TgVoipState::WaitInit; diff --git a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp index df927a123f..6cdc5f4ae4 100644 --- a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp +++ b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp @@ -205,7 +205,7 @@ base::unique_qptr CreateFingerprintAndSignalBars( call->user()->name())); raw->setMouseTracking(true); raw->events( - ) | rpl::start_with_next([=](not_null e) { + ) | rpl::on_next([=](not_null e) { if (e->type() == QEvent::MouseMove) { Ui::Tooltip::Show(kTooltipShowTimeoutMs, shower); } else if (e->type() == QEvent::Leave) { @@ -254,7 +254,7 @@ base::unique_qptr CreateFingerprintAndSignalBars( rpl::single(rpl::empty), Ui::Emoji::Updated(), style::PaletteChanged() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { background->fill(Qt::transparent); // Prepare. @@ -300,7 +300,7 @@ base::unique_qptr CreateFingerprintAndSignalBars( }, raw->lifetime()); raw->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { QPainter(raw).drawImage(raw->rect(), *background); }, raw->lifetime()); @@ -522,7 +522,7 @@ FingerprintBadge SetupFingerprintBadge( std::move( fingerprint - ) | rpl::start_with_next([=](const QByteArray &fingerprint) { + ) | rpl::on_next([=](const QByteArray &fingerprint) { auto buffered = base::BufferedRandom( kEmojiInCarousel * kEmojiInFingerprint); const auto now = crl::now(); @@ -615,7 +615,7 @@ void SetupFingerprintTooltip(not_null widget) { raw->toggleAnimated(true); }; - widget->events() | rpl::start_with_next([=](not_null e) { + widget->events() | rpl::on_next([=](not_null e) { const auto type = e->type(); if (type == QEvent::Enter) { // Enter events may come from widget destructors, @@ -681,7 +681,7 @@ void SetupFingerprintBadgeWidget( const auto ratio = style::DevicePixelRatio(); const auto esize = Ui::Emoji::GetSizeNormal(); const auto size = esize / ratio; - widget->widthValue() | rpl::start_with_next([=](int width) { + widget->widthValue() | rpl::on_next([=](int width) { static_assert(!(kEmojiInFingerprint % 2)); const auto available = width @@ -729,7 +729,7 @@ void SetupFingerprintBadgeWidget( }, lifetime); const auto cache = lifetime.make_state(); - button->paintRequest() | rpl::start_with_next([=] { + button->paintRequest() | rpl::on_next([=] { auto p = QPainter(button); const auto outer = button->rect(); @@ -770,7 +770,7 @@ void SetupFingerprintBadgeWidget( } }, lifetime); - std::move(repaints) | rpl::start_with_next([=] { + std::move(repaints) | rpl::on_next([=] { button->update(); }, lifetime); diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 8fb6a81f93..6af96a3012 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -259,7 +259,7 @@ void Instance::startOrJoinConferenceCall(StartConferenceInfo args) { const auto raw = call.get(); session->account().sessionChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { destroyGroupCall(raw); }, raw->lifetime()); @@ -432,7 +432,7 @@ void Instance::createCall( const auto raw = call.get(); user->session().account().sessionChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { destroyCall(raw); }, raw->lifetime()); @@ -446,7 +446,7 @@ void Instance::createCall( } if (raw->state() == Call::State::WaitingUserConfirmation) { _currentCallPanel->startOutgoingRequests( - ) | rpl::start_with_next([=](bool video) { + ) | rpl::on_next([=](bool video) { repeater.callback(video, true, repeater); }, raw->lifetime()); } else { @@ -488,7 +488,7 @@ void Instance::createGroupCall( const auto raw = call.get(); info.peer->session().account().sessionChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { destroyGroupCall(raw); }, raw->lifetime()); @@ -1182,7 +1182,7 @@ void Instance::showConferenceInvite( const auto raw = call.get(); user->session().account().sessionChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { destroyCall(raw); }, raw->lifetime()); diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 6293307ecd..b01c1f1d80 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -273,7 +273,7 @@ void Panel::initWindow() { : Flag::None; }); - _window->maximizeRequests() | rpl::start_with_next([=](bool maximized) { + _window->maximizeRequests() | rpl::on_next([=](bool maximized) { toggleFullScreen(maximized); }, lifetime()); // Don't do that, it looks awful :( @@ -307,12 +307,12 @@ void Panel::initWidget() { widget()->setMouseTracking(true); widget()->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { paint(clip); }, lifetime()); widget()->sizeValue( - ) | rpl::skip(1) | rpl::start_with_next([=] { + ) | rpl::skip(1) | rpl::on_next([=] { updateControlsGeometry(); }, lifetime()); } @@ -467,7 +467,7 @@ void Panel::initConferenceInvite() { + padding.right(); const auto height = add + userpics->height() + add; - _status->geometryValue() | rpl::start_with_next([=] { + _status->geometryValue() | rpl::on_next([=] { const auto top = _bodyTop + _bodySt->participantsTop; const auto left = (widget()->width() - width) / 2; raw->setGeometry(left, top, width, height); @@ -475,7 +475,7 @@ void Panel::initConferenceInvite() { label->move(add + userpics->width() + padding.left(), padding.top()); }, raw->lifetime()); - raw->paintRequest() | rpl::start_with_next([=] { + raw->paintRequest() | rpl::on_next([=] { auto p = QPainter(raw); auto hq = PainterHighQualityEnabler(p); const auto radius = raw->height() / 2.; @@ -579,7 +579,7 @@ void Panel::reinitWithCall(Call *call) { }); _call->confereceSupportedValue( - ) | rpl::start_with_next([=](bool supported) { + ) | rpl::on_next([=](bool supported) { _conferenceSupported = supported; _addPeople->toggle(_conferenceSupported && (_call->state() != State::WaitingUserConfirmation), @@ -592,7 +592,7 @@ void Panel::reinitWithCall(Call *call) { ) | rpl::map(rpl::mappers::_1 == Call::RemoteAudioState::Muted); rpl::duplicate( remoteMuted - ) | rpl::start_with_next([=](bool muted) { + ) | rpl::on_next([=](bool muted) { if (muted) { createRemoteAudioMute(); } else { @@ -601,7 +601,7 @@ void Panel::reinitWithCall(Call *call) { } }, _callLifetime); _call->remoteBatteryStateValue( - ) | rpl::start_with_next([=](Call::RemoteBatteryState state) { + ) | rpl::on_next([=](Call::RemoteBatteryState state) { if (state == Call::RemoteBatteryState::Low) { createRemoteLowBattery(); } else { @@ -621,13 +621,13 @@ void Panel::reinitWithCall(Call *call) { _window->backend()); _incoming->widget()->hide(); - _incoming->rp()->shownValue() | rpl::start_with_next([=] { + _incoming->rp()->shownValue() | rpl::on_next([=] { updateControlsShown(); }, _incoming->rp()->lifetime()); _hideControlsFilter = nullptr; _fullScreenOrMaximized.value( - ) | rpl::start_with_next([=](bool fullScreenOrMaximized) { + ) | rpl::on_next([=](bool fullScreenOrMaximized) { if (fullScreenOrMaximized) { class Filter final : public QObject { public: @@ -667,7 +667,7 @@ void Panel::reinitWithCall(Call *call) { }, _incoming->rp()->lifetime()); _call->mutedValue( - ) | rpl::start_with_next([=](bool mute) { + ) | rpl::on_next([=](bool mute) { _mute->entity()->setProgress(mute ? 1. : 0.); _mute->entity()->setText(mute ? tr::lng_call_unmute_audio() @@ -675,7 +675,7 @@ void Panel::reinitWithCall(Call *call) { }, _callLifetime); _call->videoOutgoing()->stateValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { { const auto active = _call->isSharingCamera(); _camera->setProgress(active ? 0. : 1.); @@ -692,12 +692,12 @@ void Panel::reinitWithCall(Call *call) { }, _callLifetime); _call->stateValue( - ) | rpl::start_with_next([=](State state) { + ) | rpl::on_next([=](State state) { stateChanged(state); }, _callLifetime); _call->videoIncoming()->renderNextFrame( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto track = _call->videoIncoming(); setIncomingSize(track->state() == Webrtc::VideoState::Active ? track->frameSize() @@ -714,14 +714,14 @@ void Panel::reinitWithCall(Call *call) { }, _callLifetime); _call->videoIncoming()->stateValue( - ) | rpl::start_with_next([=](Webrtc::VideoState state) { + ) | rpl::on_next([=](Webrtc::VideoState state) { setIncomingSize((state == Webrtc::VideoState::Active) ? _call->videoIncoming()->frameSize() : QSize()); }, _callLifetime); _call->videoOutgoing()->renderNextFrame( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto incoming = incomingFrameGeometry(); const auto outgoing = outgoingFrameGeometry(); widget()->update(outgoing); @@ -735,7 +735,7 @@ void Panel::reinitWithCall(Call *call) { rpl::single( rpl::empty_value() ) | rpl::then(_call->videoOutgoing()->renderNextFrame()) - ) | rpl::start_with_next([=](State state, auto) { + ) | rpl::on_next([=](State state, auto) { if (state != State::Ended && state != State::EndedByOtherDevice && state != State::Failed @@ -747,7 +747,7 @@ void Panel::reinitWithCall(Call *call) { }, _callLifetime); _call->errors( - ) | rpl::start_with_next([=](Error error) { + ) | rpl::on_next([=](Error error) { const auto text = [=] { switch (error.type) { case ErrorType::NoCamera: @@ -802,7 +802,7 @@ void Panel::createRemoteAudioMute() { _remoteAudioMute->setAttribute(Qt::WA_TransparentForMouseEvents); _remoteAudioMute->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(_remoteAudioMute); const auto r = _remoteAudioMute->rect(); @@ -839,7 +839,7 @@ void Panel::createRemoteLowBattery() { _remoteLowBattery->setAttribute(Qt::WA_TransparentForMouseEvents); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _remoteLowBattery = nullptr; createRemoteLowBattery(); }, _remoteLowBattery->lifetime()); @@ -865,7 +865,7 @@ void Panel::createRemoteLowBattery() { }(); _remoteLowBattery->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(_remoteLowBattery); const auto r = _remoteLowBattery->rect(); @@ -905,7 +905,7 @@ void Panel::initLayout() { ) | rpl::filter([=](const Data::PeerUpdate &update) { // _user may change for the same Panel. return (_call != nullptr) && (update.peer == _user); - }) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + }) | rpl::on_next([=](const Data::PeerUpdate &update) { _name->setText(_call->user()->name()); updateControlsGeometry(); }, lifetime()); diff --git a/Telegram/SourceFiles/calls/calls_panel_background.cpp b/Telegram/SourceFiles/calls/calls_panel_background.cpp index a98ab14105..709b14c331 100644 --- a/Telegram/SourceFiles/calls/calls_panel_background.cpp +++ b/Telegram/SourceFiles/calls/calls_panel_background.cpp @@ -34,7 +34,7 @@ PanelBackground::PanelBackground( _peer, Data::PeerUpdate::Flag::ColorProfile | Data::PeerUpdate::Flag::EmojiStatus - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateColors(); _brushSize = QSize(); if (_updateCallback) { @@ -46,7 +46,7 @@ PanelBackground::PanelBackground( _peer, Data::PeerUpdate::Flag::BackgroundEmoji | Data::PeerUpdate::Flag::EmojiStatus - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateEmojiId(); if (_updateCallback) { _updateCallback(); diff --git a/Telegram/SourceFiles/calls/calls_signal_bars.cpp b/Telegram/SourceFiles/calls/calls_signal_bars.cpp index 9d2f3c8703..94d2072670 100644 --- a/Telegram/SourceFiles/calls/calls_signal_bars.cpp +++ b/Telegram/SourceFiles/calls/calls_signal_bars.cpp @@ -24,7 +24,7 @@ SignalBars::SignalBars( _st.width + (_st.width + _st.skip) * (Call::kSignalBarCount - 1), _st.max); call->signalBarCountValue( - ) | rpl::start_with_next([=](int count) { + ) | rpl::on_next([=](int count) { changed(count); }, lifetime()); } diff --git a/Telegram/SourceFiles/calls/calls_top_bar.cpp b/Telegram/SourceFiles/calls/calls_top_bar.cpp index 74baba438f..3e3252fa9a 100644 --- a/Telegram/SourceFiles/calls/calls_top_bar.cpp +++ b/Telegram/SourceFiles/calls/calls_top_bar.cpp @@ -186,7 +186,7 @@ public: installEventFilter(this); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _crossLineMuteAnimation.invalidate(); }, lifetime()); } @@ -339,7 +339,7 @@ void TopBar::initControls() { muted ) | rpl::map( BarStateFromMuteState - ) | rpl::start_with_next([=](BarState state) { + ) | rpl::on_next([=](BarState state) { _isGroupConnecting = (state == BarState::Connecting); setMuted(state != BarState::Active); update(); @@ -387,7 +387,7 @@ void TopBar::initControls() { subscribeToMembersChanges(group); _isGroupConnecting.value( - ) | rpl::start_with_next([=](bool isConnecting) { + ) | rpl::on_next([=](bool isConnecting) { _mute->setAttribute( Qt::WA_TransparentForMouseEvents, isConnecting); @@ -401,7 +401,7 @@ void TopBar::initControls() { ) | rpl::filter([=](const Data::PeerUpdate &update) { // _user may change for the same Panel. return (_call != nullptr) && (update.peer == _call->user()); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { updateInfoLabels(); }, lifetime()); } @@ -491,7 +491,7 @@ void TopBar::initBlobsUnder( }); group->stateValue( - ) | rpl::start_with_next([=](Calls::GroupCall::State state) { + ) | rpl::on_next([=](Calls::GroupCall::State state) { if (state == Calls::GroupCall::State::HangingUp) { _blobs->hide(); } @@ -507,7 +507,7 @@ void TopBar::initBlobsUnder( std::move( hideBlobs ) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](bool hide) { + ) | rpl::on_next([=](bool hide) { if (hide) { state->paint.setLevel(0.); } @@ -530,7 +530,7 @@ void TopBar::initBlobsUnder( std::move( barGeometry - ) | rpl::start_with_next([=](QRect rect) { + ) | rpl::on_next([=](QRect rect) { _blobs->resize( rect.width(), (int)state->paint.maxRadius()); @@ -538,12 +538,12 @@ void TopBar::initBlobsUnder( }, lifetime()); shownValue( - ) | rpl::start_with_next([=](bool shown) { + ) | rpl::on_next([=](bool shown) { _blobs->setVisible(shown); }, lifetime()); _blobs->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { const auto hidden = state->hideAnimation.value( state->hideLastTime ? 1. : 0.); if (hidden == 1.) { @@ -563,7 +563,7 @@ void TopBar::initBlobsUnder( group->levelUpdates( ) | rpl::filter([=](const LevelUpdate &update) { return !state->hideLastTime && (update.value > state->lastLevel); - }) | rpl::start_with_next([=](const LevelUpdate &update) { + }) | rpl::on_next([=](const LevelUpdate &update) { if (state->lastLevel == 0.) { state->levelTimer.callEach(kBlobUpdateInterval); } @@ -597,7 +597,7 @@ void TopBar::subscribeToMembersChanges(not_null call) { std::move( realValue ) | rpl::before_next([=](not_null real) { - real->titleValue() | rpl::start_with_next([=] { + real->titleValue() | rpl::on_next([=] { updateInfoLabels(); }, lifetime()); }) | rpl::map([=](not_null real) { @@ -617,7 +617,7 @@ void TopBar::subscribeToMembersChanges(not_null call) { } } return false; - }) | rpl::start_with_next([=](const Ui::GroupCallBarContent &content) { + }) | rpl::on_next([=](const Ui::GroupCallBarContent &content) { _users = content.users; _usersCount = content.count; for (auto &user : _users) { @@ -630,7 +630,7 @@ void TopBar::subscribeToMembersChanges(not_null call) { }, lifetime()); _userpics->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { _userpicsWidth = width; updateControlsGeometry(); }, lifetime()); @@ -641,7 +641,7 @@ void TopBar::subscribeToMembersChanges(not_null call) { // _peer may change for the same Panel. const auto call = _groupCall.get(); return (call != nullptr) && (update.peer == call->peer()); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { updateInfoLabels(); }, lifetime()); } diff --git a/Telegram/SourceFiles/calls/calls_userpic.cpp b/Telegram/SourceFiles/calls/calls_userpic.cpp index a57b6ff19b..e1f55025df 100644 --- a/Telegram/SourceFiles/calls/calls_userpic.cpp +++ b/Telegram/SourceFiles/calls/calls_userpic.cpp @@ -58,25 +58,25 @@ void Userpic::setup(rpl::producer muted) { _content.setAttribute(Qt::WA_TransparentForMouseEvents); _content.paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { paint(); }, lifetime()); std::move( muted - ) | rpl::start_with_next([=](bool muted) { + ) | rpl::on_next([=](bool muted) { setMuted(muted); }, lifetime()); _peer->session().changes().peerFlagsValue( _peer, Data::PeerUpdate::Flag::Photo - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { processPhoto(); }, lifetime()); _peer->session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshPhoto(); }, lifetime()); diff --git a/Telegram/SourceFiles/calls/calls_video_bubble.cpp b/Telegram/SourceFiles/calls/calls_video_bubble.cpp index b6866e9fd4..733aad2814 100644 --- a/Telegram/SourceFiles/calls/calls_video_bubble.cpp +++ b/Telegram/SourceFiles/calls/calls_video_bubble.cpp @@ -30,17 +30,17 @@ void VideoBubble::setup() { applyDragMode(_dragMode); _content.paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { paint(); }, lifetime()); _track->stateValue( - ) | rpl::start_with_next([=](Webrtc::VideoState state) { + ) | rpl::on_next([=](Webrtc::VideoState state) { setState(state); }, lifetime()); _track->renderNextFrame( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (_track->frameSize().isEmpty()) { _track->markFrameShown(); } else { diff --git a/Telegram/SourceFiles/calls/calls_video_incoming.cpp b/Telegram/SourceFiles/calls/calls_video_incoming.cpp index 5020e0cf9d..1c562bb005 100644 --- a/Telegram/SourceFiles/calls/calls_video_incoming.cpp +++ b/Telegram/SourceFiles/calls/calls_video_incoming.cpp @@ -114,7 +114,7 @@ private: Panel::Incoming::RendererGL::RendererGL(not_null owner) : _owner(owner) { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _controlsShadowImage.invalidate(); }, _lifetime); } diff --git a/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp b/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp index ca3ed26b13..a71b00bc84 100644 --- a/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp +++ b/Telegram/SourceFiles/calls/group/calls_choose_join_as.cpp @@ -352,7 +352,7 @@ void ChooseJoinAsProcess::start( createRequest(); session->account().sessionChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _request = nullptr; }, _request->lifetime); @@ -476,7 +476,7 @@ void ChooseJoinAsProcess::processList( .labelFilter = filter, }); box->boxClosing( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _request = nullptr; }, _request->lifetime); @@ -490,7 +490,7 @@ void ChooseJoinAsProcess::processList( std::move(info), crl::guard(&_request->guard, [=](auto info) { finish(info); })); box->boxClosing( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _request = nullptr; }, _request->lifetime); diff --git a/Telegram/SourceFiles/calls/group/calls_cover_item.cpp b/Telegram/SourceFiles/calls/group/calls_cover_item.cpp index dc77bbe289..103ac7f64e 100644 --- a/Telegram/SourceFiles/calls/group/calls_cover_item.cpp +++ b/Telegram/SourceFiles/calls/group/calls_cover_item.cpp @@ -38,7 +38,7 @@ CoverItem::CoverItem( _cover.widget()->move(0, 0); _cover.moveRequests( - ) | rpl::start_with_next(userpic.move, lifetime()); + ) | rpl::on_next(userpic.move, lifetime()); } not_null CoverItem::action() const { diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index 7f9cbdaf51..e2a5be2ab7 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -635,7 +635,7 @@ GroupCall::GroupCall( _muted.value( ) | rpl::combine_previous( - ) | rpl::start_with_next([=](MuteState previous, MuteState state) { + ) | rpl::on_next([=](MuteState previous, MuteState state) { if (_instance) { updateInstanceMuteState(); } @@ -649,7 +649,7 @@ GroupCall::GroupCall( _instanceState.value( ) | rpl::filter([=] { return _hadJoinedState; - }) | rpl::start_with_next([=](InstanceState state) { + }) | rpl::on_next([=](InstanceState state) { if (state == InstanceState::Disconnected) { playConnectingSound(); } else { @@ -676,7 +676,7 @@ GroupCall::GroupCall( return not_null{ real }; }) | rpl::take( 1 - ) | rpl::start_with_next([=](not_null real) { + ) | rpl::on_next([=](not_null real) { subscribeToReal(real); _realChanges.fire_copy(real); }, _lifetime); @@ -769,16 +769,16 @@ void GroupCall::initConferenceE2E() { _e2e = std::make_unique(tde2eUserId); _e2e->subchainRequests( - ) | rpl::start_with_next([=](TdE2E::Call::SubchainRequest request) { + ) | rpl::on_next([=](TdE2E::Call::SubchainRequest request) { requestSubchainBlocks(request.subchain, request.height); }, _e2e->lifetime()); _e2e->sendOutboundBlock( - ) | rpl::start_with_next([=](QByteArray &&block) { + ) | rpl::on_next([=](QByteArray &&block) { sendOutboundBlock(std::move(block)); }, _e2e->lifetime()); - _e2e->failures() | rpl::start_with_next([=] { + _e2e->failures() | rpl::on_next([=] { LOG(("TdE2E: Got failure, scheduling rejoin!")); crl::on_main(this, [=] { startRejoin(); }); }, _e2e->lifetime()); @@ -792,7 +792,7 @@ void GroupCall::setupConferenceCall() { Expects(_sharedCall != nullptr); _sharedCall->staleParticipantIds( - ) | rpl::start_with_next([=](const base::flat_set &staleIds) { + ) | rpl::on_next([=](const base::flat_set &staleIds) { removeConferenceParticipants(staleIds, true); }, _lifetime); } @@ -803,7 +803,7 @@ void GroupCall::trackParticipantsWithAccess() { } _e2e->participantsSetValue( - ) | rpl::start_with_next([=](const TdE2E::ParticipantsSet &set) { + ) | rpl::on_next([=](const TdE2E::ParticipantsSet &set) { auto users = base::flat_set(); users.reserve(set.list.size()); for (const auto &id : set.list) { @@ -967,12 +967,12 @@ void GroupCall::subscribeToReal(not_null real) { _listenersHidden = real->listenersHidden(); real->scheduleDateValue( - ) | rpl::start_with_next([=](TimeId date) { + ) | rpl::on_next([=](TimeId date) { setScheduledDate(date); }, _lifetime); real->messagesEnabledValue( - ) | rpl::start_with_next([=](bool enabled) { + ) | rpl::on_next([=](bool enabled) { setMessagesEnabled(enabled); }, _lifetime); @@ -981,7 +981,7 @@ void GroupCall::subscribeToReal(not_null real) { Ui::PostponeCall(this, [=] { if (const auto real = lookupReal()) { real->participantsReloaded( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { fillActiveVideoEndpoints(); }, _lifetime); fillActiveVideoEndpoints(); @@ -990,7 +990,7 @@ void GroupCall::subscribeToReal(not_null real) { using Update = Data::GroupCall::ParticipantUpdate; real->participantUpdated( - ) | rpl::start_with_next([=](const Update &data) { + ) | rpl::on_next([=](const Update &data) { const auto regularEndpoint = [&](const std::string &endpoint) -> const std::string & { return (endpoint.empty() @@ -1067,7 +1067,7 @@ void GroupCall::subscribeToReal(not_null real) { }, _lifetime); real->participantsResolved( - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( not_null*> ssrcs) { @@ -1079,7 +1079,7 @@ void GroupCall::subscribeToReal(not_null real) { real->participantSpeaking( ) | rpl::filter([=] { return _videoEndpointLarge.current(); - }) | rpl::start_with_next([=](not_null p) { + }) | rpl::on_next([=](not_null p) { const auto now = crl::now(); if (_videoEndpointLarge.current().peer == p->peer) { _videoLargeTillTime = std::max( @@ -1350,7 +1350,7 @@ void GroupCall::initialJoinRequested() { real->participantUpdated( ) | rpl::filter([=](const Update &update) { return (_instance != nullptr); - }) | rpl::start_with_next([=](const Update &update) { + }) | rpl::on_next([=](const Update &update) { if (!update.now) { _instance->removeSsrcs({ update.was->ssrc, @@ -1472,7 +1472,7 @@ void GroupCall::markEndpointActive( const auto track = &i->second->track; track->renderNextFrame( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto activeTrack = _activeVideoTracks[endpoint].get(); const auto size = track->frameSize(); if (size.isEmpty()) { @@ -1494,7 +1494,7 @@ void GroupCall::markEndpointActive( ) | rpl::filter([=](Webrtc::VideoState state) { return (state == Webrtc::VideoState::Paused) && !_activeVideoTracks[endpoint]->shown; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { _activeVideoTracks[endpoint]->shown = true; markTrackShown(endpoint, true); }, i->second->lifetime); @@ -2671,7 +2671,7 @@ void GroupCall::applyOtherParticipantUpdate( void GroupCall::setupMediaDevices() { _playbackDeviceId.changes() | rpl::filter([=] { return _instance && _setDeviceIdCallback; - }) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) { + }) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) { _setDeviceIdCallback(deviceId); // Value doesn't matter here, just trigger reading of the new value. @@ -2680,7 +2680,7 @@ void GroupCall::setupMediaDevices() { _captureDeviceId.changes() | rpl::filter([=] { return _instance && _setDeviceIdCallback; - }) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) { + }) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) { _setDeviceIdCallback(deviceId); // Value doesn't matter here, just trigger reading of the new value. @@ -2689,12 +2689,12 @@ void GroupCall::setupMediaDevices() { _cameraDeviceId.changes() | rpl::filter([=] { return _cameraCapture != nullptr; - }) | rpl::start_with_next([=](const Webrtc::DeviceResolvedId &deviceId) { + }) | rpl::on_next([=](const Webrtc::DeviceResolvedId &deviceId) { _cameraCapture->switchToDevice(deviceId.value.toStdString(), false); }, _lifetime); if (!_rtmp) { - _muted.value() | rpl::start_with_next([=](MuteState state) { + _muted.value() | rpl::on_next([=](MuteState state) { const auto devices = &Core::App().mediaDevices(); const auto muted = (state != MuteState::Active) && (state != MuteState::PushToTalk); @@ -2804,7 +2804,7 @@ void GroupCall::setupOutgoingVideo() { ) | rpl::filter([=](VideoState previous, VideoState state) { // Recursive entrance may happen if error happens when activating. return (previous != state); - }) | rpl::start_with_next([=](VideoState previous, VideoState state) { + }) | rpl::on_next([=](VideoState previous, VideoState state) { const auto wasActive = (previous != VideoState::Inactive); const auto nowPaused = (state == VideoState::Paused); const auto nowActive = (state != VideoState::Inactive); @@ -2860,7 +2860,7 @@ void GroupCall::setupOutgoingVideo() { ) | rpl::filter([=](VideoState previous, VideoState state) { // Recursive entrance may happen if error happens when activating. return (previous != state); - }) | rpl::start_with_next([=](VideoState previous, VideoState state) { + }) | rpl::on_next([=](VideoState previous, VideoState state) { const auto wasActive = (previous != VideoState::Inactive); const auto nowPaused = (state == VideoState::Paused); const auto nowActive = (state != VideoState::Inactive); diff --git a/Telegram/SourceFiles/calls/group/calls_group_common.cpp b/Telegram/SourceFiles/calls/group/calls_group_common.cpp index d473d2ec1a..1a44fff548 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_common.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_common.cpp @@ -86,7 +86,7 @@ object_ptr MakeRoundActiveLogo( auto result = object_ptr(parent); const auto logo = result.data(); logo->resize(logo->width(), logoOuter.height()); - logo->paintRequest() | rpl::start_with_next([=, &icon] { + logo->paintRequest() | rpl::on_next([=, &icon] { if (logo->width() < logoOuter.width()) { return; } @@ -156,7 +156,7 @@ void ConferenceCallJoinConfirm( object_ptr(box), st::boxRowPadding + st::confcallJoinSepPadding); sep->resize(sep->width(), st::normalFont->height); - sep->paintRequest() | rpl::start_with_next([=] { + sep->paintRequest() | rpl::on_next([=] { auto p = QPainter(sep); const auto line = st::lineWidth; const auto top = st::confcallLinkFooterOrLineTop; @@ -323,7 +323,7 @@ void ShowConferenceCallLinkBox( }); close->geometryValue( - ) | rpl::start_with_next([=](QRect geometry) { + ) | rpl::on_next([=](QRect geometry) { toggle->moveToLeft( geometry.x() - toggle->width(), geometry.y()); @@ -380,7 +380,7 @@ void ShowConferenceCallLinkBox( box->widthValue(), copy->widthValue(), share->widthValue() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto width = st::boxWideWidth; const auto padding = st::confcallLinkBox.buttonPadding; const auto available = width - 2 * padding.right(); @@ -399,7 +399,7 @@ void ShowConferenceCallLinkBox( copy->parentWidget(), tr::lng_confcall_link_or(), st::confcallLinkFooterOr); - sep->paintRequest() | rpl::start_with_next([=] { + sep->paintRequest() | rpl::on_next([=] { auto p = QPainter(sep); const auto text = sep->textMaxWidth(); const auto white = (sep->width() - 2 * text) / 2; @@ -433,7 +433,7 @@ void ShowConferenceCallLinkBox( } return false; }); - copy->geometryValue() | rpl::start_with_next([=](QRect geometry) { + copy->geometryValue() | rpl::on_next([=](QRect geometry) { const auto width = st::boxWideWidth - st::boxRowPadding.left() - st::boxRowPadding.right(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_invite_controller.cpp b/Telegram/SourceFiles/calls/group/calls_group_invite_controller.cpp index 46fa70f933..bc4645e069 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_invite_controller.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_invite_controller.cpp @@ -51,7 +51,7 @@ namespace { const auto raw = result.data(); raw->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { auto p = QPainter(raw); p.fillRect(clip, st::groupCallMembersBgOver); }, raw->lifetime()); @@ -61,7 +61,7 @@ namespace { std::move(text), st::groupCallBoxLabel); raw->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto padding = st::groupCallInviteDividerPadding; const auto available = width - padding.left() - padding.right(); label->resizeToNaturalWidth(available); @@ -412,7 +412,7 @@ void ConfInviteRow::elementsPaint( const auto activate = [=] { content->submitted(); }; - content->noSearchSubmits() | rpl::start_with_next([=] { + content->noSearchSubmits() | rpl::on_next([=] { controller->toggleFirst(); }, content->lifetime()); @@ -676,7 +676,7 @@ void ConfInviteController::addShareLinkButton() { : st::createCallInviteLinkIcon), QPoint()); button->entity()->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { icon->moveToLeft( st::createCallInviteLinkIconPosition.x(), (height - st::groupCallInviteLinkIcon.height()) / 2); @@ -686,7 +686,7 @@ void ConfInviteController::addShareLinkButton() { button->entity()->events( ) | rpl::filter([=](not_null e) { return (e->type() == QEvent::Enter); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { delegate()->peerListMouseLeftGeometry(); }, button->lifetime()); delegate()->peerListSetAboveWidget(std::move(button)); @@ -787,7 +787,7 @@ void InviteContactsController::prepareViewHook() { std::move( _discoveredInGroup - ) | rpl::start_with_next([=](not_null user) { + ) | rpl::on_next([=](not_null user) { if (auto row = delegate()->peerListFindRow(user->id.value)) { delegate()->peerListRemoveRow(row); } @@ -846,7 +846,7 @@ object_ptr PrepareInviteBox( &st::groupCallMultiSelect); auto initBox = [=](not_null box) { box->setTitle(tr::lng_group_call_invite_conf()); - raw->hasSelectedValue() | rpl::start_with_next([=](bool has) { + raw->hasSelectedValue() | rpl::on_next([=](bool has) { box->clearButtons(); if (has) { box->addButton(tr::lng_group_call_confcall_add(), [=] { @@ -1018,7 +1018,7 @@ object_ptr PrepareInviteBox( &st::groupCallMultiSelect); auto initBox = [=](not_null box) { box->setTitle(tr::lng_group_call_invite_conf()); - raw->hasSelectedValue() | rpl::start_with_next([=](bool has) { + raw->hasSelectedValue() | rpl::on_next([=](bool has) { box->clearButtons(); if (has) { box->addButton(tr::lng_group_call_invite_button(), [=] { @@ -1067,7 +1067,7 @@ void InitReActivate(not_null box) { const auto header = CreateReActivateHeader(box); header->resizeToWidth(st::boxWideWidth); - header->heightValue() | rpl::start_with_next([=](int height) { + header->heightValue() | rpl::on_next([=](int height) { box->setAddedTopScrollSkip(height, true); }, header->lifetime()); header->moveToLeft(0, 0); @@ -1088,12 +1088,12 @@ object_ptr PrepareInviteToEmptyBox( const auto initBox = [=](not_null box) { InitReActivate(box); - box->noSearchSubmits() | rpl::start_with_next([=] { + box->noSearchSubmits() | rpl::on_next([=] { raw->noSearchSubmit(); }, box->lifetime()); raw->prioritizeScrollRequests( - ) | rpl::start_with_next([=](Ui::ScrollToRequest request) { + ) | rpl::on_next([=](Ui::ScrollToRequest request) { box->scrollTo(request); }, box->lifetime()); @@ -1171,12 +1171,12 @@ object_ptr PrepareCreateCallBox( box->setTitle(tr::lng_confcall_create_title()); } - box->noSearchSubmits() | rpl::start_with_next([=] { + box->noSearchSubmits() | rpl::on_next([=] { raw->noSearchSubmit(); }, box->lifetime()); raw->prioritizeScrollRequests( - ) | rpl::start_with_next([=](Ui::ScrollToRequest request) { + ) | rpl::on_next([=](Ui::ScrollToRequest request) { box->scrollTo(request); }, box->lifetime()); diff --git a/Telegram/SourceFiles/calls/group/calls_group_members.cpp b/Telegram/SourceFiles/calls/group/calls_group_members.cpp index 7a04d1a7b9..c3e4328e90 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_members.cpp @@ -241,7 +241,7 @@ Members::Controller::Controller( st::groupCallMembersBgOver) , _narrowRoundRect(ImageRoundRadius::Large, st::groupCallMembersBg) { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _inactiveCrossLine.invalidate(); _coloredCrossLine.invalidate(); _inactiveNarrowCrossLine.invalidate(); @@ -251,7 +251,7 @@ Members::Controller::Controller( rpl::combine( PowerSaving::OnValue(PowerSaving::kCalls), Core::App().appDeactivatedValue() - ) | rpl::start_with_next([=](bool disabled, bool deactivated) { + ) | rpl::on_next([=](bool disabled, bool deactivated) { const auto hide = disabled || deactivated; if (!(hide && _soundingAnimationHideLastTime)) { @@ -284,7 +284,7 @@ Members::Controller::Controller( _peer->session().changes().peerUpdates( Data::PeerUpdate::Flag::About - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { if (const auto row = findRow(update.peer)) { row->setAbout(update.peer->about()); } @@ -297,12 +297,12 @@ Members::Controller::~Controller() { void Members::Controller::setupListChangeViewers() { _call->real( - ) | rpl::start_with_next([=](not_null real) { + ) | rpl::on_next([=](not_null real) { subscribeToChanges(real); }, _lifetime); _call->levelUpdates( - ) | rpl::start_with_next([=](const LevelUpdate &update) { + ) | rpl::on_next([=](const LevelUpdate &update) { const auto i = _soundingRowBySsrc.find(update.ssrc); if (i != end(_soundingRowBySsrc)) { updateRowLevel(i->second, update.value); @@ -310,7 +310,7 @@ void Members::Controller::setupListChangeViewers() { }, _lifetime); _call->videoEndpointLargeValue( - ) | rpl::start_with_next([=](const VideoEndpoint &large) { + ) | rpl::on_next([=](const VideoEndpoint &large) { if (large) { hideRowsWithVideoExcept(large); } else { @@ -322,7 +322,7 @@ void Members::Controller::setupListChangeViewers() { ) | rpl::filter([=](const VideoStateToggle &update) { const auto &large = _call->videoEndpointLarge(); return large && (update.endpoint != large); - }) | rpl::start_with_next([=](const VideoStateToggle &update) { + }) | rpl::on_next([=](const VideoStateToggle &update) { if (update.value) { hideRowWithVideo(update.endpoint); } else { @@ -331,7 +331,7 @@ void Members::Controller::setupListChangeViewers() { }, _lifetime); _call->rejoinEvents( - ) | rpl::start_with_next([=](const Group::RejoinEvent &event) { + ) | rpl::on_next([=](const Group::RejoinEvent &event) { const auto guard = gsl::finally([&] { delegate()->peerListRefreshRows(); }); @@ -411,13 +411,13 @@ void Members::Controller::subscribeToChanges(not_null real) { _fullCount = real->fullCountValue(); real->participantsReloaded( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { prepareRows(real); }, _lifetime); using Update = Data::GroupCall::ParticipantUpdate; real->participantUpdated( - ) | rpl::start_with_next([=](const Update &update) { + ) | rpl::on_next([=](const Update &update) { Expects(update.was.has_value() || update.now.has_value()); const auto participantPeer = update.was @@ -444,7 +444,7 @@ void Members::Controller::subscribeToChanges(not_null real) { toggleVideoEndpointActive(endpoint, true); } _call->videoStreamActiveUpdates( - ) | rpl::start_with_next([=](const VideoStateToggle &update) { + ) | rpl::on_next([=](const VideoStateToggle &update) { toggleVideoEndpointActive(update.endpoint, update.value); }, _lifetime); } @@ -516,7 +516,7 @@ void Members::Controller::setupInvitedUsers() { _peer->owner().invitesToCalls( ) | rpl::filter([=](const Invite &invite) { return (invite.id == _call->id()); - }) | rpl::start_with_next([=](const Invite &invite) { + }) | rpl::on_next([=](const Invite &invite) { const auto user = invite.user; if (invite.removed) { if (const auto row = findRow(user)) { @@ -550,7 +550,7 @@ void Members::Controller::setupWithAccessUsers() { return; } conference->participantsWithAccessValue( - ) | rpl::start_with_next([=](base::flat_set &&nowIds) { + ) | rpl::on_next([=](base::flat_set &&nowIds) { for (auto i = begin(_withAccess); i != end(_withAccess);) { const auto oldId = *i; if (nowIds.remove(oldId)) { @@ -1610,7 +1610,7 @@ void Members::Controller::addMuteActionsToContextMenu( mutesFromVolume = volumeItem->toggleMuteRequests(); volumeItem->toggleMuteRequests( - ) | rpl::start_with_next([=](bool muted) { + ) | rpl::on_next([=](bool muted) { if (muted) { // Slider value is changed after the callback is called. // To capture good state inside the slider frame we postpone. @@ -1622,19 +1622,19 @@ void Members::Controller::addMuteActionsToContextMenu( }, volumeItem->lifetime()); volumeItem->toggleMuteLocallyRequests( - ) | rpl::start_with_next([=](bool muted) { + ) | rpl::on_next([=](bool muted) { if (!isMe(participantPeer)) { toggleMute(muted, true); } }, volumeItem->lifetime()); volumeItem->changeVolumeRequests( - ) | rpl::start_with_next([=](int volume) { + ) | rpl::on_next([=](int volume) { changeVolume(volume, false); }, volumeItem->lifetime()); volumeItem->changeVolumeLocallyRequests( - ) | rpl::start_with_next([=](int volume) { + ) | rpl::on_next([=](int volume) { if (!isMe(participantPeer)) { changeVolume(volume, true); } @@ -1680,7 +1680,7 @@ void Members::Controller::addMuteActionsToContextMenu( if (muteAction) { std::move( mutesFromVolume - ) | rpl::start_with_next([=](bool mutedFromVolume) { + ) | rpl::on_next([=](bool mutedFromVolume) { const auto state = _call->canManage() ? (mutedFromVolume ? (row->raisedHandRating() @@ -1869,7 +1869,7 @@ void Members::setupAddMember(not_null call) { _canAddMembers.value(), _canInviteByLink.value(), _mode.value() - ) | rpl::start_with_next([=](bool add, bool invite, PanelMode mode) { + ) | rpl::on_next([=](bool add, bool invite, PanelMode mode) { if (!add && !invite) { if (const auto old = _addMemberButton.current()) { delete old; @@ -1962,7 +1962,7 @@ void Members::setupList() { _layout.get(), st::groupCallMembersTopSkip)); result->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { QPainter(result).fillRect(clip, st::groupCallMembersBg); }, result->lifetime()); return result; @@ -1979,7 +1979,7 @@ void Members::setupList() { _list->heightValue() | rpl::map(_1 > 0), _addMemberButton.value() | rpl::map(_1 != nullptr) ) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](bool hasList, bool hasAddMembers) { + ) | rpl::on_next([=](bool hasList, bool hasAddMembers) { _topSkip->resize( _topSkip->width(), hasList ? st::groupCallMembersTopSkip : 0); @@ -1990,7 +1990,7 @@ void Members::setupList() { const auto skip = _layout->add(object_ptr(_layout.get())); _mode.value( - ) | rpl::start_with_next([=](PanelMode mode) { + ) | rpl::on_next([=](PanelMode mode) { skip->resize(skip->width(), (mode == PanelMode::Default) ? st::groupCallMembersBottomSkip : 0); @@ -1999,14 +1999,14 @@ void Members::setupList() { rpl::combine( _mode.value(), _layout->heightValue() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { resizeToList(); }, _layout->lifetime()); rpl::combine( _scroll->scrollTopValue(), _scroll->heightValue() - ) | rpl::start_with_next([=](int scrollTop, int scrollHeight) { + ) | rpl::on_next([=](int scrollTop, int scrollHeight) { _layout->setVisibleTopBottom(scrollTop, scrollTop + scrollHeight); }, _scroll->lifetime()); } @@ -2030,7 +2030,7 @@ void Members::setupFingerprint() { void Members::trackViewportGeometry() { _call->videoEndpointLargeValue( - ) | rpl::start_with_next([=](const VideoEndpoint &large) { + ) | rpl::on_next([=](const VideoEndpoint &large) { _viewport->showLarge(large); }, _viewport->lifetime()); @@ -2053,19 +2053,19 @@ void Members::trackViewportGeometry() { std::min(_scroll->height(), _viewport->fullHeight())); }; _layout->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { _viewport->resizeToWidth(width); resize(); }, _viewport->lifetime()); _scroll->heightValue( - ) | rpl::skip(1) | rpl::start_with_next(resize, _viewport->lifetime()); + ) | rpl::skip(1) | rpl::on_next(resize, _viewport->lifetime()); _scroll->scrollTopValue( - ) | rpl::skip(1) | rpl::start_with_next(move, _viewport->lifetime()); + ) | rpl::skip(1) | rpl::on_next(move, _viewport->lifetime()); _viewport->fullHeightValue( - ) | rpl::start_with_next([=](int viewport) { + ) | rpl::on_next([=](int viewport) { _videoWrap->resize(_videoWrap->width(), viewport); if (viewport > 0) { move(); @@ -2124,7 +2124,7 @@ void Members::setupFakeRoundCorners() { result->resize(size, size); result->setAttribute(Qt::WA_TransparentForMouseEvents); result->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { QPainter(result).drawImage( result->rect(), *image, @@ -2154,7 +2154,7 @@ void Members::setupFakeRoundCorners() { _shareLinkButton.value() | rpl::map( heightValue ) | rpl::flatten_latest() - ) | rpl::start_with_next([=](QRect list, int addMembers, int shareLink) { + ) | rpl::on_next([=](QRect list, int addMembers, int shareLink) { const auto left = list.x(); const auto top = list.y() - _topSkip->height(); const auto right = left + list.width() - topright->width(); @@ -2173,7 +2173,7 @@ void Members::setupFakeRoundCorners() { refreshImage(); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshImage(); topleft->update(); topright->update(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_members_row.cpp b/Telegram/SourceFiles/calls/group/calls_group_members_row.cpp index 0c5e6ca5c5..977d547ee1 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_members_row.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_members_row.cpp @@ -106,7 +106,7 @@ MembersRow::BlobsAnimation::BlobsAnimation( float maxLevel) : blobs(std::move(blobDatas), levelDuration, maxLevel) { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { userpicCache = QImage(); }, lifetime); } @@ -215,7 +215,7 @@ void MembersRow::setSpeaking(bool speaking) { _statusIcon->arcs.setStrokeRatio(kArcsStrokeRatio); _statusIcon->arcsWidth = _statusIcon->arcs.finishedWidth(); _statusIcon->arcs.startUpdateRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!_statusIcon->arcsAnimation.animating()) { _statusIcon->wasArcsWidth = _statusIcon->arcsWidth; } diff --git a/Telegram/SourceFiles/calls/group/calls_group_menu.cpp b/Telegram/SourceFiles/calls/group/calls_group_menu.cpp index b0f0d4af14..f9df5b7803 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_menu.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_menu.cpp @@ -132,7 +132,7 @@ JoinAsAction::JoinAsAction( setClickedCallback(std::move(callback)); paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Painter p(this); paint(p); }, lifetime()); @@ -182,7 +182,7 @@ void JoinAsAction::prepare() { rpl::combine( tr::lng_group_call_display_as_header(), Info::Profile::NameValue(_peer) - ) | rpl::start_with_next([=](QString text, QString name) { + ) | rpl::on_next([=](QString text, QString name) { const auto &padding = st::groupCallJoinAsPadding; _text.setMarkedText(_st.itemStyle, { text }, MenuTextOptions); _name.setMarkedText(_st.itemStyle, { name }, MenuTextOptions); @@ -253,7 +253,7 @@ RecordingAction::RecordingAction( + st::groupCallRecordingTimerPadding.bottom()) { std::move( startAtValues - ) | rpl::start_with_next([=](TimeId startAt) { + ) | rpl::on_next([=](TimeId startAt) { _startAt = startAt; _startedAt = crl::now(); _refreshTimer.cancel(); @@ -266,7 +266,7 @@ RecordingAction::RecordingAction( setClickedCallback(std::move(callback)); paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Painter p(this); paint(p); }, lifetime()); @@ -344,7 +344,7 @@ void RecordingAction::prepare(rpl::producer text) { _st.widthMax); setMinWidth(w); - std::move(text) | rpl::start_with_next([=](QString text) { + std::move(text) | rpl::on_next([=](QString text) { const auto &padding = _st.itemPadding; _text.setMarkedText(_st.itemStyle, { text }, MenuTextOptions); _textWidth = w - padding.left() - padding.right(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_message_field.cpp b/Telegram/SourceFiles/calls/group/calls_group_message_field.cpp index 5f26db6de9..a517de5a59 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_message_field.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_message_field.cpp @@ -167,7 +167,7 @@ void ReactionPanel::create() { _parent = std::make_unique(_outer); _parent->show(); - _parent->events() | rpl::start_with_next([=](not_null e) { + _parent->events() | rpl::on_next([=](not_null e) { if (e->type() == QEvent::MouseButtonPress) { const auto event = static_cast(e.get()); if (event->button() == Qt::LeftButton) { @@ -191,7 +191,7 @@ void ReactionPanel::create() { true); _selector->chosen( - ) | rpl::start_with_next([=](Chosen reaction) { + ) | rpl::on_next([=](Chosen reaction) { if (reaction.id.custom() && !_show->session().premium()) { ShowPremiumPreviewBox( _show, @@ -215,7 +215,7 @@ void ReactionPanel::create() { _fieldGeometry.value(), _shownValue.value(), _expanded.value() - ) | rpl::start_with_next([=](QRect field, float64 shown, bool expanded) { + ) | rpl::on_next([=](QRect field, float64 shown, bool expanded) { const auto width = margins.left() + _selector->countAppearedWidth(shown) + margins.right(); @@ -241,7 +241,7 @@ void ReactionPanel::create() { }, _selector->lifetime()); _selector->willExpand( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _expanded = true; const auto raw = _parent.get(); @@ -260,7 +260,7 @@ void ReactionPanel::create() { }); }, _selector->lifetime()); - _selector->escapes() | rpl::start_with_next([=] { + _selector->escapes() | rpl::on_next([=] { collapse(); }, _selector->lifetime()); } @@ -276,7 +276,7 @@ void ReactionPanel::fadeOutSelector() { raw->widget.setGeometry(geometry); raw->widget.show(); raw->widget.paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (const auto opacity = raw->animation.value(0.)) { auto p = QPainter(&raw->widget); p.setOpacity(opacity); @@ -349,7 +349,7 @@ void MessageField::createControls(PeerData *peer) { rpl::combine( _fieldFocused.value(), _fieldEmpty.value() - ) | rpl::start_with_next([=](bool focused, bool empty) { + ) | rpl::on_next([=](bool focused, bool empty) { if (!focused) { _reactionPanel->hideIfCollapsed(); } else if (empty) { @@ -360,7 +360,7 @@ void MessageField::createControls(PeerData *peer) { }, _field->lifetime()); _reactionPanel->chosen( - ) | rpl::start_with_next([=](Chosen reaction) { + ) | rpl::on_next([=](Chosen reaction) { if (const auto customId = reaction.id.custom()) { const auto document = _show->session().data().document(customId); if (const auto sticker = document->sticker()) { @@ -439,11 +439,11 @@ void MessageField::createControls(PeerData *peer) { panel->hide(); panel->selector()->setCurrentPeer(peer); panel->selector()->emojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::EmojiChosen data) { + ) | rpl::on_next([=](ChatHelpers::EmojiChosen data) { Ui::InsertEmojiAtCursor(_field->textCursor(), data.emoji); }, lifetime()); panel->selector()->customEmojiChosen( - ) | rpl::start_with_next([=](ChatHelpers::FileChosen data) { + ) | rpl::on_next([=](ChatHelpers::FileChosen data) { const auto info = data.document->sticker(); if (info && info->setType == Data::StickersType::Emoji @@ -467,7 +467,7 @@ void MessageField::createControls(PeerData *peer) { _width.value( ) | rpl::filter( rpl::mappers::_1 > 0 - ) | rpl::start_with_next([=](int newWidth) { + ) | rpl::on_next([=](int newWidth) { const auto fieldWidth = newWidth - st::historySendPadding - _emojiToggle->width() @@ -483,7 +483,7 @@ void MessageField::createControls(PeerData *peer) { rpl::combine( _width.value(), _field->heightValue() - ) | rpl::start_with_next([=](int width, int height) { + ) | rpl::on_next([=](int width, int height) { if (width <= 0) { return; } @@ -494,7 +494,7 @@ void MessageField::createControls(PeerData *peer) { updateWrapSize(); }, _lifetime); - _field->cancelled() | rpl::start_with_next([=] { + _field->cancelled() | rpl::on_next([=] { _closeRequests.fire({}); }, _lifetime); @@ -510,7 +510,7 @@ void MessageField::createControls(PeerData *peer) { rpl::merge( _field->submits() | rpl::to_empty, _send->clicks() | rpl::to_empty - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto text = _field->getTextWithTags(); if (text.text.size() <= _limit) { _submitted.fire(std::move(text)); @@ -527,7 +527,7 @@ void MessageField::updateEmojiPanelGeometry() { } void MessageField::setupBackground() { - _wrap->paintRequest() | rpl::start_with_next([=] { + _wrap->paintRequest() | rpl::on_next([=] { const auto radius = st::historySendSize.height() / 2.; auto p = QPainter(_wrap.get()); auto hq = PainterHighQualityEnabler(p); @@ -568,7 +568,7 @@ void MessageField::toggle(bool shown) { auto image = Ui::GrabWidgetToImage(_wrap.get()); _cache = std::make_unique(_parent); const auto raw = _cache.get(); - raw->paintRequest() | rpl::start_with_next([=] { + raw->paintRequest() | rpl::on_next([=] { auto p = QPainter(raw); auto hq = PainterHighQualityEnabler(p); const auto scale = raw->height() / float64(_wrap->height()); diff --git a/Telegram/SourceFiles/calls/group/calls_group_messages.cpp b/Telegram/SourceFiles/calls/group/calls_group_messages.cpp index 9f35bc988f..41e3c3df0a 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_messages.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_messages.cpp @@ -80,7 +80,7 @@ Messages::Messages(not_null call, not_null api) , _starsStatsTimer([=] { requestStarsStats(); }) { Ui::PostponeCall(_call, [=] { _call->real( - ) | rpl::start_with_next([=](not_null call) { + ) | rpl::on_next([=](not_null call) { _real = call; if (ready()) { sendPending(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp b/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp index 0fac740cfc..2821870e2a 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_messages_ui.cpp @@ -392,7 +392,7 @@ void MessagesUi::setupBadges() { _adminBadge.setText(st::messageTextStyle, tr::lng_admin_badge(tr::now)); _topDonors.value( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { for (auto &entry : _views) { const auto place = donorPlace(entry.from); if (entry.place != place) { @@ -419,7 +419,7 @@ void MessagesUi::setupList( rpl::combine( std::move(messages), std::move(shown) - ) | rpl::start_with_next([=](std::vector &&list, bool shown) { + ) | rpl::on_next([=](std::vector &&list, bool shown) { if (shown) { _hidden = std::nullopt; } else { @@ -500,7 +500,7 @@ void MessagesUi::showList(const std::vector &list) { void MessagesUi::handleIdUpdates(rpl::producer idUpdates) { std::move( idUpdates - ) | rpl::start_with_next([=](MessageIdUpdate update) { + ) | rpl::on_next([=](MessageIdUpdate update) { const auto i = ranges::find( _views, update.localId, @@ -1008,7 +1008,7 @@ void MessagesUi::startReactionAnimation(MessageView &entry) { rpl::combine( _scroll->scrollTopValue(), _scroll->RpWidget::positionValue() - ) | rpl::start_with_next([=](int yshift, QPoint point) { + ) | rpl::on_next([=](int yshift, QPoint point) { _reactionBasePosition = point - QPoint(0, yshift); for (auto &view : _views) { updateReactionPosition(view); @@ -1029,7 +1029,7 @@ void MessagesUi::startReactionAnimation(MessageView &entry) { const auto effectSize = st::reactionInlineImage * 2; const auto animation = entry.reactionAnimation.get(); raw->resize(effectSize, effectSize); - raw->paintRequest() | rpl::start_with_next([=] { + raw->paintRequest() | rpl::on_next([=] { if (animation->finished()) { crl::on_main(raw, [=] { removeReaction(raw); @@ -1166,7 +1166,7 @@ void MessagesUi::setupMessagesWidget() { scroll->scrollTopValue(), scroll->heightValue(), _messages->heightValue() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateTopFade(); updateBottomFade(); }, scroll->lifetime()); @@ -1177,7 +1177,7 @@ void MessagesUi::setupMessagesWidget() { receiveAllMouseEvents(); } - _messages->paintRequest() | rpl::start_with_next([=](QRect clip) { + _messages->paintRequest() | rpl::on_next([=](QRect clip) { const auto start = scroll->scrollTop(); const auto end = start + scroll->height(); const auto ratio = style::DevicePixelRatio(); @@ -1429,7 +1429,7 @@ void MessagesUi::receiveSomeMouseEvents() { } void MessagesUi::receiveAllMouseEvents() { - _messages->events() | rpl::start_with_next([=](not_null e) { + _messages->events() | rpl::on_next([=](not_null e) { const auto type = e->type(); if (type != QEvent::MouseButtonPress) { return; @@ -1529,7 +1529,7 @@ void MessagesUi::setupPinnedWidget() { scroll->scrollLeftValue(), scroll->widthValue(), _pinned->widthValue() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateLeftFade(); updateRightFade(); }, scroll->lifetime()); @@ -1570,7 +1570,7 @@ void MessagesUi::setupPinnedWidget() { }); animation->seconds.callEach(crl::time(1000)); - _pinned->paintRequest() | rpl::start_with_next([=](QRect clip) { + _pinned->paintRequest() | rpl::on_next([=](QRect clip) { const auto session = &_show->session(); const auto &colorings = session->appConfig().groupCallColorings(); const auto start = scroll->scrollLeft(); @@ -1713,7 +1713,7 @@ void MessagesUi::setupPinnedWidget() { } return MsgId(); }; - _pinned->events() | rpl::start_with_next([=](not_null e) { + _pinned->events() | rpl::on_next([=](not_null e) { const auto type = e->type(); if (type == QEvent::MouseButtonPress) { const auto pos = static_cast(e.get())->pos(); diff --git a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp index a38f6dc14f..6a26012a5d 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_panel.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_panel.cpp @@ -279,7 +279,7 @@ Panel::~Panel() { void Panel::setupRealCallViewers() { _call->real( - ) | rpl::start_with_next([=](not_null real) { + ) | rpl::on_next([=](not_null real) { subscribeToChanges(real); }, lifetime()); } @@ -338,7 +338,7 @@ void Panel::migrate(not_null channel) { void Panel::subscribeToPeerChanges() { Info::Profile::NameValue( _peer - ) | rpl::start_with_next([=](const QString &name) { + ) | rpl::on_next([=](const QString &name) { window()->setTitle(name); }, _peerLifetime); } @@ -383,7 +383,7 @@ void Panel::initWindow() { window()->setTitleStyle(st::groupCallTitle); if (_call->conference()) { - titleText() | rpl::start_with_next([=](const QString &text) { + titleText() | rpl::on_next([=](const QString &text) { window()->setTitle(text); }, lifetime()); } else { @@ -448,11 +448,11 @@ void Panel::initWindow() { }); _call->hasVideoWithFramesValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateMode(); }, lifetime()); - _window->maximizeRequests() | rpl::start_with_next([=](bool maximized) { + _window->maximizeRequests() | rpl::on_next([=](bool maximized) { if (_call->rtmp()) { toggleFullScreen(maximized); } else { @@ -462,7 +462,7 @@ void Panel::initWindow() { } }, lifetime()); - _window->showingLayer() | rpl::start_with_next([=] { + _window->showingLayer() | rpl::on_next([=] { hideStickedTooltip(StickedTooltipHide::Unavailable); }, lifetime()); @@ -476,12 +476,12 @@ void Panel::initWidget() { widget()->setMouseTracking(true); widget()->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { paint(clip); }, lifetime()); widget()->sizeValue( - ) | rpl::skip(1) | rpl::start_with_next([=](QSize size) { + ) | rpl::skip(1) | rpl::on_next([=](QSize size) { if (!updateMode()) { updateControlsGeometry(); } @@ -506,7 +506,7 @@ void Panel::toggleMessageTyping() { _messageField->toggle(true); _messageField->submitted( - ) | rpl::start_with_next([=](TextWithTags text) { + ) | rpl::on_next([=](TextWithTags text) { _call->sendMessage(std::move(text)); _messageField->toggle(false); @@ -514,17 +514,17 @@ void Panel::toggleMessageTyping() { updateWideControlsVisibility(); }, _messageField->lifetime()); - _messageField->heightValue() | rpl::start_with_next([=] { + _messageField->heightValue() | rpl::on_next([=] { updateButtonsGeometry(); }, _messageField->lifetime()); - _messageField->closeRequests() | rpl::start_with_next([=] { + _messageField->closeRequests() | rpl::on_next([=] { if (_messageTyping.current()) { toggleMessageTyping(); } }, _messageField->lifetime()); - _messageField->closed() | rpl::start_with_next([=] { + _messageField->closed() | rpl::on_next([=] { _messageField = nullptr; updateButtonsGeometry(); }, _messageField->lifetime()); @@ -576,7 +576,7 @@ void Panel::initControls() { _mute->clicks( ) | rpl::filter([=](Qt::MouseButton button) { return (button == Qt::LeftButton); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { if (_call->scheduleDate()) { if (_call->canManage()) { startScheduledNow(); @@ -611,7 +611,7 @@ void Panel::initControls() { rpl::combine( _mode.value(), _call->canManageValue() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshTopButton(); }, lifetime()); @@ -638,12 +638,12 @@ void Panel::initControls() { _peer, Data::PeerUpdate::Flag::Username ) | rpl::skip(1) | rpl::to_empty - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshLeftButton(); updateControlsGeometry(); }, _callLifetime); - std::move(started) | rpl::start_with_next([=] { + std::move(started) | rpl::on_next([=] { refreshVideoButtons(); updateButtonsStyles(); setupMembers(); @@ -658,19 +658,19 @@ void Panel::initControls() { || (state == State::Ended) || (state == State::FailedHangingUp) || (state == State::Failed); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { closeBeforeDestroy(); }, _callLifetime); _call->levelUpdates( ) | rpl::filter([=](const LevelUpdate &update) { return update.me; - }) | rpl::start_with_next([=](const LevelUpdate &update) { + }) | rpl::on_next([=](const LevelUpdate &update) { _mute->setLevel(update.value); }, _callLifetime); _call->real( - ) | rpl::start_with_next([=](not_null real) { + ) | rpl::on_next([=](not_null real) { setupRealMuteButtonState(real); }, _callLifetime); @@ -757,7 +757,7 @@ void Panel::refreshVideoButtons(std::optional overrideWideMode) { _video->setColorOverrides( toggleableOverrides(_call->isSharingCameraValue())); _call->isSharingCameraValue( - ) | rpl::start_with_next([=](bool sharing) { + ) | rpl::on_next([=](bool sharing) { if (sharing) { hideStickedTooltip( StickedTooltip::Camera, @@ -775,7 +775,7 @@ void Panel::refreshVideoButtons(std::optional overrideWideMode) { _screenShare->setColorOverrides( toggleableOverrides(_call->isSharingScreenValue())); _call->isSharingScreenValue( - ) | rpl::start_with_next([=](bool sharing) { + ) | rpl::on_next([=](bool sharing) { _screenShare->setProgress(sharing ? 1. : 0.); }, _screenShare->lifetime()); } @@ -869,7 +869,7 @@ void Panel::setupRealMuteButtonState(not_null real) { ) | rpl::distinct_until_changed( ) | rpl::filter( _2 != GroupCall::InstanceState::TransitionToRtc - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( MuteState mute, GroupCall::InstanceState state, TimeId scheduleDate, @@ -969,7 +969,7 @@ void Panel::setupScheduledLabels(rpl::producer date) { rpl::combine( widget()->sizeValue(), _startsIn->widthValue() - ) | rpl::start_with_next([=](QSize size, int width) { + ) | rpl::on_next([=](QSize size, int width) { _startsIn->move( (size.width() - width) / 2, top() + st::groupCallStartsInTop); @@ -978,7 +978,7 @@ void Panel::setupScheduledLabels(rpl::producer date) { rpl::combine( widget()->sizeValue(), _startsWhen->widthValue() - ) | rpl::start_with_next([=](QSize size, int width) { + ) | rpl::on_next([=](QSize size, int width) { _startsWhen->move( (size.width() - width) / 2, top() + st::groupCallStartsWhenTop); @@ -987,7 +987,7 @@ void Panel::setupScheduledLabels(rpl::producer date) { rpl::combine( widget()->sizeValue(), _countdown->widthValue() - ) | rpl::start_with_next([=](QSize size, int width) { + ) | rpl::on_next([=](QSize size, int width) { _countdown->move( (size.width() - width) / 2, top() + st::groupCallCountdownTop); @@ -1014,7 +1014,7 @@ void Panel::setupMembers() { _viewport->mouseInsideValue( ) | rpl::filter([=] { return !_rtmpFull; - }) | rpl::start_with_next([=](bool inside) { + }) | rpl::on_next([=](bool inside) { toggleWideControls(inside); }, _viewport->lifetime()); @@ -1025,27 +1025,27 @@ void Panel::setupMembers() { raiseControls(); _members->desiredHeightValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateMembersGeometry(); }, _members->lifetime()); _members->toggleMuteRequests( - ) | rpl::start_with_next([=](MuteRequest request) { + ) | rpl::on_next([=](MuteRequest request) { _call->toggleMute(request); }, _callLifetime); _members->changeVolumeRequests( - ) | rpl::start_with_next([=](VolumeRequest request) { + ) | rpl::on_next([=](VolumeRequest request) { _call->changeVolume(request); }, _callLifetime); _members->kickParticipantRequests( - ) | rpl::start_with_next([=](not_null participantPeer) { + ) | rpl::on_next([=](not_null participantPeer) { kickParticipant(participantPeer); }, _callLifetime); _members->addMembersRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (_call->conference()) { addMembers(); } else if (!_peer->isBroadcast() @@ -1060,10 +1060,10 @@ void Panel::setupMembers() { }, _callLifetime); _members->shareLinkRequests( - ) | rpl::start_with_next(shareConferenceLinkCallback(), _callLifetime); + ) | rpl::on_next(shareConferenceLinkCallback(), _callLifetime); _call->videoEndpointLargeValue( - ) | rpl::start_with_next([=](const VideoEndpoint &large) { + ) | rpl::on_next([=](const VideoEndpoint &large) { if (large && mode() != PanelMode::Wide) { enlargeVideo(); } @@ -1214,7 +1214,7 @@ void Panel::setupVideo(not_null viewport) { setupTile(endpoint, track); } _call->videoStreamActiveUpdates( - ) | rpl::start_with_next([=](const VideoStateToggle &update) { + ) | rpl::on_next([=](const VideoStateToggle &update) { if (update.value) { // Add async (=> the participant row is definitely in Members). const auto endpoint = update.endpoint; @@ -1232,14 +1232,14 @@ void Panel::setupVideo(not_null viewport) { }, viewport->lifetime()); viewport->pinToggled( - ) | rpl::start_with_next([=](bool pinned) { + ) | rpl::on_next([=](bool pinned) { _call->pinVideoEndpoint(pinned ? _call->videoEndpointLarge() : VideoEndpoint{}); }, viewport->lifetime()); viewport->clicks( - ) | rpl::start_with_next([=](VideoEndpoint &&endpoint) { + ) | rpl::on_next([=](VideoEndpoint &&endpoint) { if (_call->videoEndpointLarge() == endpoint) { _call->showVideoEndpointLarge({}); } else if (_call->videoEndpointPinned()) { @@ -1250,7 +1250,7 @@ void Panel::setupVideo(not_null viewport) { }, viewport->lifetime()); viewport->qualityRequests( - ) | rpl::start_with_next([=](const VideoQualityRequest &request) { + ) | rpl::on_next([=](const VideoQualityRequest &request) { _call->requestVideoQuality(request.endpoint, request.quality); }, viewport->lifetime()); } @@ -1319,7 +1319,7 @@ void Panel::subscribeToChanges(not_null real) { animate(); _recordingMark->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(_recordingMark.data()); auto hq = PainterHighQualityEnabler(p); p.setPen(Qt::NoPen); @@ -1338,7 +1338,7 @@ void Panel::subscribeToChanges(not_null real) { ) | rpl::map( _1 != 0 ) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](bool recorded) { + ) | rpl::on_next([=](bool recorded) { const auto livestream = _call->peer()->isBroadcast(); const auto isVideo = real->recordVideo(); if (recorded) { @@ -1367,12 +1367,12 @@ void Panel::subscribeToChanges(not_null real) { rpl::combine( _call->videoIsWorkingValue(), _call->isSharingCameraValue() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshVideoButtons(); showStickedTooltip(); }, lifetime()); - _call->messagesEnabledValue() | rpl::start_with_next([=] { + _call->messagesEnabledValue() | rpl::on_next([=] { updateButtonsGeometry(); raiseControls(); }, lifetime()); @@ -1380,12 +1380,12 @@ void Panel::subscribeToChanges(not_null real) { rpl::combine( _call->videoIsWorkingValue(), _call->isSharingScreenValue() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshTopButton(); }, lifetime()); _call->mutedValue( - ) | rpl::skip(1) | rpl::start_with_next([=](MuteState state) { + ) | rpl::skip(1) | rpl::on_next([=](MuteState state) { updateButtonsGeometry(); if (state == MuteState::Active || state == MuteState::PushToTalk) { @@ -1419,7 +1419,7 @@ void Panel::createPinOnTop() { } }; _fullScreenOrMaximized.value( - ) | rpl::start_with_next([=](bool fullScreenOrMaximized) { + ) | rpl::on_next([=](bool fullScreenOrMaximized) { _window->setControlsStyle(fullScreenOrMaximized ? st::callTitle : st::groupCallTitle); @@ -1436,7 +1436,7 @@ void Panel::createPinOnTop() { _viewport->rp()->events( ) | rpl::filter([](not_null event) { return (event->type() == QEvent::MouseMove); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { _hideControlsTimer.callOnce(kHideControlsTimeout); toggleWideControls(true); }, _hideControlsTimerLifetime); @@ -1491,7 +1491,7 @@ void Panel::refreshTopButton() { ) | rpl::then(_call->rejoinEvents( ) | rpl::map([](const RejoinEvent &event) { return event.nowJoinAs; - })) | rpl::start_with_next([=](not_null joinAs) { + })) | rpl::on_next([=](not_null joinAs) { auto joinAsToggle = object_ptr( widget(), joinAs, @@ -1739,7 +1739,7 @@ void Panel::initLayout(ConferencePanelMigration info) { _window->raiseControls(); _window->controlsLayoutChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { // _menuToggle geometry depends on _controls arrangement. crl::on_main(this, [=] { updateControlsGeometry(); }); }, lifetime()); @@ -1893,7 +1893,7 @@ void Panel::updateButtonsStyles() { void Panel::setupEmptyRtmp() { _call->emptyRtmpValue( - ) | rpl::start_with_next([=](bool empty) { + ) | rpl::on_next([=](bool empty) { if (!empty) { _emptyRtmp.destroy(); return; @@ -1924,13 +1924,13 @@ void Panel::setupEmptyRtmp() { _emptyRtmp->setAttribute(Qt::WA_TransparentForMouseEvents); _emptyRtmp->show(); _emptyRtmp->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(_emptyRtmp.data()); label->corners.paint(p, _emptyRtmp->rect()); }, _emptyRtmp->lifetime()); widget()->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto padding = st::groupCallWidth / 30; const auto width = std::min( size.width() - padding * 4, @@ -1987,7 +1987,7 @@ void Panel::refreshTitleBackground() { st::roundRadiusLarge, _controlsBackgroundColor.color()); _titleBackground->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(_titleBackground.data()); corners->paintSomeRounded( p, @@ -2014,7 +2014,7 @@ void Panel::setupControlsBackgroundNarrow() { QImage::Format_ARGB32_Premultiplied); rpl::single(rpl::empty) | rpl::then( style::PaletteChanged() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { full->fill(Qt::transparent); auto p = QPainter(full); @@ -2055,7 +2055,7 @@ void Panel::setupControlsBackgroundNarrow() { - st::groupCallMembersMargin.right()), height); _controlsBackgroundNarrow->shadow.paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { auto p = QPainter(&_controlsBackgroundNarrow->shadow); clip = clip.intersected(_controlsBackgroundNarrow->shadow.rect()); const auto inner = _members->getInnerGeometry().translated( @@ -2097,7 +2097,7 @@ void Panel::setupControlsBackgroundWide() { st::groupCallControlsBackRadius, _controlsBackgroundColor.color()); _controlsBackgroundWide->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(_controlsBackgroundWide.data()); corners->paint(p, _controlsBackgroundWide->rect()); }, lifetime); @@ -2111,7 +2111,7 @@ void Panel::trackControl(Ui::RpWidget *widget, rpl::lifetime &lifetime) { } const auto over = std::make_shared(); widget->events( - ) | rpl::start_with_next([=](not_null e) { + ) | rpl::on_next([=](not_null e) { const auto type = e->type(); if (type == QEvent::Enter) { // Enter events may come from widget destructors, @@ -2254,7 +2254,7 @@ void Panel::showNiceTooltip( rpl::combine( label->sizeValue(), button->sizeValue() - ) | rpl::start_with_next([=](QSize text, QSize close) { + ) | rpl::on_next([=](QSize text, QSize close) { const auto height = std::max(text.height(), close.height()); container->resize(text.width() + close.width(), height); label->move(0, (height - text.height()) / 2); @@ -2285,7 +2285,7 @@ void Panel::showNiceTooltip( base::qt_signal_producer( control.get(), &QObject::destroyed - ) | rpl::start_with_next(destroy, tooltip->lifetime()); + ) | rpl::on_next(destroy, tooltip->lifetime()); _niceTooltipControl = control; updateTooltipGeometry(); @@ -2765,7 +2765,7 @@ void Panel::refreshTitle() { refreshTitleColors(); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshTitleColors(); }, _title->lifetime()); } diff --git a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp index 0812608c17..a6ad667d06 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_rtmp.cpp @@ -140,7 +140,7 @@ void StartRtmpProcess::start( .done = std::move(done), }); session->account().sessionChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _request = nullptr; }, _request->lifetime); @@ -214,7 +214,7 @@ void StartRtmpProcess::createBox() { _request->show, _request->data.value()); object->boxClosing( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _request = nullptr; }, _request->lifetime); _request->box = base::make_weak(object.data()); @@ -272,7 +272,7 @@ void StartRtmpProcess::FillRtmpRows( const auto weak = container->add(std::move(wrap), rowPadding); Ui::AddSkip(container, st::groupCallRtmpCopyButtonBottomSkip); button->heightValue( - ) | rpl::start_with_next([=](int height) { + ) | rpl::on_next([=](int height) { weak->resize(weak->width(), height); }, container->lifetime()); return weak; diff --git a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp index 9f73004af9..aca8a90798 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_settings.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_settings.cpp @@ -377,7 +377,7 @@ void SettingsBox( ))->toggleOn(rpl::single( settings.groupCallNoiseSuppression() ))->toggledChanges( - ) | rpl::start_with_next([=](bool enabled) { + ) | rpl::on_next([=](bool enabled) { Core::App().settings().setGroupCallNoiseSuppression(enabled); call->setNoiseSuppression(enabled); Core::App().saveSettingsDelayed(); @@ -482,7 +482,7 @@ void SettingsBox( kCheckAccessibilityInterval ) | rpl::filter([] { return base::GlobalShortcutsAllowed(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { box->closeBox(); }, box->lifetime()); } @@ -579,7 +579,7 @@ void SettingsBox( settings.groupCallPushToTalk(), anim::type::instant); pushToTalk->toggledChanges( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { if (!toggled) { stopRecording(); } else if (!ensureManager()) { @@ -801,12 +801,12 @@ void SettingsBox( }); volumeItem->toggleMuteLocallyRequests( - ) | rpl::start_with_next([=](bool muted) { + ) | rpl::on_next([=](bool muted) { toggleMute(muted, true); }, volumeItem->lifetime()); volumeItem->changeVolumeLocallyRequests( - ) | rpl::start_with_next([=](int volume) { + ) | rpl::on_next([=](int volume) { changeVolume(volume, true); }, volumeItem->lifetime()); } @@ -849,7 +849,7 @@ void SettingsBox( box->setTitle(tr::lng_group_call_settings_title()); box->boxClosing( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (canChangeJoinMuted && muteJoined && muteJoined->toggled() != joinMuted) { diff --git a/Telegram/SourceFiles/calls/group/calls_group_toasts.cpp b/Telegram/SourceFiles/calls/group/calls_group_toasts.cpp index 67b6167805..7c9222ef94 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_toasts.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_toasts.cpp @@ -50,7 +50,7 @@ void Toasts::setupJoinAsChanged() { return _call->stateValue() | rpl::filter([](State state) { return (state == State::Joined); }) | rpl::take(1); - }) | rpl::flatten_latest() | rpl::start_with_next([=] { + }) | rpl::flatten_latest() | rpl::on_next([=] { _panel->uiShow()->showToast((_call->peer()->isBroadcast() ? tr::lng_group_call_join_as_changed_channel : tr::lng_group_call_join_as_changed)( @@ -70,7 +70,7 @@ void Toasts::setupTitleChanged() { return peer->groupCall()->title().isEmpty() ? peer->name() : peer->groupCall()->title(); - }) | rpl::start_with_next([=](const QString &title) { + }) | rpl::on_next([=](const QString &title) { _panel->uiShow()->showToast((_call->peer()->isBroadcast() ? tr::lng_group_call_title_changed_channel : tr::lng_group_call_title_changed)( @@ -83,7 +83,7 @@ void Toasts::setupTitleChanged() { void Toasts::setupAllowedToSpeak() { _call->allowedToSpeakNotifications( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (_panel->isActive()) { _panel->uiShow()->showToast( tr::lng_group_call_can_speak_here(tr::now)); @@ -112,7 +112,7 @@ void Toasts::setupPinnedVideo() { }) | rpl::flatten_latest( ) | rpl::filter([=] { return (_call->shownVideoTracks().size() > 1); - }) | rpl::start_with_next([=](const VideoEndpoint &endpoint) { + }) | rpl::on_next([=](const VideoEndpoint &endpoint) { const auto pinned = _call->videoEndpointPinned(); const auto peer = endpoint.peer; if (!peer) { @@ -147,7 +147,7 @@ void Toasts::setupPinnedVideo() { void Toasts::setupRequestedToSpeak() { _call->mutedValue( ) | rpl::combine_previous( - ) | rpl::start_with_next([=](MuteState was, MuteState now) { + ) | rpl::on_next([=](MuteState was, MuteState now) { if (was == MuteState::ForceMuted && now == MuteState::RaisedHand) { _panel->uiShow()->showToast( tr::lng_group_call_tooltip_raised_hand(tr::now)); @@ -157,7 +157,7 @@ void Toasts::setupRequestedToSpeak() { void Toasts::setupError() { _call->errors( - ) | rpl::start_with_next([=](Error error) { + ) | rpl::on_next([=](Error error) { const auto key = [&] { switch (error) { case Error::NoCamera: return tr::lng_call_error_no_camera; diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport.cpp b/Telegram/SourceFiles/calls/group/calls_group_viewport.cpp index 7fa5a3c8ad..1db9eaf97a 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport.cpp @@ -102,12 +102,12 @@ void Viewport::setup() { _content->sizeValue( ) | rpl::filter([=] { return wide() || videoStream(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { updateTilesGeometry(); }, lifetime()); _content->events( - ) | rpl::start_with_next([=](not_null e) { + ) | rpl::on_next([=](not_null e) { const auto type = e->type(); if (type == QEvent::Enter) { Ui::Integration::Instance().registerLeaveSubscription(raw); @@ -299,12 +299,12 @@ void Viewport::add( _tiles.back()->trackSizeValue( ) | rpl::filter([](QSize size) { return !size.isEmpty(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { updateTilesGeometry(); }, _tiles.back()->lifetime()); _tiles.back()->track()->stateValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateTilesGeometry(); }, _tiles.back()->lifetime()); } diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp index 7bf31ba2ab..94ce5cded8 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp @@ -308,7 +308,7 @@ Viewport::RendererGL::RendererGL(not_null owner) st::radialBg) { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _buttons.invalidate(); }, _lifetime); } diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.cpp b/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.cpp index 03dff5674e..6e1f2cb29a 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport_tile.cpp @@ -44,7 +44,7 @@ Viewport::VideoTile::VideoTile( _track.track->stateValue( ) | rpl::filter( _1 == Webrtc::VideoState::Paused - ) | rpl::take(1) | rpl::start_with_next([=] { + ) | rpl::take(1) | rpl::on_next([=] { _wasPaused = true; }, _lifetime); @@ -260,7 +260,7 @@ void Viewport::VideoTile::setup(rpl::producer pinned) { pinned ) | rpl::filter([=](bool pinned) { return (_pinned != pinned); - }) | rpl::start_with_next([=](bool pinned) { + }) | rpl::on_next([=](bool pinned) { _pinned = pinned; updateTopControlsSize(); if (!_hidden) { @@ -270,7 +270,7 @@ void Viewport::VideoTile::setup(rpl::producer pinned) { }, _lifetime); _track.track->renderNextFrame( - ) | rpl::start_with_next(_update, _lifetime); + ) | rpl::on_next(_update, _lifetime); updateTopControlsSize(); } diff --git a/Telegram/SourceFiles/calls/group/calls_volume_item.cpp b/Telegram/SourceFiles/calls/group/calls_volume_item.cpp index cf80b20c5c..90dd3aaa07 100644 --- a/Telegram/SourceFiles/calls/group/calls_volume_item.cpp +++ b/Telegram/SourceFiles/calls/group/calls_volume_item.cpp @@ -72,7 +72,7 @@ MenuVolumeItem::MenuVolumeItem( _slider->setAlwaysDisplayMarker(true); sizeValue( - ) | rpl::start_with_next([=](const QSize &size) { + ) | rpl::on_next([=](const QSize &size) { const auto geometry = QRect(QPoint(), size); _itemRect = geometry - _padding; _speakerRect = QRect(_itemRect.topLeft(), _stCross.icon.size()); @@ -90,7 +90,7 @@ MenuVolumeItem::MenuVolumeItem( setCloudVolume(startVolume); paintRequest( - ) | rpl::start_with_next([=](const QRect &clip) { + ) | rpl::on_next([=](const QRect &clip) { auto p = QPainter(this); const auto volume = _localMuted @@ -167,7 +167,7 @@ MenuVolumeItem::MenuVolumeItem( std::move( participantState - ) | rpl::start_with_next([=](const Group::ParticipantState &state) { + ) | rpl::on_next([=](const Group::ParticipantState &state) { const auto newMuted = state.mutedByMe; const auto newVolume = state.volume.value_or(0); @@ -210,7 +210,7 @@ void MenuVolumeItem::initArcsAnimation() { }); _arcs->startUpdateRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!_arcsAnimation.animating()) { *lastTime = crl::now(); _arcsAnimation.start(); @@ -218,7 +218,7 @@ void MenuVolumeItem::initArcsAnimation() { }, lifetime()); _arcs->stopUpdateRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _arcsAnimation.stop(); }, lifetime()); } diff --git a/Telegram/SourceFiles/calls/group/ui/calls_group_recording_box.cpp b/Telegram/SourceFiles/calls/group/ui/calls_group_recording_box.cpp index 6ee3bda246..90702ad6b7 100644 --- a/Telegram/SourceFiles/calls/group/ui/calls_group_recording_box.cpp +++ b/Telegram/SourceFiles/calls/group/ui/calls_group_recording_box.cpp @@ -121,7 +121,7 @@ RecordingInfo::RecordingInfo(not_null parent) : RpWidget(parent) , _container(this) { sizeValue( - ) | rpl::start_with_next([=](const QSize &size) { + ) | rpl::on_next([=](const QSize &size) { _container->resizeToWidth(size.width()); }, _container->lifetime()); } @@ -140,7 +140,7 @@ void RecordingInfo::prepareAudio() { audioIcon->setAttribute(Qt::WA_TransparentForMouseEvents); sizeValue( - ) | rpl::start_with_next([=](const QSize &size) { + ) | rpl::on_next([=](const QSize &size) { audioIcon->moveToLeft((size.width() - audioIcon->width()) / 2, 0); }, lifetime()); } @@ -175,7 +175,7 @@ void RecordingInfo::prepareVideo() { }; for (const auto icon : icons) { icon->clicks( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { for (const auto &i : icons) { i->setToggled(icon == i); } @@ -184,7 +184,7 @@ void RecordingInfo::prepareVideo() { } wrap->sizeValue( - ) | rpl::start_with_next([=](const QSize &size) { + ) | rpl::on_next([=](const QSize &size) { const auto wHalf = size.width() / icons.size(); for (auto i = 0; i < icons.size(); i++) { const auto &icon = icons[i]; @@ -230,7 +230,7 @@ Switcher::Switcher( }; sizeValue( - ) | rpl::start_with_next([=](const QSize &size) { + ) | rpl::on_next([=](const QSize &size) { _audio->resize(size.width(), size.height()); _video->resize(size.width(), size.height()); @@ -242,7 +242,7 @@ Switcher::Switcher( std::move( toggled - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { _toggled = toggled; _animation.start( updatePositions, @@ -281,7 +281,7 @@ void EditGroupCallTitleBox( box->closeBox(); done(result); }; - input->submits() | rpl::start_with_next(submit, input->lifetime()); + input->submits() | rpl::on_next(submit, input->lifetime()); box->addButton(tr::lng_settings_save(), submit); box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); } @@ -340,7 +340,7 @@ void AddTitleGroupCallRecordingBox( box->closeBox(); done(result); }; - input->submits() | rpl::start_with_next(submit, input->lifetime()); + input->submits() | rpl::on_next(submit, input->lifetime()); box->addButton(tr::lng_group_call_recording_start_button(), submit); box->addButton(tr::lng_cancel(), [=] { box->closeBox(); }); } diff --git a/Telegram/SourceFiles/calls/group/ui/calls_group_scheduled_labels.cpp b/Telegram/SourceFiles/calls/group/ui/calls_group_scheduled_labels.cpp index 3398089b62..ecdde9856f 100644 --- a/Telegram/SourceFiles/calls/group/ui/calls_group_scheduled_labels.cpp +++ b/Telegram/SourceFiles/calls/group/ui/calls_group_scheduled_labels.cpp @@ -99,7 +99,7 @@ object_ptr CreateGradientLabel( std::move( text - ) | rpl::start_with_next([=](const QString &text) { + ) | rpl::on_next([=](const QString &text) { state->path = QPainterPath(); const auto &font = st::groupCallCountdownFont; state->path.addText(0, font->ascent, font->f, text); @@ -116,7 +116,7 @@ object_ptr CreateGradientLabel( }, raw->lifetime()); raw->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(raw); auto hq = PainterHighQualityEnabler(p); const auto skip = st::groupCallWidth / 20; diff --git a/Telegram/SourceFiles/calls/group/ui/desktop_capture_choose_source.cpp b/Telegram/SourceFiles/calls/group/ui/desktop_capture_choose_source.cpp index 40712391b8..3dfc1fa526 100644 --- a/Telegram/SourceFiles/calls/group/ui/desktop_capture_choose_source.cpp +++ b/Telegram/SourceFiles/calls/group/ui/desktop_capture_choose_source.cpp @@ -147,14 +147,14 @@ Source::Source( , _activeRect(ImageRoundRadius::Large, st::groupCallMuted1) , _source(source) { _widget.paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { paint(); }, _widget.lifetime()); _label.setAttribute(Qt::WA_TransparentForMouseEvents); _widget.sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto padding = st::desktopCapturePadding; _label.resizeToNaturalWidth( size.width() - padding.left() - padding.right()); @@ -237,7 +237,7 @@ void Source::paint() { void Source::setupPreview() { _preview = std::make_unique(_source); _preview->track.renderNextFrame( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (_preview->track.frameSize().isEmpty()) { _preview->track.markFrameShown(); } @@ -341,7 +341,7 @@ void ChooseSourceProcess::setupPanel() { _window->setStaysOnTop(true); _window->body()->paintRequest( - ) | rpl::start_with_next([=](QRect clip) { + ) | rpl::on_next([=](QRect clip) { QPainter(_window->body()).fillRect(clip, st::groupCallMembersBg); }, _window->lifetime()); @@ -380,7 +380,7 @@ void ChooseSourceProcess::setupPanel() { _finish->widthValue(), _finish->shownValue(), cancel->widthValue() - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( int submitWidth, bool submitShown, int finishWidth, @@ -394,14 +394,14 @@ void ChooseSourceProcess::setupPanel() { }, _bottom->lifetime()); _withAudio->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto top = (bottomHeight - _withAudio->heightNoMargins()) / 2; _withAudio->moveToLeft(bottomSkip, top); }, _withAudio->lifetime()); _withAudio->setChecked(_delegate->chooseSourceActiveWithAudio()); _withAudio->checkedChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateButtonsVisibility(); }, _withAudio->lifetime()); @@ -410,7 +410,7 @@ void ChooseSourceProcess::setupPanel() { _submit->setVisible(!sharing); _window->body()->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { _scroll->setGeometry( 0, 0, @@ -419,7 +419,7 @@ void ChooseSourceProcess::setupPanel() { }, _scroll->lifetime()); _scroll->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto rows = int(std::ceil(_sources.size() / float(kColumns))); const auto innerHeight = margins.top() + rows * st::desktopCaptureSourceSize.height() @@ -435,7 +435,7 @@ void ChooseSourceProcess::setupPanel() { _window->events( ) | rpl::filter([=](not_null e) { return e->type() == QEvent::Close; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { destroy(); }, _window->lifetime()); } @@ -481,7 +481,7 @@ void ChooseSourceProcess::fillSources() { _sources.back()->activations( ) | rpl::filter([=] { return (_selected != raw); - }) | rpl::start_with_next([=]{ + }) | rpl::on_next([=]{ if (_selected) { _selected->setActive(false); } @@ -524,7 +524,7 @@ void ChooseSourceProcess::setupSourcesGeometry() { return; } _inner->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto rows = int(std::ceil(_sources.size() / float(kColumns))); const auto margins = st::desktopCaptureMargins; const auto skips = st::desktopCaptureSourceSkips; @@ -554,7 +554,7 @@ void ChooseSourceProcess::setupSourcesGeometry() { rpl::combine( _scroll->scrollTopValue(), _scroll->heightValue() - ) | rpl::start_with_next([=](int scrollTop, int scrollHeight) { + ) | rpl::on_next([=](int scrollTop, int scrollHeight) { const auto rows = int(std::ceil(_sources.size() / float(kColumns))); const auto margins = st::desktopCaptureMargins; const auto skips = st::desktopCaptureSourceSkips; diff --git a/Telegram/SourceFiles/calls/ui/calls_device_menu.cpp b/Telegram/SourceFiles/calls/ui/calls_device_menu.cpp index 1db1941c0e..bcbb91918f 100644 --- a/Telegram/SourceFiles/calls/ui/calls_device_menu.cpp +++ b/Telegram/SourceFiles/calls/ui/calls_device_menu.cpp @@ -116,7 +116,7 @@ Selector::Selector( const auto group = std::make_shared(); std::move( chosen - ) | rpl::start_with_next([=](Webrtc::DeviceResolvedId id) { + ) | rpl::on_next([=](Webrtc::DeviceResolvedId id) { const auto value = id.isDefault() ? 0 : registerId(id.value); if (!group->hasValue() || group->current() != value) { group->setValue(value); @@ -138,7 +138,7 @@ Selector::Selector( std::move( devices - ) | rpl::start_with_next([=](const std::vector &v) { + ) | rpl::on_next([=](const std::vector &v) { while (_list->count()) { delete _list->widgetAt(0); } diff --git a/Telegram/SourceFiles/chat_helpers/emoji_interactions.cpp b/Telegram/SourceFiles/chat_helpers/emoji_interactions.cpp index 9f7fe7bb28..bd2c21bffc 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_interactions.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_interactions.cpp @@ -53,7 +53,7 @@ EmojiInteractions::EmojiInteractions(not_null session) _session->changes().messageUpdates( Data::MessageUpdate::Flag::Destroyed | Data::MessageUpdate::Flag::Edited - ) | rpl::start_with_next([=](const Data::MessageUpdate &update) { + ) | rpl::on_next([=](const Data::MessageUpdate &update) { if (update.flags & Data::MessageUpdate::Flag::Destroyed) { _outgoing.remove(update.item); _incoming.remove(update.item); @@ -408,7 +408,7 @@ void EmojiInteractions::setWaitingForDownload(bool waiting) { _waitingForDownload = waiting; if (_waitingForDownload) { _session->downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { check(); }, _downloadCheckLifetime); } else { diff --git a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp index 500de20b6c..3382489d5c 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_keywords.cpp @@ -523,7 +523,7 @@ void EmojiKeywords::handleSessionChanges() { Core::App().domain().activeSessionValue( // #TODO multi someSessionValue ) | rpl::map([](Main::Session *session) { return session ? &session->api() : nullptr; - }) | rpl::start_with_next([=](ApiWrap *api) { + }) | rpl::on_next([=](ApiWrap *api) { apiChanged(api); }, _lifetime); } @@ -536,7 +536,7 @@ void EmojiKeywords::apiChanged(ApiWrap *api) { ) | rpl::filter([=] { // Refresh with the suggested language if we already were asked. return !_data.empty(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { refresh(); }, _suggestedChangeLifetime); })); diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp index 7c3a3a2744..ea360807ed 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp @@ -518,7 +518,7 @@ EmojiListWidget::EmojiListWidget( if (_mode == Mode::ChannelStatus) { session().api().peerPhoto().emojiListValue( Api::PeerPhoto::EmojiListType::NoChannelStatus - ) | rpl::start_with_next([=](const std::vector &list) { + ) | rpl::on_next([=](const std::vector &list) { _restrictedCustomList = { begin(list), end(list) }; if (!_custom.empty()) { refreshCustom(); @@ -526,7 +526,7 @@ EmojiListWidget::EmojiListWidget( }, lifetime()); } else if (_mode == Mode::EmojiStatus && _features.collectibleStatus) { session().data().emojiStatuses().collectiblesUpdates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshCustom(); }, lifetime()); } @@ -543,12 +543,12 @@ EmojiListWidget::EmojiListWidget( } _picker->chosen( - ) | rpl::start_with_next([=](EmojiChosen data) { + ) | rpl::on_next([=](EmojiChosen data) { colorChosen(data); }, lifetime()); _picker->hidden( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { pickerHidden(); }, lifetime()); @@ -556,14 +556,14 @@ EmojiListWidget::EmojiListWidget( Data::PeerUpdate::Flag::EmojiSet ) | rpl::filter([=](const Data::PeerUpdate &update) { return (update.peer.get() == _megagroupSet); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { refreshCustom(); resizeToWidth(width()); }, lifetime()); session().data().stickers().updated( Data::StickersType::Emoji - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshCustom(); resizeToWidth(width()); }, lifetime()); @@ -571,7 +571,7 @@ EmojiListWidget::EmojiListWidget( rpl::combine( Data::AmPremiumValue(&session()), session().premiumPossibleValue() - ) | rpl::skip(1) | rpl::start_with_next([=] { + ) | rpl::skip(1) | rpl::on_next([=] { refreshCustom(); resizeToWidth(width()); }, lifetime()); @@ -580,7 +580,7 @@ EmojiListWidget::EmojiListWidget( rpl::empty ) | rpl::then( style::PaletteChanged() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { initButton(_add, tr::lng_stickers_featured_add(tr::now), false); initButton(_unlock, tr::lng_emoji_featured_unlock(tr::now), true); initButton(_restore, tr::lng_emoji_premium_restore(tr::now), true); @@ -942,7 +942,7 @@ object_ptr EmojiListWidget::createFooter() { _footer = result; _footer->setChosen( - ) | rpl::start_with_next([=](uint64 setId) { + ) | rpl::on_next([=](uint64 setId) { showSet(setId); }, _footer->lifetime()); @@ -1063,7 +1063,7 @@ void EmojiListWidget::setColorAllForceRippled(bool force) { _colorAllRippleForcedLifetime = style::PaletteChanged( ) | rpl::filter([=] { return _colorAllRipple != nullptr; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { _colorAllRipple->forceRepaint(); }); if (!_colorAllRipple) { diff --git a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp index 70868b7b5f..924b3b60fb 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp @@ -391,7 +391,7 @@ void Row::setupHandler() { const auto &state = _state.current(); return !_switching && (v::is(state) || v::is(state)); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { if (v::is(_state.current())) { load(); return; @@ -410,7 +410,7 @@ void Row::setupHandler() { _state.value( ) | rpl::map([=](const SetState &state) { return v::is(state) || v::is(state); - }) | rpl::start_with_next([=](bool active) { + }) | rpl::on_next([=](bool active) { setDisabled(!active); setPointerCursor(active); }, lifetime()); @@ -435,7 +435,7 @@ void Row::setupLabels(const Set &set) { _status->setAttribute(Qt::WA_TransparentForMouseEvents); sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto left = st::manageEmojiPreviewPadding.left() + st::manageEmojiPreviewWidth + st::manageEmojiPreviewPadding.right(); @@ -487,7 +487,7 @@ void Row::setupAnimation() { using namespace rpl::mappers; _state.value( - ) | rpl::start_with_next([=](const SetState &state) { + ) | rpl::on_next([=](const SetState &state) { update(); }, lifetime()); @@ -495,7 +495,7 @@ void Row::setupAnimation() { ) | rpl::map( _1 == SetState{ Active() } ) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](bool toggled) { + ) | rpl::on_next([=](bool toggled) { _toggled.start( [=] { updateStatusColorOverride(); update(); }, toggled ? 0. : 1., @@ -507,7 +507,7 @@ void Row::setupAnimation() { ) | rpl::map([](const SetState &state) { return v::is(state) || v::is(state); }) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](bool active) { + ) | rpl::on_next([=](bool active) { _active.start( [=] { update(); }, active ? 0. : 1., @@ -519,7 +519,7 @@ void Row::setupAnimation() { ) | rpl::map([](const SetState &state) { return std::get_if(&state); }) | rpl::distinct_until_changed( - ) | rpl::start_with_next([=](const Loading *loading) { + ) | rpl::on_next([=](const Loading *loading) { if (loading && !_loading) { _loading = std::make_unique( [=](crl::time now) { radialAnimationCallback(now); }); diff --git a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp index 49791a045e..00e0c0e243 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp @@ -763,15 +763,15 @@ SuggestionsController::SuggestionsController( [=] { handleCursorPositionChange(); }); _suggestions->toggleAnimated( - ) | rpl::start_with_next([=](bool visible) { + ) | rpl::on_next([=](bool visible) { suggestionsUpdated(visible); }, _lifetime); _suggestions->triggered( - ) | rpl::start_with_next([=](const SuggestionsWidget::Chosen &chosen) { + ) | rpl::on_next([=](const SuggestionsWidget::Chosen &chosen) { replaceCurrent(chosen.emoji, chosen.customData); }, _lifetime); Core::App().emojiKeywords().refreshed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _keywordsRefreshed = true; if (!_showExactTimer.isActive()) { showWithQuery(_lastShownQuery); @@ -783,7 +783,7 @@ SuggestionsController::SuggestionsController( _container->shownValue( ) | rpl::filter([=](bool shown) { return shown && !_shown; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { _container->hide(); }, _container->lifetime()); diff --git a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp index 209dab9f52..eceea7ee3e 100644 --- a/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp +++ b/Telegram/SourceFiles/chat_helpers/field_autocomplete.cpp @@ -228,7 +228,7 @@ FieldAutocomplete::FieldAutocomplete( _inner->setGeometry(rect()); _inner->scrollToRequested( - ) | rpl::start_with_next([=](Inner::ScrollTo data) { + ) | rpl::on_next([=](Inner::ScrollTo data) { _scroll->scrollToY(data.top, data.bottom); }, lifetime()); @@ -238,7 +238,7 @@ FieldAutocomplete::FieldAutocomplete( hide(); _scroll->geometryChanged( - ) | rpl::start_with_next(crl::guard(_inner, [=] { + ) | rpl::on_next(crl::guard(_inner, [=] { _inner->onParentGeometryChanged(); }), lifetime()); } @@ -910,12 +910,12 @@ FieldAutocomplete::Inner::Inner( , _premiumMark(_session, st::stickersPremiumLock) , _previewTimer([=] { showPreview(); }) { _session->downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); }, lifetime()); _show->adjustShadowLeft( - ) | rpl::start_with_next([=](bool adjust) { + ) | rpl::on_next([=](bool adjust) { _adjustShadowLeft = adjust; update(); }, lifetime()); @@ -1488,7 +1488,7 @@ void FieldAutocomplete::Inner::setupLottie(StickerSuggestion &suggestion) { getLottieRenderer()); suggestion.lottie->updates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { repaintSticker(document); }, _stickersLifetime); } @@ -1665,7 +1665,7 @@ void InitFieldAutocomplete( field->customTab(true); raw->mentionChosen( - ) | rpl::start_with_next([=](FieldAutocomplete::MentionChosen data) { + ) | rpl::on_next([=](FieldAutocomplete::MentionChosen data) { const auto user = data.user; if (data.mention.isEmpty()) { field->insertTag( @@ -1680,7 +1680,7 @@ void InitFieldAutocomplete( const auto setText = descriptor.setText; raw->hashtagChosen( - ) | rpl::start_with_next([=](FieldAutocomplete::HashtagChosen data) { + ) | rpl::on_next([=](FieldAutocomplete::HashtagChosen data) { field->insertTag(data.hashtag); }, raw->lifetime()); @@ -1691,7 +1691,7 @@ void InitFieldAutocomplete( ? &peer->owner().shortcutMessages() : nullptr; raw->botCommandChosen( - ) | rpl::start_with_next([=](FieldAutocomplete::BotCommandChosen data) { + ) | rpl::on_next([=](FieldAutocomplete::BotCommandChosen data) { if (!features().autocompleteCommands) { return; } @@ -1715,7 +1715,7 @@ void InitFieldAutocomplete( if (const auto stickerChoosing = descriptor.stickerChoosing) { raw->choosingProcesses( - ) | rpl::start_with_next([=](FieldAutocomplete::Type type) { + ) | rpl::on_next([=](FieldAutocomplete::Type type) { if (type == FieldAutocomplete::Type::Stickers) { stickerChoosing(); } @@ -1723,11 +1723,11 @@ void InitFieldAutocomplete( } if (const auto chosen = descriptor.stickerChosen) { raw->stickerChosen( - ) | rpl::start_with_next(chosen, raw->lifetime()); + ) | rpl::on_next(chosen, raw->lifetime()); } field->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!raw->isHidden()) { raw->chooseSelected(FieldAutocomplete::ChooseMethod::ByTab); } @@ -1772,15 +1772,15 @@ void InitFieldAutocomplete( }; raw->refreshRequests( - ) | rpl::start_with_next(check, raw->lifetime()); + ) | rpl::on_next(check, raw->lifetime()); raw->stickersUpdateRequests( - ) | rpl::start_with_next(updateStickersByEmoji, raw->lifetime()); + ) | rpl::on_next(updateStickersByEmoji, raw->lifetime()); peer->owner().botCommandsChanges( ) | rpl::filter([=](not_null changed) { return (peer == changed); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { if (raw->clearFilteredBotCommands()) { check(); } @@ -1788,7 +1788,7 @@ void InitFieldAutocomplete( peer->owner().stickers().updated( Data::StickersType::Stickers - ) | rpl::start_with_next(updateStickersByEmoji, raw->lifetime()); + ) | rpl::on_next(updateStickersByEmoji, raw->lifetime()); QObject::connect( field->rawTextEdit(), @@ -1797,7 +1797,7 @@ void InitFieldAutocomplete( check, Qt::QueuedConnection); - field->changes() | rpl::start_with_next( + field->changes() | rpl::on_next( updateStickersByEmoji, raw->lifetime()); @@ -1805,11 +1805,11 @@ void InitFieldAutocomplete( Data::PeerUpdate::Flag::Rights ) | rpl::filter([=](const Data::PeerUpdate &update) { return (update.peer == peer); - }) | rpl::start_with_next(updateStickersByEmoji, raw->lifetime()); + }) | rpl::on_next(updateStickersByEmoji, raw->lifetime()); if (shortcutMessages) { shortcutMessages->shortcutsChanged( - ) | rpl::start_with_next(check, raw->lifetime()); + ) | rpl::on_next(check, raw->lifetime()); } raw->setSendMenuDetails(std::move(descriptor.sendMenuDetails)); diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index ba0a303b7f..3f153c3dc1 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -126,24 +126,24 @@ GifsListWidget::GifsListWidget( [=] { sendInlineRequest(); }); session().data().stickers().savedGifsUpdated( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshSavedGifs(); }, lifetime()); session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateInlineItems(); }, lifetime()); _show->pauseChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!paused()) { updateInlineItems(); } }, lifetime()); sizeValue( - ) | rpl::start_with_next([=](const QSize &s) { + ) | rpl::on_next([=](const QSize &s) { _mosaic.setFullWidth(s.width()); }, lifetime()); @@ -181,13 +181,13 @@ object_ptr GifsListWidget::createFooter() { GifSectionsValue( &session() - ) | rpl::start_with_next([=](std::vector &&list) { + ) | rpl::on_next([=](std::vector &&list) { _sections = std::move(list); refreshIcons(); }, _footer->lifetime()); _footer->setChosen( - ) | rpl::start_with_next([=](uint64 setId) { + ) | rpl::on_next([=](uint64 setId) { if (_search) { _search->cancel(); } diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index ce3f4f6054..2f36bd5e17 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -183,11 +183,11 @@ void EditLinkBox( tr::lng_formatting_link_url(), link)); url->heightValue( - ) | rpl::start_with_next([placeholder](int height) { + ) | rpl::on_next([placeholder](int height) { placeholder->resize(placeholder->width(), height); }, placeholder->lifetime()); placeholder->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { url->resize(width, url->height()); }, placeholder->lifetime()); url->move(placeholder->pos()); @@ -210,11 +210,11 @@ void EditLinkBox( }; text->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { url->setFocusFast(); }, text->lifetime()); url->submits( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (text->getLastText().isEmpty()) { text->setFocusFast(); } else { @@ -262,12 +262,12 @@ void EditLinkBox( }; url->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { clearFullSelection(url); text->setFocus(); }, url->lifetime()); text->tabbed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!url->empty()) { url->selectAll(); } @@ -314,7 +314,7 @@ void EditCodeLanguageBox( } }; field->submits( - ) | rpl::start_with_next(callback, field->lifetime()); + ) | rpl::on_next(callback, field->lifetime()); box->addButton(tr::lng_settings_save(), callback); box->addButton(tr::lng_cancel(), [=] { box->closeBox(); @@ -686,12 +686,12 @@ void InitMessageFieldFade( }; generateFade(); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { generateFade(); }, topFade->lifetime()); field->sizeValue( - ) | rpl::start_with_next_done([=](const QSize &size) { + ) | rpl::on_next_done([=](const QSize &size) { topFade->resizeToWidth(size.width()); bottomFade->resizeToWidth(size.width()); bottomFade->move( @@ -707,7 +707,7 @@ void InitMessageFieldFade( field->changes(), field->scrollTop().changes() | rpl::to_empty, field->sizeValue() | rpl::to_empty - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { // InputField::changes fires before the auto-resize is being applied, // so for the scroll values to be accurate we enqueue the check. InvokeQueued(field, [=] { @@ -879,7 +879,7 @@ MessageLinksParser::MessageLinksParser(not_null field) : _field(field) , _timer([=] { parse(); }) { _lifetime = _field->changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto length = _field->getTextWithTags().text.size(); if (!length) { _lastLength = 0; @@ -1133,14 +1133,14 @@ base::unique_qptr CreateDisabledFieldView( + customFontMarginTop, 0, 0); raw->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto available = width - margins.left() - margins.right(); const auto skip = st::historySendDisabledIconSkip; label->resizeToWidth(available - skip); label->moveToLeft(margins.left() + skip, margins.top(), width); }, label->lifetime()); raw->paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto p = QPainter(raw); const auto &icon = st::historySendDisabledIcon; icon.paint( @@ -1208,11 +1208,11 @@ std::unique_ptr TextErrorSendRestriction( text, st::historySendPremiumRequired); label->setAttribute(Qt::WA_TransparentForMouseEvents); - raw->paintRequest() | rpl::start_with_next([=](QRect clip) { + raw->paintRequest() | rpl::on_next([=](QRect clip) { QPainter(raw).fillRect(clip, st::windowBg); }, raw->lifetime()); raw->sizeValue( - ) | rpl::start_with_next([=](QSize size) { + ) | rpl::on_next([=](QSize size) { const auto &st = st::historyComposeField; const auto width = size.width(); const auto margins = (st.textMargins + st.placeholderMargins); @@ -1243,11 +1243,11 @@ std::unique_ptr PremiumRequiredSendRestriction( const auto link = CreateChild( result.get(), tr::lng_restricted_send_non_premium_more(tr::now)); - raw->paintRequest() | rpl::start_with_next([=](QRect clip) { + raw->paintRequest() | rpl::on_next([=](QRect clip) { QPainter(raw).fillRect(clip, st::windowBg); }, raw->lifetime()); raw->widthValue( - ) | rpl::start_with_next([=](int width) { + ) | rpl::on_next([=](int width) { const auto &st = st::historyComposeField; const auto margins = (st.textMargins + st.placeholderMargins); const auto available = width - margins.left() - margins.right(); @@ -1317,14 +1317,14 @@ std::unique_ptr FrozenWriteRestriction( const auto shadow = bar ? CreateChild(raw) : nullptr; const auto icon = bar ? CreateChild(raw) : nullptr; if (icon) { - icon->paintRequest() | rpl::start_with_next([=] { + icon->paintRequest() | rpl::on_next([=] { auto p = QPainter(icon); st::menuIconDisableAttention.paintInCenter(p, icon->rect()); }, icon->lifetime()); icon->show(); } - raw->sizeValue() | rpl::start_with_next([=](QSize size) { + raw->sizeValue() | rpl::on_next([=](QSize size) { if (bar) { const auto toggle = [&](auto &&widget, bool shown) { if (widget->isHidden() == shown) { @@ -1500,7 +1500,7 @@ void FrozenInfoBox( - buttonPadding.right(); button->widthValue() | rpl::filter([=] { return (button->widthNoMargins() != buttonWidth); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { button->resizeToWidth(buttonWidth); }, button->lifetime()); } diff --git a/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp b/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp index 42b980f936..67e2e79542 100644 --- a/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp +++ b/Telegram/SourceFiles/chat_helpers/spellchecker_common.cpp @@ -389,23 +389,23 @@ void Start(not_null session) { if (Platform::Spellchecker::IsSystemSpellchecker()) { Spellchecker::SupportedScriptsChanged() | rpl::take(1) - | rpl::start_with_next(AddExceptions, lifetime); + | rpl::on_next(AddExceptions, lifetime); return; } Spellchecker::SupportedScriptsChanged( - ) | rpl::start_with_next(AddExceptions, lifetime); + ) | rpl::on_next(AddExceptions, lifetime); Spellchecker::SetWorkingDirPath(DictionariesPath()); settings->dictionariesEnabledChanges( - ) | rpl::start_with_next([](auto dictionaries) { + ) | rpl::on_next([](auto dictionaries) { Platform::Spellchecker::UpdateLanguages(dictionaries); }, lifetime); settings->spellcheckerEnabledChanges( - ) | rpl::start_with_next(onEnabled, lifetime); + ) | rpl::on_next(onEnabled, lifetime); const auto method = QGuiApplication::inputMethod(); @@ -433,7 +433,7 @@ void Start(not_null session) { if (settings->autoDownloadDictionaries()) { session->data().contactsLoaded().changes( - ) | rpl::start_with_next([=](bool loaded) { + ) | rpl::on_next([=](bool loaded) { if (!loaded) { return; } @@ -466,7 +466,7 @@ void Start(not_null session) { rpl::combine( settings->spellcheckerEnabledValue(), settings->autoDownloadDictionariesValue() - ) | rpl::start_with_next([=](bool spell, bool download) { + ) | rpl::on_next([=](bool spell, bool download) { if (spell && download) { connectInput(); return; diff --git a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp index af07736a48..96ddbf0204 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp @@ -103,17 +103,17 @@ EmojiPack::EmojiPack(not_null session) session->data().viewRemoved( ) | rpl::filter([](not_null view) { return view->isIsolatedEmoji() || view->isOnlyCustomEmoji(); - }) | rpl::start_with_next([=](not_null item) { + }) | rpl::on_next([=](not_null item) { remove(item); }, _lifetime); Core::App().settings().largeEmojiChanges( - ) | rpl::start_with_next([=](bool large) { + ) | rpl::on_next([=](bool large) { refreshAll(); }, _lifetime); Ui::Emoji::Updated( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _images.clear(); refreshAll(); }, _lifetime); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_footer.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_footer.cpp index 6ea61e00f7..a0394d1ade 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_footer.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_footer.cpp @@ -248,7 +248,7 @@ bool StickersListFooter::ScrollState::animationCallback(crl::time now) { GradientPremiumStar::GradientPremiumStar() { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _image = QImage(); }, _lifetime); } @@ -302,7 +302,7 @@ StickersListFooter::StickersListFooter(Descriptor &&descriptor) _iconsRight = st().iconSkip; _session->downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); }, lifetime()); } @@ -1199,7 +1199,7 @@ void StickersListFooter::validateIconLottieAnimation( const auto id = icon.setId; icon.lottie->updates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateSetIcon(id); }, icon.lifetime); } diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 28761178a3..ce15597c63 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -248,7 +248,7 @@ StickersListWidget::StickersListWidget( }); session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (isVisible()) { updateItems(); readVisibleFeatured(getVisibleTop(), getVisibleBottom()); @@ -259,7 +259,7 @@ StickersListWidget::StickersListWidget( Data::PeerUpdate::Flag::StickersSet ) | rpl::filter([=](const Data::PeerUpdate &update) { return (update.peer.get() == _megagroupSet); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { refreshStickers(); }, lifetime()); @@ -267,7 +267,7 @@ StickersListWidget::StickersListWidget( session().data().stickers().recentUpdated(_isMasks ? Data::StickersType::Masks : Data::StickersType::Stickers - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshRecent(); }, lifetime()); } @@ -283,7 +283,7 @@ StickersListWidget::StickersListWidget( rpl::merge( Data::AmPremiumValue(&session()) | rpl::to_empty, session().api().premium().cloudSetUpdated() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshStickers(); }, lifetime()); } @@ -320,12 +320,12 @@ object_ptr StickersListWidget::createFooter() { _footer = result; _footer->setChosen( - ) | rpl::start_with_next([=](uint64 setId) { + ) | rpl::on_next([=](uint64 setId) { showStickerSet(setId); }, _footer->lifetime()); _footer->openSettingsRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto onlyFeatured = !_isMasks && _mySets.empty(); _show->showBox(Box( _show, @@ -1255,7 +1255,7 @@ void StickersListWidget::ensureLottiePlayer(Set &set) { const auto raw = set.lottiePlayer.get(); raw->updates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { auto &sets = shownSets(); enumerateSections([&](const SectionInfo &info) { if (sets[info.section].lottiePlayer.get() != raw) { @@ -1736,7 +1736,7 @@ void StickersListWidget::showStickerSetBox( base::timer_once(kTimeout), document->owner().stickers().updated( Data::StickersType::Stickers) - ) | rpl::start_with_next([=, weak = base::make_weak(this)] { + ) | rpl::on_next([=, weak = base::make_weak(this)] { if (weak.get()) { showStickerSetBox(document, setId); } diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp index a3d8ba3968..c39a9951f6 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp @@ -86,7 +86,7 @@ TabbedPanel::TabbedPanel( _pauseAnimations.fire(false); }); _selector->showRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { showFromSelector(); }, lifetime()); @@ -103,19 +103,19 @@ TabbedPanel::TabbedPanel( _hideTimer.setCallback([this] { hideByTimerOrLeave(); }); _selector->checkForHide( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { if (!rect().contains(mapFromGlobal(QCursor::pos()))) { _hideTimer.callOnce(kDelayedHideTimeoutMs); } }, lifetime()); _selector->cancelled( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { hideAnimated(); }, lifetime()); _selector->slideFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { InvokeQueued(this, [=] { if (_hideAfterSlide) { startOpacityAnimation(true); @@ -126,7 +126,7 @@ TabbedPanel::TabbedPanel( macWindowDeactivateEvents( ) | rpl::filter([=] { return !isHidden() && !preventAutoHide(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { hideAnimated(); }, lifetime()); diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index a576c6f040..fe56330372 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -345,7 +345,7 @@ std::unique_ptr MakeSearch( }); result->queryValue( - ) | rpl::skip(1) | rpl::start_with_next( + ) | rpl::skip(1) | rpl::on_next( std::move(callback), parent->lifetime()); @@ -439,7 +439,7 @@ TabbedSelector::TabbedSelector( const auto widget = tab.widget(); widget->scrollToRequests( - ) | rpl::start_with_next([=, tab = &tab](int y) { + ) | rpl::on_next([=, tab = &tab](int y) { if (tab == currentTab()) { scrollToY(y); } else { @@ -448,7 +448,7 @@ TabbedSelector::TabbedSelector( }, widget->lifetime()); widget->disableScrollRequests( - ) | rpl::start_with_next([=, tab = &tab](bool disabled) { + ) | rpl::on_next([=, tab = &tab](bool disabled) { if (tab == currentTab()) { _scroll->disableScroll(disabled); } @@ -460,7 +460,7 @@ TabbedSelector::TabbedSelector( ? stickers()->scrollUpdated() | rpl::map_to(0) : rpl::never() | rpl::type_erased), _scroll->scrollTopChanges() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { handleScroll(); }, lifetime()); @@ -479,14 +479,14 @@ TabbedSelector::TabbedSelector( Data::PeerUpdate::Flag::Rights ) | rpl::filter([=](const Data::PeerUpdate &update) { return (update.peer.get() == _currentPeer); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { checkRestrictedPeer(); }, lifetime()); } if (hasStickersTab()) { session().data().stickers().stickerSetInstalled( - ) | rpl::start_with_next([=](uint64 setId) { + ) | rpl::on_next([=](uint64 setId) { _tabsSlider->setActiveSection(indexByType(SelectorTab::Stickers)); stickers()->showStickerSet(setId); if (_currentPeer @@ -502,13 +502,13 @@ TabbedSelector::TabbedSelector( session().data().stickers().updated(hasMasksTab() ? Data::StickersType::Masks : Data::StickersType::Stickers) - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshStickers(); }, lifetime()); } style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _panelRounding = Ui::PrepareCornerPixmaps( st::emojiPanRadius, _st.bg); @@ -519,7 +519,7 @@ TabbedSelector::TabbedSelector( if (hasEmojiTab() && _mode == Mode::Full) { session().data().stickers().emojiSetInstalled( - ) | rpl::start_with_next([=](uint64 setId) { + ) | rpl::on_next([=](uint64 setId) { _tabsSlider->setActiveSection(indexByType(SelectorTab::Emoji)); emoji()->showSet(setId); if (_currentPeer && Data::CanSendTexts(_currentPeer)) { @@ -1211,7 +1211,7 @@ void TabbedSelector::createTabsSlider() { _tabsSlider->setActiveSectionFast(indexByType(_currentTabType)); _tabsSlider->sectionActivated( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { switchTab(); }, lifetime()); } diff --git a/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp b/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp index 65940c6b00..6130741d30 100644 --- a/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/ttl_media_layer_widget.cpp @@ -143,7 +143,7 @@ PreviewWrap::PreviewWrap( const auto closeCallback = [=] { _closeRequests.fire({}); }; HistoryView::TTLVoiceStops( item->fullId() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _lastFrameCache = Ui::GrabWidgetToImage(this, _elementGeometry); closeCallback(); }, lifetime()); @@ -155,20 +155,20 @@ PreviewWrap::PreviewWrap( std::move( theme - ) | rpl::start_with_next([=](std::shared_ptr theme) { + ) | rpl::on_next([=](std::shared_ptr theme) { _theme = std::move(theme); _style->apply(_theme.get()); }, lifetime()); const auto session = &_item->history()->session(); session->data().viewRepaintRequest( - ) | rpl::start_with_next([=](not_null view) { + ) | rpl::on_next([=](not_null view) { if (view == _element.get()) { update(_elementGeometry); } }, lifetime()); session->data().itemViewRefreshRequest( - ) | rpl::start_with_next([=](not_null item) { + ) | rpl::on_next([=](not_null item) { if (item == _item) { if (goodItem()) { createView(); @@ -180,13 +180,13 @@ PreviewWrap::PreviewWrap( } }, lifetime()); session->data().itemDataChanges( - ) | rpl::start_with_next([=](not_null item) { + ) | rpl::on_next([=](not_null item) { if (item == _item) { _element->itemDataChanged(); } }, lifetime()); session->data().itemRemoved( - ) | rpl::start_with_next([=](not_null item) { + ) | rpl::on_next([=](not_null item) { if (item == _item) { _closeRequests.fire({}); } @@ -206,7 +206,7 @@ PreviewWrap::PreviewWrap( rpl::combine( sizeValue(), _elementInner.value() - ) | rpl::start_with_next([=](QSize size, QRect inner) { + ) | rpl::on_next([=](QSize size, QRect inner) { close->moveToLeft( inner.x() + (inner.width() - close->width()) / 2, (size.height() @@ -246,7 +246,7 @@ PreviewWrap::PreviewWrap( _elementInner.value( ) | rpl::filter([](const QRect &inner) { return !inner.isEmpty(); - }) | rpl::start_with_next([=](const QRect &inner) { + }) | rpl::on_next([=](const QRect &inner) { tooltip->pointAt(inner, RectPart::Top, [=](QSize size) { return QPoint{ inner.x() + (inner.width() - size.width()) / 2, @@ -281,7 +281,7 @@ void PreviewWrap::createView() { rpl::combine( sizeValue(), _globalViewport.value() - ) | rpl::start_with_next([=](QSize outer, QRect globalViewport) { + ) | rpl::on_next([=](QSize outer, QRect globalViewport) { _viewport = globalViewport.isEmpty() ? rect() : mapFromGlobal(globalViewport); @@ -371,7 +371,7 @@ void ShowTTLMediaLayerWidget( controller, item->history()->peer)); preview->closeRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { show->hideLayer(); }, preview->lifetime()); auto layer = std::make_unique( diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 0f831c5b5c..4fa011d973 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -176,7 +176,7 @@ Application::Application() _platformIntegration->init(); passcodeLockChanges( - ) | rpl::start_with_next([=](bool locked) { + ) | rpl::on_next([=](bool locked) { _shouldLockAt = 0; if (locked) { closeAdditionalWindows(); @@ -184,18 +184,18 @@ Application::Application() }, _lifetime); passcodeLockChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _notifications->updateAll(); updateWindowTitles(); }, _lifetime); settings().windowTitleContentChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateWindowTitles(); }, _lifetime); _domain->activeSessionChanges( - ) | rpl::start_with_next([=](Main::Session *session) { + ) | rpl::on_next([=](Main::Session *session) { if (session && !UpdaterDisabled()) { // #TODO multi someSessionValue UpdateChecker().setMtproto(session); } @@ -305,12 +305,12 @@ void Application::run() { rpl::combine( _batterySaving->value(), settings().ignoreBatterySavingValue() - ) | rpl::start_with_next([=](bool saving, bool ignore) { + ) | rpl::on_next([=](bool saving, bool ignore) { PowerSaving::SetForceAll(saving && !ignore); }, _lifetime); style::ShortAnimationPlaying( - ) | rpl::start_with_next([=](bool playing) { + ) | rpl::on_next([=](bool playing) { if (playing) { MTP::details::pause(); } else { @@ -335,7 +335,7 @@ void Application::run() { _windowInSettings = _lastActivePrimaryWindow = _lastActiveWindow; _domain->activeChanges( - ) | rpl::start_with_next([=](not_null account) { + ) | rpl::on_next([=](not_null account) { showAccount(account); }, _lifetime); @@ -351,7 +351,7 @@ void Application::run() { ? _domain->activeChanges() : rpl::never>(); }) | rpl::flatten_latest( - ) | rpl::start_with_next([=](not_null account) { + ) | rpl::on_next([=](not_null account) { const auto ordered = _domain->orderedAccounts(); const auto it = ranges::find(ordered, account); if (_lastActivePrimaryWindow && it != end(ordered)) { @@ -367,7 +367,7 @@ void Application::run() { QCoreApplication::instance()->installEventFilter(this); appDeactivatedValue( - ) | rpl::start_with_next([=](bool deactivated) { + ) | rpl::on_next([=](bool deactivated) { if (deactivated) { handleAppDeactivated(); } else { @@ -403,7 +403,7 @@ void Application::run() { } _openInMediaViewRequests.events( - ) | rpl::start_with_next([=](Media::View::OpenRequest &&request) { + ) | rpl::on_next([=](Media::View::OpenRequest &&request) { if (_mediaView) { _mediaView->show(std::move(request)); } @@ -509,7 +509,7 @@ void Application::startSystemDarkModeViewer() { rpl::merge( settings().systemDarkModeChanges() | rpl::to_empty, settings().systemDarkModeEnabledChanges() | rpl::to_empty - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { checkSystemDarkMode(); }, _lifetime); } @@ -564,18 +564,18 @@ void Application::createTray() { using WindowRaw = not_null; _tray->create(); _tray->aboutToShowRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { enumerateWindows([&](WindowRaw w) { w->updateIsActive(); }); _tray->updateMenuText(); }, _lifetime); _tray->showFromTrayRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { activate(); }, _lifetime); _tray->hideToTrayRequests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { enumerateWindows([&](WindowRaw w) { w->widget()->minimizeToTray(); }); @@ -813,7 +813,7 @@ void Application::badMtprotoConfigurationError() { _badProxyDisableBox = Ui::show( Ui::MakeInformBox(Lang::Hard::ProxyConfigError())); _badProxyDisableBox->boxClosing( - ) | rpl::start_with_next( + ) | rpl::on_next( disableCallback, _badProxyDisableBox->lifetime()); } @@ -823,7 +823,7 @@ void Application::startLocalStorage() { Ui::GL::DetectLastCheckCrash(); Local::start(); _saveSettingsTimer.emplace([=] { saveSettings(); }); - settings().saveDelayedRequests() | rpl::start_with_next([=] { + settings().saveDelayedRequests() | rpl::on_next([=] { saveSettingsDelayed(); }, _lifetime); } @@ -837,7 +837,7 @@ void Application::startEmojiImageLoader() { }); settings().largeEmojiChanges( - ) | rpl::start_with_next([=](bool large) { + ) | rpl::on_next([=](bool large) { if (large) { _clearEmojiImageLoaderTimer.cancel(); } else { @@ -847,7 +847,7 @@ void Application::startEmojiImageLoader() { }, _lifetime); Ui::Emoji::Updated( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _emojiImageLoader.with([ source = prepareEmojiSourceImages() ](Stickers::EmojiImageLoader &loader) mutable { @@ -1485,7 +1485,7 @@ void Application::setLastActiveWindow(Window::Controller *window) { return; } window->floatPlayerDelegateValue( - ) | rpl::start_with_next([=](Media::Player::FloatDelegate *value) { + ) | rpl::on_next([=](Media::Player::FloatDelegate *value) { if (!value) { _floatPlayers = nullptr; } else if (_floatPlayers) { @@ -1812,12 +1812,12 @@ void Application::startShortcuts() { Shortcuts::Start(); _domain->activeSessionChanges( - ) | rpl::start_with_next([=](Main::Session *session) { + ) | rpl::on_next([=](Main::Session *session) { refreshApplicationIcon(session); }, _lifetime); Shortcuts::Requests( - ) | rpl::start_with_next([=](not_null request) { + ) | rpl::on_next([=](not_null request) { using Command = Shortcuts::Command; request->check(Command::Quit) && request->handle([] { Quit(); diff --git a/Telegram/SourceFiles/core/changelogs.cpp b/Telegram/SourceFiles/core/changelogs.cpp index ddb5b8a93f..b0a9a66eb2 100644 --- a/Telegram/SourceFiles/core/changelogs.cpp +++ b/Telegram/SourceFiles/core/changelogs.cpp @@ -51,7 +51,7 @@ Changelogs::Changelogs(not_null session, int oldVersion) _session->data().chatsListChanges( ) | rpl::filter([](Data::Folder *folder) { return !folder; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { requestCloudLogs(); }, _chatsSubscription); } diff --git a/Telegram/SourceFiles/core/crash_report_window.cpp b/Telegram/SourceFiles/core/crash_report_window.cpp index b73c12aedc..71dee2eaf0 100644 --- a/Telegram/SourceFiles/core/crash_report_window.cpp +++ b/Telegram/SourceFiles/core/crash_report_window.cpp @@ -362,21 +362,21 @@ LastCrashedWindow::LastCrashedWindow( Core::UpdateChecker checker; using Progress = Core::UpdateChecker::Progress; checker.checking( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Assert(_updaterData != nullptr); setUpdatingState(UpdatingCheck); }, _lifetime); checker.isLatest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Assert(_updaterData != nullptr); setUpdatingState(UpdatingLatest); }, _lifetime); checker.progress( - ) | rpl::start_with_next([=](const Progress &result) { + ) | rpl::on_next([=](const Progress &result) { Assert(_updaterData != nullptr); setUpdatingState(UpdatingDownload); @@ -384,14 +384,14 @@ LastCrashedWindow::LastCrashedWindow( }, _lifetime); checker.failed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Assert(_updaterData != nullptr); setUpdatingState(UpdatingFail); }, _lifetime); checker.ready( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Assert(_updaterData != nullptr); setUpdatingState(UpdatingReady); @@ -880,7 +880,7 @@ void LastCrashedWindow::networkSettings() { proxy.user, proxy.password); box->saveRequests( - ) | rpl::start_with_next([=](MTP::ProxyData &&data) { + ) | rpl::on_next([=](MTP::ProxyData &&data) { Assert(data.host.isEmpty() || data.port != 0); _proxyChanges.fire(std::move(data)); proxyUpdated(); diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 939bf86837..8a01f2cd9d 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -322,7 +322,7 @@ void ShowPhonePrivacyBox(Window::SessionController *controller) { key ) | rpl::take( 1 - ) | rpl::start_with_next([=](const Privacy::Rule &value) mutable { + ) | rpl::on_next([=](const Privacy::Rule &value) mutable { using namespace ::Settings; const auto show = shared->alive(); if (lifetime) { @@ -1111,7 +1111,7 @@ bool ShowEditBirthdayPrivacy( Api::UserPrivacy::Key::Birthday ) | rpl::take( 1 - ) | rpl::start_with_next([=](const Api::UserPrivacy::Rule &value) { + ) | rpl::on_next([=](const Api::UserPrivacy::Rule &value) { if (isFromBox) { using namespace ::Settings; class Controller final : public BirthdayPrivacyController { @@ -1162,7 +1162,7 @@ bool ShowEditPersonalChannel( }; rawController->chosen( - ) | rpl::start_with_next([=](not_null channel) { + ) | rpl::on_next([=](not_null channel) { save(channel); }, box->lifetime()); diff --git a/Telegram/SourceFiles/core/phone_click_handler.cpp b/Telegram/SourceFiles/core/phone_click_handler.cpp index 167aec1653..7c09b6ec10 100644 --- a/Telegram/SourceFiles/core/phone_click_handler.cpp +++ b/Telegram/SourceFiles/core/phone_click_handler.cpp @@ -125,7 +125,7 @@ ResolvePhoneAction::ResolvePhoneAction( } paintRequest( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { Painter p(this); paint(p); }, lifetime()); @@ -213,7 +213,7 @@ void ResolvePhoneAction::prepare() { ? rpl::single(QString()) : tr::lng_contacts_loading(); }) | rpl::flatten_latest() - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( QString text, QString name, QString no, diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index b7ac2a5d10..4f8c65e98f 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -359,7 +359,7 @@ void Sandbox::singleInstanceChecked() { _lastCrashDump, [=] { launchApplication(); }); window->proxyChanges( - ) | rpl::start_with_next([=](MTP::ProxyData &&proxy) { + ) | rpl::on_next([=](MTP::ProxyData &&proxy) { _sandboxProxy = std::move(proxy); refreshGlobalProxy(); }, window->lifetime()); diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp index 777dde80c4..9f9913147c 100644 --- a/Telegram/SourceFiles/core/update_checker.cpp +++ b/Telegram/SourceFiles/core/update_checker.cpp @@ -1134,19 +1134,19 @@ private: Updater::Updater() : _timer([=] { check(); }) , _retryTimer([=] { handleTimeout(); }) { - checking() | rpl::start_with_next([=] { + checking() | rpl::on_next([=] { handleChecking(); }, _lifetime); - progress() | rpl::start_with_next([=] { + progress() | rpl::on_next([=] { handleProgress(); }, _lifetime); - failed() | rpl::start_with_next([=] { + failed() | rpl::on_next([=] { handleFailed(); }, _lifetime); - ready() | rpl::start_with_next([=] { + ready() | rpl::on_next([=] { handleReady(); }, _lifetime); - isLatest() | rpl::start_with_next([=] { + isLatest() | rpl::on_next([=] { handleLatest(); }, _lifetime); } @@ -1299,11 +1299,11 @@ void Updater::startImplementation( } checker->ready( - ) | rpl::start_with_next([=](std::shared_ptr &&loader) { + ) | rpl::on_next([=](std::shared_ptr &&loader) { checkerDone(which, std::move(loader)); }, checker->lifetime()); checker->failed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { checkerFail(which); }, checker->lifetime()); @@ -1373,11 +1373,11 @@ bool Updater::tryLoaders() { loader->progress( ) | rpl::start_to_stream(_progress, loader->lifetime()); loader->ready( - ) | rpl::start_with_next([=](QString &&filepath) { + ) | rpl::on_next([=](QString &&filepath) { finalize(std::move(filepath)); }, loader->lifetime()); loader->failed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _failed.fire({}); }, loader->lifetime()); diff --git a/Telegram/SourceFiles/countries/countries_manager.cpp b/Telegram/SourceFiles/countries/countries_manager.cpp index 5b8c30c99b..ac59fcabed 100644 --- a/Telegram/SourceFiles/countries/countries_manager.cpp +++ b/Telegram/SourceFiles/countries/countries_manager.cpp @@ -153,9 +153,9 @@ Manager::Manager(not_null domain) domain->activeValue( ) | rpl::filter([=](Main::Account *account) { return (account != nullptr); - }) | rpl::start_with_next_done([=](Main::Account *account) { + }) | rpl::on_next_done([=](Main::Account *account) { *mtpLifetime = account->mtpMainSessionValue( - ) | rpl::start_with_next([=](not_null instance) { + ) | rpl::on_next([=](not_null instance) { _api.emplace(instance); request(); }); diff --git a/Telegram/SourceFiles/data/business/data_shortcut_messages.cpp b/Telegram/SourceFiles/data/business/data_shortcut_messages.cpp index 6cb4890973..b9ac9c665f 100644 --- a/Telegram/SourceFiles/data/business/data_shortcut_messages.cpp +++ b/Telegram/SourceFiles/data/business/data_shortcut_messages.cpp @@ -114,7 +114,7 @@ ShortcutMessages::ShortcutMessages(not_null owner) owner->itemRemoved( ) | rpl::filter([](not_null item) { return item->isBusinessShortcut(); - }) | rpl::start_with_next([=](not_null item) { + }) | rpl::on_next([=](not_null item) { remove(item); }, _lifetime); } diff --git a/Telegram/SourceFiles/data/components/credits.cpp b/Telegram/SourceFiles/data/components/credits.cpp index 121dad2da0..4dfc6febce 100644 --- a/Telegram/SourceFiles/data/components/credits.cpp +++ b/Telegram/SourceFiles/data/components/credits.cpp @@ -60,7 +60,7 @@ void Credits::load(bool force) { apply(balance); _loader = nullptr; }; - apiStats->request() | rpl::start_with_error_done([=] { + apiStats->request() | rpl::on_error_done([=] { finish(false); }, [=] { finish(true); diff --git a/Telegram/SourceFiles/data/components/factchecks.cpp b/Telegram/SourceFiles/data/components/factchecks.cpp index 77251925ef..d31937e2c2 100644 --- a/Telegram/SourceFiles/data/components/factchecks.cpp +++ b/Telegram/SourceFiles/data/components/factchecks.cpp @@ -60,7 +60,7 @@ void Factchecks::subscribeIfNotYet() { _subscribed = true; _session->data().itemRemoved( - ) | rpl::start_with_next([=](not_null item) { + ) | rpl::on_next([=](not_null item) { _pending.remove(item); const auto i = ranges::find(_requested, item.get()); if (i != end(_requested)) { diff --git a/Telegram/SourceFiles/data/components/gift_auctions.cpp b/Telegram/SourceFiles/data/components/gift_auctions.cpp index f72b109846..8ad720e550 100644 --- a/Telegram/SourceFiles/data/components/gift_auctions.cpp +++ b/Telegram/SourceFiles/data/components/gift_auctions.cpp @@ -25,7 +25,7 @@ GiftAuctions::GiftAuctions(not_null session) _session->data().chatsListLoadedEvents() ) | rpl::filter( !rpl::mappers::_1 - ) | rpl::take(1) | rpl::start_with_next([=] { + ) | rpl::take(1) | rpl::on_next([=] { requestActive(); }, _lifetime); }); @@ -43,7 +43,7 @@ rpl::producer GiftAuctions::state(const QString &slug) { } const auto raw = entry.get(); - raw->changes.events() | rpl::start_with_next([=] { + raw->changes.events() | rpl::on_next([=] { consumer.put_next_copy(raw->state); }, lifetime); diff --git a/Telegram/SourceFiles/data/components/promo_suggestions.cpp b/Telegram/SourceFiles/data/components/promo_suggestions.cpp index 9482ccd08d..15d468c155 100644 --- a/Telegram/SourceFiles/data/components/promo_suggestions.cpp +++ b/Telegram/SourceFiles/data/components/promo_suggestions.cpp @@ -50,7 +50,7 @@ PromoSuggestions::PromoSuggestions( , _topPromotionTimer([=] { refreshTopPromotion(); }) , _firstPromoLoaded(std::move(firstPromoLoaded)) { Core::App().settings().proxy().connectionTypeValue( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshTopPromotion(); }, _lifetime); } diff --git a/Telegram/SourceFiles/data/components/scheduled_messages.cpp b/Telegram/SourceFiles/data/components/scheduled_messages.cpp index 15e036dba9..53a135d210 100644 --- a/Telegram/SourceFiles/data/components/scheduled_messages.cpp +++ b/Telegram/SourceFiles/data/components/scheduled_messages.cpp @@ -117,7 +117,7 @@ ScheduledMessages::ScheduledMessages(not_null session) _session->data().itemRemoved( ) | rpl::filter([](not_null item) { return item->isScheduled(); - }) | rpl::start_with_next([=](not_null item) { + }) | rpl::on_next([=](not_null item) { remove(item); }, _lifetime); } diff --git a/Telegram/SourceFiles/data/components/sponsored_messages.cpp b/Telegram/SourceFiles/data/components/sponsored_messages.cpp index e09c333a68..fb27db98d5 100644 --- a/Telegram/SourceFiles/data/components/sponsored_messages.cpp +++ b/Telegram/SourceFiles/data/components/sponsored_messages.cpp @@ -58,7 +58,7 @@ SponsoredMessages::SponsoredMessages(not_null session) , _clearTimer([=] { clearOldRequests(); }) { Data::AmPremiumValue( _session - ) | rpl::start_with_next([=](bool premium) { + ) | rpl::on_next([=](bool premium) { if (premium) { clear(); } diff --git a/Telegram/SourceFiles/data/components/top_peers.cpp b/Telegram/SourceFiles/data/components/top_peers.cpp index 4fac09a09c..561f052d9c 100644 --- a/Telegram/SourceFiles/data/components/top_peers.cpp +++ b/Telegram/SourceFiles/data/components/top_peers.cpp @@ -72,7 +72,7 @@ void TopPeers::loadAfterChats() { using namespace rpl::mappers; crl::on_main(_session, [=] { _session->data().chatsListLoadedEvents( - ) | rpl::filter(_1 == nullptr) | rpl::start_with_next([=] { + ) | rpl::filter(_1 == nullptr) | rpl::on_next([=] { crl::on_main(_session, [=] { request(); }); diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index b8cd47c2a0..9eee5c9e19 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -1478,7 +1478,7 @@ void ApplyChannelUpdate( } creditsLoadLifetime->destroy(); }); - base::timer_once(kTimeout) | rpl::start_with_next([=] { + base::timer_once(kTimeout) | rpl::on_next([=] { creditsLoadLifetime->destroy(); }, *creditsLoadLifetime); const auto currencyLoadLifetime = std::make_shared(); @@ -1490,13 +1490,13 @@ void ApplyChannelUpdate( } currencyLoadLifetime->destroy(); }; - currencyLoad->request() | rpl::start_with_error_done( + currencyLoad->request() | rpl::on_error_done( [=](const QString &error) { apply(CreditsAmount(0, CreditsType::Ton)); }, [=] { apply(currencyLoad->data().currentBalance); }, *currencyLoadLifetime); - base::timer_once(kTimeout) | rpl::start_with_next([=] { + base::timer_once(kTimeout) | rpl::on_next([=] { currencyLoadLifetime->destroy(); }, *currencyLoadLifetime); } diff --git a/Telegram/SourceFiles/data/data_chat.cpp b/Telegram/SourceFiles/data/data_chat.cpp index d453643732..774b0f57c9 100644 --- a/Telegram/SourceFiles/data/data_chat.cpp +++ b/Telegram/SourceFiles/data/data_chat.cpp @@ -30,7 +30,7 @@ ChatData::ChatData(not_null owner, PeerId id) : PeerData(owner, id) , inputChat(MTP_long(peerToChat(id).bare)) { _flags.changes( - ) | rpl::start_with_next([=](const Flags::Change &change) { + ) | rpl::on_next([=](const Flags::Change &change) { if (change.diff & Flag::CallNotEmpty) { if (const auto history = this->owner().historyLoaded(this)) { history->updateChatListEntry(); diff --git a/Telegram/SourceFiles/data/data_chat_filters.cpp b/Telegram/SourceFiles/data/data_chat_filters.cpp index a2c5f48d89..9f04bcf66d 100644 --- a/Telegram/SourceFiles/data/data_chat_filters.cpp +++ b/Telegram/SourceFiles/data/data_chat_filters.cpp @@ -1047,7 +1047,7 @@ rpl::producer ChatFilters::moreChatsContent( _moreChatsUpdated.events_starting_with_copy( id - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { consumer.put_next(Ui::MoreChatsBarContent{ .count = int(moreChats(id).size()), }); diff --git a/Telegram/SourceFiles/data/data_cloud_file.cpp b/Telegram/SourceFiles/data/data_cloud_file.cpp index 7b3e738289..c80d8f26ee 100644 --- a/Telegram/SourceFiles/data/data_cloud_file.cpp +++ b/Telegram/SourceFiles/data/data_cloud_file.cpp @@ -289,7 +289,7 @@ void LoadCloudFile( }; file.loader->updates( - ) | rpl::start_with_next_error_done([=] { + ) | rpl::on_next_error_done([=] { if (const auto onstack = progress) { onstack(); } diff --git a/Telegram/SourceFiles/data/data_cloud_themes.cpp b/Telegram/SourceFiles/data/data_cloud_themes.cpp index 8f8b3e09af..978bab8ca7 100644 --- a/Telegram/SourceFiles/data/data_cloud_themes.cpp +++ b/Telegram/SourceFiles/data/data_cloud_themes.cpp @@ -212,7 +212,7 @@ void CloudThemes::setupReload() { return (update.type == BackgroundUpdate::Type::ApplyingTheme); }) | rpl::map([=] { return needReload(); - }) | rpl::start_with_next([=](bool need) { + }) | rpl::on_next([=](bool need) { install(); if (need) { scheduleReload(); @@ -375,7 +375,7 @@ void CloudThemes::loadDocumentAndInvoke( _session->downloaderTaskFinished( ) | rpl::filter([=, &value] { return value.documentMedia->loaded(); - }) | rpl::start_with_next([=, &value] { + }) | rpl::on_next([=, &value] { invokeForLoaded(value); }, value.subscription); } diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 5584fd66d7..7df823b626 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -1217,7 +1217,7 @@ void DocumentData::save( void DocumentData::handleLoaderUpdates() { _loader->updates( - ) | rpl::start_with_next_error_done([=] { + ) | rpl::on_next_error_done([=] { _owner->documentLoadProgress(this); }, [=](FileLoader::Error error) { using FailureReason = FileLoader::FailureReason; diff --git a/Telegram/SourceFiles/data/data_download_manager.cpp b/Telegram/SourceFiles/data/data_download_manager.cpp index 79db0acad8..15fcbae95d 100644 --- a/Telegram/SourceFiles/data/data_download_manager.cpp +++ b/Telegram/SourceFiles/data/data_download_manager.cpp @@ -141,32 +141,32 @@ void DownloadManager::trackSession(not_null session) { session->data().documentLoadProgress( ) | rpl::filter([=](not_null document) { return _loadingDocuments.contains(document); - }) | rpl::start_with_next([=](not_null document) { + }) | rpl::on_next([=](not_null document) { check(document); }, data.lifetime); session->data().itemLayoutChanged( ) | rpl::filter([=](not_null item) { return _loading.contains(item); - }) | rpl::start_with_next([=](not_null item) { + }) | rpl::on_next([=](not_null item) { check(item); }, data.lifetime); session->data().itemViewRefreshRequest( - ) | rpl::start_with_next([=](not_null item) { + ) | rpl::on_next([=](not_null item) { changed(item); }, data.lifetime); session->changes().messageUpdates( MessageUpdate::Flag::Destroyed - ) | rpl::start_with_next([=](const MessageUpdate &update) { + ) | rpl::on_next([=](const MessageUpdate &update) { removed(update.item); }, data.lifetime); session->account().sessionChanges( ) | rpl::filter( rpl::mappers::_1 != session - ) | rpl::take(1) | rpl::start_with_next([=] { + ) | rpl::take(1) | rpl::on_next([=] { untrack(session); }, data.lifetime); } @@ -1137,7 +1137,7 @@ rpl::producer MakeDownloadBarContent() { state->document->session().downloaderTaskFinished( ) | rpl::filter([=] { return self(self); - }) | rpl::start_with_next( + }) | rpl::on_next( state->push, state->downloadTaskLifetime); } @@ -1199,7 +1199,7 @@ rpl::producer MakeDownloadBarContent() { manager.loadingListChanges( ) | rpl::filter([=] { return !state->scheduled; - }) | rpl::start_with_next(state->push, lifetime); + }) | rpl::on_next(state->push, lifetime); notify(); return lifetime; diff --git a/Telegram/SourceFiles/data/data_emoji_statuses.cpp b/Telegram/SourceFiles/data/data_emoji_statuses.cpp index 73c1598305..de822f33b0 100644 --- a/Telegram/SourceFiles/data/data_emoji_statuses.cpp +++ b/Telegram/SourceFiles/data/data_emoji_statuses.cpp @@ -53,7 +53,7 @@ EmojiStatuses::EmojiStatuses(not_null owner) base::timer_each( kRefreshDefaultListEach - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshDefault(); refreshChannelDefault(); }, _lifetime); diff --git a/Telegram/SourceFiles/data/data_folder.cpp b/Telegram/SourceFiles/data/data_folder.cpp index e6599a5eea..6724923f1c 100644 --- a/Telegram/SourceFiles/data/data_folder.cpp +++ b/Telegram/SourceFiles/data/data_folder.cpp @@ -124,7 +124,7 @@ Folder::Folder(not_null owner, FolderId id) PeerUpdate::Flag::Name ) | rpl::filter([=](const PeerUpdate &update) { return ranges::contains(_lastHistories, update.peer, &History::peer); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { ++_chatListViewVersion; updateChatListEntryPostponed(); }, _lifetime); @@ -134,13 +134,13 @@ Folder::Folder(not_null owner, FolderId id) _chatsList.unreadStateChanges( ) | rpl::filter([=] { return inChatList(); - }) | rpl::start_with_next([=](const Dialogs::UnreadState &old) { + }) | rpl::on_next([=](const Dialogs::UnreadState &old) { ++_chatListViewVersion; notifyUnreadStateChange(old); }, _lifetime); _chatsList.fullSize().changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { updateChatListEntryPostponed(); }, _lifetime); } diff --git a/Telegram/SourceFiles/data/data_forum_topic.cpp b/Telegram/SourceFiles/data/data_forum_topic.cpp index 4c4280ed7e..98279cdec3 100644 --- a/Telegram/SourceFiles/data/data_forum_topic.cpp +++ b/Telegram/SourceFiles/data/data_forum_topic.cpp @@ -250,7 +250,7 @@ ForumTopic::ForumTopic(not_null forum, MsgId rootId) if (isGeneral()) { style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _defaultIcon = QImage(); }, _lifetime); } @@ -374,7 +374,7 @@ void ForumTopic::subscribeToUnreadChanges() { ) | rpl::combine_previous( ) | rpl::filter([=] { return inChatList(); - }) | rpl::start_with_next([=]( + }) | rpl::on_next([=]( std::optional previous, std::optional now) { if (previous.value_or(0) != now.value_or(0)) { diff --git a/Telegram/SourceFiles/data/data_group_call.cpp b/Telegram/SourceFiles/data/data_group_call.cpp index 7318e271db..dbadcbd3d7 100644 --- a/Telegram/SourceFiles/data/data_group_call.cpp +++ b/Telegram/SourceFiles/data/data_group_call.cpp @@ -84,7 +84,7 @@ GroupCall::GroupCall( return !update.now && !update.was->peer->isSelf() && !_participantsWithAccess.current().empty(); - }) | rpl::start_with_next([=](const ParticipantUpdate &update) { + }) | rpl::on_next([=](const ParticipantUpdate &update) { if (const auto id = peerToUser(update.was->peer->id)) { if (_participantsWithAccess.current().contains(id)) { _staleParticipantIds.fire({ id }); @@ -95,7 +95,7 @@ GroupCall::GroupCall( _participantsWithAccess.changes( ) | rpl::filter([=](const base::flat_set &list) { return !list.empty(); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { if (_allParticipantsLoaded) { checkStaleParticipants(); } else { diff --git a/Telegram/SourceFiles/data/data_history_messages.cpp b/Telegram/SourceFiles/data/data_history_messages.cpp index 6711059297..c86a8907db 100644 --- a/Telegram/SourceFiles/data/data_history_messages.cpp +++ b/Telegram/SourceFiles/data/data_history_messages.cpp @@ -88,7 +88,7 @@ rpl::producer HistoryViewer( limitAfter); using RequestAroundInfo = SparseIdsSliceBuilder::AroundData; builder->insufficientAround( - ) | rpl::start_with_next([=](const RequestAroundInfo &info) { + ) | rpl::on_next([=](const RequestAroundInfo &info) { if (!info.aroundId) { // Ignore messages-count-only requests, because we perform // them with non-zero limit of messages and end up adding @@ -110,22 +110,22 @@ rpl::producer HistoryViewer( messages->sliceUpdated( ) | rpl::filter([=](const SliceUpdate &update) { return builder->applyUpdate(update); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); messages->oneRemoved( ) | rpl::filter([=](MsgId messageId) { return builder->removeOne(messageId); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); messages->allRemoved( ) | rpl::filter([=] { return builder->removeAll(); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); messages->bottomInvalidated( ) | rpl::filter([=] { return builder->invalidateBottom(); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); const auto snapshot = messages->snapshot({ aroundId, diff --git a/Telegram/SourceFiles/data/data_media_preload.cpp b/Telegram/SourceFiles/data/data_media_preload.cpp index 8fb9380673..934bbf13ad 100644 --- a/Telegram/SourceFiles/data/data_media_preload.cpp +++ b/Telegram/SourceFiles/data/data_media_preload.cpp @@ -75,7 +75,7 @@ void PhotoPreload::start(FileOrigin origin) { _photo->owner()->session().downloaderTaskFinished( ) | rpl::filter([=] { return _photo->loaded(); - }) | rpl::start_with_next([=] { callDone(); }, _lifetime); + }) | rpl::on_next([=] { callDone(); }, _lifetime); } } diff --git a/Telegram/SourceFiles/data/data_message_reactions.cpp b/Telegram/SourceFiles/data/data_message_reactions.cpp index 1b8b31c21c..995e89c6ac 100644 --- a/Telegram/SourceFiles/data/data_message_reactions.cpp +++ b/Telegram/SourceFiles/data/data_message_reactions.cpp @@ -367,14 +367,14 @@ Reactions::Reactions(not_null owner) base::timer_each( kRefreshFullListEach - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refreshDefault(); requestEffects(); }, _lifetime); _owner->session().changes().messageUpdates( MessageUpdate::Flag::Destroyed - ) | rpl::start_with_next([=](const MessageUpdate &update) { + ) | rpl::on_next([=](const MessageUpdate &update) { const auto item = update.item; _pollingItems.remove(item); _pollItems.remove(item); @@ -401,7 +401,7 @@ Reactions::Reactions(not_null owner) : ReactionId{ config.reactionDefaultEmoji }; }) | rpl::filter([=](const ReactionId &id) { return !_saveFaveRequestId; - }) | rpl::start_with_next([=](ReactionId &&id) { + }) | rpl::on_next([=](ReactionId &&id) { applyFavorite(id); }, _lifetime); }); @@ -915,7 +915,7 @@ void Reactions::loadImage( setAnimatedIcon(set); } else if (!_imagesLoadLifetime) { document->session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { downloadTaskFinished(); }, _imagesLoadLifetime); } diff --git a/Telegram/SourceFiles/data/data_peer_values.cpp b/Telegram/SourceFiles/data/data_peer_values.cpp index 3828d03ee9..2e8ee8c52d 100644 --- a/Telegram/SourceFiles/data/data_peer_values.cpp +++ b/Telegram/SourceFiles/data/data_peer_values.cpp @@ -558,7 +558,7 @@ rpl::producer PeerUserpicImageValue( if (loading && !state->waiting) { peer->session().downloaderTaskFinished( - ) | rpl::start_with_next(state->push, state->waiting); + ) | rpl::on_next(state->push, state->waiting); } else if (!loading && state->waiting) { state->waiting.destroy(); } @@ -578,7 +578,7 @@ rpl::producer PeerUserpicImageValue( peer->session().changes().peerFlagsValue( peer, PeerUpdate::Flag::Photo - ) | rpl::start_with_next(state->push, result); + ) | rpl::on_next(state->push, result); return result; }; } diff --git a/Telegram/SourceFiles/data/data_replies_list.cpp b/Telegram/SourceFiles/data/data_replies_list.cpp index c34b10f672..d74a4da1f0 100644 --- a/Telegram/SourceFiles/data/data_replies_list.cpp +++ b/Telegram/SourceFiles/data/data_replies_list.cpp @@ -71,7 +71,7 @@ RepliesList::RepliesList( , _readRequestTimer([=] { sendReadTillRequest(); }) { if (_owningTopic) { _owningTopic->destroyed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _owningTopic = nullptr; subscribeToUpdates(); }, _lifetime); @@ -96,7 +96,7 @@ void RepliesList::subscribeToUpdates() { ) | rpl::filter([=](const RepliesReadTillUpdate &update) { return (update.id.msg == _rootId) && (update.id.peer == _history->peer->id); - }) | rpl::start_with_next([=](const RepliesReadTillUpdate &update) { + }) | rpl::on_next([=](const RepliesReadTillUpdate &update) { apply(update); }, _lifetime); @@ -105,18 +105,18 @@ void RepliesList::subscribeToUpdates() { | MessageUpdate::Flag::NewMaybeAdded | MessageUpdate::Flag::ReplyToTopAdded | MessageUpdate::Flag::Destroyed - ) | rpl::start_with_next([=](const MessageUpdate &update) { + ) | rpl::on_next([=](const MessageUpdate &update) { apply(update); }, _lifetime); _history->session().changes().topicUpdates( TopicUpdate::Flag::Creator - ) | rpl::start_with_next([=](const TopicUpdate &update) { + ) | rpl::on_next([=](const TopicUpdate &update) { apply(update); }, _lifetime); _history->owner().channelDifferenceTooLong( - ) | rpl::start_with_next([=](not_null channel) { + ) | rpl::on_next([=](not_null channel) { if (channel == _history->peer) { applyDifferenceTooLong(); } @@ -194,19 +194,19 @@ rpl::producer RepliesList::source( _history->session().changes().historyUpdates( _history, HistoryUpdate::Flag::ClientSideMessages - ) | rpl::start_with_next(pushDelayed, lifetime); + ) | rpl::on_next(pushDelayed, lifetime); _history->session().changes().messageUpdates( MessageUpdate::Flag::Destroyed ) | rpl::filter([=](const MessageUpdate &update) { return applyItemDestroyed(viewer, update.item); - }) | rpl::start_with_next(pushDelayed, lifetime); + }) | rpl::on_next(pushDelayed, lifetime); _listChanges.events( - ) | rpl::start_with_next(pushDelayed, lifetime); + ) | rpl::on_next(pushDelayed, lifetime); _instantChanges.events( - ) | rpl::start_with_next(pushInstant, lifetime); + ) | rpl::on_next(pushInstant, lifetime); pushInstant(); return lifetime; diff --git a/Telegram/SourceFiles/data/data_saved_music.cpp b/Telegram/SourceFiles/data/data_saved_music.cpp index d6d8cc705e..4b59e9a05c 100644 --- a/Telegram/SourceFiles/data/data_saved_music.cpp +++ b/Telegram/SourceFiles/data/data_saved_music.cpp @@ -402,7 +402,7 @@ rpl::producer SavedMusicList( savedMusic->changed( ) | rpl::filter( rpl::mappers::_1 == peerId - ) | rpl::start_with_next(schedule, lifetime); + ) | rpl::on_next(schedule, lifetime); if (!savedMusic->countKnown(peerId)) { savedMusic->loadMore(peerId); diff --git a/Telegram/SourceFiles/data/data_saved_sublist.cpp b/Telegram/SourceFiles/data/data_saved_sublist.cpp index bf6d050147..566c3fcd46 100644 --- a/Telegram/SourceFiles/data/data_saved_sublist.cpp +++ b/Telegram/SourceFiles/data/data_saved_sublist.cpp @@ -145,13 +145,13 @@ rpl::producer SavedSublist::source( history->session().changes().historyUpdates( history, HistoryUpdate::Flag::ClientSideMessages - ) | rpl::start_with_next(pushDelayed, lifetime); + ) | rpl::on_next(pushDelayed, lifetime); _listChanges.events( - ) | rpl::start_with_next(pushDelayed, lifetime); + ) | rpl::on_next(pushDelayed, lifetime); _instantChanges.events( - ) | rpl::start_with_next(pushInstant, lifetime); + ) | rpl::on_next(pushInstant, lifetime); pushInstant(); return lifetime; @@ -707,7 +707,7 @@ void SavedSublist::subscribeToUnreadChanges() { ) | rpl::combine_previous( ) | rpl::filter([=] { return inChatList(); - }) | rpl::start_with_next([=]( + }) | rpl::on_next([=]( std::optional previous, std::optional now) { if (previous.value_or(0) != now.value_or(0)) { diff --git a/Telegram/SourceFiles/data/data_search_controller.cpp b/Telegram/SourceFiles/data/data_search_controller.cpp index 4d599c135b..b05ea91441 100644 --- a/Telegram/SourceFiles/data/data_search_controller.cpp +++ b/Telegram/SourceFiles/data/data_search_controller.cpp @@ -434,7 +434,7 @@ rpl::producer SearchController::simpleIdsSlice( limitBefore, limitAfter); builder->insufficientAround( - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( const SparseIdsSliceBuilder::AroundData &data) { requestMore(data, query, listData); }, lifetime); @@ -446,7 +446,7 @@ rpl::producer SearchController::simpleIdsSlice( listData->list.sliceUpdated( ) | rpl::filter([=](const SliceUpdate &update) { return builder->applyUpdate(update); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); _session->data().itemRemoved( ) | rpl::filter([=](not_null item) { @@ -456,14 +456,14 @@ rpl::producer SearchController::simpleIdsSlice( || item->sublistPeerId() == monoforumPeerId); }) | rpl::filter([=](not_null item) { return builder->removeOne(item->id); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); _session->data().historyCleared( ) | rpl::filter([=](not_null history) { return (history->peer->id == peerId); }) | rpl::filter([=] { return builder->removeAll(); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); using Result = Storage::SparseIdsListResult; listData->list.query(Storage::SparseIdsListQuery( @@ -472,7 +472,7 @@ rpl::producer SearchController::simpleIdsSlice( limitAfter )) | rpl::filter([=](const Result &result) { return builder->applyInitial(result); - }) | rpl::start_with_next_done( + }) | rpl::on_next_done( pushNextSnapshot, [=] { builder->checkInsufficient(); }, lifetime); diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 934155204f..7c5a71a44b 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -274,12 +274,12 @@ Session::Session(not_null session) setupUserIsContactViewer(); _chatsList.unreadStateChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { notifyUnreadBadgeChanged(); }, _lifetime); _chatsFilters->changed( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { const auto enabled = _chatsFilters->has(); if (enabled != session->settings().dialogsFiltersEnabled()) { session->settings().setDialogsFiltersEnabled(enabled); @@ -288,7 +288,7 @@ Session::Session(not_null session) }, _lifetime); _reactions->myTagRenamed( - ) | rpl::start_with_next([=](const ReactionId &id) { + ) | rpl::on_next([=](const ReactionId &id) { const auto i = _viewsByTag.find(id); if (i != end(_viewsByTag)) { for (const auto &view : i->second) { @@ -298,7 +298,7 @@ Session::Session(not_null session) }, _lifetime); Spellchecker::HighlightReady( - ) | rpl::start_with_next([=](uint64 processId) { + ) | rpl::on_next([=](uint64 processId) { highlightProcessDone(processId); }, _lifetime); @@ -307,7 +307,7 @@ Session::Session(not_null session) crl::on_main(_session, [=] { AmPremiumValue( _session - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { for (const auto &[document, items] : _documentItems) { if (document->isVoiceMessage()) { for (const auto &item : items) { @@ -321,7 +321,7 @@ Session::Session(not_null session) }); session->appConfig().ignoredRestrictionReasonsChanges( - ) | rpl::start_with_next([=](std::vector &&changed) { + ) | rpl::on_next([=](std::vector &&changed) { auto refresh = std::vector>(); for (const auto &[item, reasons] : _possiblyRestricted) { for (const auto &reason : changed) { @@ -339,7 +339,7 @@ Session::Session(not_null session) void Session::subscribeForTopicRepliesLists() { repliesReadTillUpdates( - ) | rpl::start_with_next([=](const RepliesReadTillUpdate &update) { + ) | rpl::on_next([=](const RepliesReadTillUpdate &update) { if (const auto peer = peerLoaded(update.id.peer)) { if (const auto topic = peer->forumTopicFor(update.id.msg)) { topic->replies()->apply(update); @@ -348,7 +348,7 @@ void Session::subscribeForTopicRepliesLists() { }, _lifetime); sublistReadTillUpdates( - ) | rpl::start_with_next([=](const SublistReadTillUpdate &update) { + ) | rpl::on_next([=](const SublistReadTillUpdate &update) { if (const auto parentChat = channelLoaded(update.parentChatId)) { if (const auto monoforum = parentChat->monoforum()) { const auto sublistPeerId = update.sublistPeerId; @@ -365,7 +365,7 @@ void Session::subscribeForTopicRepliesLists() { | MessageUpdate::Flag::NewMaybeAdded | MessageUpdate::Flag::ReplyToTopAdded | MessageUpdate::Flag::Destroyed - ) | rpl::start_with_next([=](const MessageUpdate &update) { + ) | rpl::on_next([=](const MessageUpdate &update) { if (const auto topic = update.item->topic()) { topic->replies()->apply(update); } else if (update.flags == MessageUpdate::Flag::ReplyToTopAdded) { @@ -378,12 +378,12 @@ void Session::subscribeForTopicRepliesLists() { session().changes().topicUpdates( TopicUpdate::Flag::Creator - ) | rpl::start_with_next([=](const TopicUpdate &update) { + ) | rpl::on_next([=](const TopicUpdate &update) { update.topic->replies()->apply(update); }, _lifetime); channelDifferenceTooLong( - ) | rpl::start_with_next([=](not_null channel) { + ) | rpl::on_next([=](not_null channel) { if (const auto forum = channel->forum()) { forum->enumerateTopics([](not_null topic) { topic->replies()->applyDifferenceTooLong(); @@ -1622,7 +1622,7 @@ void Session::setupMigrationViewer() { return update.peer->asChat(); }) | rpl::filter([=](ChatData *chat) { return (chat != nullptr); - }) | rpl::start_with_next([=](not_null chat) { + }) | rpl::on_next([=](not_null chat) { const auto channel = chat->migrateTo(); if (!channel) { return; @@ -1644,7 +1644,7 @@ void Session::setupChannelLeavingViewer() { PeerUpdate::Flag::ChannelAmIn ) | rpl::map([](const PeerUpdate &update) { return update.peer->asChannel(); - }) | rpl::start_with_next([=](not_null channel) { + }) | rpl::on_next([=](not_null channel) { if (channel->amIn()) { channel->clearInvitePeek(); } else { @@ -1662,7 +1662,7 @@ void Session::setupChannelLeavingViewer() { void Session::setupPeerNameViewer() { session().changes().realtimeNameUpdates( - ) | rpl::start_with_next([=](const NameUpdate &update) { + ) | rpl::on_next([=](const NameUpdate &update) { const auto peer = update.peer; if (const auto history = historyLoaded(peer)) { history->refreshChatListNameSortKey(); @@ -1678,7 +1678,7 @@ void Session::setupUserIsContactViewer() { PeerUpdate::Flag::IsContact ) | rpl::map([](const PeerUpdate &update) { return update.peer->asUser(); - }) | rpl::start_with_next([=](not_null user) { + }) | rpl::on_next([=](not_null user) { const auto i = _contactViews.find(peerToUser(user->id)); if (i != _contactViews.end()) { for (const auto &view : i->second) { diff --git a/Telegram/SourceFiles/data/data_shared_media.cpp b/Telegram/SourceFiles/data/data_shared_media.cpp index 3ee5f54785..6a208106f4 100644 --- a/Telegram/SourceFiles/data/data_shared_media.cpp +++ b/Telegram/SourceFiles/data/data_shared_media.cpp @@ -122,7 +122,7 @@ rpl::producer SharedMediaViewer( data.direction); }; builder->insufficientAround( - ) | rpl::start_with_next(requestMediaAround, lifetime); + ) | rpl::on_next(requestMediaAround, lifetime); auto pushNextSnapshot = [=] { consumer.put_next(builder->snapshot()); @@ -137,7 +137,7 @@ rpl::producer SharedMediaViewer( && (update.type == key.type); }) | rpl::filter([=](const SliceUpdate &update) { return builder->applyUpdate(update.data); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); using OneRemoved = Storage::SharedMediaRemoveOne; session->storage().sharedMediaOneRemoved( @@ -146,7 +146,7 @@ rpl::producer SharedMediaViewer( && update.types.test(key.type); }) | rpl::filter([=](const OneRemoved &update) { return builder->removeOne(update.messageId); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); using AllRemoved = Storage::SharedMediaRemoveAll; session->storage().sharedMediaAllRemoved( @@ -159,7 +159,7 @@ rpl::producer SharedMediaViewer( && update.types.test(key.type); }) | rpl::filter([=] { return builder->removeAll(); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); using InvalidateBottom = Storage::SharedMediaInvalidateBottom; session->storage().sharedMediaBottomInvalidated( @@ -167,7 +167,7 @@ rpl::producer SharedMediaViewer( return (update.peerId == key.peerId); }) | rpl::filter([=] { return builder->invalidateBottom(); - }) | rpl::start_with_next(pushNextSnapshot, lifetime); + }) | rpl::on_next(pushNextSnapshot, lifetime); using Result = Storage::SharedMediaResult; session->storage().query(Storage::SharedMediaQuery( @@ -176,7 +176,7 @@ rpl::producer SharedMediaViewer( limitAfter )) | rpl::filter([=](const Result &result) { return builder->applyInitial(result); - }) | rpl::start_with_next_done( + }) | rpl::on_next_done( pushNextSnapshot, [=] { builder->checkInsufficient(); }, lifetime); @@ -501,7 +501,7 @@ rpl::producer SharedMediaWithLastViewer( std::move(viewerKey), limitBefore, limitAfter - ) | rpl::start_with_next([=](SparseIdsMergedSlice &&update) { + ) | rpl::on_next([=](SparseIdsMergedSlice &&update) { consumer.put_next(SharedMediaWithLastSlice( session, key, @@ -516,7 +516,7 @@ rpl::producer SharedMediaWithLastViewer( std::move(viewerKey), limitBefore, limitAfter - ) | rpl::start_with_next([=](SparseIdsMergedSlice &&update) { + ) | rpl::on_next([=](SparseIdsMergedSlice &&update) { consumer.put_next(SharedMediaWithLastSlice( session, key, @@ -529,7 +529,7 @@ rpl::producer SharedMediaWithLastViewer( std::move(viewerKey), limitBefore, limitAfter - ) | rpl::start_with_next([=](SparseIdsMergedSlice &&update) { + ) | rpl::on_next([=](SparseIdsMergedSlice &&update) { consumer.put_next(SharedMediaWithLastSlice( session, key, @@ -550,7 +550,7 @@ rpl::producer SharedMediaWithLastViewer( key.type), 1, 1) - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( SparseIdsMergedSlice &&viewer, SparseIdsMergedSlice &&ending) { consumer.put_next(SharedMediaWithLastSlice( diff --git a/Telegram/SourceFiles/data/data_sparse_ids.cpp b/Telegram/SourceFiles/data/data_sparse_ids.cpp index 787c0148a3..1f11a04242 100644 --- a/Telegram/SourceFiles/data/data_sparse_ids.cpp +++ b/Telegram/SourceFiles/data/data_sparse_ids.cpp @@ -399,7 +399,7 @@ rpl::producer SparseIdsMergedSlice::CreateViewer( if (!key.migratedPeerId) { return std::move( partViewer - ) | rpl::start_with_next([=](SparseIdsSlice &&part) { + ) | rpl::on_next([=](SparseIdsSlice &&part) { consumer.put_next(SparseIdsMergedSlice( key, std::move(part), @@ -416,7 +416,7 @@ rpl::producer SparseIdsMergedSlice::CreateViewer( return rpl::combine( std::move(partViewer), std::move(migratedViewer) - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( SparseIdsSlice &&part, SparseIdsSlice &&migrated) { consumer.put_next(SparseIdsMergedSlice( diff --git a/Telegram/SourceFiles/data/data_stories.cpp b/Telegram/SourceFiles/data/data_stories.cpp index 6f69b9538e..dfa73b25ad 100644 --- a/Telegram/SourceFiles/data/data_stories.cpp +++ b/Telegram/SourceFiles/data/data_stories.cpp @@ -193,7 +193,7 @@ Stories::Stories(not_null owner) crl::on_main(this, [=] { session().changes().peerUpdates( Data::PeerUpdate::Flag::Rights - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { const auto channel = update.peer->asChannel(); if (!channel) { return; diff --git a/Telegram/SourceFiles/data/data_stories_ids.cpp b/Telegram/SourceFiles/data/data_stories_ids.cpp index 04b36e148e..d6e85edd56 100644 --- a/Telegram/SourceFiles/data/data_stories_ids.cpp +++ b/Telegram/SourceFiles/data/data_stories_ids.cpp @@ -83,7 +83,7 @@ rpl::producer AlbumStoriesIds( stories->albumIdsChanged( ) | rpl::filter( rpl::mappers::_1 == Data::StoryAlbumIdsKey{ peerId, albumId } - ) | rpl::start_with_next(schedule, lifetime); + ) | rpl::on_next(schedule, lifetime); if (!stories->albumIdsCountKnown(peerId, albumId)) { stories->albumIdsLoadMore(peerId, albumId); diff --git a/Telegram/SourceFiles/data/data_user.cpp b/Telegram/SourceFiles/data/data_user.cpp index 2d55a60698..f1a52958a4 100644 --- a/Telegram/SourceFiles/data/data_user.cpp +++ b/Telegram/SourceFiles/data/data_user.cpp @@ -917,7 +917,7 @@ void ApplyUserUpdate(not_null user, const MTPDuserFull &update) { } creditsLoadLifetime->destroy(); }); - base::timer_once(kTimeout) | rpl::start_with_next([=] { + base::timer_once(kTimeout) | rpl::on_next([=] { creditsLoadLifetime->destroy(); }, *creditsLoadLifetime); const auto currencyLoadLifetime @@ -930,13 +930,13 @@ void ApplyUserUpdate(not_null user, const MTPDuserFull &update) { } currencyLoadLifetime->destroy(); }; - currencyLoad->request() | rpl::start_with_error_done( + currencyLoad->request() | rpl::on_error_done( [=](const QString &error) { apply(CreditsAmount(0, CreditsType::Ton)); }, [=] { apply(currencyLoad->data().currentBalance); }, *currencyLoadLifetime); - base::timer_once(kTimeout) | rpl::start_with_next([=] { + base::timer_once(kTimeout) | rpl::on_next([=] { currencyLoadLifetime->destroy(); }, *currencyLoadLifetime); } diff --git a/Telegram/SourceFiles/data/data_user_photos.cpp b/Telegram/SourceFiles/data/data_user_photos.cpp index 6271f9b4c9..74553e6319 100644 --- a/Telegram/SourceFiles/data/data_user_photos.cpp +++ b/Telegram/SourceFiles/data/data_user_photos.cpp @@ -203,16 +203,16 @@ rpl::producer UserPhotosViewer( photoId); }; builder->insufficientPhotosAround() - | rpl::start_with_next(std::move(requestPhotosAround), lifetime); + | rpl::on_next(std::move(requestPhotosAround), lifetime); session->storage().userPhotosSliceUpdated() - | rpl::start_with_next(applyUpdate, lifetime); + | rpl::on_next(applyUpdate, lifetime); session->storage().query(Storage::UserPhotosQuery( key, limitBefore, limitAfter - )) | rpl::start_with_next_done( + )) | rpl::on_next_done( applyUpdate, [=] { builder->checkInsufficientPhotos(); }, lifetime); @@ -247,7 +247,7 @@ std::optional SyncUserFallbackPhotoViewer(not_null user) { Storage::UserPhotosKey(peerToUser(user->id), true), kFallbackCount, kFallbackCount - )) | rpl::start_with_next([&](Storage::UserPhotosResult &&slice) { + )) | rpl::on_next([&](Storage::UserPhotosResult &&slice) { if (slice.photoIds.empty()) { return; } diff --git a/Telegram/SourceFiles/data/notify/data_notify_settings.cpp b/Telegram/SourceFiles/data/notify/data_notify_settings.cpp index 299b7fc61b..d0df98687c 100644 --- a/Telegram/SourceFiles/data/notify/data_notify_settings.cpp +++ b/Telegram/SourceFiles/data/notify/data_notify_settings.cpp @@ -321,7 +321,7 @@ void NotifySettings::updateLocal(not_null thread) { auto &lifetime = _mutedTopics.emplace( topic, rpl::lifetime()).first->second; - topic->destroyed() | rpl::start_with_next([=] { + topic->destroyed() | rpl::on_next([=] { _mutedTopics.erase(topic); }, lifetime); unmuteByFinishedDelayed(changesIn); @@ -385,7 +385,7 @@ void NotifySettings::cacheSound(const std::optional &sound) { } // Not requested yet. _owner->session().api().ringtones().listUpdates( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { for (const auto id : base::take(_ringtones.pendingIds)) { cacheSound(id); } diff --git a/Telegram/SourceFiles/data/stickers/data_custom_emoji.cpp b/Telegram/SourceFiles/data/stickers/data_custom_emoji.cpp index 840249d8ef..a90656303c 100644 --- a/Telegram/SourceFiles/data/stickers/data_custom_emoji.cpp +++ b/Telegram/SourceFiles/data/stickers/data_custom_emoji.cpp @@ -259,7 +259,7 @@ void CustomEmojiLoader::load(Fn loaded) { check(); } else { load->document->session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { check(); }, load->process->lifetime); } @@ -463,7 +463,7 @@ CustomEmojiManager::CustomEmojiManager(not_null owner) appConfig->value( ) | rpl::take_while([=] { return !_coloredSetId; - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { const auto setId = appConfig->get( "default_emoji_statuses_stickerset_id", QString()).toULongLong(); @@ -917,7 +917,7 @@ void CustomEmojiManager::scheduleRepaintTimer() { #if 0 // inject-to-on_main if (!_repaintsLifetime) { crl::on_main_update_requests( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { invokeRepaints(); }, _repaintsLifetime); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index ac1273e4a9..dc6f0bafbd 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -206,7 +206,7 @@ constexpr auto kPreviewPostsLimit = 3; rpl::single(std::move(text))); if (suggestAllChats) { result->handlerActivated( - ) | rpl::start_with_next(resetChatTypeFilter, result->lifetime()); + ) | rpl::on_next(resetChatTypeFilter, result->lifetime()); } result->show(); result->resizeToWidth(parent->width()); @@ -291,7 +291,7 @@ InnerWidget::InnerWidget( setAttribute(Qt::WA_OpaquePaintEvent, true); style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _topicJumpCache = nullptr; _chatsFilterTags.clear(); _rightButtons.clear(); @@ -304,12 +304,12 @@ InnerWidget::InnerWidget( }, lifetime()); session().downloaderTaskFinished( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { update(); }, lifetime()); Core::App().notifications().settingsChanged( - ) | rpl::start_with_next([=](Window::Notifications::ChangeType change) { + ) | rpl::on_next([=](Window::Notifications::ChangeType change) { if (change == Window::Notifications::ChangeType::CountMessages) { // Folder rows change their unread badge with this setting. update(); @@ -317,23 +317,23 @@ InnerWidget::InnerWidget( }, lifetime()); session().data().contactsLoaded().changes( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refresh(); refreshEmpty(); }, lifetime()); session().data().itemRemoved( - ) | rpl::start_with_next([=](not_null item) { + ) | rpl::on_next([=](not_null item) { itemRemoved(item); }, lifetime()); session().data().dialogsRowReplacements( - ) | rpl::start_with_next([=](Data::Session::DialogsRowReplacement r) { + ) | rpl::on_next([=](Data::Session::DialogsRowReplacement r) { dialogRowReplaced(r.old, r.now); }, lifetime()); session().data().sendActionManager().animationUpdated( - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( const Data::SendActionManager::AnimationUpdate &update) { const auto updateRect = Ui::RowPainter::SendActionAnimationRect( update.thread, @@ -348,7 +348,7 @@ InnerWidget::InnerWidget( }, lifetime()); session().data().sendActionManager().speakingAnimationUpdated( - ) | rpl::start_with_next([=](not_null history) { + ) | rpl::on_next([=](not_null history) { repaintDialogRowCornerStatus(history); }, lifetime()); @@ -361,7 +361,7 @@ InnerWidget::InnerWidget( return !_savedSublists && !_openedForum && (folder == _openedFolder); - }) | rpl::start_with_next([=] { + }) | rpl::on_next([=] { refresh(); }, lifetime()); @@ -370,7 +370,7 @@ InnerWidget::InnerWidget( session().data().chatsFilters().changed() | rpl::map_to(true), session().data().chatsFilters().tagsEnabledChanges( ) | rpl::map_to(true) - ) | rpl::start_with_next([=](bool refreshHeight) { + ) | rpl::on_next([=](bool refreshHeight) { if (refreshHeight) { _chatsFilterTags.clear(); _shownList->updateHeights(_narrowRatio); @@ -379,7 +379,7 @@ InnerWidget::InnerWidget( }, lifetime()); session().data().chatsFilters().tagsEnabledValue( - ) | rpl::start_with_next([=](bool tags) { + ) | rpl::on_next([=](bool tags) { _handleChatListEntryTagRefreshesLifetime.destroy(); if (!tags) { return; @@ -397,7 +397,7 @@ InnerWidget::InnerWidget( } } return false; - }) | rpl::start_with_next([=](const Event &event) { + }) | rpl::on_next([=](const Event &event) { Ui::PostponeCall(crl::guard(this, [=] { _waitingAllChatListEntryRefreshesForTags = false; if (_shownList->updateHeights(_narrowRatio)) { @@ -407,7 +407,7 @@ InnerWidget::InnerWidget( }, _handleChatListEntryTagRefreshesLifetime); session().data().chatsFilters().tagColorChanged( - ) | rpl::start_with_next([=](Data::TagColorChanged data) { + ) | rpl::on_next([=](Data::TagColorChanged data) { const auto filterId = data.filterId; const auto key = SerializeFilterTagsKey(filterId, 0, false); const auto activeKey = SerializeFilterTagsKey(filterId, 0, true); @@ -442,14 +442,14 @@ InnerWidget::InnerWidget( }, lifetime()); session().settings().archiveInMainMenuChanges( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refresh(); }, lifetime()); session().changes().historyUpdates( Data::HistoryUpdate::Flag::IsPinned | Data::HistoryUpdate::Flag::ChatOccupied - ) | rpl::start_with_next([=](const Data::HistoryUpdate &update) { + ) | rpl::on_next([=](const Data::HistoryUpdate &update) { if (update.flags & Data::HistoryUpdate::Flag::IsPinned) { stopReorderPinned(); } @@ -466,7 +466,7 @@ InnerWidget::InnerWidget( | UpdateFlag::IsContact | UpdateFlag::FullInfo | UpdateFlag::EmojiStatus - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { if (update.flags & (UpdateFlag::Name | UpdateFlag::Photo @@ -491,14 +491,14 @@ InnerWidget::InnerWidget( session().changes().messageUpdates( Data::MessageUpdate::Flag::DialogRowRefresh - ) | rpl::start_with_next([=](const Data::MessageUpdate &update) { + ) | rpl::on_next([=](const Data::MessageUpdate &update) { refreshDialogRow({ update.item->history(), update.item->fullId() }); }, lifetime()); session().changes().entryUpdates( Data::EntryUpdate::Flag::Repaint | Data::EntryUpdate::Flag::Height - ) | rpl::start_with_next([=](const Data::EntryUpdate &update) { + ) | rpl::on_next([=](const Data::EntryUpdate &update) { const auto entry = update.entry; if (update.flags & Data::EntryUpdate::Flag::Height) { if (updateEntryHeight(entry)) { @@ -520,7 +520,7 @@ InnerWidget::InnerWidget( _controller->activeChatEntryValue( ) | rpl::combine_previous( - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( RowDescriptor previous, RowDescriptor next) { const auto update = [&](const RowDescriptor &descriptor) { @@ -545,12 +545,12 @@ InnerWidget::InnerWidget( }, lifetime()); _controller->activeChatsFilter( - ) | rpl::start_with_next([=](FilterId filterId) { + ) | rpl::on_next([=](FilterId filterId) { switchToFilter(filterId); }, lifetime()); _controller->window().widget()->globalForceClicks( - ) | rpl::start_with_next([=](QPoint globalPosition) { + ) | rpl::on_next([=](QPoint globalPosition) { processGlobalForceClick(globalPosition); }, lifetime()); @@ -780,7 +780,7 @@ void InnerWidget::changeOpenedForum(Data::Forum *forum) { rpl::merge( forum->chatsListChanges(), forum->chatsListLoadedEvents() - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refresh(); }, _openedForumLifetime); } @@ -812,7 +812,7 @@ void InnerWidget::showSavedSublists() { _openedForumLifetime.destroy(); //session().data().savedMessages().chatsListChanges( - //) | rpl::start_with_next([=] { + //) | rpl::on_next([=] { // refresh(); //}, lifetime()); @@ -2751,7 +2751,7 @@ void InnerWidget::handleChatListEntryRefreshes() { } else { return !_openedForum; } - }) | rpl::start_with_next([=](const Event &event) { + }) | rpl::on_next([=](const Event &event) { const auto offset = dialogsOffset(); const auto from = offset + event.moved.from; const auto to = offset + event.moved.to; @@ -3441,13 +3441,13 @@ void InnerWidget::applySearchState(SearchState state) { reactions->myTagsValue(sublist), state.tags); - _searchTags->repaintRequests() | rpl::start_with_next([=] { + _searchTags->repaintRequests() | rpl::on_next([=] { const auto height = _searchTags->height(); update(0, 0, width(), height); }, _searchTags->lifetime()); _searchTags->menuRequests( - ) | rpl::start_with_next([=](Data::ReactionId id) { + ) | rpl::on_next([=](Data::ReactionId id) { HistoryView::ShowTagInListMenu( &_menu, _lastMousePosition.value_or(QCursor::pos()), @@ -3458,7 +3458,7 @@ void InnerWidget::applySearchState(SearchState state) { _searchTags->heightValue() | rpl::skip( 1 - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { refresh(); moveSearchIn(); if (_loadingAnimation) { @@ -3645,7 +3645,7 @@ void InnerWidget::trackResultsHistory(not_null history) { ) | rpl::filter([=](const ChannelData::Flags::Change &change) { return (change.diff & ChannelDataFlag::Forum); }) | rpl::to_empty | rpl::type_erased; - std::move(changes) | rpl::start_with_next([=] { + std::move(changes) | rpl::on_next([=] { for (const auto &row : _searchResults) { if (row->item()->history()->peer == peer) { row->invalidateTopic(); @@ -3678,7 +3678,7 @@ void InnerWidget::trackResultsHistory(not_null history) { if (const auto forum = peer->forum()) { forum->topicDestroyed( - ) | rpl::start_with_next([=](not_null topic) { + ) | rpl::on_next([=](not_null topic) { auto removed = false; const auto sfrom = ranges::remove( _searchResults, @@ -4204,13 +4204,13 @@ void InnerWidget::refreshEmpty() { _emptyButton->setClickedCallback([=, window = _controller] { window->show(PrepareContactsBox(window)); }); - geometryValue() | rpl::start_with_next([=](const QRect &r) { + geometryValue() | rpl::on_next([=](const QRect &r) { const auto top = r.height() - _emptyButton->height() - st::dialogEmptyButtonSkip; _emptyButton->moveToLeft(st::dialogEmptyButtonSkip, top); }, _emptyButton->lifetime()); - geometryValue() | rpl::start_with_next([=](const QRect &r) { + geometryValue() | rpl::on_next([=](const QRect &r) { const auto bottom = _emptyButton ? (_emptyButton->height() + st::dialogEmptyButtonSkip) : 0; @@ -5153,7 +5153,7 @@ void InnerWidget::setupOnlineStatusCheck() { Data::PeerUpdate::Flag::OnlineStatus | Data::PeerUpdate::Flag::GroupCall | Data::PeerUpdate::Flag::MessagesTTL - ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + ) | rpl::on_next([=](const Data::PeerUpdate &update) { const auto &peer = update.peer; if (const auto user = peer->asUser()) { if (user->isSelf()) { @@ -5265,7 +5265,7 @@ void InnerWidget::setupShortcuts() { && !_controller->window().locked() && !_childListShown.current().shown && !_chatPreviewRow.key; - }) | rpl::start_with_next([=](not_null request) { + }) | rpl::on_next([=](not_null request) { using Command = Shortcuts::Command; const auto row = _controller->activeChatEntryCurrent(); diff --git a/Telegram/SourceFiles/dialogs/dialogs_main_list.cpp b/Telegram/SourceFiles/dialogs/dialogs_main_list.cpp index c38d844ef0..affe4fab3d 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_main_list.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_main_list.cpp @@ -27,12 +27,12 @@ MainList::MainList( std::move( pinnedLimit - ) | rpl::start_with_next([=](int limit) { + ) | rpl::on_next([=](int limit) { _pinned.setLimit(std::max(limit, 1)); }, _lifetime); session->changes().realtimeNameUpdates( - ) | rpl::start_with_next([=](const Data::NameUpdate &update) { + ) | rpl::on_next([=](const Data::NameUpdate &update) { _all.peerNameChanged(_filterId, update.peer, update.oldFirstLetters); }, _lifetime); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp index b81e79f7b3..8790507de5 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp @@ -41,7 +41,7 @@ object_ptr SearchFromBox( box->closeBox(); }); }); - box->boxClosing() | rpl::start_with_next( + box->boxClosing() | rpl::on_next( std::move(closedCallback), *subscription); return box; diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_posts.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_posts.cpp index 626c96151f..0bf32a752c 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_search_posts.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_search_posts.cpp @@ -33,7 +33,7 @@ PostsSearch::PostsSearch(not_null session) , _api(&_session->api().instance()) , _timer([=] { applyQuery(); }) , _recheckTimer([=] { recheck(); }) { - Data::AmPremiumValue(_session) | rpl::start_with_next([=] { + Data::AmPremiumValue(_session) | rpl::on_next([=] { maybePushPremiumUpdate(); }, _lifetime); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_tags.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_tags.cpp index 61272816a0..d9cff28865 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_search_tags.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_search_tags.cpp @@ -92,7 +92,7 @@ SearchTags::SearchTags( rpl::combine( std::move(tags), Data::AmPremiumValue(&owner->session()) - ) | rpl::start_with_next([=]( + ) | rpl::on_next([=]( const std::vector &list, bool premium) { fill(list, premium); @@ -107,7 +107,7 @@ SearchTags::SearchTags( } style::PaletteChanged( - ) | rpl::start_with_next([=] { + ) | rpl::on_next([=] { _normalBg = _selectedBg = QImage(); }, _lifetime); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_top_bar_suggestion.cpp b/Telegram/SourceFiles/dialogs/dialogs_top_bar_suggestion.cpp index f20493ae81..51d034522a 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_top_bar_suggestion.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_top_bar_suggestion.cpp @@ -204,7 +204,7 @@ rpl::producer*> TopBarSuggestionValue( rpl::combine( parent->widthValue(), state->content->desiredHeightValue() - ) | rpl::start_with_next([=](int width, int height) { + ) | rpl::on_next([=](int width, int height) { state->content->resize(width, height); }, state->content->lifetime()); } @@ -292,7 +292,7 @@ rpl::producer*> TopBarSuggestionValue( const auto button = lifetime.template make_state