Added api support of reactions count for recent posts in statistics.

This commit is contained in:
23rd 2023-11-22 05:29:20 +03:00 committed by John Preston
parent 0865776d9a
commit 69b9d404c0
2 changed files with 8 additions and 2 deletions

View file

@ -67,16 +67,18 @@ constexpr auto kCheckRequestsTimer = 10 * crl::time(1000);
data.vrecent_posts_interactions().v data.vrecent_posts_interactions().v
) | ranges::views::transform([&](const Recent &tl) { ) | ranges::views::transform([&](const Recent &tl) {
return tl.match([&](const MTPDpostInteractionCountersStory &data) { return tl.match([&](const MTPDpostInteractionCountersStory &data) {
return Data::StatisticsMessageInteractionInfo{ // #TODO return Data::StatisticsMessageInteractionInfo{
.messageId = data.vstory_id().v, .storyId = data.vstory_id().v,
.viewsCount = data.vviews().v, .viewsCount = data.vviews().v,
.forwardsCount = data.vforwards().v, .forwardsCount = data.vforwards().v,
.reactionsCount = data.vreactions().v,
}; };
}, [&](const MTPDpostInteractionCountersMessage &data) { }, [&](const MTPDpostInteractionCountersMessage &data) {
return Data::StatisticsMessageInteractionInfo{ return Data::StatisticsMessageInteractionInfo{
.messageId = data.vmsg_id().v, .messageId = data.vmsg_id().v,
.viewsCount = data.vviews().v, .viewsCount = data.vviews().v,
.forwardsCount = data.vforwards().v, .forwardsCount = data.vforwards().v,
.reactionsCount = data.vreactions().v,
}; };
}); });
}) | ranges::to_vector; }) | ranges::to_vector;
@ -88,6 +90,8 @@ constexpr auto kCheckRequestsTimer = 10 * crl::time(1000);
.memberCount = StatisticalValueFromTL(data.vfollowers()), .memberCount = StatisticalValueFromTL(data.vfollowers()),
.meanViewCount = StatisticalValueFromTL(data.vviews_per_post()), .meanViewCount = StatisticalValueFromTL(data.vviews_per_post()),
.meanShareCount = StatisticalValueFromTL(data.vshares_per_post()), .meanShareCount = StatisticalValueFromTL(data.vshares_per_post()),
.meanReactionCount = StatisticalValueFromTL(
data.vreactions_per_post()),
.enabledNotificationsPercentage = unmuted, .enabledNotificationsPercentage = unmuted,

View file

@ -13,6 +13,7 @@ namespace Data {
struct StatisticsMessageInteractionInfo final { struct StatisticsMessageInteractionInfo final {
MsgId messageId; MsgId messageId;
StoryId storyId = StoryId(0);
int viewsCount = 0; int viewsCount = 0;
int forwardsCount = 0; int forwardsCount = 0;
int reactionsCount = 0; int reactionsCount = 0;
@ -56,6 +57,7 @@ struct ChannelStatistics final {
StatisticalValue memberCount; StatisticalValue memberCount;
StatisticalValue meanViewCount; StatisticalValue meanViewCount;
StatisticalValue meanShareCount; StatisticalValue meanShareCount;
StatisticalValue meanReactionCount;
float64 enabledNotificationsPercentage = 0.; float64 enabledNotificationsPercentage = 0.;