summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt15
1 files changed, 12 insertions, 3 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt
index d2138af..f5cb2e1 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt
@@ -63,8 +63,15 @@ class DashboardFragment :
private lateinit var graphHolder: GraphHolder
private lateinit var binding: FragmentDashboardBinding
+ private var updateUIJob: Job? = null
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+
+ updateUIJob = lifecycleScope.launchWhenStarted {
+ viewModel.dashboardFeature.takeView(this, this@DashboardFragment)
+ }
+
lifecycleScope.launchWhenStarted {
viewModel.dashboardFeature.singleEvents.collect { event ->
when (event) {
@@ -128,11 +135,13 @@ class DashboardFragment :
}
}
- private var updateUIJob: Job? = null
override fun onResume() {
super.onResume()
- updateUIJob = lifecycleScope.launch {
- viewModel.dashboardFeature.takeView(this, this@DashboardFragment)
+
+ if (updateUIJob == null || updateUIJob?.isActive == false) {
+ updateUIJob = lifecycleScope.launch {
+ viewModel.dashboardFeature.takeView(this, this@DashboardFragment)
+ }
}
viewModel.submitAction(DashboardFeature.Action.FetchStatistics)