diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp index f4ee98dd36..5206eae066 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp @@ -114,7 +114,8 @@ FixedBar::FixedBar( , _backButton( this, &controller->session(), - tr::lng_admin_log_title_all(tr::now)) + tr::lng_admin_log_title_all(tr::now), + controller->adaptive().oneColumnValue()) , _search(this, st::topBarSearch) , _cancel(this, st::historyAdminLogCancelSearch) , _filter(this, tr::lng_admin_log_filter(), st::topBarButton) { diff --git a/Telegram/SourceFiles/profile/profile_back_button.cpp b/Telegram/SourceFiles/profile/profile_back_button.cpp index 2e6158653b..50c70d559c 100644 --- a/Telegram/SourceFiles/profile/profile_back_button.cpp +++ b/Telegram/SourceFiles/profile/profile_back_button.cpp @@ -14,21 +14,35 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_window.h" #include "styles/style_profile.h" #include "styles/style_info.h" -#include "facades.h" namespace Profile { BackButton::BackButton( QWidget *parent, not_null session, - const QString &text) + const QString &text, + rpl::producer oneColumnValue) : Ui::AbstractButton(parent) , _session(session) , _text(text.toUpper()) { setCursor(style::cur_pointer); - subscribe(Adaptive::Changed(), [=] { updateAdaptiveLayout(); }); - updateAdaptiveLayout(); + std::move( + oneColumnValue + ) | rpl::start_with_next([=](bool oneColumn) { + if (!oneColumn) { + _unreadBadgeLifetime.destroy(); + } else if (!_unreadBadgeLifetime) { + _session->data().unreadBadgeChanges( + ) | rpl::start_with_next([=] { + rtlupdate( + 0, + 0, + st::titleUnreadCounterRight, + st::titleUnreadCounterTop); + }, _unreadBadgeLifetime); + } + }, lifetime()); } void BackButton::setText(const QString &text) { @@ -57,15 +71,4 @@ void BackButton::onStateChanged(State was, StateChangeSource source) { } } -void BackButton::updateAdaptiveLayout() { - if (!Adaptive::OneColumn()) { - _unreadBadgeLifetime.destroy(); - } else if (!_unreadBadgeLifetime) { - _session->data().unreadBadgeChanges( - ) | rpl::start_with_next([=] { - rtlupdate(0, 0, st::titleUnreadCounterRight, st::titleUnreadCounterTop); - }, _unreadBadgeLifetime); - } -} - } // namespace Profile diff --git a/Telegram/SourceFiles/profile/profile_back_button.h b/Telegram/SourceFiles/profile/profile_back_button.h index a3037fce2e..98056ce9ea 100644 --- a/Telegram/SourceFiles/profile/profile_back_button.h +++ b/Telegram/SourceFiles/profile/profile_back_button.h @@ -20,7 +20,8 @@ public: BackButton( QWidget *parent, not_null session, - const QString &text); + const QString &text, + rpl::producer oneColumnValue); void setText(const QString &text); @@ -31,8 +32,6 @@ protected: void onStateChanged(State was, StateChangeSource source) override; private: - void updateAdaptiveLayout(); - const not_null _session; rpl::lifetime _unreadBadgeLifetime;