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