Show connecting / proxy status above downloads.

Fixes #24125.
This commit is contained in:
John Preston 2022-03-01 18:38:45 +03:00
parent 0192edbe84
commit aa3357eee1
6 changed files with 32 additions and 3 deletions

View file

@ -1706,6 +1706,11 @@ void Widget::updateControlsGeometry() {
putBottomButton(_updateTelegram);
putBottomButton(_downloadBar);
putBottomButton(_loadMoreChats);
const auto bottomSkip = (height() - scrollTop) - scrollHeight;
if (_connecting) {
_connecting->setBottomSkip(bottomSkip);
}
controller()->setConnectingBottomSkip(bottomSkip);
auto wasScrollHeight = _scroll->height();
_scroll->setGeometry(0, scrollTop, width(), scrollHeight);
_inner->resize(width(), _inner->height());

View file

@ -391,6 +391,10 @@ void MainWidget::setupConnectingWidget() {
this,
&session().account(),
_controller->adaptive().oneColumnValue() | rpl::map(!_1));
_controller->connectingBottomSkipValue(
) | rpl::start_with_next([=](int skip) {
_connecting->setBottomSkip(skip);
}, lifetime());
}
not_null<Media::Player::FloatDelegate*> MainWidget::floatPlayerDelegate() {

View file

@ -243,11 +243,12 @@ void ConnectionState::createWidget() {
rpl::combine(
visibility(),
_parent->heightValue()
) | rpl::start_with_next([=](float64 visible, int height) {
_parent->heightValue(),
_bottomSkip.value()
) | rpl::start_with_next([=](float64 visible, int height, int skip) {
_widget->moveToLeft(0, anim::interpolate(
height - st::connectingMargin.top(),
height - _widget->height(),
height - _widget->height() - skip,
visible));
}, _widget->lifetime());
@ -281,6 +282,10 @@ void ConnectionState::setForceHidden(bool hidden) {
}
}
void ConnectionState::setBottomSkip(int skip) {
_bottomSkip = skip;
}
void ConnectionState::refreshState() {
using Checker = Core::UpdateChecker;
const auto state = [&]() -> State {

View file

@ -30,6 +30,7 @@ public:
void raise();
void setForceHidden(bool hidden);
void setBottomSkip(int skip);
rpl::lifetime &lifetime() {
return _lifetime;
@ -78,6 +79,7 @@ private:
const not_null<Main::Account*> _account;
not_null<Ui::RpWidget*> _parent;
rpl::variable<int> _bottomSkip;
base::unique_qptr<Widget> _widget;
bool _forceHidden = false;
base::Timer _refreshTimer;

View file

@ -1500,6 +1500,14 @@ Window::Adaptive &SessionController::adaptive() const {
return _window->adaptive();
}
void SessionController::setConnectingBottomSkip(int skip) {
_connectingBottomSkip = skip;
}
rpl::producer<int> SessionController::connectingBottomSkipValue() const {
return _connectingBottomSkip.value();
}
QPointer<Ui::BoxContent> SessionController::show(
object_ptr<Ui::BoxContent> content,
Ui::LayerOptions options,

View file

@ -287,6 +287,9 @@ public:
return _selectingPeer;
}
void setConnectingBottomSkip(int skip);
rpl::producer<int> connectingBottomSkipValue() const;
QPointer<Ui::BoxContent> show(
object_ptr<Ui::BoxContent> content,
Ui::LayerOptions options = Ui::LayerOption::KeepOther,
@ -541,6 +544,8 @@ private:
rpl::variable<FilterId> _activeChatsFilter;
rpl::variable<int> _connectingBottomSkip;
PeerData *_showEditPeer = nullptr;
rpl::variable<Data::Folder*> _openedFolder;