mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Added ability to request earn stats without currency earn in megagroups.
This commit is contained in:
parent
4ab4eb8ef2
commit
8e83a55143
1 changed files with 16 additions and 4 deletions
|
@ -297,9 +297,7 @@ void InnerWidget::load() {
|
||||||
|
|
||||||
_showFinished.events(
|
_showFinished.events(
|
||||||
) | rpl::take(1) | rpl::start_with_next([=] {
|
) | rpl::take(1) | rpl::start_with_next([=] {
|
||||||
state->api.request(
|
const auto nextRequests = [=] {
|
||||||
) | rpl::start_with_error_done(fail, [=] {
|
|
||||||
_state.currencyEarn = state->api.data();
|
|
||||||
state->apiCreditsHistory.request({}, [=](
|
state->apiCreditsHistory.request({}, [=](
|
||||||
const Data::CreditsStatusSlice &data) {
|
const Data::CreditsStatusSlice &data) {
|
||||||
_state.creditsStatusSlice = data;
|
_state.creditsStatusSlice = data;
|
||||||
|
@ -322,6 +320,19 @@ void InnerWidget::load() {
|
||||||
state->apiPremiumBotLifetime.destroy();
|
state->apiPremiumBotLifetime.destroy();
|
||||||
}, state->apiPremiumBotLifetime);
|
}, state->apiPremiumBotLifetime);
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
const auto isMegagroup = _peer->isMegagroup();
|
||||||
|
state->api.request(
|
||||||
|
) | rpl::start_with_error_done([=](const QString &error) {
|
||||||
|
if (isMegagroup) {
|
||||||
|
_state.currencyEarn = {};
|
||||||
|
nextRequests();
|
||||||
|
} else {
|
||||||
|
show->showToast(error);
|
||||||
|
}
|
||||||
|
}, [=] {
|
||||||
|
_state.currencyEarn = state->api.data();
|
||||||
|
nextRequests();
|
||||||
}, state->apiLifetime);
|
}, state->apiLifetime);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
@ -333,7 +344,8 @@ void InnerWidget::fill() {
|
||||||
: nullptr;
|
: nullptr;
|
||||||
const auto channel = _peer->asChannel();
|
const auto channel = _peer->asChannel();
|
||||||
const auto canViewCurrencyEarn = channel
|
const auto canViewCurrencyEarn = channel
|
||||||
? (channel->flags() & ChannelDataFlag::CanViewRevenue)
|
? ((channel->flags() & ChannelDataFlag::CanViewRevenue)
|
||||||
|
&& !channel->isMegagroup())
|
||||||
: true;
|
: true;
|
||||||
const auto &data = canViewCurrencyEarn
|
const auto &data = canViewCurrencyEarn
|
||||||
? _state.currencyEarn
|
? _state.currencyEarn
|
||||||
|
|
Loading…
Add table
Reference in a new issue