Merge pull request #7347 from Bnyro/master

fix: add missing dearrow calls to playlist fragment and video player
This commit is contained in:
Bnyro 2025-04-25 16:16:56 +02:00 committed by GitHub
commit 6df5904cb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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.parcelable.PlayerData
import com.github.libretube.util.PlayingQueue import com.github.libretube.util.PlayingQueue
import com.github.libretube.util.YoutubeHlsPlaylistParser import com.github.libretube.util.YoutubeHlsPlaylistParser
import com.github.libretube.util.deArrow
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -126,7 +127,7 @@ open class OnlinePlayerService : AbstractPlayerService() {
streams = withContext(Dispatchers.IO) { streams = withContext(Dispatchers.IO) {
try { try {
MediaServiceRepository.instance.getStreams(videoId) MediaServiceRepository.instance.getStreams(videoId).deArrow(videoId)
} catch (e: IOException) { } catch (e: IOException) {
toastFromMainDispatcher(getString(R.string.unknown_error)) toastFromMainDispatcher(getString(R.string.unknown_error))
return@withContext null 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.BaseBottomSheet
import com.github.libretube.ui.sheets.PlaylistOptionsBottomSheet import com.github.libretube.ui.sheets.PlaylistOptionsBottomSheet
import com.github.libretube.util.PlayingQueue import com.github.libretube.util.PlayingQueue
import com.github.libretube.util.deArrow
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
@ -391,7 +392,9 @@ class PlaylistFragment : DynamicLayoutManagerFragment(R.layout.fragment_playlist
val response = try { val response = try {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
// load locally stored playlists with the auth api // 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) { } catch (e: Exception) {
context?.toastFromMainDispatcher(e.localizedMessage.orEmpty()) context?.toastFromMainDispatcher(e.localizedMessage.orEmpty())

View File

@ -78,14 +78,14 @@ class HomeViewModel : ViewModel() {
runSafely( runSafely(
onSuccess = { videos -> trending.updateIfChanged(videos) }, 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) { private suspend fun loadFeed(subscriptionsViewModel: SubscriptionsViewModel) {
runSafely( runSafely(
onSuccess = { videos -> feed.updateIfChanged(videos) }, onSuccess = { videos -> feed.updateIfChanged(videos) },
ioBlock = { tryLoadFeed(subscriptionsViewModel).deArrow().take(20) } ioBlock = { tryLoadFeed(subscriptionsViewModel).take(20).deArrow() }
) )
} }