mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed currency stat from channel earn section when it's not available.
This commit is contained in:
parent
f2ea0edc95
commit
bfbdf1b935
1 changed files with 16 additions and 6 deletions
|
@ -386,7 +386,13 @@ void InnerWidget::load() {
|
||||||
|
|
||||||
void InnerWidget::fill() {
|
void InnerWidget::fill() {
|
||||||
const auto container = this;
|
const auto container = this;
|
||||||
const auto &data = _state.currencyEarn;
|
const auto channel = _peer->asChannel();
|
||||||
|
const auto canViewCurrencyEarn = channel
|
||||||
|
? (channel->flags() & ChannelDataFlag::CanViewRevenue)
|
||||||
|
: true;
|
||||||
|
const auto &data = canViewCurrencyEarn
|
||||||
|
? _state.currencyEarn
|
||||||
|
: Data::EarnStatistics();
|
||||||
const auto &creditsData = _state.creditsEarn;
|
const auto &creditsData = _state.creditsEarn;
|
||||||
|
|
||||||
auto currencyStateValue = rpl::single(
|
auto currencyStateValue = rpl::single(
|
||||||
|
@ -417,7 +423,6 @@ void InnerWidget::fill() {
|
||||||
const auto nonInteractive = base::unixtime::now() < kNonInteractivePeriod;
|
const auto nonInteractive = base::unixtime::now() < kNonInteractivePeriod;
|
||||||
|
|
||||||
const auto session = &_peer->session();
|
const auto session = &_peer->session();
|
||||||
const auto channel = _peer->asChannel();
|
|
||||||
const auto withdrawalEnabled = WithdrawalEnabled(session)
|
const auto withdrawalEnabled = WithdrawalEnabled(session)
|
||||||
&& !nonInteractive;
|
&& !nonInteractive;
|
||||||
const auto makeContext = [=](not_null<Ui::FlatLabel*> l) {
|
const auto makeContext = [=](not_null<Ui::FlatLabel*> l) {
|
||||||
|
@ -1486,10 +1491,15 @@ void InnerWidget::fill() {
|
||||||
[] {});
|
[] {});
|
||||||
}
|
}
|
||||||
if (!isLocked) {
|
if (!isLocked) {
|
||||||
Api::RestrictSponsored(channel, value, [=](const QString &e) {
|
const auto weak = Ui::MakeWeak(this);
|
||||||
toggled->fire(false);
|
const auto show = _controller->uiShow();
|
||||||
_controller->uiShow()->showToast(e);
|
const auto failed = [=](const QString &e) {
|
||||||
});
|
if (weak.data()) {
|
||||||
|
toggled->fire(false);
|
||||||
|
show->showToast(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Api::RestrictSponsored(channel, value, failed);
|
||||||
}
|
}
|
||||||
}, button->lifetime());
|
}, button->lifetime());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue