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

Commit cf033578 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Merge branch '2800-u-fix-regression-when-logout' into 'main'

fix: If no home data is displayed also load data again

See merge request !521
parents 0696de42 49961d7d
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -186,7 +186,7 @@ class HomeFragment : TimeoutFragment(R.layout.fragment_home), ApplicationInstall
    }

    override fun loadData(authObjectList: List<AuthObject>) {
        if (homeViewModel.haveSourcesChanged()) {
        if (shouldLoadData()) {
            showLoadingUI()
            homeViewModel.loadData(authObjectList, viewLifecycleOwner) { _ ->
                clearAndRestartGPlayLogin()
@@ -195,6 +195,8 @@ class HomeFragment : TimeoutFragment(R.layout.fragment_home), ApplicationInstall
        }
    }

    private fun shouldLoadData() = homeViewModel.haveSourcesChanged() || !homeViewModel.hasData()

    override fun showLoadingUI() {
        binding.shimmerLayout.startShimmer()
        binding.shimmerLayout.visibility = View.VISIBLE
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ class HomeViewModel @Inject constructor(

    private var previousSources = emptyList<Boolean>()

   fun hasData(): Boolean {
       return homeScreenData.value?.data?.isNotEmpty() ?: false
   }

    fun loadData(
        authObjectList: List<AuthObject>,
        lifecycleOwner: LifecycleOwner,