mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Added initial boosts info to layer.
This commit is contained in:
parent
8b6d475882
commit
f925a9e961
2 changed files with 35 additions and 0 deletions
|
@ -7,6 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "info/boosts/info_boosts_inner_widget.h"
|
#include "info/boosts/info_boosts_inner_widget.h"
|
||||||
|
|
||||||
|
#include "api/api_statistics.h"
|
||||||
|
#include "ui/boxes/boost_box.h"
|
||||||
|
|
||||||
namespace Info::Boosts {
|
namespace Info::Boosts {
|
||||||
|
|
||||||
InnerWidget::InnerWidget(
|
InnerWidget::InnerWidget(
|
||||||
|
@ -16,6 +19,37 @@ InnerWidget::InnerWidget(
|
||||||
: VerticalLayout(parent)
|
: VerticalLayout(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _peer(peer) {
|
, _peer(peer) {
|
||||||
|
const auto api = lifetime().make_state<Api::Boosts>(peer);
|
||||||
|
|
||||||
|
const auto fakeShowed = lifetime().make_state<rpl::event_stream<>>();
|
||||||
|
|
||||||
|
_showFinished.events(
|
||||||
|
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||||
|
api->request(
|
||||||
|
) | rpl::start_with_error_done([](const QString &error) {
|
||||||
|
}, [=] {
|
||||||
|
const auto status = api->boostStatus();
|
||||||
|
|
||||||
|
Ui::FillBoostLimit(
|
||||||
|
fakeShowed->events(),
|
||||||
|
rpl::single(status.overview.isBoosted),
|
||||||
|
this,
|
||||||
|
Ui::BoostBoxData{
|
||||||
|
.boost = Ui::BoostCounters{
|
||||||
|
.level = status.overview.level,
|
||||||
|
.boosts = status.overview.boostCount,
|
||||||
|
.thisLevelBoosts
|
||||||
|
= status.overview.currentLevelBoostCount,
|
||||||
|
.nextLevelBoosts
|
||||||
|
= status.overview.nextLevelBoostCount,
|
||||||
|
.mine = status.overview.isBoosted,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
resizeToWidth(width());
|
||||||
|
crl::on_main([=]{ fakeShowed->fire({}); });
|
||||||
|
}, lifetime());
|
||||||
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<Ui::ScrollToRequest> InnerWidget::scrollToRequests() const {
|
rpl::producer<Ui::ScrollToRequest> InnerWidget::scrollToRequests() const {
|
||||||
|
|
|
@ -931,6 +931,7 @@ void AddBubbleRow(
|
||||||
) | rpl::start_with_next([=](const QSize &parentSize, const QSize &size) {
|
) | rpl::start_with_next([=](const QSize &parentSize, const QSize &size) {
|
||||||
container->resize(parentSize.width(), size.height());
|
container->resize(parentSize.width(), size.height());
|
||||||
}, bubble->lifetime());
|
}, bubble->lifetime());
|
||||||
|
bubble->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddLimitRow(
|
void AddLimitRow(
|
||||||
|
|
Loading…
Add table
Reference in a new issue