Revert "Fixing Source List Displaying Empty Items"

This reverts commit 8ba4879574.
This commit is contained in:
yueehaoo 2023-12-11 21:57:55 +08:00
parent 8ba4879574
commit 75ac93e493

View file

@ -184,20 +184,16 @@ class PlayerGeneratorViewModel : ViewModel() {
_loadingLinks.postValue(Resource.Loading()) _loadingLinks.postValue(Resource.Loading())
val loadingState = safeApiCall { val loadingState = safeApiCall {
generator?.generateLinks(type = type, clearCache = clearCache, callback = { generator?.generateLinks(type = type, clearCache = clearCache, callback = {
if (it.first?.url?.isNotEmpty() == true) { currentLinks.add(it)
currentLinks.add(it) // Clone to prevent ConcurrentModificationException
// Clone to prevent ConcurrentModificationException normalSafeApiCall {
normalSafeApiCall { // Extra normalSafeApiCall since .toSet() iterates.
// Extra normalSafeApiCall since .toSet() iterates. _currentLinks.postValue(currentLinks.toSet())
_currentLinks.postValue(currentLinks.toSet())
}
} }
}, subtitleCallback = { }, subtitleCallback = {
if (it.url.isNotEmpty()) { currentSubs.add(it)
currentSubs.add(it) normalSafeApiCall {
normalSafeApiCall { _currentSubs.postValue(currentSubs.toSet())
_currentSubs.postValue(currentSubs.toSet())
}
} }
}) })
} }