From 69b9d404c082d3c7cf87a53e3cbe32943d964f01 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 22 Nov 2023 05:29:20 +0300 Subject: [PATCH] Added api support of reactions count for recent posts in statistics. --- Telegram/SourceFiles/api/api_statistics.cpp | 8 ++++++-- Telegram/SourceFiles/data/data_statistics.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/api/api_statistics.cpp b/Telegram/SourceFiles/api/api_statistics.cpp index c6eb3d26db..1c0793b2dc 100644 --- a/Telegram/SourceFiles/api/api_statistics.cpp +++ b/Telegram/SourceFiles/api/api_statistics.cpp @@ -67,16 +67,18 @@ constexpr auto kCheckRequestsTimer = 10 * crl::time(1000); data.vrecent_posts_interactions().v ) | ranges::views::transform([&](const Recent &tl) { return tl.match([&](const MTPDpostInteractionCountersStory &data) { - return Data::StatisticsMessageInteractionInfo{ // #TODO - .messageId = data.vstory_id().v, + return Data::StatisticsMessageInteractionInfo{ + .storyId = data.vstory_id().v, .viewsCount = data.vviews().v, .forwardsCount = data.vforwards().v, + .reactionsCount = data.vreactions().v, }; }, [&](const MTPDpostInteractionCountersMessage &data) { return Data::StatisticsMessageInteractionInfo{ .messageId = data.vmsg_id().v, .viewsCount = data.vviews().v, .forwardsCount = data.vforwards().v, + .reactionsCount = data.vreactions().v, }; }); }) | ranges::to_vector; @@ -88,6 +90,8 @@ constexpr auto kCheckRequestsTimer = 10 * crl::time(1000); .memberCount = StatisticalValueFromTL(data.vfollowers()), .meanViewCount = StatisticalValueFromTL(data.vviews_per_post()), .meanShareCount = StatisticalValueFromTL(data.vshares_per_post()), + .meanReactionCount = StatisticalValueFromTL( + data.vreactions_per_post()), .enabledNotificationsPercentage = unmuted, diff --git a/Telegram/SourceFiles/data/data_statistics.h b/Telegram/SourceFiles/data/data_statistics.h index 7eb8f0a4d1..59bc728689 100644 --- a/Telegram/SourceFiles/data/data_statistics.h +++ b/Telegram/SourceFiles/data/data_statistics.h @@ -13,6 +13,7 @@ namespace Data { struct StatisticsMessageInteractionInfo final { MsgId messageId; + StoryId storyId = StoryId(0); int viewsCount = 0; int forwardsCount = 0; int reactionsCount = 0; @@ -56,6 +57,7 @@ struct ChannelStatistics final { StatisticalValue memberCount; StatisticalValue meanViewCount; StatisticalValue meanShareCount; + StatisticalValue meanReactionCount; float64 enabledNotificationsPercentage = 0.;