Add selectServer function to native shell (#235)

Fixes server selection in 10.7+
This commit is contained in:
Niels van Velzen
2020-11-16 20:39:03 +01:00
committed by GitHub
parent 4d1f7da7d5
commit 83babffbfe
2 changed files with 10 additions and 0 deletions
@@ -52,6 +52,10 @@ window.NativeShell = {
window.NativeInterface.openClientSettings();
},
selectServer() {
window.NativeInterface.openServerSelection();
},
getPlugins() {
return ["native/exoplayer", "native/externalplayer"];
},
@@ -10,6 +10,7 @@ import android.webkit.JavascriptInterface
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import org.jellyfin.apiclient.interaction.AndroidDevice
import org.jellyfin.mobile.fragment.ConnectFragment
import org.jellyfin.mobile.fragment.WebViewFragment
import org.jellyfin.mobile.settings.SettingsFragment
import org.jellyfin.mobile.utils.*
@@ -160,6 +161,11 @@ class NativeInterface(private val fragment: WebViewFragment) : KoinComponent {
fragment.parentFragmentManager.addFragment<SettingsFragment>()
}
@JavascriptInterface
fun openServerSelection() {
fragment.parentFragmentManager.addFragment<ConnectFragment>()
}
@JavascriptInterface
fun exitApp() {
val activity = fragment.requireMainActivity()