fix: optimization # 1

This commit is contained in:
rebelonion 2024-05-05 18:57:03 -05:00
parent 390c709f5d
commit 14f29d09df

View file

@ -453,10 +453,12 @@ class HomeFragment : Fragment() {
binding.homeUserStatusContainer, binding.homeUserStatusContainer,
) )
val live = Refresh.activity.getOrPut(1) { MutableLiveData(false) } var running = false
val live = Refresh.activity.getOrPut(1) { MutableLiveData(true) }
live.observe(viewLifecycleOwner) live.observe(viewLifecycleOwner)
{ {
if (it) { if (it && !running) {
running = true
scope.launch { scope.launch {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
//Get userData First //Get userData First
@ -483,6 +485,7 @@ class HomeFragment : Fragment() {
_binding?.homeRefresh?.isRefreshing = false _binding?.homeRefresh?.isRefreshing = false
} }
binding.homeHiddenItemsContainer.visibility = View.GONE binding.homeHiddenItemsContainer.visibility = View.GONE
running = false
} }
} }