fix: add missing dearrow calls to playlist fragment and video player

This commit is contained in:
Bnyro 2025-04-25 16:16:37 +02:00
parent c7a587f509
commit 66c690a6af
No known key found for this signature in database
3 changed files with 8 additions and 4 deletions

View File

@ -35,6 +35,7 @@ import com.github.libretube.helpers.ProxyHelper
import com.github.libretube.parcelable.PlayerData
import com.github.libretube.util.PlayingQueue
import com.github.libretube.util.YoutubeHlsPlaylistParser
import com.github.libretube.util.deArrow
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@ -126,7 +127,7 @@ open class OnlinePlayerService : AbstractPlayerService() {
streams = withContext(Dispatchers.IO) {
try {
MediaServiceRepository.instance.getStreams(videoId)
MediaServiceRepository.instance.getStreams(videoId).deArrow(videoId)
} catch (e: IOException) {
toastFromMainDispatcher(getString(R.string.unknown_error))
return@withContext null

View File

@ -46,6 +46,7 @@ import com.github.libretube.ui.models.CommonPlayerViewModel
import com.github.libretube.ui.sheets.BaseBottomSheet
import com.github.libretube.ui.sheets.PlaylistOptionsBottomSheet
import com.github.libretube.util.PlayingQueue
import com.github.libretube.util.deArrow
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
@ -391,7 +392,9 @@ class PlaylistFragment : DynamicLayoutManagerFragment(R.layout.fragment_playlist
val response = try {
withContext(Dispatchers.IO) {
// load locally stored playlists with the auth api
MediaServiceRepository.instance.getPlaylistNextPage(playlistId, nextPage!!)
MediaServiceRepository.instance.getPlaylistNextPage(playlistId, nextPage!!).apply {
relatedStreams = relatedStreams.deArrow()
}
}
} catch (e: Exception) {
context?.toastFromMainDispatcher(e.localizedMessage.orEmpty())

View File

@ -78,14 +78,14 @@ class HomeViewModel : ViewModel() {
runSafely(
onSuccess = { videos -> trending.updateIfChanged(videos) },
ioBlock = { MediaServiceRepository.instance.getTrending(region).deArrow().take(10) }
ioBlock = { MediaServiceRepository.instance.getTrending(region).take(10).deArrow() }
)
}
private suspend fun loadFeed(subscriptionsViewModel: SubscriptionsViewModel) {
runSafely(
onSuccess = { videos -> feed.updateIfChanged(videos) },
ioBlock = { tryLoadFeed(subscriptionsViewModel).deArrow().take(20) }
ioBlock = { tryLoadFeed(subscriptionsViewModel).take(20).deArrow() }
)
}