Post session capabilities to the server
This commit is contained in:
parent
1f931ec6e2
commit
55e7b64628
3 changed files with 16 additions and 3 deletions
|
@ -73,6 +73,6 @@ dependencies {
|
|||
|
||||
// Testing
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
}
|
|
@ -32,6 +32,7 @@ class JellyfinApi(context: Context, baseUrl: String) {
|
|||
val itemsApi = ItemsApi(api)
|
||||
val userLibraryApi = UserLibraryApi(api)
|
||||
val showsApi = TvShowsApi(api)
|
||||
val sessionApi = SessionApi(api)
|
||||
|
||||
companion object {
|
||||
@Volatile
|
||||
|
|
|
@ -37,14 +37,26 @@ class ServerSelectViewModel(
|
|||
}
|
||||
|
||||
fun connectToServer(server: Server) {
|
||||
JellyfinApi.newInstance(application, server.address).apply {
|
||||
val jellyfinApi = JellyfinApi.newInstance(application, server.address).apply {
|
||||
api.accessToken = server.accessToken
|
||||
userId = UUID.fromString(server.userId)
|
||||
}
|
||||
|
||||
viewModelScope.launch {
|
||||
postCapabilities(jellyfinApi)
|
||||
}
|
||||
|
||||
|
||||
_navigateToMain.value = true
|
||||
}
|
||||
|
||||
fun doneNavigatingToMain() {
|
||||
_navigateToMain.value = false
|
||||
}
|
||||
|
||||
private suspend fun postCapabilities(jellyfinApi: JellyfinApi) {
|
||||
withContext(Dispatchers.IO) {
|
||||
jellyfinApi.sessionApi.postCapabilities(playableMediaTypes = listOf("Video"), supportsMediaControl = false, supportsSync = false, supportsPersistentIdentifier = true)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue