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

Commit f8448a52 authored by Hasib Prince's avatar Hasib Prince
Browse files

App Lounge: fixed progress update

Fixed progress update after coming back from background
parent a8394def
Loading
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -259,8 +259,6 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) {
            if (appInfoFetchViewModel.isAppInBlockedList(it)) {
                binding.snackbarLayout.visibility = View.VISIBLE
            }

            observeDownloadStatus(view)
            fetchAppTracker(it)
        }

@@ -323,6 +321,11 @@ class ApplicationFragment : Fragment(R.layout.fragment_application) {
        }
    }

    override fun onResume() {
        super.onResume()
        observeDownloadStatus(binding.root)
    }

    private fun handleInstallingIssue(
        installButton: MaterialButton,
        fusedApp: FusedApp,
+4 −4
Original line number Diff line number Diff line
@@ -143,10 +143,6 @@ class ApplicationListFragment : Fragment(R.layout.fragment_application_list), Fu
            layoutManager = LinearLayoutManager(view?.context)
        }

        appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) {
            updateProgressOfDownloadingItems(recyclerView, it)
        }

        viewModel.appListLiveData.observe(viewLifecycleOwner) {
            listAdapter?.setData(it)
            if (!isDownloadObserverAdded) {
@@ -184,6 +180,10 @@ class ApplicationListFragment : Fragment(R.layout.fragment_application_list), Fu
                }
            }
        }

        appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) {
            updateProgressOfDownloadingItems(recyclerView, it)
        }
    }

    private fun updateProgressOfDownloadingItems(
+5 −5
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import javax.inject.Inject
@AndroidEntryPoint
class HomeFragment : Fragment(R.layout.fragment_home), FusedAPIInterface {

    private lateinit var homeParentRVAdapter: HomeParentRVAdapter
    private var _binding: FragmentHomeBinding? = null
    private val binding get() = _binding!!

@@ -83,7 +84,7 @@ class HomeFragment : Fragment(R.layout.fragment_home), FusedAPIInterface {
            }
        }

        val homeParentRVAdapter = HomeParentRVAdapter(
        homeParentRVAdapter = HomeParentRVAdapter(
            this,
            pkgManagerModule,
            pwaManagerModule,
@@ -123,10 +124,6 @@ class HomeFragment : Fragment(R.layout.fragment_home), FusedAPIInterface {
                }, it.second)
            }
        }

        appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) {
            updateProgressOfDownloadingAppItemViews(homeParentRVAdapter, it)
        }
    }

    /*
@@ -190,6 +187,9 @@ class HomeFragment : Fragment(R.layout.fragment_home), FusedAPIInterface {
    override fun onResume() {
        super.onResume()
        binding.shimmerLayout.startShimmer()
        appProgressViewModel.downloadProgress.observe(viewLifecycleOwner) {
            updateProgressOfDownloadingAppItemViews(homeParentRVAdapter, it)
        }
    }

    override fun onPause() {
+0 −10
Original line number Diff line number Diff line
package foundation.e.apps.manager.download.data

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.FlowCollector

class DownloadProgressFlow : Flow<DownloadProgress> {
    override suspend fun collect(collector: FlowCollector<DownloadProgress>) {

    }
}
 No newline at end of file
+3 −5
Original line number Diff line number Diff line
@@ -31,12 +31,11 @@ class DownloadProgressLD @Inject constructor(
    override fun observe(owner: LifecycleOwner, observer: Observer<in DownloadProgress>) {
        job = Job()
        super.observe(owner, observer)
    }

    override fun onActive() {
        super.onActive()
        val hasActiveObservers = hasActiveObservers()

        launch {
            while (isActive) {
            while (hasActiveObservers) {
                val downloads = fusedManagerRepository.getDownloadList()
                val downloadingList =
                    downloads.map { it.downloadIdMap }.filter { it.values.contains(false) }
@@ -80,7 +79,6 @@ class DownloadProgressLD @Inject constructor(
                                }

                                if (downloadingIds.isEmpty()) {
                                    clearDownload()
                                    cancel()
                                }
                                cursor.moveToNext()
Loading