summaryrefslogtreecommitdiff
path: root/app/src/main/java/foundation
diff options
context:
space:
mode:
authorAbhishek Aggarwal <warabhishek@e.email>2022-03-25 08:35:30 +0000
committerAbhishek Aggarwal <warabhishek@e.email>2022-03-25 08:35:30 +0000
commitc95e83ef10dd4120775b04a3914740d4beabc901 (patch)
treec20b5957108ce05e35f4703c5c1dd634f04d01c3 /app/src/main/java/foundation
parent61f492a49a70103fade1a486f1b7b0d836889927 (diff)
parent3dd5b80faba18852f824d2a294dded8a0390d7da (diff)
Merge branch 'fix_refresh_dashboard_5147' into 'main'
Fix refresh dashboard on start #5147 See merge request e/privacy-central/privacycentralapp!33
Diffstat (limited to 'app/src/main/java/foundation')
-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)