Loading app/src/main/java/foundation/e/apps/data/updates/UpdatesManagerImpl.kt +32 −12 Original line number Diff line number Diff line Loading @@ -126,15 +126,19 @@ class UpdatesManagerImpl @Inject constructor( status = if (status == ResultStatus.OK) status else gplayStatus } val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList) val systemApps = mutableListOf<Application>() getUpdatesFromApi({ val systemApps = getSystemUpdates().toMutableList() putAppLoungeAtLast(systemApps) Pair(systemApps, ResultStatus.OK) }, updateList) getSystemUpdates().toMutableList().let { Pair(it, ResultStatus.OK) } }, systemApps) val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList) arrangeWithSystemApps(updateList, nonFaultyUpdateList, systemApps) return Pair(nonFaultyUpdateList, status) return Pair(updateList, status) } suspend fun getUpdatesOSS(): Pair<List<Application>, ResultStatus> { Loading Loading @@ -167,19 +171,35 @@ class UpdatesManagerImpl @Inject constructor( }, updateList) } val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList) val systemApps = mutableListOf<Application>() getUpdatesFromApi({ val systemApps = getSystemUpdates().toMutableList() putAppLoungeAtLast(systemApps) Pair(systemApps, ResultStatus.OK) }, updateList) getSystemUpdates().toMutableList().let { Pair(it, ResultStatus.OK) } }, systemApps) val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList) arrangeWithSystemApps(updateList, nonFaultyUpdateList, systemApps) return Pair(nonFaultyUpdateList, status) return Pair(updateList, status) } suspend fun getSystemUpdates(): List<Application> = applicationRepository.getSystemUpdates() private fun arrangeWithSystemApps( updateList: MutableList<Application>, nonFaultyApps: List<Application>, systemApps: List<Application>, ) { updateList.clear() updateList.addAll(nonFaultyApps) updateList.addAll(systemApps) putAppLoungeAtLast(updateList) } private fun putAppLoungeAtLast(updateList: MutableList<Application>) { val appLoungeItem = updateList.find { it.isSystemApp && it.package_name == context.packageName } ?: return Loading Loading
app/src/main/java/foundation/e/apps/data/updates/UpdatesManagerImpl.kt +32 −12 Original line number Diff line number Diff line Loading @@ -126,15 +126,19 @@ class UpdatesManagerImpl @Inject constructor( status = if (status == ResultStatus.OK) status else gplayStatus } val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList) val systemApps = mutableListOf<Application>() getUpdatesFromApi({ val systemApps = getSystemUpdates().toMutableList() putAppLoungeAtLast(systemApps) Pair(systemApps, ResultStatus.OK) }, updateList) getSystemUpdates().toMutableList().let { Pair(it, ResultStatus.OK) } }, systemApps) val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList) arrangeWithSystemApps(updateList, nonFaultyUpdateList, systemApps) return Pair(nonFaultyUpdateList, status) return Pair(updateList, status) } suspend fun getUpdatesOSS(): Pair<List<Application>, ResultStatus> { Loading Loading @@ -167,19 +171,35 @@ class UpdatesManagerImpl @Inject constructor( }, updateList) } val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList) val systemApps = mutableListOf<Application>() getUpdatesFromApi({ val systemApps = getSystemUpdates().toMutableList() putAppLoungeAtLast(systemApps) Pair(systemApps, ResultStatus.OK) }, updateList) getSystemUpdates().toMutableList().let { Pair(it, ResultStatus.OK) } }, systemApps) val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList) arrangeWithSystemApps(updateList, nonFaultyUpdateList, systemApps) return Pair(nonFaultyUpdateList, status) return Pair(updateList, status) } suspend fun getSystemUpdates(): List<Application> = applicationRepository.getSystemUpdates() private fun arrangeWithSystemApps( updateList: MutableList<Application>, nonFaultyApps: List<Application>, systemApps: List<Application>, ) { updateList.clear() updateList.addAll(nonFaultyApps) updateList.addAll(systemApps) putAppLoungeAtLast(updateList) } private fun putAppLoungeAtLast(updateList: MutableList<Application>) { val appLoungeItem = updateList.find { it.isSystemApp && it.package_name == context.packageName } ?: return Loading