From bf6fed5d555c8fe1351c5fbefe68e03e0063b74a Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Thu, 18 Jul 2024 23:30:00 +0530 Subject: [PATCH] clear systemAppProjectList before storing new data --- .../e/apps/data/gitlab/SystemAppsUpdatesRepository.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt index 25d9487da..f0c886a39 100644 --- a/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/gitlab/SystemAppsUpdatesRepository.kt @@ -41,7 +41,7 @@ class SystemAppsUpdatesRepository @Inject constructor( private val appLoungePackageManager: AppLoungePackageManager, ) { - private var systemAppProjectList = mutableListOf() + private val systemAppProjectList = mutableListOf() private fun getUpdatableSystemApps(): List { return systemAppProjectList.map { it.packageName } @@ -54,6 +54,7 @@ class SystemAppsUpdatesRepository @Inject constructor( } val response = updatableSystemAppsApi.getUpdatableSystemApps() if (response.isSuccessful && !response.body().isNullOrEmpty()) { + systemAppProjectList.clear() response.body()?.let { systemAppProjectList.addAll(it) } } else { Timber.e("Failed to fetch updatable apps: ${response.errorBody()?.string()}") -- GitLab