From eda1f413edefc8ce966a88470d66863ac2518cb3 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:36:48 +0300 Subject: [PATCH 01/15] Add string resources for emails card --- WordPress/src/main/res/values/strings.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index 2c68bed47170..9e0fb245eddf 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -1025,6 +1025,9 @@ Site timezone (UTC + %s) Site timezone (UTC - %s) File download stats were not recorded before June 28th 2019. + Latest emails + Opens + Clicks -%s @@ -1322,9 +1325,9 @@ Total Likes Total Comments Total Followers + Emails - Subscribers seconds ago a minute ago %1$d minutes @@ -1461,6 +1464,8 @@ File Downloads Totals + Subscribers + Emails Select previous period Select next period From 6a90ff418922eeef3871f151a2324bc1cd8bb78c Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:36:59 +0300 Subject: [PATCH 02/15] Add stats_block_list_header_item.xml --- .../layout/stats_block_list_header_item.xml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 WordPress/src/main/res/layout/stats_block_list_header_item.xml diff --git a/WordPress/src/main/res/layout/stats_block_list_header_item.xml b/WordPress/src/main/res/layout/stats_block_list_header_item.xml new file mode 100644 index 000000000000..8adf4be3499b --- /dev/null +++ b/WordPress/src/main/res/layout/stats_block_list_header_item.xml @@ -0,0 +1,36 @@ + + + + + + + + + From fee5c09d06acc407bff3ddbb7ca3cbf3c0f425ab Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:37:06 +0300 Subject: [PATCH 03/15] Add stats_block_list_item_with_two_values.xml --- .../stats_block_list_item_with_two_values.xml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 WordPress/src/main/res/layout/stats_block_list_item_with_two_values.xml diff --git a/WordPress/src/main/res/layout/stats_block_list_item_with_two_values.xml b/WordPress/src/main/res/layout/stats_block_list_item_with_two_values.xml new file mode 100644 index 000000000000..721d3428cae8 --- /dev/null +++ b/WordPress/src/main/res/layout/stats_block_list_item_with_two_values.xml @@ -0,0 +1,40 @@ + + + + + + + + + From 4eddd10695ee044bf9f97724aa0b2895fc11b0b7 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:38:52 +0300 Subject: [PATCH 04/15] Add ListHeaderViewHolder --- .../ui/stats/refresh/BlockDiffCallback.kt | 2 ++ .../lists/sections/BlockListAdapter.kt | 5 +++++ .../refresh/lists/sections/BlockListItem.kt | 8 ++++++++ .../viewholders/ListHeaderViewHolder.kt | 20 +++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListHeaderViewHolder.kt diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt index e75b3f41934e..90d838eafcf8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt @@ -31,6 +31,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type. import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.INFO import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LINE_CHART import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LINK +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_HEADER import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_ICON import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_IMAGE @@ -79,6 +80,7 @@ class BlockDiffCallback( TEXT, INFO, HEADER, + LIST_HEADER, TITLE, TITLE_WITH_MORE, BIG_TITLE, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListAdapter.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListAdapter.kt index 6dfe06dafc3f..bb045dc206e1 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListAdapter.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListAdapter.kt @@ -22,6 +22,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Image import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Information import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.LineChartItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Link +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListHeader import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemActionCard import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemGuideCard @@ -58,6 +59,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type. import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.INFO import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LINE_CHART import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LINK +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_HEADER import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_ICON import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_IMAGE @@ -99,6 +101,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ImageIt import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.InformationViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.LineChartViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.LinkViewHolder +import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListHeaderViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListItemViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListItemWithIconViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListItemWithImageViewHolder @@ -142,6 +145,7 @@ class BlockListAdapter(val imageManager: ImageManager) : Adapter ListItemWithImageViewHolder(parent, imageManager = imageManager) LIST_ITEM_WITH_ICON -> ListItemWithIconViewHolder(parent, imageManager) LIST_ITEM -> ListItemViewHolder(parent) + LIST_HEADER -> ListHeaderViewHolder(parent) EMPTY -> EmptyViewHolder(parent) TEXT -> TextViewHolder(parent) COLUMNS -> FourColumnsViewHolder(parent) @@ -194,6 +198,7 @@ class BlockListAdapter(val imageManager: ImageManager) : Adapter holder.bind(item as ListItemWithImage) is ListItemWithIconViewHolder -> holder.bind(item as ListItemWithIcon) is ListItemViewHolder -> holder.bind(item as ListItem) + is ListHeaderViewHolder -> holder.bind(item as ListHeader) is TextViewHolder -> holder.bind(item as Text) is FourColumnsViewHolder -> holder.bind(item as Columns, payloads) is ChipsViewHolder -> holder.bind(item as Chips) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt index 0d9852e5965b..98919eaf71c3 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt @@ -25,6 +25,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type. import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.INFO import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LINE_CHART import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LINK +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_HEADER import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_ICON import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_IMAGE @@ -62,6 +63,7 @@ sealed class BlockListItem(val type: Type) { VALUE_ITEM, VALUE_WITH_CHART_ITEM, VALUES_ITEM, + LIST_HEADER, LIST_ITEM, LIST_ITEM_WITH_ICON, LIST_ITEM_WITH_IMAGE, @@ -145,6 +147,12 @@ sealed class BlockListItem(val type: Type) { val contentDescription2: String? = null ) : BlockListItem(VALUES_ITEM) + data class ListHeader( + @StringRes val label: Int, + @StringRes val valueLabel1: Int, + @StringRes val valueLabel2: Int + ) : BlockListItem(LIST_HEADER) + data class ListItem( val text: String, val value: String, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListHeaderViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListHeaderViewHolder.kt new file mode 100644 index 000000000000..c2b010897c6c --- /dev/null +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListHeaderViewHolder.kt @@ -0,0 +1,20 @@ +package org.wordpress.android.ui.stats.refresh.lists.sections.viewholders + +import android.view.ViewGroup +import android.widget.TextView +import org.wordpress.android.R +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListHeader + +class ListHeaderViewHolder(parent: ViewGroup) : BlockListItemViewHolder( + parent, + R.layout.stats_block_list_header_item +) { + private val label = itemView.findViewById(R.id.label) + private val valueLabel1 = itemView.findViewById(R.id.valueLabel1) + private val valueLabel2 = itemView.findViewById(R.id.valueLabel2) + fun bind(item: ListHeader) { + label.setText(item.label) + valueLabel1.setText(item.valueLabel1) + valueLabel2.setText(item.valueLabel2) + } +} From 3d57faa29cf5ee6cf144b3e4afb8e625de14e924 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:39:42 +0300 Subject: [PATCH 05/15] Add ListItemWithTwoValuesViewHolder --- .../ui/stats/refresh/BlockDiffCallback.kt | 2 ++ .../lists/sections/BlockListAdapter.kt | 5 +++++ .../refresh/lists/sections/BlockListItem.kt | 11 ++++++++++ .../ListItemWithTwoValuesViewHolder.kt | 21 +++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemWithTwoValuesViewHolder.kt diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt index 90d838eafcf8..114631192269 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/BlockDiffCallback.kt @@ -35,6 +35,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type. import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_ICON import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_IMAGE +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_TWO_VALUES import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LOADING_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.MAP import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.MAP_LEGEND @@ -75,6 +76,7 @@ class BlockDiffCallback( LINE_CHART, SUBSCRIBERS_CHART, ACTIVITY_ITEM, + LIST_ITEM_WITH_TWO_VALUES, LIST_ITEM -> oldItem.itemId == newItem.itemId LINK, TEXT, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListAdapter.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListAdapter.kt index bb045dc206e1..9cf4bd31a916 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListAdapter.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListAdapter.kt @@ -28,6 +28,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListI import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemGuideCard import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithIcon import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithImage +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithTwoValues import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.LoadingItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.MapItem import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.MapLegend @@ -63,6 +64,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type. import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_ICON import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_IMAGE +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_TWO_VALUES import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LOADING_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.MAP import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.MAP_LEGEND @@ -105,6 +107,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListHea import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListItemViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListItemWithIconViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListItemWithImageViewHolder +import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.ListItemWithTwoValuesViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.LoadingItemViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.MapLegendViewHolder import org.wordpress.android.ui.stats.refresh.lists.sections.viewholders.MapViewHolder @@ -144,6 +147,7 @@ class BlockListAdapter(val imageManager: ImageManager) : Adapter ImageItemViewHolder(parent, imageManager) LIST_ITEM_WITH_IMAGE -> ListItemWithImageViewHolder(parent, imageManager = imageManager) LIST_ITEM_WITH_ICON -> ListItemWithIconViewHolder(parent, imageManager) + LIST_ITEM_WITH_TWO_VALUES -> ListItemWithTwoValuesViewHolder(parent) LIST_ITEM -> ListItemViewHolder(parent) LIST_HEADER -> ListHeaderViewHolder(parent) EMPTY -> EmptyViewHolder(parent) @@ -195,6 +199,7 @@ class BlockListAdapter(val imageManager: ImageManager) : Adapter holder.bind(item as ValueItem) is ValueWithChartViewHolder -> holder.bind(item as ValueWithChartItem) is ValuesViewHolder -> holder.bind(item as ValuesItem) + is ListItemWithTwoValuesViewHolder -> holder.bind(item as ListItemWithTwoValues) is ListItemWithImageViewHolder -> holder.bind(item as ListItemWithImage) is ListItemWithIconViewHolder -> holder.bind(item as ListItemWithIcon) is ListItemViewHolder -> holder.bind(item as ListItem) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt index 98919eaf71c3..d5332fe4c0d7 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/BlockListItem.kt @@ -29,6 +29,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type. import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_ICON import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_IMAGE +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_ITEM_WITH_TWO_VALUES import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LOADING_ITEM import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.MAP import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.MAP_LEGEND @@ -65,6 +66,7 @@ sealed class BlockListItem(val type: Type) { VALUES_ITEM, LIST_HEADER, LIST_ITEM, + LIST_ITEM_WITH_TWO_VALUES, LIST_ITEM_WITH_ICON, LIST_ITEM_WITH_IMAGE, INFO, @@ -163,6 +165,15 @@ sealed class BlockListItem(val type: Type) { get() = text.hashCode() } + data class ListItemWithTwoValues( + val text: String, + val value1: String, + val value2: String + ) : BlockListItem(LIST_ITEM_WITH_TWO_VALUES) { + override val itemId: Int + get() = text.hashCode() + } + data class ListItemWithIcon( @DrawableRes val icon: Int? = null, val iconUrl: String? = null, diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemWithTwoValuesViewHolder.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemWithTwoValuesViewHolder.kt new file mode 100644 index 000000000000..74a32c41a202 --- /dev/null +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ListItemWithTwoValuesViewHolder.kt @@ -0,0 +1,21 @@ +package org.wordpress.android.ui.stats.refresh.lists.sections.viewholders + +import android.view.ViewGroup +import android.widget.TextView +import org.wordpress.android.R +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemWithTwoValues + +class ListItemWithTwoValuesViewHolder(parent: ViewGroup) : BlockListItemViewHolder( + parent, + R.layout.stats_block_list_item_with_two_values +) { + private val text = itemView.findViewById(R.id.text) + private val value1 = itemView.findViewById(R.id.value1) + private val value2 = itemView.findViewById(R.id.value2) + + fun bind(item: ListItemWithTwoValues) { + text.text = item.text + value1.text = item.value1 + value2.text = item.value2 + } +} From b1f0c7d5b64836c44b6ade554df1c28d8013909e Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:40:43 +0300 Subject: [PATCH 06/15] Add EmailsUseCase --- .../android/ui/stats/StatsViewType.kt | 3 +- .../ui/stats/refresh/NavigationTarget.kt | 2 + .../refresh/StatsViewAllViewModelFactory.kt | 7 + .../subscribers/usecases/EmailsUseCase.kt | 129 ++++++++++++++++++ .../ui/stats/refresh/utils/StatsNavigator.kt | 6 + .../android/analytics/AnalyticsTracker.java | 1 + 6 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/subscribers/usecases/EmailsUseCase.kt diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsViewType.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsViewType.kt index eec85b513743..110f6838a1ab 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsViewType.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/StatsViewType.kt @@ -29,5 +29,6 @@ enum class StatsViewType { ANNUAL_STATS, TOTAL_LIKES, TOTAL_COMMENTS, - TOTAL_FOLLOWERS + TOTAL_FOLLOWERS, + EMAILS, } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/NavigationTarget.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/NavigationTarget.kt index 1c93458cbed1..acd6af9f5bce 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/NavigationTarget.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/NavigationTarget.kt @@ -51,6 +51,8 @@ sealed class NavigationTarget { val selectedDate: Date? ) : NavigationTarget() + data object EmailsStats : NavigationTarget() + object SetBloggingReminders : NavigationTarget() object CheckCourse : NavigationTarget() object SchedulePost : NavigationTarget() diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsViewAllViewModelFactory.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsViewAllViewModelFactory.kt index cec09374d5c0..1a460dbae2d8 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsViewAllViewModelFactory.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsViewAllViewModelFactory.kt @@ -15,6 +15,7 @@ import org.wordpress.android.ui.stats.StatsViewType.CLICKS import org.wordpress.android.ui.stats.StatsViewType.DETAIL_AVERAGE_VIEWS_PER_DAY import org.wordpress.android.ui.stats.StatsViewType.DETAIL_MONTHS_AND_YEARS import org.wordpress.android.ui.stats.StatsViewType.DETAIL_RECENT_WEEKS +import org.wordpress.android.ui.stats.StatsViewType.EMAILS import org.wordpress.android.ui.stats.StatsViewType.FILE_DOWNLOADS import org.wordpress.android.ui.stats.StatsViewType.FOLLOWERS import org.wordpress.android.ui.stats.StatsViewType.GEOVIEWS @@ -52,6 +53,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.P import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.TagsAndCategoriesUseCase import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.TodayStatsUseCase import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.ViewsAndVisitorsUseCase +import org.wordpress.android.ui.stats.refresh.lists.sections.subscribers.usecases.EmailsUseCase import org.wordpress.android.ui.stats.refresh.utils.StatsDateSelector import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider import java.security.InvalidParameterException @@ -205,6 +207,11 @@ class StatsViewAllViewModelFactory( insightsUseCases.first { it is PostRecentWeeksUseCase } to R.string.stats_detail_recent_weeks + + EMAILS -> Pair( + insightsUseCases.first { it is EmailsUseCase }, + R.string.stats_view_emails + ) else -> throw InvalidParameterException("Invalid insights stats type: ${type.name}") } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/subscribers/usecases/EmailsUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/subscribers/usecases/EmailsUseCase.kt new file mode 100644 index 000000000000..b3fa42fe21ee --- /dev/null +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/subscribers/usecases/EmailsUseCase.kt @@ -0,0 +1,129 @@ +package org.wordpress.android.ui.stats.refresh.lists.sections.subscribers.usecases + +import kotlinx.coroutines.CoroutineDispatcher +import org.wordpress.android.R +import org.wordpress.android.analytics.AnalyticsTracker +import org.wordpress.android.fluxc.model.stats.LimitMode +import org.wordpress.android.fluxc.model.stats.subscribers.PostsModel +import org.wordpress.android.fluxc.network.rest.wpcom.stats.subscribers.EmailsRestClient.SortField +import org.wordpress.android.fluxc.store.StatsStore.SubscriberType.EMAILS +import org.wordpress.android.fluxc.store.stats.subscribers.EmailsStore +import org.wordpress.android.modules.BG_THREAD +import org.wordpress.android.modules.UI_THREAD +import org.wordpress.android.ui.stats.refresh.NavigationTarget +import org.wordpress.android.ui.stats.refresh.lists.BLOCK_ITEM_COUNT +import org.wordpress.android.ui.stats.refresh.lists.sections.BaseStatsUseCase.StatelessUseCase +import org.wordpress.android.ui.stats.refresh.lists.sections.BaseStatsUseCase.UseCaseMode.VIEW_ALL +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem +import org.wordpress.android.ui.stats.refresh.lists.sections.insights.InsightUseCaseFactory +import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider +import org.wordpress.android.ui.stats.refresh.utils.StatsUtils +import org.wordpress.android.ui.utils.ListItemInteraction +import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper +import javax.inject.Inject +import javax.inject.Named + +class EmailsUseCase @Inject constructor( + @Named(UI_THREAD) private val mainDispatcher: CoroutineDispatcher, + @Named(BG_THREAD) private val bgDispatcher: CoroutineDispatcher, + private val emailsStore: EmailsStore, + private val statsSiteProvider: StatsSiteProvider, + private val statsUtils: StatsUtils, + private val analyticsTracker: AnalyticsTrackerWrapper, + private val useCaseMode: UseCaseMode +) : StatelessUseCase(EMAILS, mainDispatcher, bgDispatcher) { + private val itemsToShow = if (useCaseMode == VIEW_ALL) VIEW_ALL_ITEM_SIZE else BLOCK_ITEM_COUNT + private val sortField = if (useCaseMode == VIEW_ALL) SortField.OPENS else SortField.POST_ID + + override suspend fun fetchRemoteData(forced: Boolean): State { + val response = emailsStore.fetchEmails( + statsSiteProvider.siteModel, + LimitMode.Top(VIEW_ALL_ITEM_SIZE), + sortField, + forced + ) + val model = response.model + val error = response.error + + return when { + error != null -> State.Error(error.message ?: error.type.name) + model != null && model.posts.isNotEmpty() -> State.Data(model) + else -> State.Empty() + } + } + + override suspend fun loadCachedData() = + emailsStore.getEmails(statsSiteProvider.siteModel, LimitMode.Top(VIEW_ALL_ITEM_SIZE), sortField) + + override fun buildLoadingItem() = listOf(BlockListItem.Title(R.string.stats_subscribers_emails)) + + override fun buildEmptyItem() = listOf(buildTitle(), BlockListItem.Empty()) + + override fun buildUiModel(domainModel: PostsModel): List { + val items = mutableListOf() + + if (useCaseMode == UseCaseMode.BLOCK) { + items.add(buildTitle()) + } + + if (domainModel.posts.isEmpty()) { + items.add(BlockListItem.Empty()) + } else { + val header = BlockListItem.ListHeader( + R.string.stats_emails_latest_emails_label, + R.string.stats_emails_opens_label, + R.string.stats_emails_clicks_label + ) + items.add(header) + val postsList = mutableListOf() + domainModel.posts.take(itemsToShow).forEach { post -> postsList.add(mapPost(post)) } + + items.addAll(postsList) + if (useCaseMode == UseCaseMode.BLOCK && domainModel.posts.size > BLOCK_ITEM_COUNT) { + items.add( + BlockListItem.Link( + text = R.string.stats_insights_view_more, + navigateAction = ListItemInteraction.create(this::onLinkClick) + ) + ) + } + } + return items + } + + private fun buildTitle() = BlockListItem.Title(R.string.stats_subscribers_emails) + + private fun mapPost(post: PostsModel.PostModel) = BlockListItem.ListItemWithTwoValues( + text = post.title, + value1 = statsUtils.toFormattedString(post.opens), + value2 = statsUtils.toFormattedString(post.clicks) + ) + + private fun onLinkClick() { + analyticsTracker.track(AnalyticsTracker.Stat.STATS_EMAILS_VIEW_MORE_TAPPED) + navigateTo(NavigationTarget.EmailsStats) + } + + class EmailsUseCaseFactory @Inject constructor( + @Named(UI_THREAD) private val mainDispatcher: CoroutineDispatcher, + @Named(BG_THREAD) private val backgroundDispatcher: CoroutineDispatcher, + private val emailsStore: EmailsStore, + private val statsSiteProvider: StatsSiteProvider, + private val statsUtils: StatsUtils, + private val analyticsTracker: AnalyticsTrackerWrapper + ) : InsightUseCaseFactory { + override fun build(useCaseMode: UseCaseMode) = EmailsUseCase( + mainDispatcher, + backgroundDispatcher, + emailsStore, + statsSiteProvider, + statsUtils, + analyticsTracker, + useCaseMode + ) + } + + companion object { + private const val VIEW_ALL_ITEM_SIZE = 30 + } +} diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/StatsNavigator.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/StatsNavigator.kt index e9777cf54021..26d6d5b63920 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/StatsNavigator.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/utils/StatsNavigator.kt @@ -15,6 +15,7 @@ import org.wordpress.android.ui.stats.StatsViewType.CLICKS import org.wordpress.android.ui.stats.StatsViewType.COMMENTS import org.wordpress.android.ui.stats.StatsViewType.DETAIL_MONTHS_AND_YEARS import org.wordpress.android.ui.stats.StatsViewType.DETAIL_RECENT_WEEKS +import org.wordpress.android.ui.stats.StatsViewType.EMAILS import org.wordpress.android.ui.stats.StatsViewType.FILE_DOWNLOADS import org.wordpress.android.ui.stats.StatsViewType.FOLLOWERS import org.wordpress.android.ui.stats.StatsViewType.GEOVIEWS @@ -215,6 +216,11 @@ class StatsNavigator @Inject constructor( ) } + is NavigationTarget.EmailsStats -> ActivityLauncher.viewAllInsightsStats( + activity, + EMAILS, + siteProvider.siteModel.id + ) is NavigationTarget.SetBloggingReminders -> { ActivityLauncher.showSetBloggingReminders(activity, siteProvider.siteModel) } diff --git a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java index ba0555b62d66..6fd192bd0615 100644 --- a/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java +++ b/libs/analytics/src/main/java/org/wordpress/android/analytics/AnalyticsTracker.java @@ -131,6 +131,7 @@ public enum Stat { STATS_POSTS_AND_PAGES_VIEW_MORE_TAPPED, STATS_POSTS_AND_PAGES_ITEM_TAPPED, STATS_REFERRERS_VIEW_MORE_TAPPED, + STATS_EMAILS_VIEW_MORE_TAPPED, STATS_REFERRERS_ITEM_TAPPED, STATS_REFERRERS_ITEM_LONG_PRESSED, STATS_REFERRERS_ITEM_MARKED_AS_SPAM, From daf80ad50623606757b973e9408105e5eabe016b Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:41:14 +0300 Subject: [PATCH 07/15] Add email card to the Subscribers tab --- .../org/wordpress/android/ui/stats/refresh/StatsModule.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt index bfe9f5a57d69..b56f7eb2e515 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt @@ -62,6 +62,7 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.T import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.TotalFollowersUseCase.TotalFollowersUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.TotalLikesUseCase.TotalLikesUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases.ViewsAndVisitorsUseCase.ViewsAndVisitorsUseCaseFactory +import org.wordpress.android.ui.stats.refresh.lists.sections.subscribers.usecases.EmailsUseCase.EmailsUseCaseFactory import org.wordpress.android.ui.stats.refresh.lists.sections.subscribers.usecases.SubscribersUseCase import org.wordpress.android.ui.stats.refresh.utils.SelectedTrafficGranularityManager import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider @@ -255,8 +256,10 @@ class StatsModule { @Named(BLOCK_SUBSCRIBERS_USE_CASES) @Suppress("LongParameterList") fun provideBlockSubscribersUseCases( - subscribersUseCase: SubscribersUseCase - ): List<@JvmSuppressWildcards BaseStatsUseCase<*, *>> = listOf(subscribersUseCase) + subscribersUseCase: SubscribersUseCase, + emailsUseCaseFactory: EmailsUseCaseFactory + ): List<@JvmSuppressWildcards BaseStatsUseCase<*, *>> = + listOf(subscribersUseCase, emailsUseCaseFactory.build(BLOCK)) /** * Provides a singleton usecase that represents the Insights screen. It consists of list of use cases that build From 38674a316d61b0f1a1bb7bc9641fe3bd68cae2dc Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:42:38 +0300 Subject: [PATCH 08/15] Add Emails detail screen to VIEW_ALL_INSIGHTS_USE_CASES --- .../org/wordpress/android/ui/stats/refresh/StatsModule.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt index b56f7eb2e515..eac5fb7e3a3f 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/StatsModule.kt @@ -179,7 +179,8 @@ class StatsModule { postMonthsAndYearsUseCaseFactory: PostMonthsAndYearsUseCaseFactory, postAverageViewsPerDayUseCaseFactory: PostAverageViewsPerDayUseCaseFactory, postRecentWeeksUseCaseFactory: PostRecentWeeksUseCaseFactory, - annualSiteStatsUseCaseFactory: AnnualSiteStatsUseCaseFactory + annualSiteStatsUseCaseFactory: AnnualSiteStatsUseCaseFactory, + emailsUseCaseFactory: EmailsUseCaseFactory ): List<@JvmSuppressWildcards BaseStatsUseCase<*, *>> { return listOf( followersUseCaseFactory.build(VIEW_ALL), @@ -188,7 +189,8 @@ class StatsModule { postMonthsAndYearsUseCaseFactory.build(VIEW_ALL), postAverageViewsPerDayUseCaseFactory.build(VIEW_ALL), postRecentWeeksUseCaseFactory.build(VIEW_ALL), - annualSiteStatsUseCaseFactory.build(VIEW_ALL) + annualSiteStatsUseCaseFactory.build(VIEW_ALL), + emailsUseCaseFactory.build(VIEW_ALL) ) } From df4333c650037d57170be2a4973ccb27fcb59108 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:42:49 +0300 Subject: [PATCH 09/15] Add EmailsUseCaseTest --- .../insights/usecases/EmailsUseCaseTest.kt | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/EmailsUseCaseTest.kt diff --git a/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/EmailsUseCaseTest.kt b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/EmailsUseCaseTest.kt new file mode 100644 index 000000000000..6242e4c87e6f --- /dev/null +++ b/WordPress/src/test/java/org/wordpress/android/ui/stats/refresh/lists/sections/insights/usecases/EmailsUseCaseTest.kt @@ -0,0 +1,145 @@ +package org.wordpress.android.ui.stats.refresh.lists.sections.insights.usecases + +import kotlinx.coroutines.ExperimentalCoroutinesApi +import org.assertj.core.api.Assertions.assertThat +import org.junit.Before +import org.junit.Test +import org.mockito.Mock +import org.mockito.kotlin.any +import org.mockito.kotlin.whenever +import org.wordpress.android.BaseUnitTest +import org.wordpress.android.R +import org.wordpress.android.fluxc.model.SiteModel +import org.wordpress.android.fluxc.model.stats.LimitMode +import org.wordpress.android.fluxc.model.stats.subscribers.PostsModel +import org.wordpress.android.fluxc.network.rest.wpcom.stats.subscribers.EmailsRestClient.SortField +import org.wordpress.android.fluxc.store.StatsStore.OnStatsFetched +import org.wordpress.android.fluxc.store.StatsStore.StatsError +import org.wordpress.android.fluxc.store.StatsStore.StatsErrorType.GENERIC_ERROR +import org.wordpress.android.fluxc.store.stats.subscribers.EmailsStore +import org.wordpress.android.ui.stats.refresh.lists.sections.BaseStatsUseCase.UseCaseMode.BLOCK +import org.wordpress.android.ui.stats.refresh.lists.sections.BaseStatsUseCase.UseCaseModel +import org.wordpress.android.ui.stats.refresh.lists.sections.BaseStatsUseCase.UseCaseModel.UseCaseState +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListHeader +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Title +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.LIST_HEADER +import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.Type.TITLE +import org.wordpress.android.ui.stats.refresh.lists.sections.subscribers.usecases.EmailsUseCase +import org.wordpress.android.ui.stats.refresh.utils.StatsSiteProvider +import org.wordpress.android.ui.stats.refresh.utils.StatsUtils +import org.wordpress.android.util.analytics.AnalyticsTrackerWrapper + +@ExperimentalCoroutinesApi +class EmailsUseCaseTest : BaseUnitTest() { + @Mock + lateinit var emailsStore: EmailsStore + + @Mock + lateinit var statsSiteProvider: StatsSiteProvider + + @Mock + lateinit var statsUtils: StatsUtils + + @Mock + lateinit var site: SiteModel + + @Mock + lateinit var tracker: AnalyticsTrackerWrapper + + private lateinit var useCase: EmailsUseCase + private val itemsToLoad = 30 + private val firstPost = PostsModel.PostModel(1, "post1", "url.com", 10, 20) + private val secondPost = PostsModel.PostModel(2, "post2", "url2.com", 30, 40) + + @Before + fun setUp() { + useCase = EmailsUseCase( + testDispatcher(), + testDispatcher(), + emailsStore, + statsSiteProvider, + statsUtils, + tracker, + BLOCK + ) + whenever(statsSiteProvider.siteModel).thenReturn(site) + whenever(statsUtils.toFormattedString(any(), any())).then { (it.arguments[0] as Int).toString() } + } + + @Test + fun `maps emails summary to UI model`() = test { + val forced = false + val model = PostsModel(listOf(firstPost, secondPost)) + whenever(emailsStore.getEmails(site, LimitMode.Top(itemsToLoad), SortField.POST_ID)).thenReturn(model) + whenever(emailsStore.fetchEmails(site, LimitMode.Top(itemsToLoad), SortField.POST_ID, forced)) + .thenReturn(OnStatsFetched(model)) + + val result = loadPosts(true, forced) + + assertThat(result.state).isEqualTo(UseCaseState.SUCCESS) + result.data!!.apply { + assertThat(this).hasSize(4) + assertTitle(this[0]) + assertListHeader(this[1]) + assertListItem(this[2], firstPost.title, firstPost.opens, firstPost.clicks) + assertListItem(this[3], secondPost.title, secondPost.opens, secondPost.clicks) + } + } + + @Test + fun `maps empty posts to UI model`() = test { + val forced = false + whenever(emailsStore.fetchEmails(site, LimitMode.Top(itemsToLoad), SortField.POST_ID, forced)).thenReturn( + OnStatsFetched(PostsModel(listOf())) + ) + + val result = loadPosts(true, forced) + + assertThat(result.state).isEqualTo(UseCaseState.EMPTY) + result.stateData!!.apply { + assertThat(this).hasSize(2) + assertTitle(this[0]) + } + } + + @Test + fun `maps error item to UI model`() = test { + val forced = false + val message = "Generic error" + whenever(emailsStore.fetchEmails(site, LimitMode.Top(itemsToLoad), SortField.POST_ID, forced)) + .thenReturn(OnStatsFetched(StatsError(GENERIC_ERROR, message))) + + val result = loadPosts(true, forced) + + assertThat(result.state).isEqualTo(UseCaseState.ERROR) + } + + private fun assertTitle(item: BlockListItem) { + assertThat(item.type).isEqualTo(TITLE) + assertThat((item as Title).textResource).isEqualTo(R.string.stats_subscribers_emails) + } + + private fun assertListHeader(item: BlockListItem) { + assertThat(item.type).isEqualTo(LIST_HEADER) + assertThat((item as ListHeader).label).isEqualTo(R.string.stats_emails_latest_emails_label) + assertThat(item.valueLabel1).isEqualTo(R.string.stats_emails_opens_label) + assertThat(item.valueLabel2).isEqualTo(R.string.stats_emails_clicks_label) + } + + private fun assertListItem(blockListItem: BlockListItem, text: String, value1: Int, value2: Int) { + assertThat(blockListItem.type).isEqualTo(BlockListItem.Type.LIST_ITEM_WITH_TWO_VALUES) + val item = blockListItem as BlockListItem.ListItemWithTwoValues + assertThat(item.text).isEqualTo(text) + assertThat(item.value1).isEqualTo(value1.toString()) + assertThat(item.value2).isEqualTo(value2.toString()) + } + + private suspend fun loadPosts(refresh: Boolean, forced: Boolean): UseCaseModel { + var result: UseCaseModel? = null + useCase.liveData.observeForever { result = it } + useCase.fetch(refresh, forced) + advanceUntilIdle() + return checkNotNull(result) + } +} From d0914bd43147d8d6a370279e194ca383b95f4b8d Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 17:43:04 +0300 Subject: [PATCH 10/15] Update FluxC reference to the PR --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 948f6471f096..206fd07e5cf0 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '4.0.2' gutenbergMobileVersion = 'v1.118.0' wordPressAztecVersion = 'v2.1.2' - wordPressFluxCVersion = 'trunk-c237f715b11e3005c841c43b94623d7ef92720a0' + wordPressFluxCVersion = '2996-0758f03bdaf36978621216e6f284f67bcca9ab32' wordPressLoginVersion = '1.15.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.14.0' From e16ec9f8fc5add3753757cb3c0475e76c81aee95 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 19:15:49 +0300 Subject: [PATCH 11/15] Correct mock subscribers endpoint --- .../assets/mocks/mappings/wpcom/stats/stats_subscribers.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/mocks/src/main/assets/mocks/mappings/wpcom/stats/stats_subscribers.json b/libs/mocks/src/main/assets/mocks/mappings/wpcom/stats/stats_subscribers.json index b5e7642b6502..090a7c26a3d5 100644 --- a/libs/mocks/src/main/assets/mocks/mappings/wpcom/stats/stats_subscribers.json +++ b/libs/mocks/src/main/assets/mocks/mappings/wpcom/stats/stats_subscribers.json @@ -1,7 +1,7 @@ { "request": { "method": "GET", - "urlPattern": "/rest/v1.1/sites/.*/subscribers/.*" + "urlPattern": "/rest/v1.1/sites/.*/stats/subscribers/.*" }, "response": { "status": 200, From 77d09756e775c7b9f6f171393a057852fd8ac8ce Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Mon, 29 Apr 2024 19:16:05 +0300 Subject: [PATCH 12/15] Add mock emails/summary endpoint --- .../wpcom/stats/stats_emails_summary.json | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 libs/mocks/src/main/assets/mocks/mappings/wpcom/stats/stats_emails_summary.json diff --git a/libs/mocks/src/main/assets/mocks/mappings/wpcom/stats/stats_emails_summary.json b/libs/mocks/src/main/assets/mocks/mappings/wpcom/stats/stats_emails_summary.json new file mode 100644 index 000000000000..c35e48fb3593 --- /dev/null +++ b/libs/mocks/src/main/assets/mocks/mappings/wpcom/stats/stats_emails_summary.json @@ -0,0 +1,31 @@ +{ + "request": { + "method": "GET", + "urlPattern": "/rest/v1.1/sites/.*/stats/emails/summary/.*" + }, + "response": { + "status": 200, + "jsonBody": { + "posts": [ + { + "id": 1, + "href": "http://url1", + "date": "2024-04-29 12:00:00", + "title": "title1", + "type": "post", + "opens": 10, + "clicks": 20 + }, + { + "id": 2, + "href": "http://url2", + "date": "2024-04-28 12:00:00", + "title": "title2", + "type": "post", + "opens": 30, + "clicks": 40 + } + ] + } + } +} From 6eb7290c5e2d1982ec6d6f8fd64db7e2889a510e Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Tue, 30 Apr 2024 14:17:47 +0300 Subject: [PATCH 13/15] Update FluxC reference to trunk --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 206fd07e5cf0..6efa6e281360 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '4.0.2' gutenbergMobileVersion = 'v1.118.0' wordPressAztecVersion = 'v2.1.2' - wordPressFluxCVersion = '2996-0758f03bdaf36978621216e6f284f67bcca9ab32' + wordPressFluxCVersion = 'trunk-dddc5b3c4a6ca9de33eb29a929247eebf9dc8de1' wordPressLoginVersion = '1.15.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.14.0' From 77ddb54832853f948a3d85232bd035a71e58ed59 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Wed, 1 May 2024 12:59:42 +0300 Subject: [PATCH 14/15] Update FluxC reference to trunk --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 34e8540d528b..f467c0ec6e9a 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '4.0.2' gutenbergMobileVersion = 'v1.118.0' wordPressAztecVersion = 'v2.1.2' - wordPressFluxCVersion = '2.77.1' + wordPressFluxCVersion = 'trunk-b57bd0adcc3a0bda801359e904d54650dd3d9f9b' wordPressLoginVersion = '1.15.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.14.0' From 63dbc3eedc53be128168b2ce465a5a9afe829d7c Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Wed, 1 May 2024 13:36:22 +0300 Subject: [PATCH 15/15] Update FluxC reference to the trunk --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index f467c0ec6e9a..f8b5b4fe1e8a 100644 --- a/build.gradle +++ b/build.gradle @@ -25,7 +25,7 @@ ext { automatticTracksVersion = '4.0.2' gutenbergMobileVersion = 'v1.118.0' wordPressAztecVersion = 'v2.1.2' - wordPressFluxCVersion = 'trunk-b57bd0adcc3a0bda801359e904d54650dd3d9f9b' + wordPressFluxCVersion = 'trunk-fdf3a127a8dedf50bc1ac7f41ee1a6c1df2bb6a1' wordPressLoginVersion = '1.15.0' wordPressPersistentEditTextVersion = '1.0.2' wordPressUtilsVersion = '3.14.0'