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

Commit 6f402040 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Make ResultSupreme nullable

parent 773f59fe
Loading
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -161,11 +161,13 @@ class ApplicationListFragment :
    private fun observeAppListLiveData() {
        viewModel.appListLiveData.observe(viewLifecycleOwner) {
            stopLoadingUI()
            if (it != null) {
                if (it.isSuccess()) {
                    observeDownloadList(listAdapter, it)
                }
            }
        }
    }

    private fun isFusedAppsUpdated(it: ResultSupreme<List<FusedApp>>) =
        listAdapter.currentList.isEmpty() || it.data != null && viewModel.isAnyAppUpdated(
+3 −3
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ class ApplicationListViewModel @Inject constructor(
    private val fusedAPIRepository: FusedAPIRepository
) : LoadingViewModel() {

    val appListLiveData: MutableLiveData<ResultSupreme<List<FusedApp>>> = MutableLiveData()
    val appListLiveData: MutableLiveData<ResultSupreme<List<FusedApp>>?> = MutableLiveData()

    var isLoading = false

@@ -118,7 +118,7 @@ class ApplicationListViewModel @Inject constructor(
            isLoading = true
            val result = fusedAPIRepository.loadMore(authData, browseUrl)
            isLoading = false
            appListLiveData.postValue(result.first!!)
            appListLiveData.postValue(result.first)
            /*
             * Check if a placeholder app is to be added at the end.
             * If yes then post the updated result.
@@ -127,7 +127,7 @@ class ApplicationListViewModel @Inject constructor(
             * list, and none at the middle of the list.
             */
            if (fusedAPIRepository.addPlaceHolderAppIfNeeded(result.first)) {
                appListLiveData.postValue(result.first!!)
                appListLiveData.postValue(result.first)
            }

            /*