diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp index 2176492d5..b271eac58 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_earn_inner_widget.cpp @@ -315,7 +315,7 @@ void InnerWidget::fill() { }; const auto addEmojiToMajor = [=]( not_null label, - EarnInt value, + rpl::producer value, std::optional isIn, std::optional margins) { const auto &st = label->st(); @@ -330,12 +330,16 @@ void InnerWidget::fill() { : st::menuIconAttentionColor->c), margins ? *margins : st::channelEarnCurrencyCommonMargins, false)); - auto prepended = !isIn + const auto prepended = !isIn ? TextWithEntities() : TextWithEntities::Simple((*isIn) ? QChar('+') : kMinus); - label->setMarkedText( - prepended.append(icon).append(MajorPart(value)), - makeContext(label)); + std::move( + value + ) | rpl::start_with_next([=](EarnInt v) { + label->setMarkedText( + base::duplicate(prepended).append(icon).append(MajorPart(v)), + makeContext(label)); + }, label->lifetime()); }; const auto bigCurrencyIcon = Ui::Text::SingleCustomEmoji( @@ -589,7 +593,7 @@ void InnerWidget::fill() { const auto majorLabel = Ui::CreateChild( line, st::channelEarnOverviewMajorLabel); - addEmojiToMajor(majorLabel, value, {}, {}); + addEmojiToMajor(majorLabel, rpl::single(value), {}, {}); const auto minorLabel = Ui::CreateChild( line, MinorPart(value), @@ -704,7 +708,7 @@ void InnerWidget::fill() { { const auto &m = st::channelEarnCurrencyCommonMargins; const auto p = QMargins(m.left(), 0, m.right(), m.bottom()); - addEmojiToMajor(majorLabel, value, {}, p); + addEmojiToMajor(majorLabel, rpl::single(value), {}, p); } majorLabel->setAttribute(Qt::WA_TransparentForMouseEvents); const auto minorLabel = Ui::CreateChild( @@ -855,7 +859,7 @@ void InnerWidget::fill() { const auto majorLabel = Ui::CreateChild( wrap, st::channelEarnHistoryMajorLabel); - addEmojiToMajor(majorLabel, entry.amount, isIn, {}); + addEmojiToMajor(majorLabel, rpl::single(entry.amount), isIn, {}); majorLabel->setAttribute(Qt::WA_TransparentForMouseEvents); majorLabel->setTextColorOverride(color); const auto minorText = MinorPart(entry.amount); @@ -885,7 +889,7 @@ void InnerWidget::fill() { const auto majorLabel = Ui::CreateChild( labels, st::channelEarnOverviewMajorLabel); - addEmojiToMajor(majorLabel, amount, isIn, {}); + addEmojiToMajor(majorLabel, rpl::single(amount), isIn, {}); majorLabel->setAttribute(Qt::WA_TransparentForMouseEvents); majorLabel->setTextColorOverride(color); const auto minorLabel = Ui::CreateChild(