From 3ef07cdf710766c60a8d2330c95d3de2f386dc85 Mon Sep 17 00:00:00 2001 From: Arthur Geron Date: Thu, 24 Aug 2023 16:33:24 -0300 Subject: [PATCH 1/2] feat: add suport to RN 0.73 --- android/build.gradle | 3 ++- android/src/main/AndroidManifest.xml | 3 +-- example/android/build.gradle | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index d13cc1c..7b28362 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -35,10 +35,11 @@ def pkgData = new JsonSlurper().parseText(rootPkg.text) def sdk_version = pkgData.version android { + namespace = "com.amazonaws.ivs.reactnative.player" compileSdkVersion getExtOrIntegerDefault('compileSdkVersion') buildToolsVersion getExtOrDefault('buildToolsVersion') defaultConfig { - minSdkVersion 21 + minSdkVersion 26 targetSdkVersion getExtOrIntegerDefault('targetSdkVersion') versionCode 1 versionName sdk_version diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index f8eb395..e151c3c 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + Date: Thu, 24 Aug 2023 16:37:42 -0300 Subject: [PATCH 2/2] fix: android warnings uncovered player states --- .../ivs/reactnative/player/AmazonIvsView.kt | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt b/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt index c763c30..b66e936 100644 --- a/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt +++ b/android/src/main/java/com/amazonaws/ivs/reactnative/player/AmazonIvsView.kt @@ -7,6 +7,7 @@ import android.net.Uri import android.widget.FrameLayout import com.amazonaws.ivs.player.* import android.os.Build +import com.amazonaws.ivs.player.Player.State.* import com.facebook.react.bridge.Arguments import com.facebook.react.bridge.LifecycleEventListener import com.facebook.react.bridge.ReactContext @@ -314,7 +315,7 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte val reactContext = context as ReactContext when (state) { - Player.State.PLAYING -> { + PLAYING -> { if (!finishedLoading) { val onLoadData = Arguments.createMap() val parsedDuration = getDuration(player!!.duration); @@ -325,7 +326,7 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(id, Events.LOAD.toString(), onLoadData) } } - Player.State.READY -> { + READY -> { val data = Arguments.createMap() val playerData = Arguments.createMap() playerData.putString("version", player?.version) @@ -346,8 +347,10 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte data.putMap("playerData", playerData) reactContext.getJSModule(RCTEventEmitter::class.java).receiveEvent(id, Events.DATA.toString(), data) - } - else -> {} + }; + BUFFERING -> {} // The following empty statements are intentional and avoid Kotlin’s "expression must be exhaustive" error. + IDLE -> {} + ENDED -> {} } val onStateChangeData = Arguments.createMap() @@ -418,7 +421,7 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte lastDuration = player?.duration } player?.position?.let { position -> - if (position > 0 && player?.state === Player.State.PLAYING) { + if (position > 0 && player?.state === PLAYING) { onProgress(position) } } @@ -430,11 +433,11 @@ class AmazonIvsView(private val context: ThemedReactContext) : FrameLayout(conte private fun mapPlayerState(state: Player.State): String { return when(state) { - Player.State.PLAYING -> "Playing" - Player.State.BUFFERING -> "Buffering" - Player.State.READY -> "Ready" - Player.State.IDLE -> "Idle" - Player.State.ENDED -> "Ended" + PLAYING -> "Playing" + BUFFERING -> "Buffering" + READY -> "Ready" + IDLE -> "Idle" + ENDED -> "Ended" } }