From 30d5accd3ecf6fe28e325fd9bb1d15a3ac482d79 Mon Sep 17 00:00:00 2001 From: Danilo Ercoli Date: Tue, 20 Feb 2024 16:59:13 +0100 Subject: [PATCH] Track analytics about the number of total sites followed --- .../java/org/wordpress/android/ui/reader/ReaderEvents.java | 7 +++++++ .../android/ui/reader/ReaderPostListFragment.java | 4 +--- .../ui/reader/services/update/ReaderUpdateLogic.java | 3 ++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderEvents.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderEvents.java index e107db26f932..c60f0b38ee83 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderEvents.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderEvents.java @@ -51,6 +51,13 @@ public String getTagName() { } public static class FollowedBlogsChanged { + private final int mTotalSubscriptions; + public int getTotalSubscriptions() { + return mTotalSubscriptions; + } + public FollowedBlogsChanged(int totalSubscriptions) { + mTotalSubscriptions = totalSubscriptions; + } } public static class InterestTagsFetchEnded { diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java index 612c07b5dc1e..99068b03c079 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostListFragment.java @@ -967,9 +967,7 @@ && hasCurrentTag() refreshPosts(); } - ReaderBlogTable.getFollowedBlogs(); - ReaderTracker.trackFollowedTagsCount(ReaderTagTable.getFollowedTags().size()); - AppPrefs.setReaderAnalyticsCountTagsTimestamp(now); + ReaderTracker.trackFollowedSitesCount(event.getTotalSubscriptions()); } @Override diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/services/update/ReaderUpdateLogic.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/services/update/ReaderUpdateLogic.java index cde09194380f..769365baaddf 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/services/update/ReaderUpdateLogic.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/services/update/ReaderUpdateLogic.java @@ -338,9 +338,10 @@ public void run() { // changed if the server list doesn't have the same blogs as the local list // (ie: a blog has been followed/unfollowed since local was last updated) if (!localBlogs.hasSameBlogs(serverBlogs)) { + final int totalSites = jsonObject == null ? 0 : jsonObject.optInt("total_subscriptions", 0); ReaderPostTable.updateFollowedStatus(); AppLog.i(AppLog.T.READER, "reader blogs service > followed blogs changed"); - EventBus.getDefault().post(new ReaderEvents.FollowedBlogsChanged()); + EventBus.getDefault().post(new ReaderEvents.FollowedBlogsChanged(totalSites)); } }