Added initial structure for bot earn data.

This commit is contained in:
23rd 2024-06-19 05:05:46 +03:00 committed by John Preston
parent 71893f4ef7
commit c5ba0fa705
4 changed files with 36 additions and 4 deletions

View file

@ -0,0 +1,31 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_statistics_chart.h"
#include <QtCore/QDateTime>
namespace Data {
using BotEarnInt = uint64;
struct BotEarnStatistics final {
explicit operator bool() const {
return !!usdRate;
}
Data::StatisticalGraph revenueGraph;
BotEarnInt currentBalance = 0;
BotEarnInt availableBalance = 0;
BotEarnInt overallRevenue = 0;
float64 usdRate = 0.;
bool isWithdrawalEnabled = false;
QDateTime nextWithdrawalAt;
};
} // namespace Data

View file

@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_channel_earn.h"
#include "data/data_bot_earn.h"
#include "ui/widgets/scroll_area.h"
#include "ui/wrap/vertical_layout.h"
@ -56,7 +56,7 @@ private:
not_null<PeerData*> _peer;
std::shared_ptr<Ui::Show> _show;
Data::EarnStatistics _state;
Data::BotEarnStatistics _state;
rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
rpl::event_stream<ShowRequest> _showRequests;

View file

@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "data/data_channel_earn.h"
#include "data/data_bot_earn.h"
#include "info/info_content_widget.h"
namespace Info::BotEarn {
@ -27,7 +27,7 @@ public:
Section section() const override;
using SavedState = Data::EarnStatistics;
using SavedState = Data::BotEarnStatistics;
void setState(SavedState states);
[[nodiscard]] SavedState state();

View file

@ -80,6 +80,7 @@ PRIVATE
data/data_birthday.cpp
data/data_birthday.h
data/data_bot_earn.h
data/data_channel_earn.h
data/data_credits.h
data/data_statistics_chart.cpp