diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt index 28c504ac55b..4fe88f817f7 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/analytics/AnalyticsEvent.kt @@ -167,10 +167,7 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv DASHBOARD_SHARE_YOUR_STORE_BUTTON_TAPPED, DASHBOARD_MAIN_STATS_DATE, DASHBOARD_MAIN_STATS_LOADED, - DASHBOARD_TOP_PERFORMERS_DATE, DASHBOARD_TOP_PERFORMERS_LOADED, - DASHBOARD_NEW_STATS_REVERTED_BANNER_DISMISS_TAPPED, - DASHBOARD_NEW_STATS_REVERTED_BANNER_LEARN_MORE_TAPPED, DASHBOARD_WAITING_TIME_LOADED, DASHBOARD_SEE_MORE_ANALYTICS_TAPPED, DASHBOARD_STORE_TIMEZONE_DIFFER_FROM_DEVICE, @@ -178,7 +175,6 @@ enum class AnalyticsEvent(override val siteless: Boolean = false) : IAnalyticsEv STATS_UNEXPECTED_FORMAT, DASHBOARD_STATS_CUSTOM_RANGE_ADD_BUTTON_TAPPED, DASHBOARD_STATS_CUSTOM_RANGE_CONFIRMED, - DASHBOARD_STATS_CUSTOM_RANGE_TAB_SELECTED, DASHBOARD_STATS_CUSTOM_RANGE_EDIT_BUTTON_TAPPED, DASHBOARD_STATS_CUSTOM_RANGE_INTERACTED, DYNAMIC_DASHBOARD_EDIT_LAYOUT_BUTTON_TAPPED, diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsCard.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsCard.kt index 244c14dc219..561247c2419 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsCard.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsCard.kt @@ -98,7 +98,7 @@ fun DashboardStatsCard( currencyFormatter = viewModel.currencyFormatter, usageTracksEventEmitter = viewModel.usageTracksEventEmitter, onAddCustomRangeClick = viewModel::onAddCustomRangeClicked, - onTabSelected = viewModel::onTabSelected, + onTabSelected = viewModel::onRangeChanged, onChartDateSelected = viewModel::onChartDateSelected ) } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsViewModel.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsViewModel.kt index 6e9a3c5f111..e1cbe2a4f25 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsViewModel.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsViewModel.kt @@ -123,7 +123,7 @@ class DashboardStatsViewModel @AssistedInject constructor( trackLocalTimezoneDifferenceFromStore() } - fun onTabSelected(selectionType: SelectionType) { + fun onRangeChanged(selectionType: SelectionType) { parentViewModel.trackCardInteracted(DashboardWidget.Type.STATS.trackingIdentifier) usageTracksEventEmitter.interacted() if (selectionType != SelectionType.CUSTOM) { @@ -134,7 +134,7 @@ class DashboardStatsViewModel @AssistedInject constructor( } else { appPrefsWrapper.setActiveStatsTab(SelectionType.CUSTOM.name) analyticsTrackerWrapper.track( - AnalyticsEvent.DASHBOARD_STATS_CUSTOM_RANGE_TAB_SELECTED + AnalyticsEvent.DASHBOARD_STATS_CUSTOM_RANGE_ADD_BUTTON_TAPPED ) } } @@ -151,7 +151,7 @@ class DashboardStatsViewModel @AssistedInject constructor( viewModelScope.launch { customDateRangeDataStore.updateDateRange(range) if (dateRangeState.value?.rangeSelection?.selectionType != SelectionType.CUSTOM) { - onTabSelected(SelectionType.CUSTOM) + onRangeChanged(SelectionType.CUSTOM) } } } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/topperformers/DashboardTopPerformersViewModel.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/topperformers/DashboardTopPerformersViewModel.kt index 5bbafb6b035..f279156a4fb 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/topperformers/DashboardTopPerformersViewModel.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/topperformers/DashboardTopPerformersViewModel.kt @@ -140,7 +140,7 @@ class DashboardTopPerformersViewModel @AssistedInject constructor( } } - fun onTabSelected(selectionType: SelectionType) { + fun onRangeChanged(selectionType: SelectionType) { parentViewModel.trackCardInteracted(DashboardWidget.Type.POPULAR_PRODUCTS.trackingIdentifier) usageTracksEventEmitter.interacted() if (selectionType != SelectionType.CUSTOM) { @@ -150,7 +150,7 @@ class DashboardTopPerformersViewModel @AssistedInject constructor( onEditCustomRangeTapped() } else { appPrefsWrapper.setActiveTopPerformersTab(SelectionType.CUSTOM.name) - analyticsTrackerWrapper.track(AnalyticsEvent.DASHBOARD_STATS_CUSTOM_RANGE_TAB_SELECTED) + analyticsTrackerWrapper.track(AnalyticsEvent.DASHBOARD_STATS_CUSTOM_RANGE_ADD_BUTTON_TAPPED) } } } @@ -287,7 +287,7 @@ class DashboardTopPerformersViewModel @AssistedInject constructor( viewModelScope.launch { customDateRangeDataStore.updateDateRange(statsTimeRange) if (selectedDateRange.value?.rangeSelection?.selectionType != SelectionType.CUSTOM) { - onTabSelected(SelectionType.CUSTOM) + onRangeChanged(SelectionType.CUSTOM) } } } diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/topperformers/DashboardTopPerformersWidgetCard.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/topperformers/DashboardTopPerformersWidgetCard.kt index 9a06d8d7352..1b3a2e9ed90 100644 --- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/topperformers/DashboardTopPerformersWidgetCard.kt +++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/topperformers/DashboardTopPerformersWidgetCard.kt @@ -95,7 +95,7 @@ fun DashboardTopPerformersWidgetCard( topPerformersState = topPerformersState, selectedDateRange = selectedDateRange, lastUpdateState = lastUpdateState, - onTabSelected = topPerformersViewModel::onTabSelected, + onTabSelected = topPerformersViewModel::onRangeChanged, onEditCustomRangeTapped = topPerformersViewModel::onEditCustomRangeTapped ) } diff --git a/WooCommerce/src/test/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsViewModelTest.kt b/WooCommerce/src/test/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsViewModelTest.kt index 6495032b0f4..27d868d8046 100644 --- a/WooCommerce/src/test/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsViewModelTest.kt +++ b/WooCommerce/src/test/kotlin/com/woocommerce/android/ui/dashboard/stats/DashboardStatsViewModelTest.kt @@ -141,7 +141,7 @@ class DashboardStatsViewModelTest : BaseUnitTest() { whenever(networkStatus.isConnected()).thenReturn(false) } - viewModel.onTabSelected(ANY_SELECTION_TYPE) + viewModel.onRangeChanged(ANY_SELECTION_TYPE) verify(getStats, never()).invoke(any(), any()) } @@ -155,7 +155,7 @@ class DashboardStatsViewModelTest : BaseUnitTest() { .thenReturn(ANY_SELECTION_TYPE.name) } - viewModel.onTabSelected(ANY_SELECTION_TYPE) + viewModel.onRangeChanged(ANY_SELECTION_TYPE) verify(getStats, times(2)).invoke( refresh = ArgumentMatchers.eq(false), @@ -196,7 +196,7 @@ class DashboardStatsViewModelTest : BaseUnitTest() { .thenReturn(ANY_SELECTION_TYPE.name) } - viewModel.onTabSelected(ANY_SELECTION_TYPE) + viewModel.onRangeChanged(ANY_SELECTION_TYPE) Assertions.assertThat(viewModel.revenueStatsState.value) .isInstanceOf(DashboardStatsViewModel.RevenueStatsViewState.Content::class.java) @@ -209,7 +209,7 @@ class DashboardStatsViewModelTest : BaseUnitTest() { testBlocking { setup() - viewModel.onTabSelected(ANY_SELECTION_TYPE) + viewModel.onRangeChanged(ANY_SELECTION_TYPE) verify(appPrefsWrapper).setActiveStatsTab(ANY_SELECTION_TYPE.name) } @@ -286,7 +286,7 @@ class DashboardStatsViewModelTest : BaseUnitTest() { val state = viewModel.dateRangeState.runAndCaptureValues { viewModel.onChartDateSelected("11") - viewModel.onTabSelected(ANY_SELECTION_TYPE) + viewModel.onRangeChanged(ANY_SELECTION_TYPE) }.last() verify(dateRangeFormatter, never())