Added mode animations to loading screen from different stats.

This commit is contained in:
23rd 2024-08-05 21:01:25 +03:00 committed by John Preston
parent ba99706e75
commit 89dc18aaea
9 changed files with 34 additions and 3 deletions

Binary file not shown.

Binary file not shown.

View file

@ -5179,6 +5179,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_stats_loading" = "Loading stats..."; "lng_stats_loading" = "Loading stats...";
"lng_stats_loading_subtext" = "Please wait a few moments while we generate your stats."; "lng_stats_loading_subtext" = "Please wait a few moments while we generate your stats.";
"lng_stats_boosts_loading" = "Loading boosts list...";
"lng_stats_boosts_loading_subtext" = "Please wait a few moments while we generate your stats.";
"lng_stats_earn_loading" = "Loading rewards info...";
"lng_stats_earn_loading_subtext" = "Please wait a few moments while we generate your stats.";
"lng_chart_title_member_count" = "Growth"; "lng_chart_title_member_count" = "Growth";
"lng_chart_title_join" = "Followers"; "lng_chart_title_join" = "Followers";

View file

@ -11,6 +11,8 @@
<file alias="ttl.tgs">../../animations/ttl.tgs</file> <file alias="ttl.tgs">../../animations/ttl.tgs</file>
<file alias="discussion.tgs">../../animations/discussion.tgs</file> <file alias="discussion.tgs">../../animations/discussion.tgs</file>
<file alias="stats.tgs">../../animations/stats.tgs</file> <file alias="stats.tgs">../../animations/stats.tgs</file>
<file alias="stats_boosts.tgs">../../animations/stats_boosts.tgs</file>
<file alias="stats_earn.tgs">../../animations/stats_earn.tgs</file>
<file alias="voice_ttl_idle.tgs">../../animations/voice_ttl_idle.tgs</file> <file alias="voice_ttl_idle.tgs">../../animations/voice_ttl_idle.tgs</file>
<file alias="voice_ttl_start.tgs">../../animations/voice_ttl_start.tgs</file> <file alias="voice_ttl_start.tgs">../../animations/voice_ttl_start.tgs</file>
<file alias="palette.tgs">../../animations/palette.tgs</file> <file alias="palette.tgs">../../animations/palette.tgs</file>

View file

@ -87,6 +87,7 @@ void InnerWidget::load() {
Info::Statistics::FillLoading( Info::Statistics::FillLoading(
this, this,
Info::Statistics::LoadingType::Earn,
_loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1), _loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1),
_showFinished.events()); _showFinished.events());

View file

@ -273,6 +273,7 @@ void InnerWidget::load() {
Info::Statistics::FillLoading( Info::Statistics::FillLoading(
this, this,
Info::Statistics::LoadingType::Boosts,
_loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1), _loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1),
_showFinished.events()); _showFinished.events());

View file

@ -287,6 +287,7 @@ void InnerWidget::load() {
Info::Statistics::FillLoading( Info::Statistics::FillLoading(
this, this,
Info::Statistics::LoadingType::Earn,
_loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1), _loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1),
_showFinished.events()); _showFinished.events());

View file

@ -560,6 +560,7 @@ void FillOverview(
void FillLoading( void FillLoading(
not_null<Ui::VerticalLayout*> container, not_null<Ui::VerticalLayout*> container,
LoadingType type,
rpl::producer<bool> toggleOn, rpl::producer<bool> toggleOn,
rpl::producer<> showFinished) { rpl::producer<> showFinished) {
const auto emptyWrap = container->add( const auto emptyWrap = container->add(
@ -569,9 +570,14 @@ void FillLoading(
emptyWrap->toggleOn(std::move(toggleOn), anim::type::instant); emptyWrap->toggleOn(std::move(toggleOn), anim::type::instant);
const auto content = emptyWrap->entity(); const auto content = emptyWrap->entity();
const auto iconName = (type == LoadingType::Boosts)
? u"stats_boosts"_q
: (type == LoadingType::Earn)
? u"stats_earn"_q
: u"stats"_q;
auto icon = ::Settings::CreateLottieIcon( auto icon = ::Settings::CreateLottieIcon(
content, content,
{ .name = u"stats"_q, .sizeOverride = Size(st::changePhoneIconSize) }, { .name = iconName, .sizeOverride = Size(st::changePhoneIconSize) },
st::settingsBlockedListIconPadding); st::settingsBlockedListIconPadding);
( (
@ -586,7 +592,11 @@ void FillLoading(
content, content,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
content, content,
tr::lng_stats_loading(), (type == LoadingType::Boosts)
? tr::lng_stats_boosts_loading()
: (type == LoadingType::Earn)
? tr::lng_stats_earn_loading()
: tr::lng_stats_loading(),
st::changePhoneTitle)), st::changePhoneTitle)),
st::changePhoneTitlePadding + st::boxRowPadding); st::changePhoneTitlePadding + st::boxRowPadding);
@ -595,7 +605,11 @@ void FillLoading(
content, content,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
content, content,
tr::lng_stats_loading_subtext(), (type == LoadingType::Boosts)
? tr::lng_stats_boosts_loading_subtext()
: (type == LoadingType::Earn)
? tr::lng_stats_earn_loading_subtext()
: tr::lng_stats_loading_subtext(),
st::statisticsLoadingSubtext)), st::statisticsLoadingSubtext)),
st::changePhoneDescriptionPadding + st::boxRowPadding); st::changePhoneDescriptionPadding + st::boxRowPadding);
@ -626,6 +640,7 @@ void InnerWidget::load() {
FillLoading( FillLoading(
inner, inner,
Info::Statistics::LoadingType::Statistic,
_loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1), _loaded.events_starting_with(false) | rpl::map(!rpl::mappers::_1),
_showFinished.events()); _showFinished.events());

View file

@ -21,8 +21,15 @@ namespace Info::Statistics {
class Memento; class Memento;
class MessagePreview; class MessagePreview;
enum class LoadingType {
Statistic,
Boosts,
Earn,
};
void FillLoading( void FillLoading(
not_null<Ui::VerticalLayout*> container, not_null<Ui::VerticalLayout*> container,
LoadingType type,
rpl::producer<bool> toggleOn, rpl::producer<bool> toggleOn,
rpl::producer<> showFinished); rpl::producer<> showFinished);