Skip to content

Commit

Permalink
Merge pull request #401 from jellyfin/dependency-updates
Browse files Browse the repository at this point in the history
Update dependencies and fix deprecations
  • Loading branch information
nielsvanvelzen authored May 24, 2021
2 parents 83c46e9 + 8db1d2c commit ed12c2e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/src/main/assets/native/nativeshell.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ window.NativeShell = {
},

openUrl(url, target) {
window.NativeInterface.openUrl(url, target);
window.NativeInterface.openUrl(url);
},

updateMediaSession(mediaInfo) {
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/org/jellyfin/mobile/bridge/NativeInterface.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import kotlinx.coroutines.runBlocking
import org.jellyfin.mobile.R
import org.jellyfin.mobile.fragment.WebViewFragment
import org.jellyfin.mobile.settings.SettingsFragment
import org.jellyfin.mobile.utils.*
import org.jellyfin.mobile.utils.Constants
import org.jellyfin.mobile.utils.Constants.EXTRA_ALBUM
import org.jellyfin.mobile.utils.Constants.EXTRA_ARTIST
import org.jellyfin.mobile.utils.Constants.EXTRA_CAN_SEEK
Expand All @@ -24,6 +24,12 @@ import org.jellyfin.mobile.utils.Constants.EXTRA_ITEM_ID
import org.jellyfin.mobile.utils.Constants.EXTRA_PLAYER_ACTION
import org.jellyfin.mobile.utils.Constants.EXTRA_POSITION
import org.jellyfin.mobile.utils.Constants.EXTRA_TITLE
import org.jellyfin.mobile.utils.addFragment
import org.jellyfin.mobile.utils.disableFullscreen
import org.jellyfin.mobile.utils.enableFullscreen
import org.jellyfin.mobile.utils.requestDownload
import org.jellyfin.mobile.utils.requireMainActivity
import org.jellyfin.mobile.utils.runOnUiThread
import org.jellyfin.mobile.webapp.RemotePlayerService
import org.jellyfin.mobile.webapp.RemoteVolumeProvider
import org.jellyfin.mobile.webapp.WebappFunctionChannel
Expand Down Expand Up @@ -92,7 +98,7 @@ class NativeInterface(private val fragment: WebViewFragment) : KoinComponent {
}

@JavascriptInterface
fun openUrl(uri: String, target: String): Boolean = try {
fun openUrl(uri: String): Boolean = try {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(uri))
context.startActivity(intent)
true
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/org/jellyfin/mobile/bridge/NativePlayer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,36 @@ class NativePlayer(private val host: NativePlayerHost) : KoinComponent {

@JavascriptInterface
fun pausePlayer() {
playerEventChannel.offer(PlayerEvent.Pause)
playerEventChannel.trySend(PlayerEvent.Pause)
}

@JavascriptInterface
fun resumePlayer() {
playerEventChannel.offer(PlayerEvent.Resume)
playerEventChannel.trySend(PlayerEvent.Resume)
}

@JavascriptInterface
fun stopPlayer() {
playerEventChannel.offer(PlayerEvent.Stop)
playerEventChannel.trySend(PlayerEvent.Stop)
}

@JavascriptInterface
fun destroyPlayer() {
playerEventChannel.offer(PlayerEvent.Destroy)
playerEventChannel.trySend(PlayerEvent.Destroy)
}

@JavascriptInterface
fun seek(ticks: Long) {
playerEventChannel.offer(PlayerEvent.Seek(ticks / Constants.TICKS_PER_MILLISECOND))
playerEventChannel.trySend(PlayerEvent.Seek(ticks / Constants.TICKS_PER_MILLISECOND))
}

@JavascriptInterface
fun seekMs(ms: Long) {
playerEventChannel.offer(PlayerEvent.Seek(ms))
playerEventChannel.trySend(PlayerEvent.Seek(ms))
}

@JavascriptInterface
fun setVolume(volume: Int) {
playerEventChannel.offer(PlayerEvent.SetVolume(volume))
playerEventChannel.trySend(PlayerEvent.SetVolume(volume))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class WebViewFragment : Fragment(), NativePlayerHost {
webViewClient = object : WebViewClientCompat() {
override fun shouldInterceptRequest(webView: WebView, request: WebResourceRequest): WebResourceResponse? {
val url = request.url
val path = url.path?.toLowerCase(Locale.ROOT) ?: return null
val path = url.path?.lowercase(Locale.ROOT) ?: return null
return when {
path.endsWith(Constants.WEB_CONFIG_PATH) -> {
runOnUiThread {
Expand Down
15 changes: 7 additions & 8 deletions app/src/main/java/org/jellyfin/mobile/utils/UIExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.widget.Toast
import androidx.annotation.StringRes
import androidx.annotation.StyleRes
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updateMargins
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
Expand All @@ -34,15 +35,13 @@ fun LayoutInflater.withThemedContext(context: Context, @StyleRes style: Int): La
}

fun View.applyWindowInsetsAsMargins() {
ViewCompat.setOnApplyWindowInsetsListener(this) { _, insets ->
ViewCompat.setOnApplyWindowInsetsListener(this) { _, windowInsets ->
val layoutParams = layoutParams as ViewGroup.MarginLayoutParams
layoutParams.updateMargins(
left = insets.systemWindowInsetLeft,
top = insets.systemWindowInsetTop,
right = insets.systemWindowInsetRight,
bottom = insets.systemWindowInsetBottom
)
insets
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
with(insets) {
layoutParams.updateMargins(left, top, right, bottom)
}
windowInsets
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class WebappFunctionChannel {

operator fun iterator(): ChannelIterator<String> = internalChannel.iterator()

fun call(action: String) = internalChannel.offer(action)
fun call(action: String) = internalChannel.trySend(action).isSuccess

// Web component helpers
fun callPlaybackManagerAction(action: String) = call("$PLAYBACK_MANAGER.$action();")
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
}
dependencies {
val kotlinVersion: String by project
classpath("com.android.tools.build:gradle:4.2.0")
classpath("com.android.tools.build:gradle:4.2.1")
classpath(kotlin("gradle-plugin", kotlinVersion))
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1")
}
Expand Down
22 changes: 11 additions & 11 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ object Dependencies {
object Versions {
// Gradle plugins
const val dependencyUpdates = "0.38.0"
const val detekt = "1.17.0-RC2"
const val detekt = "1.17.1"

// KotlinX
const val coroutines = "1.4.3"
const val coroutines = "1.5.0"

// Core
const val koin = "2.1.6"
const val appCompat = "1.2.0"
const val androidxCore = "1.5.0-rc01"
const val activity = "1.2.2"
const val fragment = "1.3.2"
const val appCompat = "1.3.0"
const val androidxCore = "1.5.0"
const val activity = "1.2.3"
const val fragment = "1.3.4"
const val exoPlayer = "2.13.3"

// Lifecycle
Expand All @@ -22,7 +22,7 @@ object Dependencies {
const val constraintLayout = "2.0.4"
const val material = "1.3.0"
const val webkitX = "1.4.0"
const val modernAndroidPreferences = "2.0"
const val modernAndroidPreferences = "2.1.0"

// Room
const val room = "2.3.0"
Expand All @@ -34,18 +34,18 @@ object Dependencies {
const val coil = "1.1.1"

// Cast
const val mediaRouter = "1.2.2"
const val mediaRouter = "1.2.3"
const val playServicesCast = "19.0.0"

// Media
const val media = "1.3.0"
const val media = "1.3.1"

// Health
const val timber = "4.7.1"
const val leakCanary = "2.7"
const val redScreenOfDeath = "0.1.3"
const val junit = "5.7.1"
const val kotest = "4.4.3"
const val junit = "5.7.2"
const val kotest = "4.6.0"
const val mockk = "1.11.0"
const val androidXRunner = "1.3.0"
const val androidXEspresso = "3.3.0"
Expand Down

0 comments on commit ed12c2e

Please sign in to comment.