From 0bfd2bd0d5d77eece92f90e2b1d02c3bb841da1f Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 26 May 2026 10:50:23 +0400 Subject: [PATCH] SavedMusic not participating in profile sections. --- .../profile/info_profile_inner_widget.cpp | 32 +++++++--------- .../profile/info_profile_section_stack.cpp | 37 +------------------ .../info/profile/info_profile_section_stack.h | 2 - 3 files changed, 14 insertions(+), 57 deletions(-) diff --git a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp index bf63cd0bdc..9cad510b75 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_inner_widget.cpp @@ -53,31 +53,24 @@ namespace Profile { namespace { -[[nodiscard]] Section MakeSavedMusicSection( - not_null parent, +void AddSavedMusic( + not_null layout, not_null controller, not_null peer, rpl::producer> topBarColor) { - auto wrap = object_ptr>( - parent, - object_ptr(parent)); - const auto raw = wrap.data(); + const auto wrap = layout->add( + object_ptr>( + layout, + object_ptr(layout))); Info::Saved::SetupSavedMusic( - raw->entity(), + wrap->entity(), controller, peer, std::move(topBarColor)); using namespace rpl::mappers; - raw->toggleOn( - raw->entity()->heightValue() | rpl::map(_1 > 0), + wrap->toggleOn( + wrap->entity()->heightValue() | rpl::map(_1 > 0), anim::type::instant); - return Section{ - .widget = std::move(wrap), - .shown = raw->toggledValue(), - .trailing = SectionSeparator::None(), - .embedsLeadingSeparator = false, - .attachesToCover = true, - }; } [[nodiscard]] Section MakeSecurityRiskWarningSection( @@ -243,16 +236,17 @@ object_ptr InnerWidget::setupContent( } auto result = object_ptr(parent); - auto stack = SectionStack(result.data()); const auto musicPeer = _sublist ? _sublist->sublistPeer().get() : _peer.get(); - stack.add(MakeSavedMusicSection( + AddSavedMusic( result.data(), _controller, musicPeer, - _topBarColor.value())); + _topBarColor.value()); + + auto stack = SectionStack(result.data()); if (const auto user = _peer->asUser()) { stack.add(MakeSecurityRiskWarningSection(result.data(), user)); } diff --git a/Telegram/SourceFiles/info/profile/info_profile_section_stack.cpp b/Telegram/SourceFiles/info/profile/info_profile_section_stack.cpp index 7b147ee8ea..302f16433e 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_section_stack.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_section_stack.cpp @@ -154,33 +154,6 @@ rpl::producer SectionStack::nextVisibleIsNonEmbedding( }) | rpl::distinct_until_changed(); } -rpl::producer SectionStack::firstVisibleAttachesToCover() const { - if (_sections.empty()) { - return rpl::single(false); - } - auto producers = std::vector>(); - auto attaches = std::vector(); - producers.reserve(_sections.size()); - attaches.reserve(_sections.size()); - for (auto j = 0; j != int(_sections.size()); ++j) { - producers.push_back(_sections[j].shown - ? rpl::duplicate(_sections[j].shown) - : rpl::single(true)); - attaches.push_back(_sections[j].attachesToCover); - } - return rpl::combine( - std::move(producers), - [attaches = std::move(attaches)]( - const std::vector &values) -> bool { - for (auto k = 0; k != int(values.size()); ++k) { - if (values[k]) { - return attaches[k]; - } - } - return false; - }) | rpl::distinct_until_changed(); -} - rpl::producer SectionStack::computePlainMarkerCandidate( int position) const { auto upper = anyShownAtOrBefore(position); @@ -275,15 +248,7 @@ void SectionStack::finalize() { } } - auto leadingInner = object_ptr(_layout); - Ui::AddSkip(leadingInner.data(), st::infoProfileSkip); - const auto leadingWrap = _layout->add( - object_ptr>( - _layout, - std::move(leadingInner))); - leadingWrap->setDuration(st::infoSlideDuration)->toggleOn( - firstVisibleAttachesToCover() - | rpl::map([](bool a) { return !a; })); + Ui::AddSkip(_layout, st::infoProfileSkip); const auto sectionCount = int(_sections.size()); const auto markerCandidates = _layout->lifetime().make_state< diff --git a/Telegram/SourceFiles/info/profile/info_profile_section_stack.h b/Telegram/SourceFiles/info/profile/info_profile_section_stack.h index 1a108ab3b4..6d30e934dd 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_section_stack.h +++ b/Telegram/SourceFiles/info/profile/info_profile_section_stack.h @@ -36,7 +36,6 @@ struct Section { rpl::producer shown; SectionSeparator trailing; bool embedsLeadingSeparator = false; - bool attachesToCover = false; }; class SectionStack final { @@ -58,7 +57,6 @@ private: [[nodiscard]] rpl::producer anyShownInRange( int from, int toInclusive) const; - [[nodiscard]] rpl::producer firstVisibleAttachesToCover() const; [[nodiscard]] rpl::producer computePlainMarkerCandidate( int position) const; void addPlainMarkerSlot(