mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added loading label to boosts info.
This commit is contained in:
parent
72c8999e50
commit
764b0d3dcd
3 changed files with 56 additions and 44 deletions
|
@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "info/boosts/info_boosts_widget.h"
|
#include "info/boosts/info_boosts_widget.h"
|
||||||
#include "info/info_controller.h"
|
#include "info/info_controller.h"
|
||||||
#include "info/profile/info_profile_icon.h"
|
#include "info/profile/info_profile_icon.h"
|
||||||
|
#include "info/statistics/info_statistics_inner_widget.h" // FillLoading.
|
||||||
#include "info/statistics/info_statistics_list_controllers.h"
|
#include "info/statistics/info_statistics_list_controllers.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "settings/settings_common.h"
|
#include "settings/settings_common.h"
|
||||||
|
@ -229,12 +230,18 @@ InnerWidget::InnerWidget(
|
||||||
void InnerWidget::load() {
|
void InnerWidget::load() {
|
||||||
const auto api = lifetime().make_state<Api::Boosts>(_peer);
|
const auto api = lifetime().make_state<Api::Boosts>(_peer);
|
||||||
|
|
||||||
|
Info::Statistics::FillLoading(
|
||||||
|
this,
|
||||||
|
_loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1),
|
||||||
|
_showFinished.events());
|
||||||
|
|
||||||
_showFinished.events(
|
_showFinished.events(
|
||||||
) | rpl::take(1) | rpl::start_with_next([=] {
|
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||||
api->request(
|
api->request(
|
||||||
) | rpl::start_with_error_done([](const QString &error) {
|
) | rpl::start_with_error_done([](const QString &error) {
|
||||||
}, [=] {
|
}, [=] {
|
||||||
_state = api->boostStatus();
|
_state = api->boostStatus();
|
||||||
|
_loaded.fire(true);
|
||||||
fill();
|
fill();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
|
@ -247,50 +247,6 @@ void FillStatistic(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillLoading(
|
|
||||||
not_null<Ui::VerticalLayout*> container,
|
|
||||||
rpl::producer<bool> toggleOn,
|
|
||||||
rpl::producer<> showFinished) {
|
|
||||||
const auto emptyWrap = container->add(
|
|
||||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
|
||||||
container,
|
|
||||||
object_ptr<Ui::VerticalLayout>(container)));
|
|
||||||
emptyWrap->toggleOn(std::move(toggleOn), anim::type::instant);
|
|
||||||
|
|
||||||
const auto content = emptyWrap->entity();
|
|
||||||
auto icon = ::Settings::CreateLottieIcon(
|
|
||||||
content,
|
|
||||||
{ .name = u"stats"_q, .sizeOverride = Size(st::changePhoneIconSize) },
|
|
||||||
st::settingsBlockedListIconPadding);
|
|
||||||
|
|
||||||
(
|
|
||||||
std::move(showFinished) | rpl::take(1)
|
|
||||||
) | rpl::start_with_next([animate = std::move(icon.animate)] {
|
|
||||||
animate(anim::repeat::loop);
|
|
||||||
}, icon.widget->lifetime());
|
|
||||||
content->add(std::move(icon.widget));
|
|
||||||
|
|
||||||
content->add(
|
|
||||||
object_ptr<Ui::CenterWrap<>>(
|
|
||||||
content,
|
|
||||||
object_ptr<Ui::FlatLabel>(
|
|
||||||
content,
|
|
||||||
tr::lng_stats_loading(),
|
|
||||||
st::changePhoneTitle)),
|
|
||||||
st::changePhoneTitlePadding + st::boxRowPadding);
|
|
||||||
|
|
||||||
content->add(
|
|
||||||
object_ptr<Ui::CenterWrap<>>(
|
|
||||||
content,
|
|
||||||
object_ptr<Ui::FlatLabel>(
|
|
||||||
content,
|
|
||||||
tr::lng_stats_loading_subtext(),
|
|
||||||
st::statisticsLoadingSubtext)),
|
|
||||||
st::changePhoneDescriptionPadding + st::boxRowPadding);
|
|
||||||
|
|
||||||
::Settings::AddSkip(content, st::settingsBlockedListIconPadding.top());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddHeader(
|
void AddHeader(
|
||||||
not_null<Ui::VerticalLayout*> content,
|
not_null<Ui::VerticalLayout*> content,
|
||||||
tr::phrase<> text,
|
tr::phrase<> text,
|
||||||
|
@ -507,6 +463,50 @@ void FillOverview(
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
void FillLoading(
|
||||||
|
not_null<Ui::VerticalLayout*> container,
|
||||||
|
rpl::producer<bool> toggleOn,
|
||||||
|
rpl::producer<> showFinished) {
|
||||||
|
const auto emptyWrap = container->add(
|
||||||
|
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||||
|
container,
|
||||||
|
object_ptr<Ui::VerticalLayout>(container)));
|
||||||
|
emptyWrap->toggleOn(std::move(toggleOn), anim::type::instant);
|
||||||
|
|
||||||
|
const auto content = emptyWrap->entity();
|
||||||
|
auto icon = ::Settings::CreateLottieIcon(
|
||||||
|
content,
|
||||||
|
{ .name = u"stats"_q, .sizeOverride = Size(st::changePhoneIconSize) },
|
||||||
|
st::settingsBlockedListIconPadding);
|
||||||
|
|
||||||
|
(
|
||||||
|
std::move(showFinished) | rpl::take(1)
|
||||||
|
) | rpl::start_with_next([animate = std::move(icon.animate)] {
|
||||||
|
animate(anim::repeat::loop);
|
||||||
|
}, icon.widget->lifetime());
|
||||||
|
content->add(std::move(icon.widget));
|
||||||
|
|
||||||
|
content->add(
|
||||||
|
object_ptr<Ui::CenterWrap<>>(
|
||||||
|
content,
|
||||||
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
content,
|
||||||
|
tr::lng_stats_loading(),
|
||||||
|
st::changePhoneTitle)),
|
||||||
|
st::changePhoneTitlePadding + st::boxRowPadding);
|
||||||
|
|
||||||
|
content->add(
|
||||||
|
object_ptr<Ui::CenterWrap<>>(
|
||||||
|
content,
|
||||||
|
object_ptr<Ui::FlatLabel>(
|
||||||
|
content,
|
||||||
|
tr::lng_stats_loading_subtext(),
|
||||||
|
st::statisticsLoadingSubtext)),
|
||||||
|
st::changePhoneDescriptionPadding + st::boxRowPadding);
|
||||||
|
|
||||||
|
::Settings::AddSkip(content, st::settingsBlockedListIconPadding.top());
|
||||||
|
}
|
||||||
|
|
||||||
InnerWidget::InnerWidget(
|
InnerWidget::InnerWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Controller*> controller,
|
not_null<Controller*> controller,
|
||||||
|
|
|
@ -21,6 +21,11 @@ namespace Info::Statistics {
|
||||||
class Memento;
|
class Memento;
|
||||||
class MessagePreview;
|
class MessagePreview;
|
||||||
|
|
||||||
|
void FillLoading(
|
||||||
|
not_null<Ui::VerticalLayout*> container,
|
||||||
|
rpl::producer<bool> toggleOn,
|
||||||
|
rpl::producer<> showFinished);
|
||||||
|
|
||||||
class InnerWidget final : public Ui::VerticalLayout {
|
class InnerWidget final : public Ui::VerticalLayout {
|
||||||
public:
|
public:
|
||||||
struct ShowRequest final {
|
struct ShowRequest final {
|
||||||
|
|
Loading…
Add table
Reference in a new issue