Skip to content

Commit d41c79d

Browse files
committed
Api 33 Compat
1 parent 22a8900 commit d41c79d

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

android/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@ dependencies {
5454
implementation "com.facebook.react:react-native:+"
5555
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$_kotlinVersion"
5656
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$_kotlinCoroutinesVersion"
57+
implementation "androidx.core:core-ktx:1.10.1"
5758
}

android/src/main/java/com/github/yamill/orientation/listeners/OrientationConfigListener.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.content.Context
66
import android.content.Intent
77
import android.content.IntentFilter
88
import android.content.res.Configuration
9+
import androidx.core.content.IntentCompat
910
import com.facebook.common.logging.FLog
1011
import com.facebook.react.bridge.Arguments
1112
import com.facebook.react.bridge.LifecycleEventListener
@@ -21,7 +22,7 @@ class OrientationConfigListener internal constructor(
2122
private val receiver = object : BroadcastReceiver() {
2223

2324
override fun onReceive(context: Context, intent: Intent) {
24-
val newConfig = intent.getParcelableExtra<Configuration>(INTENT_VALUE_KEY)!!
25+
val newConfig = IntentCompat.getParcelableExtra(intent, INTENT_VALUE_KEY, Configuration::class.java)!!
2526
tryEmitOrientationChange(newConfig.orientation, reactContext)
2627
}
2728
}

android/src/main/java/com/github/yamill/orientation/listeners/OrientationListener.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.facebook.react.bridge.LifecycleEventListener
99
import com.facebook.react.bridge.ReactContext
1010
import com.facebook.react.common.ReactConstants
1111
import com.github.yamill.orientation.throttleLatest
12+
import kotlinx.coroutines.DelicateCoroutinesApi
1213
import kotlinx.coroutines.GlobalScope
1314

1415
class OrientationListener internal constructor(
@@ -46,6 +47,7 @@ class OrientationListener internal constructor(
4647
companion object {
4748
var lastEmittedOrientationDegrees: Int? = null
4849

50+
@OptIn(DelicateCoroutinesApi::class)
4951
val onOrientationDegreesChange: (Int, ReactContext) -> Unit = throttleLatest(
5052
intervalMs = 1000L,
5153
coroutineScope = GlobalScope,

0 commit comments

Comments
 (0)