mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Split adaptive changed rpl::producer into two.
This commit is contained in:
parent
5dcc219f1c
commit
bb76818cc8
12 changed files with 22 additions and 23 deletions
|
@ -744,7 +744,7 @@ FieldAutocomplete::Inner::Inner(
|
|||
update();
|
||||
}, lifetime());
|
||||
|
||||
controller->adaptive().changed(
|
||||
controller->adaptive().value(
|
||||
) | rpl::start_with_next([=] {
|
||||
_isOneColumn = controller->adaptive().isOneColumn();
|
||||
update();
|
||||
|
|
|
@ -95,6 +95,9 @@ public:
|
|||
[[nodiscard]] rpl::producer<bool> adaptiveForWideValue() const {
|
||||
return _adaptiveForWide.value();
|
||||
}
|
||||
[[nodiscard]] rpl::producer<bool> adaptiveForWideChanges() const {
|
||||
return _adaptiveForWide.changes();
|
||||
}
|
||||
void setAdaptiveForWide(bool value) {
|
||||
_adaptiveForWide = value;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ Widget::Widget(
|
|||
}, lifetime());
|
||||
}
|
||||
|
||||
controller->adaptive().changed(
|
||||
controller->adaptive().changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateForwardBar();
|
||||
}, lifetime());
|
||||
|
|
|
@ -298,10 +298,7 @@ Widget::Widget(
|
|||
|
||||
_fixedBarShadow->raise();
|
||||
|
||||
rpl::single(
|
||||
rpl::empty_value()
|
||||
) | rpl::then(
|
||||
controller->adaptive().changed()
|
||||
controller->adaptive().value(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateAdaptiveLayout();
|
||||
}, lifetime());
|
||||
|
|
|
@ -413,7 +413,7 @@ HistoryWidget::HistoryWidget(
|
|||
Window::ActivateWindow(controller);
|
||||
});
|
||||
|
||||
controller->adaptive().changed(
|
||||
controller->adaptive().changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
if (_history) {
|
||||
_history->forceFullResize();
|
||||
|
|
|
@ -128,10 +128,7 @@ PinnedWidget::PinnedWidget(
|
|||
}, _topBar->lifetime());
|
||||
|
||||
_topBarShadow->raise();
|
||||
rpl::single(
|
||||
rpl::empty_value()
|
||||
) | rpl::then(
|
||||
controller->adaptive().changed()
|
||||
controller->adaptive().value(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateAdaptiveLayout();
|
||||
}, lifetime());
|
||||
|
|
|
@ -193,10 +193,7 @@ RepliesWidget::RepliesWidget(
|
|||
_rootView->raise();
|
||||
_topBarShadow->raise();
|
||||
|
||||
rpl::single(
|
||||
rpl::empty_value()
|
||||
) | rpl::then(
|
||||
controller->adaptive().changed()
|
||||
controller->adaptive().value(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateAdaptiveLayout();
|
||||
}, lifetime());
|
||||
|
|
|
@ -126,10 +126,7 @@ ScheduledWidget::ScheduledWidget(
|
|||
}, _topBar->lifetime());
|
||||
|
||||
_topBarShadow->raise();
|
||||
rpl::single(
|
||||
rpl::empty_value()
|
||||
) | rpl::then(
|
||||
controller->adaptive().changed()
|
||||
controller->adaptive().value(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateAdaptiveLayout();
|
||||
}, lifetime());
|
||||
|
|
|
@ -117,7 +117,7 @@ TopBarWidget::TopBarWidget(
|
|||
_search->setForceRippled(searchInActiveChat, animated);
|
||||
}, lifetime());
|
||||
|
||||
controller->adaptive().changed(
|
||||
controller->adaptive().changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
updateAdaptiveLayout();
|
||||
}, lifetime());
|
||||
|
|
|
@ -380,7 +380,7 @@ MainWidget::MainWidget(
|
|||
}
|
||||
});
|
||||
|
||||
_controller->adaptive().changed(
|
||||
_controller->adaptive().changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
handleAdaptiveLayoutUpdate();
|
||||
}, lifetime());
|
||||
|
|
|
@ -25,13 +25,20 @@ void Adaptive::setChatLayout(ChatLayout value) {
|
|||
_chatLayout = value;
|
||||
}
|
||||
|
||||
rpl::producer<> Adaptive::changed() const {
|
||||
rpl::producer<> Adaptive::value() const {
|
||||
return rpl::merge(
|
||||
Core::App().settings().adaptiveForWideValue() | rpl::to_empty,
|
||||
_chatLayout.changes() | rpl::to_empty,
|
||||
_layout.changes() | rpl::to_empty);
|
||||
}
|
||||
|
||||
rpl::producer<> Adaptive::changes() const {
|
||||
return rpl::merge(
|
||||
Core::App().settings().adaptiveForWideChanges() | rpl::to_empty,
|
||||
_chatLayout.changes() | rpl::to_empty,
|
||||
_layout.changes() | rpl::to_empty);
|
||||
}
|
||||
|
||||
rpl::producer<bool> Adaptive::oneColumnValue() const {
|
||||
return _layout.value(
|
||||
) | rpl::map([=] {
|
||||
|
|
|
@ -27,7 +27,8 @@ public:
|
|||
void setWindowLayout(WindowLayout value);
|
||||
void setChatLayout(ChatLayout value);
|
||||
|
||||
[[nodiscard]] rpl::producer<> changed() const;
|
||||
[[nodiscard]] rpl::producer<> value() const;
|
||||
[[nodiscard]] rpl::producer<> changes() const;
|
||||
[[nodiscard]] rpl::producer<bool> oneColumnValue() const;
|
||||
[[nodiscard]] rpl::producer<ChatLayout> chatLayoutValue() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue