From 9e1e6046c86b1b587a265ac74bd66c5b3bbe6fa9 Mon Sep 17 00:00:00 2001 From: Bart Nijland Date: Mon, 13 Jun 2022 09:04:58 +0200 Subject: [PATCH] Always refresh credentials on resume --- .../rijksoverheid/ctr/holder/dashboard/DashboardViewModel.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/holder/src/main/java/nl/rijksoverheid/ctr/holder/dashboard/DashboardViewModel.kt b/holder/src/main/java/nl/rijksoverheid/ctr/holder/dashboard/DashboardViewModel.kt index 48419772f..482a254b3 100644 --- a/holder/src/main/java/nl/rijksoverheid/ctr/holder/dashboard/DashboardViewModel.kt +++ b/holder/src/main/java/nl/rijksoverheid/ctr/holder/dashboard/DashboardViewModel.kt @@ -75,7 +75,6 @@ class DashboardViewModelImpl( private suspend fun refreshCredentials(dashboardSync: DashboardSync) { mutex.withLock { val previousSyncResult = databaseSyncerResultLiveData.value?.peekContent() - val hasDoneRefreshCall = previousSyncResult != null // Check if we need to load new credentials val shouldLoadNewCredentials = when (dashboardSync) { @@ -89,8 +88,7 @@ class DashboardViewModelImpl( } is DashboardSync.CheckSync -> { // Load new credentials if no previous refresh has been executed and we should refresh because a credentials for a green card expired - val shouldRefreshCredentials = - (greenCardRefreshUtil.shouldRefresh() && !hasDoneRefreshCall) + val shouldRefreshCredentials = greenCardRefreshUtil.shouldRefresh() // Load new credentials if we the previous request failed more than once and more than x minutes ago val shouldRetryFailedRequest =