diff --git a/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/StatsComponent.kt b/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/StatsComponent.kt
index d7a302085a1..234ab82a149 100644
--- a/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/StatsComponent.kt
+++ b/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/StatsComponent.kt
@@ -6,7 +6,7 @@ import com.woocommerce.android.R
import com.woocommerce.android.e2e.helpers.util.Screen
import com.woocommerce.android.ui.dashboard.stats.DashboardStatsTestTags
-class StatsComponent : Screen(R.id.dashboardStats_root) {
+class StatsComponent : Screen(R.id.my_store_stats_container) {
override fun recover() {
super.recover()
clickOn(R.id.dashboard)
diff --git a/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/TopPerformersComponent.kt b/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/TopPerformersComponent.kt
index c3e5abc2d91..2df6cfc3903 100644
--- a/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/TopPerformersComponent.kt
+++ b/WooCommerce/src/androidTest/kotlin/com/woocommerce/android/e2e/screens/mystore/TopPerformersComponent.kt
@@ -6,7 +6,7 @@ import com.woocommerce.android.R
import com.woocommerce.android.e2e.helpers.util.Screen
import com.woocommerce.android.ui.dashboard.stats.DashboardStatsTestTags
-class TopPerformersComponent : Screen(R.id.dashboardStats_root) {
+class TopPerformersComponent : Screen(R.id.my_store_stats_container) {
override fun recover() {
super.recover()
clickOn(R.id.dashboard)
diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/DashboardFragment.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/DashboardFragment.kt
index a22c3ac0677..83f7a06dc7b 100644
--- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/DashboardFragment.kt
+++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/DashboardFragment.kt
@@ -30,7 +30,6 @@ import com.woocommerce.android.extensions.getColorCompat
import com.woocommerce.android.extensions.handleNotice
import com.woocommerce.android.extensions.handleResult
import com.woocommerce.android.extensions.navigateSafely
-import com.woocommerce.android.extensions.scrollStartEvents
import com.woocommerce.android.extensions.showDateRangePicker
import com.woocommerce.android.extensions.startHelpActivity
import com.woocommerce.android.extensions.verticalOffsetChanges
@@ -52,6 +51,7 @@ import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.Fe
import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.FeedbackPositiveAction
import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.OpenEditWidgets
import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.OpenRangePicker
+import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.RefreshJitm
import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.ShareStore
import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.ShowPrivacyBanner
import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardWidgetUiModel
@@ -145,18 +145,8 @@ class DashboardFragment :
}
}
- binding.myStoreRefreshLayout.setOnRefreshListener {
- binding.myStoreRefreshLayout.isRefreshing = false
- dashboardViewModel.onPullToRefresh()
- refreshJitm()
- }
-
prepareJetpackBenefitsBanner()
- binding.statsScrollView.scrollStartEvents()
- .onEach { usageTracksEventEmitter.interacted() }
- .launchIn(viewLifecycleOwner.lifecycleScope)
-
setupStateObservers()
setupResultHandlers()
}
@@ -190,6 +180,8 @@ class DashboardFragment :
is ShowSnackbar -> ToastUtils.showToast(requireContext(), event.message)
+ is RefreshJitm -> refreshJitm()
+
else -> event.isHandled = false
}
}
@@ -324,10 +316,6 @@ class DashboardFragment :
override fun getFragmentSubtitle(): String = dashboardViewModel.storeName.value ?: ""
- override fun scrollToTop() {
- binding.statsScrollView.smoothScrollTo(0, 0)
- }
-
private fun handleFeedbackRequestPositiveClick() {
// Request a ReviewInfo object from the Google Reviews API. If this fails
// we just move on as there isn't anything we can do.
@@ -361,7 +349,11 @@ class DashboardFragment :
)
}
- override fun shouldExpandToolbar() = binding.statsScrollView.scrollY == 0
+ override fun shouldExpandToolbar() = true
+
+ override fun scrollToTop() {
+ return
+ }
@OptIn(ExperimentalBadgeUtils::class)
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
diff --git a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/DashboardViewModel.kt b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/DashboardViewModel.kt
index 8ea0eb66dc3..2df480a70b5 100644
--- a/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/DashboardViewModel.kt
+++ b/WooCommerce/src/main/kotlin/com/woocommerce/android/ui/dashboard/DashboardViewModel.kt
@@ -25,6 +25,7 @@ import com.woocommerce.android.tools.SiteConnectionType
import com.woocommerce.android.tools.connectionType
import com.woocommerce.android.ui.analytics.ranges.StatsTimeRangeSelection.SelectionType
import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.OpenEditWidgets
+import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardEvent.RefreshJitm
import com.woocommerce.android.ui.dashboard.DashboardViewModel.DashboardWidgetUiModel.NewWidgetsCard
import com.woocommerce.android.ui.dashboard.data.DashboardRepository
import com.woocommerce.android.ui.prefs.privacy.banner.domain.ShouldShowPrivacyBanner
@@ -170,6 +171,7 @@ class DashboardViewModel @Inject constructor(
usageTracksEventEmitter.interacted()
analyticsTrackerWrapper.track(AnalyticsEvent.DASHBOARD_PULLED_TO_REFRESH)
_refreshTrigger.tryEmit(RefreshEvent(isForced = true))
+ triggerEvent(RefreshJitm)
}
fun onResume() {
@@ -355,6 +357,8 @@ class DashboardViewModel @Inject constructor(
data object FeedbackPositiveAction : DashboardEvent()
data object FeedbackNegativeAction : DashboardEvent()
+
+ data object RefreshJitm : DashboardEvent()
}
data class RefreshEvent(val isForced: Boolean = false)
diff --git a/WooCommerce/src/main/res/layout/fragment_dashboard.xml b/WooCommerce/src/main/res/layout/fragment_dashboard.xml
index f9f18a8b733..922c6a98a93 100644
--- a/WooCommerce/src/main/res/layout/fragment_dashboard.xml
+++ b/WooCommerce/src/main/res/layout/fragment_dashboard.xml
@@ -1,59 +1,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_marginBottom="@dimen/minor_100" />
-
-
-
-
-
-
-
+
+
-
-
+
+