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

Commit 910ccb1c authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

UI changes for UpdatesFragment

parent e11e00a0
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -132,10 +132,20 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), ApplicationI
    }

    private fun observeUpdateList(listAdapter: ApplicationListRVAdapter?) {
        updatesViewModel.updatesList.observe(viewLifecycleOwner) {
            listAdapter?.setData(it.first)
        updatesViewModel.updatesList.observe(viewLifecycleOwner) { result ->

            val updateList = result.first
            val resultStatus = result.second

            val systemAppsUpdates = updateList.filter { it.isSystemApp }
            val userAppsUpdates = updateList.filter { !it.isSystemApp }

            // Put system apps on top
            val appsToDisplay = systemAppsUpdates + userAppsUpdates

            listAdapter?.setData(appsToDisplay)
            if (!isDownloadObserverAdded) {
                handleStateNoUpdates(it.first)
                handleStateNoUpdates(updateList)
                observeDownloadList()
                isDownloadObserverAdded = true
            }
@@ -143,8 +153,8 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), ApplicationI
            stopLoadingUI()

            Timber.d("===>> observeupdate list called")
            if (it.second != ResultStatus.OK) {
                val exception = GPlayException(it.second == ResultStatus.TIMEOUT)
            if (resultStatus != ResultStatus.OK) {
                val exception = GPlayException(resultStatus == ResultStatus.TIMEOUT)
                val alertDialogBuilder = AlertDialog.Builder(requireContext())
                onTimeout(exception, alertDialogBuilder)
            }