Fixed the issue with passes refresh on app open #12

This commit is contained in:
Arty Bishop committed 2020-09-09 21:13:24 +01:00
1 parent 15d414f8f8
commit bfefae84da
2 files changed
+1 -3

No files matched your search

@@ -49,7 +49,6 @@ class SharedViewModel @Inject constructor(
value = Result.Success(prefsManager.getPosition())
}
private var calculationJob: Job? = null
var isFirstLaunch = true
fun getTransmittersForSat(id: Int) = liveData { emit(repository.getTransmittersByCatNum(id)) }
fun getPassList(): LiveData<Result<MutableList<SatPass>>> = _satPassList
@@ -87,9 +87,8 @@ class PassListFragment : Fragment(R.layout.fragment_pass_list) {
setupObservers(binding)
setupComponents(binding)
if (viewModel.isFirstLaunch) {
if (satPassList.isEmpty()) {
viewModel.calculatePasses()
viewModel.isFirstLaunch = false
}
}