Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit b2af3535 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

fix: resolve showing progress percentage while downloading apps

AppsFragment observes DownloadProgressLD LiveData to get progress update when an app gets downloaded.

For apps with Status.INSTALLATION_ISSUE in the database, they were interfering with the update logic of the LiveData and hence the UI was not getting the updates from it.

This commit fixes the issue by filtering the faulty apps beforehand.
parent c653df65
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import foundation.e.apps.data.enums.Status
import foundation.e.apps.data.install.AppManagerWrapper
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -56,6 +57,7 @@ class DownloadProgressLD @Inject constructor(
        launch {
            while (hasActiveObservers() || owner.lifecycle.currentState == Lifecycle.State.RESUMED) {
                val downloads = appManagerWrapper.getDownloadList()
                    .filterNot { it.status == Status.INSTALLATION_ISSUE }
                val downloadingList =
                    downloads.map { it.downloadIdMap }.filter { it.values.contains(false) }
                val downloadingIds = mutableListOf<Long>()