Renamed rpl::start_with_ with rpl::on_.

This commit is contained in:
23rd
2025-12-10 20:51:57 +03:00
parent 29b714dd5f
commit eca8dfb0ec
623 changed files with 4524 additions and 4524 deletions

View File

@@ -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<const HistoryItem*> item) {
) | rpl::on_next([=](not_null<const HistoryItem*> 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*> history) {
) | rpl::on_next([=](not_null<History*> 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*> 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*> history) {
if (const auto forum = peer->forum()) {
forum->topicDestroyed(
) | rpl::start_with_next([=](not_null<Data::ForumTopic*> topic) {
) | rpl::on_next([=](not_null<Data::ForumTopic*> 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<Shortcuts::Request*> request) {
}) | rpl::on_next([=](not_null<Shortcuts::Request*> request) {
using Command = Shortcuts::Command;
const auto row = _controller->activeChatEntryCurrent();

View File

@@ -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);
}

View File

@@ -41,7 +41,7 @@ object_ptr<Ui::BoxContent> SearchFromBox(
box->closeBox();
});
});
box->boxClosing() | rpl::start_with_next(
box->boxClosing() | rpl::on_next(
std::move(closedCallback),
*subscription);
return box;

View File

@@ -33,7 +33,7 @@ PostsSearch::PostsSearch(not_null<Main::Session*> session)
, _api(&_session->api().instance())
, _timer([=] { applyQuery(); })
, _recheckTimer([=] { recheck(); }) {
Data::AmPremiumValue(_session) | rpl::start_with_next([=] {
Data::AmPremiumValue(_session) | rpl::on_next([=] {
maybePushPremiumUpdate();
}, _lifetime);
}

View File

@@ -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<Data::Reaction> &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);
}

View File

@@ -204,7 +204,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> 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<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
const auto button = lifetime.template make_state<Button>();
const auto window = FindSessionController(parent);
auctions->active(
) | rpl::start_with_next([=](ActiveAuctions &&active) {
) | rpl::on_next([=](ActiveAuctions &&active) {
const auto empty = active.list.empty();
state->desiredWrapToggle.force_assign(
Toggle{ !empty, anim::type::normal });
@@ -425,7 +425,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
};
session->credits().load();
state->creditsLifetime.destroy();
session->credits().balanceValue() | rpl::start_with_next([=] {
session->credits().balanceValue() | rpl::on_next([=] {
state->creditsLifetime.destroy();
state->creditsHistory->requestSubscriptions(
Data::CreditsStatusSlice::OffsetToken(),
@@ -513,7 +513,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
widget->setAttribute(
Qt::WA_TransparentForMouseEvents);
content->sizeValue() | rpl::filter_size(
) | rpl::start_with_next([=](const QSize &size) {
) | rpl::on_next([=](const QSize &size) {
widget->resize(size);
widget->show();
widget->raise();
@@ -523,7 +523,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
s->inRow.push_back({ .peer = user });
}
}
widget->paintRequest() | rpl::start_with_next([=] {
widget->paintRequest() | rpl::on_next([=] {
auto p = QPainter(widget);
const auto regenerate = [&] {
if (s->userpics.isNull()) {
@@ -573,7 +573,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
rpl::combine(
state->leftPadding.value(),
content->sizeValue() | rpl::filter_size()
) | rpl::start_with_next([=](int p, const QSize &s) {
) | rpl::on_next([=](int p, const QSize &s) {
fake->raise();
fake->show();
fake->moveToLeft(
@@ -605,7 +605,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
Data::IsBirthdayTodayValue
) | rpl::flatten_latest(
) | rpl::distinct_until_changed(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
repeat(repeat);
});
});
@@ -667,7 +667,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
content->setRightIcon(RightIcon::Arrow);
content->setLeftPadding(state->leftPadding.value());
const auto api = &session->api().premium();
api->statusTextValue() | rpl::start_with_next([=] {
api->statusTextValue() | rpl::on_next([=] {
for (const auto &o : api->subscriptionOptions()) {
if (o.months == 12) {
set(o.discount);
@@ -692,7 +692,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
rpl::combine(
state->leftPadding.value(),
content->sizeValue() | rpl::filter_size()
) | rpl::start_with_next([=](int padding, const QSize &s) {
) | rpl::on_next([=](int padding, const QSize &s) {
upload->raise();
upload->show();
upload->moveToLeft(
@@ -700,7 +700,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
(s.height() - upload->height()) / 2);
}, content->lifetime());
setLeftPaddingRelativeTo(content, upload);
upload->chosenImages() | rpl::start_with_next([=](
upload->chosenImages() | rpl::on_next([=](
Ui::UserpicButton::ChosenImage &&chosen) {
if (chosen.type == Ui::UserpicButton::ChosenType::Set) {
session->api().peerPhoto().upload(
@@ -716,7 +716,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
state->userpicLifetime = session->changes().peerUpdates(
session->user(),
Data::PeerUpdate::Flag::Photo
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (session->user()->userpicPhotoId()) {
repeat(repeat);
}
@@ -762,7 +762,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
state->desiredWrapToggle.value() | rpl::combine_previous(
) | rpl::filter([=] {
return state->wrap != nullptr;
}) | rpl::start_with_next([=](Toggle was, Toggle now) {
}) | rpl::on_next([=](Toggle was, Toggle now) {
state->wrap->toggle(
state->outerWrapToggle.current() && now.value,
(was.value == now.value)
@@ -773,7 +773,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
state->outerWrapToggle.value() | rpl::combine_previous(
) | rpl::filter([=] {
return state->wrap != nullptr;
}) | rpl::start_with_next([=](bool was, bool now) {
}) | rpl::on_next([=](bool was, bool now) {
const auto toggle = state->desiredWrapToggle.current();
state->wrap->toggle(
toggle.value && now,
@@ -785,7 +785,7 @@ rpl::producer<Ui::SlideWrap<Ui::RpWidget>*> TopBarSuggestionValue(
session->api().authorizations().unreviewedChanges(),
Data::AmPremiumValue(session) | rpl::skip(1) | rpl::to_empty,
session->giftAuctions().hasActiveChanges() | rpl::to_empty
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto was = state->wrap.get();
const auto weak = base::make_weak(was);
processCurrentSuggestion(processCurrentSuggestion);

View File

@@ -223,7 +223,7 @@ Widget::BottomButton::BottomButton(
if (_hasTextIcon) {
rpl::single(rpl::empty_value()) | rpl::then(
style::PaletteChanged()
) | rpl::start_with_next([this] {
) | rpl::on_next([this] {
_textIcon = UpdateIcon();
}, lifetime());
}
@@ -392,12 +392,12 @@ Widget::Widget(
rpl::combine(
_scroll->heightValue(),
_topBarSuggestionHeightChanged.events_starting_with(0)
) | rpl::start_with_next([=](int height, int topBarHeight) {
) | rpl::on_next([=](int height, int topBarHeight) {
innerList->setMinimumHeight(height);
_inner->setMinimumHeight(height - topBarHeight);
_inner->refresh();
}, innerList->lifetime());
_scroll->widthValue() | rpl::start_with_next([=](int width) {
_scroll->widthValue() | rpl::on_next([=](int width) {
innerList->resizeToWidth(width);
}, innerList->lifetime());
_scrollToTop->raise();
@@ -405,14 +405,14 @@ Widget::Widget(
_inner->updated(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
listScrollUpdated();
}, lifetime());
rpl::combine(
session().api().dialogsLoadMayBlockByDate(),
session().api().dialogsLoadBlockedByDate()
) | rpl::start_with_next([=](bool mayBlock, bool isBlocked) {
) | rpl::on_next([=](bool mayBlock, bool isBlocked) {
refreshLoadMoreButton(mayBlock, isBlocked);
}, lifetime());
@@ -429,7 +429,7 @@ Widget::Widget(
&& !update.history->isPinnedDialog(
controller->activeChatsFilterCurrent());
}
}) | rpl::start_with_next([=](const Data::HistoryUpdate &update) {
}) | rpl::on_next([=](const Data::HistoryUpdate &update) {
jumpToTop(true);
}, lifetime());
@@ -437,20 +437,20 @@ Widget::Widget(
) | rpl::to_empty);
_inner->scrollByDeltaRequests(
) | rpl::start_with_next([=](int delta) {
) | rpl::on_next([=](int delta) {
if (_scroll) {
_scroll->scrollToY(_scroll->scrollTop() + delta);
}
}, lifetime());
_inner->mustScrollTo(
) | rpl::start_with_next([=](const Ui::ScrollToRequest &data) {
) | rpl::on_next([=](const Ui::ScrollToRequest &data) {
if (_scroll) {
_scroll->scrollToY(data.ymin, data.ymax);
}
}, lifetime());
_inner->dialogMoved(
) | rpl::start_with_next([=](const Ui::ScrollToRequest &data) {
) | rpl::on_next([=](const Ui::ScrollToRequest &data) {
const auto movedFrom = data.ymin;
const auto movedTo = data.ymax;
const auto st = _scroll->scrollTop();
@@ -459,21 +459,21 @@ Widget::Widget(
}
}, lifetime());
_inner->searchRequests(
) | rpl::start_with_next([=](SearchRequestDelay delay) {
) | rpl::on_next([=](SearchRequestDelay delay) {
searchRequested(delay);
}, lifetime());
_inner->completeHashtagRequests(
) | rpl::start_with_next([=](const QString &tag) {
) | rpl::on_next([=](const QString &tag) {
completeHashtag(tag);
}, lifetime());
_inner->refreshHashtagsRequests(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
searchCursorMoved();
}, lifetime());
_inner->changeSearchTabRequests(
) | rpl::filter([=](ChatSearchTab tab) {
return _searchState.tab != tab;
}) | rpl::start_with_next([=](ChatSearchTab tab) {
}) | rpl::on_next([=](ChatSearchTab tab) {
auto copy = _searchState;
copy.tab = tab;
applySearchState(std::move(copy));
@@ -482,13 +482,13 @@ Widget::Widget(
) | rpl::filter([=](ChatTypeFilter filter) {
return (_searchState.filter != filter)
&& (_searchState.tab == ChatSearchTab::MyMessages);
}) | rpl::start_with_next([=](ChatTypeFilter filter) {
}) | rpl::on_next([=](ChatTypeFilter filter) {
auto copy = _searchState;
copy.filter = filter;
applySearchState(copy);
}, lifetime());
_inner->cancelSearchRequests(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
cancelSearch({
.forceFullCancel = true,
.jumpBackToSearchedChat = true,
@@ -496,7 +496,7 @@ Widget::Widget(
controller->widget()->setInnerFocus();
}, lifetime());
_inner->cancelSearchFromRequests(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto copy = _searchState;
copy.fromPeer = nullptr;
if (copy.inChat.sublist()) {
@@ -505,33 +505,33 @@ Widget::Widget(
applySearchState(std::move(copy));
}, lifetime());
_inner->changeSearchFromRequests(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
showSearchFrom();
}, lifetime());
_inner->chosenRow(
) | rpl::start_with_next([=](const ChosenRow &row) {
) | rpl::on_next([=](const ChosenRow &row) {
chosenRow(row);
}, lifetime());
_inner->openBotMainAppRequests(
) | rpl::start_with_next([=](UserId userId) {
) | rpl::on_next([=](UserId userId) {
if (const auto user = session().data().user(userId)) {
openBotMainApp(user);
}
}, lifetime());
_scroll->geometryChanged(
) | rpl::start_with_next(crl::guard(_inner, [=] {
) | rpl::on_next(crl::guard(_inner, [=] {
_inner->parentGeometryChanged();
}), lifetime());
_scroll->scrolls(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
listScrollUpdated();
}, lifetime());
session().data().chatsListChanges(
) | rpl::filter([=](Data::Folder *folder) {
return (folder == _inner->shownFolder());
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
Ui::PostponeCall(this, [=] { listScrollUpdated(); });
}, lifetime());
@@ -539,17 +539,17 @@ Widget::Widget(
controller->widget()->imeCompositionStarts(
) | rpl::filter([=] {
return redirectImeToSearch();
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
_search->setFocusFast();
}, lifetime());
_search->changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
crl::on_main(this, [=] { applySearchUpdate(); });
}, _search->lifetime());
_search->submits(
) | rpl::start_with_next([=] { submit(); }, _search->lifetime());
) | rpl::on_next([=] { submit(); }, _search->lifetime());
QObject::connect(
_search->rawTextEdit().get(),
@@ -565,7 +565,7 @@ Widget::Widget(
checker.isLatest(),
checker.failed(),
checker.ready()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
checkUpdateStatus();
}, lifetime());
}
@@ -577,7 +577,7 @@ Widget::Widget(
_chooseFromUser->entity()->setClickedCallback([=] { showSearchFrom(); });
rpl::single(rpl::empty) | rpl::then(
session().domain().local().localPasscodeChanged()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateLockUnlockVisibility();
}, lifetime());
const auto lockUnlock = _lockUnlock->entity();
@@ -629,7 +629,7 @@ Widget::Widget(
}
});
_inner->listBottomReached(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
loadMoreBlockedByDate();
}, lifetime());
@@ -649,7 +649,7 @@ Widget::Widget(
};
_scroll->setOverscrollBg(overscrollBg());
style::PaletteChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_scroll->setOverscrollBg(overscrollBg());
}, lifetime());
@@ -661,12 +661,12 @@ Widget::Widget(
anim::type::instant);
controller->openedFolder().changes(
) | rpl::start_with_next([=](Data::Folder *folder) {
) | rpl::on_next([=](Data::Folder *folder) {
changeOpenedFolder(folder, anim::type::normal);
}, lifetime());
controller->shownForum().changes(
) | rpl::filter(!rpl::mappers::_1) | rpl::start_with_next([=] {
) | rpl::filter(!rpl::mappers::_1) | rpl::on_next([=] {
if (_openedForum) {
changeOpenedForum(nullptr, anim::type::normal);
} else if (_childList) {
@@ -675,14 +675,14 @@ Widget::Widget(
}, lifetime());
_childListShown.changes(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_scroll->setOverscrollBg(overscrollBg());
updateControlsGeometry();
}, lifetime());
_childListShown.changes(
) | rpl::filter((rpl::mappers::_1 == 0.) || (rpl::mappers::_1 == 1.)
) | rpl::start_with_next([=](float64 shown) {
) | rpl::on_next([=](float64 shown) {
const auto color = (shown > 0.) ? &st::dialogsRippleBg : nullptr;
_mainMenu.toggle->setRippleColorOverride(color);
_searchForNarrowLayout->setRippleColorOverride(color);
@@ -1042,7 +1042,7 @@ void Widget::setupTouchChatPreview() {
_scroll->setCustomTouchProcess([=](not_null<QTouchEvent*> e) {
return _inner->processTouchEvent(e);
});
_inner->touchCancelRequests() | rpl::start_with_next([=] {
_inner->touchCancelRequests() | rpl::on_next([=] {
QTouchEvent ev(QEvent::TouchCancel);
ev.setTimestamp(crl::now());
QGuiApplication::sendEvent(_scroll, &ev);
@@ -1051,7 +1051,7 @@ void Widget::setupTouchChatPreview() {
void Widget::setupFrozenAccountBar() {
session().frozenValue(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateFrozenAccountBar();
updateControlsGeometry();
}, lifetime());
@@ -1065,7 +1065,7 @@ void Widget::setupTopBarSuggestions(not_null<Ui::VerticalLayout*> dialogs) {
crl::on_main(dialogs, [=] {
const auto owner = &session().data();
session().api().authorizations().unreviewedChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateForceDisplayWide();
}, lifetime());
(owner->chatsListLoaded(nullptr)
@@ -1094,7 +1094,7 @@ void Widget::setupTopBarSuggestions(not_null<Ui::VerticalLayout*> dialogs) {
&& (id == owner->chatsFilters().defaultId());
});
return TopBarSuggestionValue(dialogs, &session(), std::move(on));
}) | rpl::flatten_latest() | rpl::start_with_next([=](
}) | rpl::flatten_latest() | rpl::on_next([=](
Ui::SlideWrap<Ui::RpWidget> *raw) {
if (raw) {
_topBarSuggestion = dialogs->insert(
@@ -1107,7 +1107,7 @@ void Widget::setupTopBarSuggestions(not_null<Ui::VerticalLayout*> dialogs) {
rpl::combine(
_topBarSuggestion->entity()->desiredHeightValue(),
_childListShown.value()
) | rpl::start_with_next([=](
) | rpl::on_next([=](
int desiredHeight,
float64 shown) {
const auto newHeight = desiredHeight * (1. - shown);
@@ -1153,7 +1153,7 @@ void Widget::setupMoreChatsBar() {
return;
}
controller()->activeChatsFilter(
) | rpl::start_with_next([=](FilterId id) {
) | rpl::on_next([=](FilterId id) {
storiesToggleExplicitExpand(false);
const auto cancelled = cancelSearch({ .forceFullCancel = true });
const auto guard = gsl::finally([&] {
@@ -1175,7 +1175,7 @@ void Widget::setupMoreChatsBar() {
trackScroll(_moreChatsBar->wrap());
_moreChatsBar->barClicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (const auto missing = filters->moreChats(id)
; !missing.empty()) {
Api::ProcessFilterUpdate(controller(), id, missing);
@@ -1183,7 +1183,7 @@ void Widget::setupMoreChatsBar() {
}, _moreChatsBar->lifetime());
_moreChatsBar->closeClicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Api::ProcessFilterUpdate(controller(), id, {});
}, _moreChatsBar->lifetime());
@@ -1195,7 +1195,7 @@ void Widget::setupMoreChatsBar() {
}
_moreChatsBar->heightValue(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateControlsGeometry();
}, _moreChatsBar->lifetime());
}, lifetime());
@@ -1207,7 +1207,7 @@ void Widget::setupDownloadBar() {
}
Data::MakeDownloadBarContent(
) | rpl::start_with_next([=](Ui::DownloadBarContent &&content) {
) | rpl::on_next([=](Ui::DownloadBarContent &&content) {
const auto create = (content.count && !_downloadBar);
if (create) {
_downloadBar = std::make_unique<Ui::DownloadBar>(
@@ -1219,20 +1219,20 @@ void Widget::setupDownloadBar() {
}
if (create) {
_downloadBar->heightValue(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateControlsGeometry();
}, _downloadBar->lifetime());
_downloadBar->shownValue(
) | rpl::filter(
!rpl::mappers::_1
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_downloadBar = nullptr;
updateControlsGeometry();
}, _downloadBar->lifetime());
_downloadBar->clicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto &&list = Core::App().downloadManager().loadingList();
const auto guard = gsl::finally([] {
Core::App().downloadManager().clearIfFinished();
@@ -1326,7 +1326,7 @@ void Widget::setupMainMenuToggle() {
rpl::single(rpl::empty) | rpl::then(
controller()->filtersMenuChanged()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
const auto filtersHidden = !controller()->filtersWidth();
_mainMenu.toggle->setVisible(filtersHidden);
_mainMenu.under->setVisible(filtersHidden);
@@ -1336,7 +1336,7 @@ void Widget::setupMainMenuToggle() {
Window::OtherAccountsUnreadState(
&controller()->session().account()
) | rpl::start_with_next([=](const Window::OthersUnreadState &state) {
) | rpl::on_next([=](const Window::OthersUnreadState &state) {
const auto icon = !state.count
? nullptr
: !state.allMuted
@@ -1348,7 +1348,7 @@ void Widget::setupMainMenuToggle() {
void Widget::setupStories() {
_stories->verticalScrollEvents(
) | rpl::start_with_next([=](not_null<QWheelEvent*> e) {
) | rpl::on_next([=](not_null<QWheelEvent*> e) {
_scroll->viewportEvent(e);
}, _stories->lifetime());
@@ -1383,7 +1383,7 @@ void Widget::setupStories() {
_scroll->positionValue(),
_scroll->movementValue(),
_storiesExplicitExpandValue.value()
) | rpl::start_with_next([=](
) | rpl::on_next([=](
Ui::ElasticScrollPosition position,
Ui::ElasticScrollMovement movement,
int explicitlyExpanded) {
@@ -1425,27 +1425,27 @@ void Widget::setupStories() {
}, lifetime());
_stories->collapsedGeometryChanged(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateLockUnlockPosition();
}, lifetime());
_stories->clicks(
) | rpl::start_with_next([=](uint64 id) {
) | rpl::on_next([=](uint64 id) {
controller()->openPeerStories(PeerId(int64(id)), currentSource());
}, lifetime());
_stories->showMenuRequests(
) | rpl::start_with_next([=](const Stories::ShowMenuRequest &request) {
) | rpl::on_next([=](const Stories::ShowMenuRequest &request) {
FillSourceMenu(controller(), request);
}, lifetime());
_stories->loadMoreRequests(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
session().data().stories().loadMore(currentSource());
}, lifetime());
_stories->toggleExpandedRequests(
) | rpl::start_with_next([=](bool expanded) {
) | rpl::on_next([=](bool expanded) {
const auto position = _scroll->position();
if (!expanded) {
_scroll->setOverscrollDefaults(0, 0);
@@ -1459,11 +1459,11 @@ void Widget::setupStories() {
}
}, lifetime());
_stories->emptyValue() | rpl::skip(1) | rpl::start_with_next([=] {
_stories->emptyValue() | rpl::skip(1) | rpl::on_next([=] {
updateStoriesVisibility();
}, lifetime());
_stories->widthValue() | rpl::start_with_next([=] {
_stories->widthValue() | rpl::on_next([=] {
updateLockUnlockPosition();
}, lifetime());
}
@@ -1486,7 +1486,7 @@ void Widget::storiesToggleExplicitExpand(bool expand) {
void Widget::trackScroll(not_null<Ui::RpWidget*> widget) {
widget->events(
) | rpl::start_with_next([=](not_null<QEvent*> e) {
) | rpl::on_next([=](not_null<QEvent*> e) {
const auto type = e->type();
if (type == QEvent::TouchBegin
|| type == QEvent::TouchUpdate
@@ -1506,7 +1506,7 @@ void Widget::setupShortcuts() {
&& !_childList
&& !controller()->isLayerShown()
&& !controller()->window().locked();
}) | rpl::start_with_next([=](not_null<Shortcuts::Request*> request) {
}) | rpl::on_next([=](not_null<Shortcuts::Request*> request) {
using Command = Shortcuts::Command;
if (!controller()->activeChatCurrent()) {
@@ -1547,7 +1547,7 @@ void Widget::fullSearchRefreshOn(rpl::producer<> events) {
events
) | rpl::filter([=] {
return !_searchQuery.isEmpty();
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
_searchTimer.cancel();
_searchProcess.cache.clear();
const auto queries = base::take(_searchProcess.queries);
@@ -1698,7 +1698,7 @@ void Widget::toggleFiltersMenu(bool enabled) {
raw->resizeToWidth(width());
const auto shadow = Ui::CreateChild<Ui::PlainShadow>(raw);
shadow->show();
inner->sizeValue() | rpl::start_with_next([=, this](const QSize &s) {
inner->sizeValue() | rpl::on_next([=, this](const QSize &s) {
raw->resize(s);
shadow->setGeometry(
0,
@@ -1773,7 +1773,7 @@ void Widget::updateSuggestions(anim::type animated) {
controller(),
TopPeersContent(&session()),
RecentPeersContent(&session()));
_suggestions->clearSearchQueryRequests() | rpl::start_with_next([=] {
_suggestions->clearSearchQueryRequests() | rpl::on_next([=] {
setSearchQuery(QString());
}, _suggestions->lifetime());
_searchSuggestionsLocked = false;
@@ -1783,7 +1783,7 @@ void Widget::updateSuggestions(anim::type animated) {
_suggestions->recentPeerChosen(),
_suggestions->myChannelChosen(),
_suggestions->recommendationChosen()
) | rpl::start_with_next([=](not_null<PeerData*> peer) {
) | rpl::on_next([=](not_null<PeerData*> peer) {
if (_searchSuggestionsLocked
&& (!_suggestions || !_suggestions->persist())) {
processSearchFocusChange();
@@ -1801,7 +1801,7 @@ void Widget::updateSuggestions(anim::type animated) {
rpl::merge(
_suggestions->openBotMainAppRequests(),
_suggestions->recentAppChosen()
) | rpl::start_with_next([=](not_null<PeerData*> peer) {
) | rpl::on_next([=](not_null<PeerData*> peer) {
if (const auto user = peer->asUser()) {
if (const auto info = user->botInfo.get()) {
if (info->hasMainApp) {
@@ -1817,11 +1817,11 @@ void Widget::updateSuggestions(anim::type animated) {
}, _suggestions->lifetime());
_suggestions->popularAppChosen(
) | rpl::start_with_next([=](not_null<PeerData*> peer) {
) | rpl::on_next([=](not_null<PeerData*> peer) {
controller()->showPeerInfo(peer);
}, _suggestions->lifetime());
_suggestions->closeRequests() | rpl::start_with_next([=] {
_suggestions->closeRequests() | rpl::on_next([=] {
closeSuggestions();
}, _suggestions->lifetime());
@@ -1992,23 +1992,23 @@ void Widget::refreshTopBars() {
_stories->raise();
}
_subsectionTopBar->searchCancelled(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
escape();
}, _subsectionTopBar->lifetime());
_subsectionTopBar->searchSubmitted(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
submit();
}, _subsectionTopBar->lifetime());
_subsectionTopBar->searchQuery(
) | rpl::start_with_next([=](QString query) {
) | rpl::on_next([=](QString query) {
applySearchUpdate();
}, _subsectionTopBar->lifetime());
_subsectionTopBar->jumpToDateRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
showCalendar();
}, _subsectionTopBar->lifetime());
_subsectionTopBar->chooseFromUserRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
showSearchFrom();
}, _subsectionTopBar->lifetime());
updateControlsGeometry();
@@ -2059,14 +2059,14 @@ void Widget::refreshTopBars() {
_forumTopShadow = std::make_unique<Ui::PlainShadow>(this);
_forumRequestsBar->barClicks(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
RequestsBoxController::Start(controller(), peer);
}, _forumRequestsBar->lifetime());
rpl::merge(
_forumGroupCallBar->barClicks(),
_forumGroupCallBar->joinClicks()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
if (peer->groupCall()) {
controller()->startOrJoinGroupCall(peer);
}
@@ -2090,7 +2090,7 @@ void Widget::refreshTopBars() {
_forumGroupCallBar->heightValue(),
_forumRequestsBar->heightValue(),
_forumReportBar->bar().heightValue()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updateControlsGeometry();
}, _forumRequestsBar->lifetime());
} else {
@@ -3398,12 +3398,12 @@ void Widget::openChildList(
const auto opacity = shadow->lifetime().make_state<float64>(0.);
shadow->setAttribute(Qt::WA_TransparentForMouseEvents);
shadow->paintRequest(
) | rpl::start_with_next([=](QRect clip) {
) | rpl::on_next([=](QRect clip) {
auto p = QPainter(shadow);
p.setOpacity(*opacity);
p.fillRect(clip, st::shadowFg);
}, shadow->lifetime());
_childListShown.value() | rpl::start_with_next([=](float64 value) {
_childListShown.value() | rpl::on_next([=](float64 value) {
*opacity = value;
update();
_inner->update();
@@ -3445,7 +3445,7 @@ void Widget::closeChildList(anim::type animated) {
Window::SlideAnimation
>();
_hideChildListCanvas->paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
QPainter p(_hideChildListCanvas.get());
animation->paintContents(p);
}, _hideChildListCanvas->lifetime());
@@ -3636,7 +3636,7 @@ bool Widget::applySearchState(SearchState state) {
}
_searchTagsLifetime = _inner->searchTagsChanges(
) | rpl::start_with_next([=](std::vector<Data::ReactionId> &&list) {
) | rpl::on_next([=](std::vector<Data::ReactionId> &&list) {
auto copy = _searchState;
copy.tags = std::move(list);
applySearchState(std::move(copy));

View File

@@ -50,7 +50,7 @@ void SearchEmpty::setup(Icon icon, rpl::producer<TextWithEntities> text) {
st::recentPeersEmptyMargin);
const auto animated = widget.data();
sizeValue() | rpl::start_with_next([=](QSize size) {
sizeValue() | rpl::on_next([=](QSize size) {
const auto padding = st::recentPeersEmptyMargin;
const auto paddings = padding.left() + padding.right();
label->resizeToWidth(size.width() - paddings);

View File

@@ -104,7 +104,7 @@ Action::Action(
resolveMinWidth();
paintRequest(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
Painter p(this);
paint(p);
}, lifetime());
@@ -263,7 +263,7 @@ void ChatSearchIn::Section::update() {
ChatSearchIn::ChatSearchIn(QWidget *parent)
: RpWidget(parent) {
_in.clicks.events() | rpl::start_with_next([=] {
_in.clicks.events() | rpl::on_next([=] {
showMenu();
}, lifetime());
}
@@ -410,7 +410,7 @@ void ChatSearchIn::updateSection(
st::columnMinimalWidthLeft,
st::dialogsSearchInHeight);
raw->paintRequest() | rpl::start_with_next([=] {
raw->paintRequest() | rpl::on_next([=] {
auto p = QPainter(raw);
if (!section->subscribed) {
section->subscribed = true;
@@ -452,7 +452,7 @@ void ChatSearchIn::updateSection(
const auto st = &st::dialogsCancelSearchInPeer;
section->cancel = std::make_unique<Ui::IconButton>(raw, *st);
section->cancel->show();
raw->sizeValue() | rpl::start_with_next([=](QSize size) {
raw->sizeValue() | rpl::on_next([=](QSize size) {
const auto left = size.width() - section->cancel->width();
const auto top = (size.height() - st->height) / 2;
section->cancel->moveToLeft(left, top);

View File

@@ -320,7 +320,7 @@ void MessageView::prepare(
if (!_loadingContext) {
_loadingContext = std::make_unique<LoadingContext>();
item->history()->session().downloaderTaskFinished(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_textCachedFor = nullptr;
}, _loadingContext->lifetime);
}

View File

@@ -99,7 +99,7 @@ rpl::producer<Content> ContentForSession(
rpl::empty
) | rpl::then(
stories->sourcesChanged(list)
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
consumer.put_next(state->next());
}, result);
return result;
@@ -191,11 +191,11 @@ rpl::producer<Content> LastForPeer(not_null<PeerData*> peer) {
rpl::single(peerId) | rpl::then(
stories->itemsChanged() | rpl::filter(_1 == peerId)
) | rpl::start_with_next(state->check, lifetime);
) | rpl::on_next(state->check, lifetime);
stories->session().changes().storyUpdates(
Data::StoryUpdate::Flag::MarkRead
) | rpl::start_with_next([=](const Data::StoryUpdate &update) {
) | rpl::on_next([=](const Data::StoryUpdate &update) {
if (update.story->peer()->id == peerId) {
if (update.story->id() > state->readTill) {
state->readTill = update.story->id();

View File

@@ -66,7 +66,7 @@ constexpr auto kMaxTooltipNames = 3;
result.data(),
st::dialogsStoriesTooltipHide);
result->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
button->resize(button->width(), size.height());
button->moveToRight(0, 0, size.width());
}, button->lifetime());
@@ -106,7 +106,7 @@ List::List(
, _st(st) {
setCursor(style::cur_default);
std::move(content) | rpl::start_with_next([=](Content &&content) {
std::move(content) | rpl::on_next([=](Content &&content) {
showContent(std::move(content));
}, lifetime());
@@ -996,7 +996,7 @@ void List::setShowTooltip(
notEmpty
) | rpl::distinct_until_changed(),
tooltipParent->windowActiveValue()
) | rpl::start_with_next([=](bool, bool, bool active) {
) | rpl::on_next([=](bool, bool, bool active) {
_tooltipWindowActive = active;
if (!isHidden()) {
toggleTooltip(false);
@@ -1004,7 +1004,7 @@ void List::setShowTooltip(
}, tooltip->lifetime());
shownValue(
) | rpl::skip(1) | rpl::start_with_next([=](bool shown) {
) | rpl::skip(1) | rpl::on_next([=](bool shown) {
toggleTooltip(true);
}, tooltip->lifetime());
}

View File

@@ -684,7 +684,7 @@ bool Suggestions::ObjectListController::processTouchEvent(
void Suggestions::ObjectListController::setupTouchChatPreview(
not_null<Ui::ElasticScroll*> scroll) {
_touchCancelRequests.events() | rpl::start_with_next([=] {
_touchCancelRequests.events() | rpl::on_next([=] {
QTouchEvent ev(QEvent::TouchCancel);
ev.setTimestamp(crl::now());
QGuiApplication::sendEvent(scroll, &ev);
@@ -731,13 +731,13 @@ void Suggestions::ObjectListController::setupPlainDivider(
std::move(title),
st::searchedBarLabel);
raw->sizeValue(
) | rpl::start_with_next([=](QSize size) {
) | rpl::on_next([=](QSize size) {
const auto x = st::searchedBarPosition.x();
const auto y = st::searchedBarPosition.y();
label->resizeToWidth(size.width() - x * 2);
label->moveToLeft(x, y, size.width());
}, raw->lifetime());
raw->paintRequest() | rpl::start_with_next([=](QRect clip) {
raw->paintRequest() | rpl::on_next([=](QRect clip) {
QPainter(raw).fillRect(clip, st::searchedBarBg);
}, raw->lifetime());
@@ -757,7 +757,7 @@ void Suggestions::ObjectListController::setupExpandDivider(
count(
) | rpl::map(
rpl::mappers::_1 > kCollapsedChannelsCount
) | rpl::distinct_until_changed() | rpl::start_with_next([=](bool more) {
) | rpl::distinct_until_changed() | rpl::on_next([=](bool more) {
_expanded = false;
if (!more) {
const auto toggle = _toggleExpanded.current();
@@ -782,7 +782,7 @@ void Suggestions::ObjectListController::setupExpandDivider(
rpl::combine(
raw->sizeValue(),
toggle->widthValue()
) | rpl::start_with_next([=](QSize size, int width) {
) | rpl::on_next([=](QSize size, int width) {
const auto x = st::searchedBarPosition.x();
const auto y = st::searchedBarPosition.y();
toggle->moveToRight(0, 0, size.width());
@@ -797,14 +797,14 @@ void Suggestions::ObjectListController::setupExpandDivider(
_toggleExpanded.value()
) | rpl::filter(
rpl::mappers::_2 == nullptr
) | rpl::start_with_next([=](QSize size, const auto) {
) | rpl::on_next([=](QSize size, const auto) {
const auto x = st::searchedBarPosition.x();
const auto y = st::searchedBarPosition.y();
label->resizeToWidth(size.width() - x * 2);
label->moveToLeft(x, y, size.width());
}, raw->lifetime());
raw->paintRequest() | rpl::start_with_next([=](QRect clip) {
raw->paintRequest() | rpl::on_next([=](QRect clip) {
QPainter(raw).fillRect(clip, st::searchedBarBg);
}, raw->lifetime());
@@ -918,14 +918,14 @@ void RecentsController::setupDivider() {
rpl::combine(
raw->sizeValue(),
clear->widthValue()
) | rpl::start_with_next([=](QSize size, int width) {
) | rpl::on_next([=](QSize size, int width) {
const auto x = st::searchedBarPosition.x();
const auto y = st::searchedBarPosition.y();
clear->moveToRight(0, 0, size.width());
label->resizeToWidth(size.width() - x - width);
label->moveToLeft(x, y, size.width());
}, raw->lifetime());
raw->paintRequest() | rpl::start_with_next([=](QRect clip) {
raw->paintRequest() | rpl::on_next([=](QRect clip) {
QPainter(raw).fillRect(clip, st::searchedBarBg);
}, raw->lifetime());
@@ -937,7 +937,7 @@ void RecentsController::subscribeToEvents() {
session().changes().peerUpdates(
Flag::Notifications
| Flag::OnlineStatus
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
const auto peer = update.peer;
if (peer->isSelf()) {
return;
@@ -961,7 +961,7 @@ void RecentsController::subscribeToEvents() {
}, _lifetime);
session().data().unreadBadgeChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
for (auto i = 0; i != countCurrent(); ++i) {
const auto row = delegate()->peerListRowAt(i);
if (static_cast<RecentRow*>(row.get())->refreshBadge()) {
@@ -981,7 +981,7 @@ void MyChannelsController::prepare() {
session().changes().peerUpdates(
Data::PeerUpdate::Flag::ChannelAmIn
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
const auto channel = update.peer->asBroadcast();
if (!channel || channel->amIn()) {
return;
@@ -1019,7 +1019,7 @@ void MyChannelsController::prepare() {
ranges::sort(_channels, ranges::greater(), &History::chatListTimeId);
setCount(_channels.size());
expanded() | rpl::start_with_next([=] {
expanded() | rpl::on_next([=] {
fill();
}, _lifetime);
@@ -1030,7 +1030,7 @@ void MyChannelsController::prepare() {
rpl::merge(
std::move(loading),
owner->chatsListLoadedEvents()
) | rpl::start_with_next([=](Data::Folder *folder) {
) | rpl::on_next([=](Data::Folder *folder) {
const auto list = owner->chatsList(folder);
for (const auto &row : list->indexed()->all()) {
if (const auto history = row->history()) {
@@ -1120,7 +1120,7 @@ void RecommendationsController::load() {
const auto participants = &session().api().chatParticipants();
participants->loadRecommendations();
participants->recommendationsLoaded(
) | rpl::take(1) | rpl::start_with_next([=] {
) | rpl::take(1) | rpl::on_next([=] {
fill();
}, _lifetime);
}
@@ -1139,7 +1139,7 @@ void RecommendationsController::fill() {
delegate()->peerListRefreshRows();
setCount(delegate()->peerListFullRowsCount());
window()->activeChatValue() | rpl::start_with_next([=](const Key &key) {
window()->activeChatValue() | rpl::on_next([=](const Key &key) {
const auto history = key.history();
if (_activeHistory == history) {
return;
@@ -1185,7 +1185,7 @@ void RecentAppsController::prepare() {
_bots.reserve(kProbablyMaxApps);
rpl::single() | rpl::then(
session().topBotApps().updates()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_bots.clear();
for (const auto &peer : session().topBotApps().list()) {
if (const auto bot = peer->asUser()) {
@@ -1201,7 +1201,7 @@ void RecentAppsController::prepare() {
fill();
}, _lifetime);
expanded() | rpl::skip(1) | rpl::start_with_next([=] {
expanded() | rpl::skip(1) | rpl::on_next([=] {
fill();
}, _lifetime);
}
@@ -1299,7 +1299,7 @@ void PopularAppsController::prepare() {
}
rpl::single() | rpl::then(
std::move(_filterOutRefreshes)
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
fill();
}, _lifetime);
}
@@ -1312,7 +1312,7 @@ void PopularAppsController::load() {
const auto attachWebView = &session().attachWebView();
attachWebView->loadPopularAppBots();
attachWebView->popularAppBotsLoaded(
) | rpl::take(1) | rpl::start_with_next([=] {
) | rpl::take(1) | rpl::on_next([=] {
fill();
}, _lifetime);
}
@@ -1429,7 +1429,7 @@ void Suggestions::setupTabs() {
rpl::single(-1) | rpl::then(
_tabs->sectionActivated()
) | rpl::combine_previous(
) | rpl::start_with_next([=](int was, int index) {
) | rpl::on_next([=](int was, int index) {
if (was != index) {
scrollToIndex(index, anim::type::normal);
}
@@ -1443,7 +1443,7 @@ void Suggestions::setupTabs() {
rpl::combine(
widthValue(),
_tabs->heightValue()
) | rpl::start_with_next([=](int width, int height) {
) | rpl::on_next([=](int width, int height) {
const auto line = st::lineWidth;
shadow->setGeometry(0, height - line, width, line);
}, shadow->lifetime());
@@ -1478,39 +1478,39 @@ void Suggestions::setupTabs() {
}
_tabs->setSections(sections);
_tabs->sectionActivated(
) | rpl::start_with_next([=](int section) {
) | rpl::on_next([=](int section) {
Assert(section >= 0 && section < _tabKeys.size());
switchTab(_tabKeys[section]);
}, _tabs->lifetime());
}
void Suggestions::setupChats() {
_recent->count.value() | rpl::start_with_next([=](int count) {
_recent->count.value() | rpl::on_next([=](int count) {
_recent->wrap->toggle(count > 0, anim::type::instant);
_emptyRecent->toggle(count == 0, anim::type::instant);
}, _recent->wrap->lifetime());
_topPeers->emptyValue() | rpl::start_with_next([=](bool empty) {
_topPeers->emptyValue() | rpl::on_next([=](bool empty) {
_topPeersWrap->toggle(!empty, anim::type::instant);
}, _topPeers->lifetime());
_topPeers->clicks() | rpl::start_with_next([=](uint64 peerIdRaw) {
_topPeers->clicks() | rpl::on_next([=](uint64 peerIdRaw) {
const auto peerId = PeerId(peerIdRaw);
_topPeerChosen.fire(_controller->session().data().peer(peerId));
}, _topPeers->lifetime());
_topPeers->pressed() | rpl::start_with_next([=](uint64 peerIdRaw) {
_topPeers->pressed() | rpl::on_next([=](uint64 peerIdRaw) {
handlePressForChatPreview(PeerId(peerIdRaw), [=](bool shown) {
_topPeers->pressLeftToContextMenu(shown);
});
}, _topPeers->lifetime());
_topPeers->pressCancelled() | rpl::start_with_next([=] {
_topPeers->pressCancelled() | rpl::on_next([=] {
_controller->cancelScheduledPreview();
}, _topPeers->lifetime());
_topPeers->showMenuRequests(
) | rpl::start_with_next([=](const ShowTopPeerMenuRequest &request) {
) | rpl::on_next([=](const ShowTopPeerMenuRequest &request) {
const auto weak = base::make_weak(this);
const auto owner = &_controller->session().data();
const auto peer = owner->peer(PeerId(request.id));
@@ -1544,12 +1544,12 @@ void Suggestions::setupChats() {
}, _topPeers->lifetime());
_topPeers->scrollToRequests(
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
) | rpl::on_next([this](Ui::ScrollToRequest request) {
_chatsScroll->scrollToY(request.ymin, request.ymax);
}, _topPeers->lifetime());
_topPeers->verticalScrollEvents(
) | rpl::start_with_next([=](not_null<QWheelEvent*> e) {
) | rpl::on_next([=](not_null<QWheelEvent*> e) {
_chatsScroll->viewportEvent(e);
}, _topPeers->lifetime());
@@ -1572,11 +1572,11 @@ void Suggestions::handlePressForChatPreview(
}
void Suggestions::setupChannels() {
_myChannels->count.value() | rpl::start_with_next([=](int count) {
_myChannels->count.value() | rpl::on_next([=](int count) {
_myChannels->wrap->toggle(count > 0, anim::type::instant);
}, _myChannels->wrap->lifetime());
_recommendations->count.value() | rpl::start_with_next([=](int count) {
_recommendations->count.value() | rpl::on_next([=](int count) {
_recommendations->wrap->toggle(count > 0, anim::type::instant);
}, _recommendations->wrap->lifetime());
@@ -1596,11 +1596,11 @@ void Suggestions::setupChannels() {
}
void Suggestions::setupApps() {
_recentApps->count.value() | rpl::start_with_next([=](int count) {
_recentApps->count.value() | rpl::on_next([=](int count) {
_recentApps->wrap->toggle(count > 0, anim::type::instant);
}, _recentApps->wrap->lifetime());
_popularApps->count.value() | rpl::start_with_next([=](int count) {
_popularApps->count.value() | rpl::on_next([=](int count) {
_popularApps->wrap->toggle(count > 0, anim::type::instant);
}, _popularApps->wrap->lifetime());
@@ -1901,7 +1901,7 @@ void Suggestions::setupPostsSearch() {
_postsSearch = std::make_unique<PostsSearch>(&_controller->session());
_postsSearch->stateUpdates(
) | rpl::start_with_next([=](const PostsSearchState &state) {
) | rpl::on_next([=](const PostsSearchState &state) {
if (state.intro) {
if (!_postsSearchIntro) {
setupPostsIntro(*state.intro);
@@ -1931,7 +1931,7 @@ void Suggestions::setupPostsSearch() {
}, _postsWrap->lifetime());
_postsSearch->pagesUpdates(
) | rpl::start_with_next([=](const PostsSearchState &state) {
) | rpl::on_next([=](const PostsSearchState &state) {
Expects(!state.intro && !state.loading);
if (!_postsContent) {
@@ -1974,7 +1974,7 @@ void Suggestions::setupPostsResults() {
_postsContent->searchRequested(true);
_postsContent->chosenRow(
) | rpl::start_with_next([=](const ChosenRow &row) {
) | rpl::on_next([=](const ChosenRow &row) {
const auto history = row.key.history();
if (!history) {
return;
@@ -1992,14 +1992,14 @@ void Suggestions::setupPostsResults() {
}
}, _postsContent->lifetime());
_postsContent->heightValue() | rpl::start_with_next([=](int height) {
_postsContent->heightValue() | rpl::on_next([=](int height) {
_postsWrap->resize(_postsWrap->width(), height);
}, _postsContent->lifetime());
rpl::combine(
rpl::single(rpl::empty) | rpl::then(_postsScroll->scrolls()),
_postsScroll->heightValue()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
updatePostsSearchVisibleRange();
}, _postsContent->lifetime());
@@ -2027,7 +2027,7 @@ void Suggestions::setupPostsIntro(const PostsSearchIntroState &intro) {
_postsSearchIntro = Ui::CreateChild<PostsSearchIntro>(_postsWrap, intro);
_postsSearchIntro->searchWithStars(
) | rpl::start_with_next([=](int stars) {
) | rpl::on_next([=](int stars) {
if (!_controller->session().premium()) {
Settings::ShowPremium(
_controller,
@@ -2061,7 +2061,7 @@ void Suggestions::setupPostsIntro(const PostsSearchIntroState &intro) {
}
}, _postsSearchIntro->lifetime());
_postsScroll->heightValue() | rpl::start_with_next([=](int height) {
_postsScroll->heightValue() | rpl::on_next([=](int height) {
_postsWrap->resize(_postsWrap->width(), height);
}, _postsSearchIntro->lifetime());
@@ -2432,7 +2432,7 @@ auto Suggestions::setupRecentPeers(RecentPeersList recentPeers)
};
raw->chosen.events(
) | rpl::start_with_next([=](not_null<PeerData*> peer) {
) | rpl::on_next([=](not_null<PeerData*> peer) {
_controller->session().recentPeers().bump(peer);
}, list->lifetime());
@@ -2492,7 +2492,7 @@ auto Suggestions::setupMyChannels() -> std::unique_ptr<ObjectList> {
};
raw->chosen.events(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_persist = false;
}, list->lifetime());
@@ -2538,13 +2538,13 @@ auto Suggestions::setupRecommendations() -> std::unique_ptr<ObjectList> {
};
raw->chosen.events(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_persist = true;
}, list->lifetime());
_key.value() | rpl::filter(
rpl::mappers::_1 == Key{ Tab::Channels }
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
controller->load();
}, list->lifetime());
@@ -2606,7 +2606,7 @@ auto Suggestions::setupRecentApps() -> std::unique_ptr<ObjectList> {
};
raw->chosen.events(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_persist = false;
}, list->lifetime());
@@ -2656,13 +2656,13 @@ auto Suggestions::setupPopularApps() -> std::unique_ptr<ObjectList> {
};
raw->chosen.events(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
_persist = true;
}, list->lifetime());
_key.value() | rpl::filter(
rpl::mappers::_1 == Key{ Tab::Apps }
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
controller->load();
}, list->lifetime());
@@ -2697,7 +2697,7 @@ auto Suggestions::setupObjectList(
};
controller->chosen(
) | rpl::start_with_next([=](not_null<PeerData*> peer) {
) | rpl::on_next([=](not_null<PeerData*> peer) {
raw->chosen.fire_copy(peer);
}, lifetime);
@@ -2712,7 +2712,7 @@ auto Suggestions::setupObjectList(
};
list->scrollToRequests(
) | rpl::start_with_next([=](Ui::ScrollToRequest request) {
) | rpl::on_next([=](Ui::ScrollToRequest request) {
const auto add = addToScroll ? addToScroll() : 0;
scroll->scrollToY(request.ymin + add, request.ymax + add);
}, list->lifetime());
@@ -2742,7 +2742,7 @@ object_ptr<Ui::SlideWrap<>> Suggestions::setupEmpty(
rpl::combine(
_chatsScroll->heightValue(),
_topPeersWrap->heightValue()
) | rpl::start_with_next([=](int height, int top) {
) | rpl::on_next([=](int height, int top) {
raw->setMinimalHeight(height - top);
}, raw->lifetime());
@@ -2753,7 +2753,7 @@ object_ptr<Ui::SlideWrap<>> Suggestions::setupEmpty(
result->toggledValue() | rpl::filter([=](bool shown) {
return shown && _controller->session().data().chatsListLoaded();
}) | rpl::start_with_next([=] {
}) | rpl::on_next([=] {
raw->animate();
}, raw->lifetime());
@@ -2841,7 +2841,7 @@ rpl::producer<TopPeersList> TopPeersContent(
| Flag::Photo
| Flag::Notifications
| Flag::OnlineStatus
) | rpl::start_with_next([=](const Data::PeerUpdate &update) {
) | rpl::on_next([=](const Data::PeerUpdate &update) {
const auto peer = update.peer;
if (peer->isSelf()) {
return;
@@ -2890,7 +2890,7 @@ rpl::producer<TopPeersList> TopPeersContent(
}, lifetime);
session->data().unreadBadgeChanges(
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
auto changed = false;
auto &entries = state->data.entries;
for (const auto &[peer, data] : state->indices) {
@@ -2931,7 +2931,7 @@ object_ptr<Ui::BoxContent> StarsExamplesBox(
});
raw->load();
raw->chosen() | rpl::start_with_next([=](not_null<PeerData*> peer) {
raw->chosen() | rpl::on_next([=](not_null<PeerData*> peer) {
if (const auto user = peer->asUser()) {
if (const auto info = user->botInfo.get()) {
if (info->hasMainApp) {

View File

@@ -54,7 +54,7 @@ not_null<Ui::SlideWrap<Ui::VerticalLayout>*> CreateUnconfirmedAuthContent(
parent,
object_ptr<Ui::VerticalLayout>(parent));
const auto content = wrap->entity();
content->paintRequest() | rpl::start_with_next([=] {
content->paintRequest() | rpl::on_next([=] {
auto p = QPainter(content);
p.fillRect(content->rect(), st::dialogsBg);
}, content->lifetime());
@@ -141,7 +141,7 @@ not_null<Ui::SlideWrap<Ui::VerticalLayout>*> CreateUnconfirmedAuthContent(
});
buttons->sizeValue(
) | rpl::filter_size(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
const auto halfWidth = (s.width() - rect::m::sum::h(padding)) / 2;
yes->moveToLeft(
padding.left() + (halfWidth - yes->width()) / 2,
@@ -181,7 +181,7 @@ void TopBarSuggestionContent::setRightIcon(RightIcon icon) {
st::dialogsCancelSearchInPeer);
const auto rightHide = _rightHide.get();
sizeValue() | rpl::filter_size(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
rightHide->moveToRight(st::buttonRadius, st::lineWidth);
}, rightHide->lifetime());
rightHide->show();
@@ -195,7 +195,7 @@ void TopBarSuggestionContent::setRightIcon(RightIcon icon) {
&st::settingsPremiumArrowOver);
arrow->setAttribute(Qt::WA_TransparentForMouseEvents);
sizeValue() | rpl::filter_size(
) | rpl::start_with_next([=](const QSize &s) {
) | rpl::on_next([=](const QSize &s) {
const auto &point = st::settingsPremiumArrowShift;
arrow->moveToLeft(
s.width() - arrow->width(),
@@ -224,7 +224,7 @@ void TopBarSuggestionContent::setRightButton(
rpl::combine(
sizeValue(),
_rightButton->sizeValue()
) | rpl::start_with_next([=](QSize outer, QSize inner) {
) | rpl::on_next([=](QSize outer, QSize inner) {
const auto top = (outer.height() - inner.height()) / 2;
_rightButton->moveToRight(top, top, outer.width());
}, _rightButton->lifetime());
@@ -371,7 +371,7 @@ void TopBarSuggestionContent::setHideCallback(Fn<void()> hideCallback) {
}
void TopBarSuggestionContent::setLeftPadding(rpl::producer<int> value) {
std::move(value) | rpl::start_with_next([=](int padding) {
std::move(value) | rpl::on_next([=](int padding) {
_leftPadding = padding;
update();
}, lifetime());

View File

@@ -79,7 +79,7 @@ void SetSearchButtonLabel(
rpl::combine(
button->sizeValue(),
std::move(text)
) | rpl::start_with_next([=](QSize size, const auto &) {
) | rpl::on_next([=](QSize size, const auto &) {
icons->setGeometry(QRect(QPoint(), size));
const auto available = size.width() - leftSkip - rightSkip;
if (available <= 0) {
@@ -93,7 +93,7 @@ void SetSearchButtonLabel(
label->moveToLeft(x + leftSkip, y, size.width());
}, icons->lifetime());
icons->paintRequest() | rpl::start_with_next([=] {
icons->paintRequest() | rpl::on_next([=] {
auto p = QPainter(icons);
left->paint(
p,
@@ -198,7 +198,7 @@ void PostsSearchIntro::setup() {
_footer->setTryMakeSimilarLines(true);
_state.value(
) | rpl::start_with_next([=](const PostsSearchIntroState &state) {
) | rpl::on_next([=](const PostsSearchIntroState &state) {
if (state.query.trimmed().isEmpty() && !state.needsPremium) {
_button->resize(_button->width(), 0);
_content->resizeToWidth(width());

View File

@@ -60,14 +60,14 @@ TopPeersStrip::TopPeersStrip(
setupHeader();
setupStrip();
std::move(content) | rpl::start_with_next([=](const TopPeersList &list) {
std::move(content) | rpl::on_next([=](const TopPeersList &list) {
apply(list);
}, lifetime());
rpl::combine(
_count.value(),
_expanded.value()
) | rpl::start_with_next([=] {
) | rpl::on_next([=] {
resizeToWidth(width());
}, _strip.lifetime());
@@ -88,7 +88,7 @@ void TopPeersStrip::setupHeader() {
widthValue()
) | rpl::map(
(rpl::mappers::_1 * single) > (rpl::mappers::_2 + (single * 2) / 3)
) | rpl::distinct_until_changed() | rpl::start_with_next([=](bool more) {
) | rpl::distinct_until_changed() | rpl::on_next([=](bool more) {
setExpanded(false);
if (!more) {
const auto toggle = _toggleExpanded.current();
@@ -113,7 +113,7 @@ void TopPeersStrip::setupHeader() {
rpl::combine(
_header.sizeValue(),
toggle->widthValue()
) | rpl::start_with_next([=](QSize size, int width) {
) | rpl::on_next([=](QSize size, int width) {
const auto x = st::searchedBarPosition.x();
const auto y = st::searchedBarPosition.y();
toggle->moveToRight(0, 0, size.width());
@@ -128,14 +128,14 @@ void TopPeersStrip::setupHeader() {
_toggleExpanded.value()
) | rpl::filter(
rpl::mappers::_2 == nullptr
) | rpl::start_with_next([=](QSize size, const auto) {
) | rpl::on_next([=](QSize size, const auto) {
const auto x = st::searchedBarPosition.x();
const auto y = st::searchedBarPosition.y();
label->resizeToWidth(size.width() - x * 2);
label->moveToLeft(x, y, size.width());
}, _header.lifetime());
_header.paintRequest() | rpl::start_with_next([=](QRect clip) {
_header.paintRequest() | rpl::on_next([=](QRect clip) {
QPainter(&_header).fillRect(clip, st::searchedBarBg);
}, _header.lifetime());
}
@@ -181,7 +181,7 @@ void TopPeersStrip::setupStrip() {
return base::EventFilterResult::Cancel;
});
_strip.paintRequest() | rpl::start_with_next([=](QRect clip) {
_strip.paintRequest() | rpl::on_next([=](QRect clip) {
paintStrip(clip);
}, _strip.lifetime());
}