Fix network on main exception trying to play theme songs (#111)

Fetch the theme song info on the IO thread

This would throw an exception on some devices, but it would be caught
without affecting the app, other than just not playing theme music.
This commit is contained in:
damontecres 2025-10-29 20:07:00 -04:00 committed by GitHub
parent 84ee57225b
commit f76556f90e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 18 deletions

View file

@ -3,12 +3,12 @@ package com.github.damontecres.wholphin.util
import android.content.Context
import android.widget.Toast
import com.github.damontecres.wholphin.hilt.IoCoroutineScope
import com.github.damontecres.wholphin.ui.launchIO
import com.github.damontecres.wholphin.ui.showToast
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import org.jellyfin.sdk.api.client.ApiClient
import org.jellyfin.sdk.api.client.extensions.sessionApi
import org.jellyfin.sdk.api.sockets.subscribe
@ -32,7 +32,7 @@ class ServerEventListener
}
fun init() {
scope.launch(ExceptionHandler()) {
scope.launchIO {
api.sessionApi.postCapabilities(
playableMediaTypes = listOf(MediaType.VIDEO),
supportedCommands =