Limited list of data for non-owners of channel in earn section.

This commit is contained in:
23rd 2024-03-31 17:23:03 +03:00 committed by John Preston
parent 4db885d8b4
commit 04acf08d34
2 changed files with 13 additions and 3 deletions

View file

@ -4985,7 +4985,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_channel_earn_balance_password_title" = "Two-step verification";
"lng_channel_earn_balance_password_description" = "Please enter your password to withdraw.";
"lng_channel_earn_balance_about" = "Collect your reward using Fragment, a third-party platform used by the advertiser to pay for the ad. {link}";
"lng_channel_earn_balance_about_temp" = "By the end of May, you will be able to collect your reward using Fragment, a third-party platform used by the advertiser to pay for the ad. {link}";
"lng_channel_earn_balance_about_temp" = "In the coming weeks you will be able to collect your reward using Fragment, a third-party platform used by advertisers to pay ads. {link}";
"lng_channel_earn_transfer_sure_about1" = "Check the address of the recipient:";
"lng_channel_earn_transfer_sure_about2" = "This action can not be undone. If the address above is incorrect you will lose your TON.";
"lng_channel_earn_history_title" = "Transaction history";
@ -5013,7 +5013,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_channel_earn_learn_out_subtitle" = "Flexible withdrawals";
"lng_channel_earn_learn_out_about" = "You can withdraw your TON any time.";
"lng_channel_earn_learn_coin_title" = "What is {emoji} TON?";
"lng_channel_earn_learn_coin_about" = "TON is a blockchain platform and cryptocurrency that Telegram uses for its record scalability and ultra low commissions on transactions. {link}";
"lng_channel_earn_learn_coin_about" = "TON is a blockchain platform and cryptocurrency that Telegram uses for its high speed and low commissions on transactions. {link}";
"lng_channel_earn_learn_close" = "Got it";
"lng_channel_earn_chart_top_hours" = "Ad impressions";
"lng_channel_earn_chart_revenue" = "Ad revenue";

View file

@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_earn.h"
#include "api/api_statistics.h"
#include "base/unixtime.h"
#include "boxes/peers/edit_peer_color_box.h" // AddLevelBadge.
#include "chat_helpers/stickers_emoji_pack.h"
#include "core/ui_integration.h" // Core::MarkedTextContext.
@ -203,9 +204,13 @@ void InnerWidget::fill() {
const auto currency = u"TON"_q;
const auto multiplier = data.usdRate;
constexpr auto kNonInteractivePeriod = 1717200000;
const auto nonInteractive = base::unixtime::now() < kNonInteractivePeriod;
const auto session = &_peer->session();
const auto channel = _peer->asChannel();
const auto withdrawalEnabled = WithdrawalEnabled(session);
const auto withdrawalEnabled = WithdrawalEnabled(session)
&& !nonInteractive;
const auto makeContext = [=](not_null<Ui::FlatLabel*> l) {
return Core::MarkedTextContext{
.session = session,
@ -506,6 +511,11 @@ void InnerWidget::fill() {
addOverview(data.overallRevenue, tr::lng_channel_earn_total);
Ui::AddSkip(container);
}
if (!channel->amCreator()) {
Ui::AddSkip(container);
Ui::AddSkip(container);
return;
}
Ui::AddSkip(container);
Ui::AddDivider(container);
Ui::AddSkip(container);