mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Added support of api update to history lists in section of channel earn.
This commit is contained in:
parent
b79c306bfe
commit
a84ac933dd
2 changed files with 426 additions and 372 deletions
|
@ -5214,6 +5214,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_channel_earn_chart_revenue" = "Ad revenue";
|
"lng_channel_earn_chart_revenue" = "Ad revenue";
|
||||||
"lng_channel_earn_chart_overriden_detail_currency" = "Revenue in TON";
|
"lng_channel_earn_chart_overriden_detail_currency" = "Revenue in TON";
|
||||||
"lng_channel_earn_chart_overriden_detail_usd" = "Revenue in USD";
|
"lng_channel_earn_chart_overriden_detail_usd" = "Revenue in USD";
|
||||||
|
"lng_channel_earn_currency_history" = "TON Transactions";
|
||||||
|
"lng_channel_earn_credits_history" = "Stars Transactions";
|
||||||
|
|
||||||
"lng_bot_earn_title" = "Stars Balance";
|
"lng_bot_earn_title" = "Stars Balance";
|
||||||
"lng_bot_earn_chart_revenue" = "Revenue";
|
"lng_bot_earn_chart_revenue" = "Revenue";
|
||||||
|
|
|
@ -697,7 +697,11 @@ void InnerWidget::fill() {
|
||||||
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||||
line,
|
line,
|
||||||
st::channelEarnOverviewMajorLabel);
|
st::channelEarnOverviewMajorLabel);
|
||||||
addEmojiToMajor(majorLabel, rpl::duplicate(currencyValue), {}, {});
|
addEmojiToMajor(
|
||||||
|
majorLabel,
|
||||||
|
rpl::duplicate(currencyValue),
|
||||||
|
{},
|
||||||
|
{});
|
||||||
const auto minorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
const auto minorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||||
line,
|
line,
|
||||||
rpl::duplicate(currencyValue) | rpl::map(MinorPart),
|
rpl::duplicate(currencyValue) | rpl::map(MinorPart),
|
||||||
|
@ -912,21 +916,27 @@ void InnerWidget::fill() {
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto hasCurrencyTab = !data.firstHistorySlice.list.empty();
|
const auto sectionIndex = container->lifetime().make_state<int>(0);
|
||||||
const auto hasCreditsTab = !_state.creditsStatusSlice.list.empty()
|
const auto rebuildLists = [=](
|
||||||
&& _state.premiumBotId;
|
const Memento::SavedState &data,
|
||||||
|
not_null<Ui::VerticalLayout*> listsContainer) {
|
||||||
|
const auto hasCurrencyTab
|
||||||
|
= !data.currencyEarn.firstHistorySlice.list.empty();
|
||||||
|
const auto hasCreditsTab = !data.creditsStatusSlice.list.empty()
|
||||||
|
&& data.premiumBotId;
|
||||||
const auto hasOneTab = (hasCurrencyTab || hasCreditsTab)
|
const auto hasOneTab = (hasCurrencyTab || hasCreditsTab)
|
||||||
&& (hasCurrencyTab != hasCreditsTab);
|
&& (hasCurrencyTab != hasCreditsTab);
|
||||||
|
|
||||||
const auto currencyTabText = tr::lng_channel_earn_currency_history(
|
const auto currencyTabText = tr::lng_channel_earn_currency_history(
|
||||||
tr::now);
|
tr::now);
|
||||||
const auto creditsTabText = tr::lng_channel_earn_credits_history(tr::now);
|
const auto creditsTabText = tr::lng_channel_earn_credits_history(
|
||||||
|
tr::now);
|
||||||
|
|
||||||
const auto slider = container->add(
|
const auto slider = listsContainer->add(
|
||||||
object_ptr<Ui::SlideWrap<Ui::CustomWidthSlider>>(
|
object_ptr<Ui::SlideWrap<Ui::CustomWidthSlider>>(
|
||||||
container,
|
listsContainer,
|
||||||
object_ptr<Ui::CustomWidthSlider>(
|
object_ptr<Ui::CustomWidthSlider>(
|
||||||
container,
|
listsContainer,
|
||||||
st::defaultTabsSlider)),
|
st::defaultTabsSlider)),
|
||||||
st::boxRowPadding);
|
st::boxRowPadding);
|
||||||
slider->toggle(!hasOneTab, anim::type::instant);
|
slider->toggle(!hasOneTab, anim::type::instant);
|
||||||
|
@ -952,38 +962,43 @@ void InnerWidget::fill() {
|
||||||
|
|
||||||
if (hasOneTab) {
|
if (hasOneTab) {
|
||||||
if (hasCurrencyTab) {
|
if (hasCurrencyTab) {
|
||||||
AddHeader(container, tr::lng_channel_earn_history_title);
|
AddHeader(listsContainer, tr::lng_channel_earn_history_title);
|
||||||
} else if (hasCreditsTab) {
|
} else if (hasCreditsTab) {
|
||||||
AddHeader(container, tr::lng_channel_earn_credits_history);
|
AddHeader(
|
||||||
|
listsContainer,
|
||||||
|
tr::lng_channel_earn_credits_history);
|
||||||
slider->entity()->setActiveSectionFast(1);
|
slider->entity()->setActiveSectionFast(1);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
slider->entity()->setActiveSectionFast(*sectionIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto historyCurrencyList = container->add(
|
const auto tabCurrencyList = listsContainer->add(
|
||||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||||
container,
|
listsContainer,
|
||||||
object_ptr<Ui::VerticalLayout>(container)));
|
object_ptr<Ui::VerticalLayout>(listsContainer)));
|
||||||
const auto historyCreditsList = container->add(
|
const auto tabCreditsList = listsContainer->add(
|
||||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||||
container,
|
listsContainer,
|
||||||
object_ptr<Ui::VerticalLayout>(container)));
|
object_ptr<Ui::VerticalLayout>(listsContainer)));
|
||||||
|
|
||||||
rpl::single(slider->entity()->activeSection()) | rpl::then(
|
rpl::single(slider->entity()->activeSection()) | rpl::then(
|
||||||
slider->entity()->sectionActivated()
|
slider->entity()->sectionActivated()
|
||||||
) | rpl::start_with_next([=](int index) {
|
) | rpl::start_with_next([=](int index) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
historyCurrencyList->toggle(true, anim::type::instant);
|
tabCurrencyList->toggle(true, anim::type::instant);
|
||||||
historyCreditsList->toggle(false, anim::type::instant);
|
tabCreditsList->toggle(false, anim::type::instant);
|
||||||
} else if (index == 1) {
|
} else if (index == 1) {
|
||||||
historyCurrencyList->toggle(false, anim::type::instant);
|
tabCurrencyList->toggle(false, anim::type::instant);
|
||||||
historyCreditsList->toggle(true, anim::type::instant);
|
tabCreditsList->toggle(true, anim::type::instant);
|
||||||
}
|
}
|
||||||
}, container->lifetime());
|
*sectionIndex = index;
|
||||||
|
}, listsContainer->lifetime());
|
||||||
|
|
||||||
if (hasCurrencyTab) {
|
if (hasCurrencyTab) {
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(listsContainer);
|
||||||
|
|
||||||
const auto historyList = historyCurrencyList->entity();
|
const auto historyList = tabCurrencyList->entity();
|
||||||
const auto addHistoryEntry = [=](
|
const auto addHistoryEntry = [=](
|
||||||
const Data::EarnHistoryEntry &entry,
|
const Data::EarnHistoryEntry &entry,
|
||||||
const tr::phrase<> &text) {
|
const tr::phrase<> &text) {
|
||||||
|
@ -999,7 +1014,8 @@ void InnerWidget::fill() {
|
||||||
text(),
|
text(),
|
||||||
st::channelEarnSemiboldLabel));
|
st::channelEarnSemiboldLabel));
|
||||||
|
|
||||||
const auto isIn = entry.type == Data::EarnHistoryEntry::Type::In;
|
const auto isIn
|
||||||
|
= (entry.type == Data::EarnHistoryEntry::Type::In);
|
||||||
const auto recipient = Ui::Text::Wrapped(
|
const auto recipient = Ui::Text::Wrapped(
|
||||||
{ entry.provider },
|
{ entry.provider },
|
||||||
EntityType::Code);
|
EntityType::Code);
|
||||||
|
@ -1036,7 +1052,8 @@ void InnerWidget::fill() {
|
||||||
dateText,
|
dateText,
|
||||||
st::channelEarnHistorySubLabel)
|
st::channelEarnHistorySubLabel)
|
||||||
)->setTextColorOverride(isFailed
|
)->setTextColorOverride(isFailed
|
||||||
? std::make_optional<QColor>(st::menuIconAttentionColor->c)
|
? std::make_optional<QColor>(
|
||||||
|
st::menuIconAttentionColor->c)
|
||||||
: std::nullopt);
|
: std::nullopt);
|
||||||
|
|
||||||
const auto color = (isIn
|
const auto color = (isIn
|
||||||
|
@ -1045,7 +1062,11 @@ void InnerWidget::fill() {
|
||||||
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||||
wrap,
|
wrap,
|
||||||
st::channelEarnHistoryMajorLabel);
|
st::channelEarnHistoryMajorLabel);
|
||||||
addEmojiToMajor(majorLabel, rpl::single(entry.amount), isIn, {});
|
addEmojiToMajor(
|
||||||
|
majorLabel,
|
||||||
|
rpl::single(entry.amount),
|
||||||
|
isIn,
|
||||||
|
{});
|
||||||
majorLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
|
majorLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
majorLabel->setTextColorOverride(color);
|
majorLabel->setTextColorOverride(color);
|
||||||
const auto minorText = MinorPart(entry.amount);
|
const auto minorText = MinorPart(entry.amount);
|
||||||
|
@ -1060,7 +1081,7 @@ void InnerWidget::fill() {
|
||||||
rpl::single(QString()));
|
rpl::single(QString()));
|
||||||
Ui::ToggleChildrenVisibility(wrap, true);
|
Ui::ToggleChildrenVisibility(wrap, true);
|
||||||
|
|
||||||
const auto detailsBox = [=, amount = entry.amount, peer = _peer](
|
const auto detailsBox = [=, peer = _peer](
|
||||||
not_null<Ui::GenericBox*> box) {
|
not_null<Ui::GenericBox*> box) {
|
||||||
box->addTopButton(
|
box->addTopButton(
|
||||||
st::boxTitleClose,
|
st::boxTitleClose,
|
||||||
|
@ -1075,14 +1096,20 @@ void InnerWidget::fill() {
|
||||||
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||||
labels,
|
labels,
|
||||||
st::channelEarnOverviewMajorLabel);
|
st::channelEarnOverviewMajorLabel);
|
||||||
addEmojiToMajor(majorLabel, rpl::single(amount), isIn, {});
|
addEmojiToMajor(
|
||||||
majorLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
|
majorLabel,
|
||||||
|
rpl::single(entry.amount),
|
||||||
|
isIn,
|
||||||
|
{});
|
||||||
|
majorLabel->setAttribute(
|
||||||
|
Qt::WA_TransparentForMouseEvents);
|
||||||
majorLabel->setTextColorOverride(color);
|
majorLabel->setTextColorOverride(color);
|
||||||
const auto minorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
const auto minorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||||
labels,
|
labels,
|
||||||
minorText,
|
minorText,
|
||||||
st::channelEarnOverviewMinorLabel);
|
st::channelEarnOverviewMinorLabel);
|
||||||
minorLabel->setAttribute(Qt::WA_TransparentForMouseEvents);
|
minorLabel->setAttribute(
|
||||||
|
Qt::WA_TransparentForMouseEvents);
|
||||||
minorLabel->setTextColorOverride(color);
|
minorLabel->setTextColorOverride(color);
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
majorLabel->sizeValue(),
|
majorLabel->sizeValue(),
|
||||||
|
@ -1157,7 +1184,9 @@ void InnerWidget::fill() {
|
||||||
+ rect::m::sum::h(padding),
|
+ rect::m::sum::h(padding),
|
||||||
leftSize.height());
|
leftSize.height());
|
||||||
left->moveToLeft(0, 0);
|
left->moveToLeft(0, 0);
|
||||||
right->moveToRight(padding.right(), padding.top());
|
right->moveToRight(
|
||||||
|
padding.right(),
|
||||||
|
padding.top());
|
||||||
const auto maxRightSize = box->width()
|
const auto maxRightSize = box->width()
|
||||||
- rect::m::sum::h(st::boxRowPadding)
|
- rect::m::sum::h(st::boxRowPadding)
|
||||||
- rect::m::sum::h(padding)
|
- rect::m::sum::h(padding)
|
||||||
|
@ -1177,11 +1206,12 @@ void InnerWidget::fill() {
|
||||||
p.drawRoundedRect(rect, radius, radius);
|
p.drawRoundedRect(rect, radius, radius);
|
||||||
}, peerBubble->lifetime());
|
}, peerBubble->lifetime());
|
||||||
}
|
}
|
||||||
|
const auto closeBox = [=] { box->closeBox(); };
|
||||||
{
|
{
|
||||||
const auto &st = st::premiumPreviewDoubledLimitsBox;
|
const auto &st = st::premiumPreviewDoubledLimitsBox;
|
||||||
box->setStyle(st);
|
box->setStyle(st);
|
||||||
auto button = object_ptr<Ui::RoundButton>(
|
auto button = object_ptr<Ui::RoundButton>(
|
||||||
container,
|
box,
|
||||||
(!entry.successLink.isEmpty())
|
(!entry.successLink.isEmpty())
|
||||||
? tr::lng_channel_earn_history_out_button()
|
? tr::lng_channel_earn_history_out_button()
|
||||||
: tr::lng_box_ok(),
|
: tr::lng_box_ok(),
|
||||||
|
@ -1191,7 +1221,8 @@ void InnerWidget::fill() {
|
||||||
- st.buttonPadding.left());
|
- st.buttonPadding.left());
|
||||||
if (!entry.successLink.isEmpty()) {
|
if (!entry.successLink.isEmpty()) {
|
||||||
button->setAcceptBoth();
|
button->setAcceptBoth();
|
||||||
button->addClickHandler([=](Qt::MouseButton button) {
|
button->addClickHandler([=](
|
||||||
|
Qt::MouseButton button) {
|
||||||
if (button == Qt::LeftButton) {
|
if (button == Qt::LeftButton) {
|
||||||
UrlClickHandler::Open(entry.successLink);
|
UrlClickHandler::Open(entry.successLink);
|
||||||
} else if (button == Qt::RightButton) {
|
} else if (button == Qt::RightButton) {
|
||||||
|
@ -1199,13 +1230,13 @@ void InnerWidget::fill() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
button->setClickedCallback([=] { box->closeBox(); });
|
button->setClickedCallback(closeBox);
|
||||||
}
|
}
|
||||||
box->addButton(std::move(button));
|
box->addButton(std::move(button));
|
||||||
}
|
}
|
||||||
Ui::AddSkip(box->verticalLayout());
|
Ui::AddSkip(box->verticalLayout());
|
||||||
Ui::AddSkip(box->verticalLayout());
|
Ui::AddSkip(box->verticalLayout());
|
||||||
box->addButton(tr::lng_box_ok(), [=] { box->closeBox(); });
|
box->addButton(tr::lng_box_ok(), closeBox);
|
||||||
};
|
};
|
||||||
|
|
||||||
button->setClickedCallback([=] {
|
button->setClickedCallback([=] {
|
||||||
|
@ -1214,7 +1245,8 @@ void InnerWidget::fill() {
|
||||||
wrap->geometryValue(
|
wrap->geometryValue(
|
||||||
) | rpl::start_with_next([=](const QRect &g) {
|
) | rpl::start_with_next([=](const QRect &g) {
|
||||||
const auto &padding = st::boxRowPadding;
|
const auto &padding = st::boxRowPadding;
|
||||||
const auto majorTop = (g.height() - majorLabel->height()) / 2;
|
const auto majorTop = (g.height() - majorLabel->height())
|
||||||
|
/ 2;
|
||||||
minorLabel->moveToRight(
|
minorLabel->moveToRight(
|
||||||
padding.right(),
|
padding.right(),
|
||||||
majorTop + st::channelEarnHistoryMinorLabelSkip);
|
majorTop + st::channelEarnHistoryMinorLabelSkip);
|
||||||
|
@ -1224,27 +1256,28 @@ void InnerWidget::fill() {
|
||||||
const auto rightWrapPadding = rect::m::sum::h(padding)
|
const auto rightWrapPadding = rect::m::sum::h(padding)
|
||||||
+ minorLabel->width()
|
+ minorLabel->width()
|
||||||
+ majorLabel->width();
|
+ majorLabel->width();
|
||||||
wrap->setPadding(
|
wrap->setPadding(st::channelEarnHistoryOuter
|
||||||
st::channelEarnHistoryOuter
|
|
||||||
+ QMargins(padding.left(), 0, rightWrapPadding, 0));
|
+ QMargins(padding.left(), 0, rightWrapPadding, 0));
|
||||||
button->resize(g.size());
|
button->resize(g.size());
|
||||||
button->lower();
|
button->lower();
|
||||||
}, wrap->lifetime());
|
}, wrap->lifetime());
|
||||||
};
|
};
|
||||||
const auto handleSlice = [=](const Data::EarnHistorySlice &slice) {
|
const auto handleSlice = [=](const Data::EarnHistorySlice &s) {
|
||||||
for (const auto &entry : slice.list) {
|
using Type = Data::EarnHistoryEntry::Type;
|
||||||
|
for (const auto &entry : s.list) {
|
||||||
addHistoryEntry(
|
addHistoryEntry(
|
||||||
entry,
|
entry,
|
||||||
(entry.type == Data::EarnHistoryEntry::Type::In)
|
(entry.type == Type::In)
|
||||||
? tr::lng_channel_earn_history_in
|
? tr::lng_channel_earn_history_in
|
||||||
: (entry.type == Data::EarnHistoryEntry::Type::Return)
|
: (entry.type == Type::Return)
|
||||||
? tr::lng_channel_earn_history_return
|
? tr::lng_channel_earn_history_return
|
||||||
: tr::lng_channel_earn_history_out);
|
: tr::lng_channel_earn_history_out);
|
||||||
}
|
}
|
||||||
historyList->resizeToWidth(container->width());
|
historyList->resizeToWidth(listsContainer->width());
|
||||||
};
|
};
|
||||||
handleSlice(data.firstHistorySlice);
|
const auto &firstSlice = data.currencyEarn.firstHistorySlice;
|
||||||
if (!data.firstHistorySlice.allLoaded) {
|
handleSlice(firstSlice);
|
||||||
|
if (!firstSlice.allLoaded) {
|
||||||
struct ShowMoreState final {
|
struct ShowMoreState final {
|
||||||
ShowMoreState(not_null<ChannelData*> channel)
|
ShowMoreState(not_null<ChannelData*> channel)
|
||||||
: api(channel) {
|
: api(channel) {
|
||||||
|
@ -1254,15 +1287,16 @@ void InnerWidget::fill() {
|
||||||
Data::EarnHistorySlice::OffsetToken token;
|
Data::EarnHistorySlice::OffsetToken token;
|
||||||
rpl::variable<int> showed = 0;
|
rpl::variable<int> showed = 0;
|
||||||
};
|
};
|
||||||
const auto state = lifetime().make_state<ShowMoreState>(channel);
|
const auto state
|
||||||
state->token = data.firstHistorySlice.token;
|
= lifetime().make_state<ShowMoreState>(channel);
|
||||||
state->showed = data.firstHistorySlice.list.size();
|
state->token = firstSlice.token;
|
||||||
const auto max = data.firstHistorySlice.total;
|
state->showed = firstSlice.list.size();
|
||||||
const auto wrap = container->add(
|
const auto max = firstSlice.total;
|
||||||
|
const auto wrap = listsContainer->add(
|
||||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||||
container,
|
listsContainer,
|
||||||
object_ptr<Ui::SettingsButton>(
|
object_ptr<Ui::SettingsButton>(
|
||||||
container,
|
listsContainer,
|
||||||
tr::lng_channel_earn_history_show_more(
|
tr::lng_channel_earn_history_show_more(
|
||||||
lt_count,
|
lt_count,
|
||||||
state->showed.value(
|
state->showed.value(
|
||||||
|
@ -1274,29 +1308,30 @@ void InnerWidget::fill() {
|
||||||
AddArrow(button);
|
AddArrow(button);
|
||||||
|
|
||||||
wrap->toggle(true, anim::type::instant);
|
wrap->toggle(true, anim::type::instant);
|
||||||
const auto handleReceived = [=](Data::EarnHistorySlice slice) {
|
const auto handleReceived = [=](
|
||||||
|
Data::EarnHistorySlice slice) {
|
||||||
state->loading = false;
|
state->loading = false;
|
||||||
handleSlice(slice);
|
handleSlice(slice);
|
||||||
wrap->toggle(!slice.allLoaded, anim::type::instant);
|
wrap->toggle(!slice.allLoaded, anim::type::instant);
|
||||||
state->token = slice.token;
|
state->token = slice.token;
|
||||||
state->showed = state->showed.current() + slice.list.size();
|
state->showed = state->showed.current()
|
||||||
|
+ slice.list.size();
|
||||||
};
|
};
|
||||||
button->setClickedCallback([=] {
|
button->setClickedCallback([=] {
|
||||||
if (!state->loading) {
|
if (state->loading) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
state->loading = true;
|
state->loading = true;
|
||||||
state->api.requestHistory(state->token, handleReceived);
|
state->api.requestHistory(state->token, handleReceived);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Ui::AddSkip(container);
|
|
||||||
Ui::AddDivider(container);
|
|
||||||
Ui::AddSkip(container);
|
|
||||||
}
|
}
|
||||||
if (hasCreditsTab) {
|
if (hasCreditsTab) {
|
||||||
const auto controller = _controller->parentController();
|
const auto controller = _controller->parentController();
|
||||||
const auto show = controller->uiShow();
|
const auto show = controller->uiShow();
|
||||||
const auto premiumBot = _peer->owner().peer(_state.premiumBotId);
|
const auto premiumBot = _peer->owner().peer(data.premiumBotId);
|
||||||
const auto entryClicked = [=](const Data::CreditsHistoryEntry &e) {
|
const auto entryClicked = [=](
|
||||||
|
const Data::CreditsHistoryEntry &e) {
|
||||||
show->show(Box(
|
show->show(Box(
|
||||||
::Settings::ReceiptCreditsBox,
|
::Settings::ReceiptCreditsBox,
|
||||||
controller,
|
controller,
|
||||||
|
@ -1304,22 +1339,39 @@ void InnerWidget::fill() {
|
||||||
e));
|
e));
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto star = historyCreditsList->lifetime().make_state<QImage>(
|
const auto star = tabCreditsList->lifetime().make_state<QImage>(
|
||||||
Ui::GenerateStars(st::creditsTopupButton.height, 1));
|
Ui::GenerateStars(st::creditsTopupButton.height, 1));
|
||||||
|
|
||||||
Info::Statistics::AddCreditsHistoryList(
|
Info::Statistics::AddCreditsHistoryList(
|
||||||
show,
|
show,
|
||||||
_state.creditsStatusSlice,
|
data.creditsStatusSlice,
|
||||||
historyCreditsList->entity(),
|
tabCreditsList->entity(),
|
||||||
entryClicked,
|
entryClicked,
|
||||||
premiumBot,
|
premiumBot,
|
||||||
star,
|
star,
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
Ui::AddSkip(container);
|
|
||||||
Ui::AddDivider(container);
|
|
||||||
Ui::AddSkip(container);
|
|
||||||
}
|
}
|
||||||
|
if (hasCurrencyTab || hasCreditsTab) {
|
||||||
|
Ui::AddSkip(listsContainer);
|
||||||
|
Ui::AddDivider(listsContainer);
|
||||||
|
Ui::AddSkip(listsContainer);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto historyContainer = container->add(
|
||||||
|
object_ptr<Ui::VerticalLayout>(container));
|
||||||
|
rpl::single(rpl::empty) | rpl::then(
|
||||||
|
_stateUpdated.events()
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
const auto listsContainer = historyContainer->add(
|
||||||
|
object_ptr<Ui::VerticalLayout>(container));
|
||||||
|
rebuildLists(_state, listsContainer);
|
||||||
|
while (historyContainer->count() > 1) {
|
||||||
|
delete historyContainer->widgetAt(0);
|
||||||
|
}
|
||||||
|
}, historyContainer->lifetime());
|
||||||
|
|
||||||
if (channel) {
|
if (channel) {
|
||||||
//constexpr auto kMaxCPM = 50; // Debug.
|
//constexpr auto kMaxCPM = 50; // Debug.
|
||||||
const auto requiredLevel = Data::LevelLimits(session)
|
const auto requiredLevel = Data::LevelLimits(session)
|
||||||
|
|
Loading…
Add table
Reference in a new issue