diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index fef6f1492..ca2fccad8 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -555,6 +555,8 @@ PRIVATE data/data_sparse_ids.h data/data_sponsored_messages.cpp data/data_sponsored_messages.h + data/data_statistics.cpp + data/data_statistics.h data/data_stories.cpp data/data_stories.h data/data_stories_ids.cpp diff --git a/Telegram/SourceFiles/data/data_statistics.cpp b/Telegram/SourceFiles/data/data_statistics.cpp new file mode 100644 index 000000000..604797551 --- /dev/null +++ b/Telegram/SourceFiles/data/data_statistics.cpp @@ -0,0 +1,14 @@ +/* +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 +*/ +#include "data/data_statistics.h" + +namespace Data { +namespace { +} // namespace + +} // namespace Data diff --git a/Telegram/SourceFiles/data/data_statistics.h b/Telegram/SourceFiles/data/data_statistics.h new file mode 100644 index 000000000..dd0c64071 --- /dev/null +++ b/Telegram/SourceFiles/data/data_statistics.h @@ -0,0 +1,107 @@ +/* +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 + +namespace Data { + +struct StatisticsMessageInteractionInfo final { + MsgId messageId; + int viewsCount = 0; + int forwardsCount = 0; +}; + +struct StatisticsMessageSenderInfo final { + UserId userId = UserId(0); + int sentMessageCount = 0; + int averageCharacterCount = 0; +}; + +struct StatisticsAdministratorActionsInfo final { + UserId userId = UserId(0); + int deletedMessageCount = 0; + int bannedUserCount = 0; + int restrictedUserCount = 0; +}; + +struct StatisticsInviterInfo final { + UserId userId = UserId(0); + int addedMemberCount = 0; +}; + +struct StatisticalGraph final { +}; + +struct StatisticalValue final { + float64 value = 0.; + float64 previousValue = 0.; + float64 growthRatePercentage = 0.; +}; + +struct ChannelStatistics final { + [[nodiscard]] bool empty() const { + return !startDate || !endDate; + } + [[nodiscard]] explicit operator bool() const { + return !empty(); + } + + int startDate = 0; + int endDate = 0; + + StatisticalValue memberCount; + StatisticalValue meanViewCount; + StatisticalValue meanShareCount; + + float64 enabledNotificationsPercentage = 0.; + + StatisticalGraph memberCountGraph; + StatisticalGraph joinGraph; + StatisticalGraph muteGraph; + StatisticalGraph viewCountByHourGraph; + StatisticalGraph viewCountBySourceGraph; + StatisticalGraph joinBySourceGraph; + StatisticalGraph languageGraph; + StatisticalGraph messageInteractionGraph; + StatisticalGraph instantViewInteractionGraph; + + std::vector recentMessageInteractions; + +}; + +struct SupergroupStatistics final { + [[nodiscard]] bool empty() const { + return !startDate || !endDate; + } + [[nodiscard]] explicit operator bool() const { + return !empty(); + } + + int startDate = 0; + int endDate = 0; + + StatisticalValue memberCount; + StatisticalValue messageCount; + StatisticalValue viewerCount; + StatisticalValue senderCount; + + StatisticalGraph memberCountGraph; + StatisticalGraph joinGraph; + StatisticalGraph joinBySourceGraph; + StatisticalGraph languageGraph; + StatisticalGraph messageContentGraph; + StatisticalGraph actionGraph; + StatisticalGraph dayGraph; + StatisticalGraph weekGraph; + + std::vector topSenders; + std::vector topAdministrators; + std::vector topInviters; + +}; + +} // namespace Data