@iternio/react-native-auto-play 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -5,7 +5,7 @@ buildscript {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
dependencies {
|
|
8
|
-
classpath "com.android.tools.build:gradle:8.13.
|
|
8
|
+
classpath "com.android.tools.build:gradle:8.13.2"
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -14,18 +14,11 @@ def reactNativeArchitectures() {
|
|
|
14
14
|
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
def isNewArchitectureEnabled() {
|
|
18
|
-
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
17
|
apply plugin: "com.android.library"
|
|
22
18
|
apply plugin: 'org.jetbrains.kotlin.android'
|
|
23
19
|
apply from: '../nitrogen/generated/android/ReactNativeAutoPlay+autolinking.gradle'
|
|
24
20
|
apply from: "./fix-prefab.gradle"
|
|
25
|
-
|
|
26
|
-
if (isNewArchitectureEnabled()) {
|
|
27
|
-
apply plugin: "com.facebook.react"
|
|
28
|
-
}
|
|
21
|
+
apply plugin: "com.facebook.react"
|
|
29
22
|
|
|
30
23
|
def getExtOrDefault(name) {
|
|
31
24
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["ReactNativeAutoPlay_" + name]
|
|
@@ -117,12 +110,10 @@ android {
|
|
|
117
110
|
|
|
118
111
|
sourceSets {
|
|
119
112
|
main {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
]
|
|
125
|
-
}
|
|
113
|
+
java.srcDirs += [
|
|
114
|
+
// React Codegen files
|
|
115
|
+
"${project.buildDir}/generated/source/codegen/java"
|
|
116
|
+
]
|
|
126
117
|
|
|
127
118
|
if (getExtOrDefault("isAutomotiveApp") == "true") {
|
|
128
119
|
java.srcDirs += 'src/automotive/java'
|
|
@@ -163,6 +154,6 @@ dependencies {
|
|
|
163
154
|
}
|
|
164
155
|
|
|
165
156
|
implementation 'com.google.android.gms:play-services-base:18.10.0'
|
|
166
|
-
implementation 'com.google.android.gms:play-services-auth:21.5.
|
|
157
|
+
implementation 'com.google.android.gms:play-services-auth:21.5.1'
|
|
167
158
|
}
|
|
168
159
|
|
|
@@ -11,6 +11,7 @@ import android.content.ServiceConnection
|
|
|
11
11
|
import android.content.pm.ApplicationInfo
|
|
12
12
|
import android.content.pm.PackageManager
|
|
13
13
|
import android.graphics.Bitmap
|
|
14
|
+
import android.os.Build
|
|
14
15
|
import android.os.IBinder
|
|
15
16
|
import android.util.Log
|
|
16
17
|
import androidx.car.app.CarAppService
|
|
@@ -61,11 +62,13 @@ class AndroidAutoService : CarAppService() {
|
|
|
61
62
|
notificationManager = getSystemService(NotificationManager::class.java)
|
|
62
63
|
val appLabel = AppInfo.getApplicationLabel(this)
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
66
|
+
getSystemService(NotificationManager::class.java).createNotificationChannel(
|
|
67
|
+
NotificationChannel(
|
|
68
|
+
CHANNEL_ID, appLabel, NotificationManager.IMPORTANCE_DEFAULT
|
|
69
|
+
)
|
|
67
70
|
)
|
|
68
|
-
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
override fun onCreateSession(sessionInfo: SessionInfo): Session {
|
|
@@ -2,59 +2,35 @@ package com.margelo.nitro.swe.iternio.reactnativeautoplay.utils
|
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.ReactApplication
|
|
4
4
|
import com.facebook.react.ReactInstanceEventListener
|
|
5
|
-
import com.facebook.react.ReactInstanceManager
|
|
6
5
|
import com.facebook.react.bridge.ReactContext
|
|
7
|
-
import com.margelo.nitro.BuildConfig
|
|
8
6
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
|
9
7
|
import kotlin.coroutines.resume
|
|
10
8
|
|
|
11
9
|
object ReactContextResolver {
|
|
12
10
|
suspend fun getReactContext(application: ReactApplication): ReactContext {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
application.reactHost ?: throw IllegalArgumentException("application host null")
|
|
16
|
-
return suspendCancellableCoroutine { continuation ->
|
|
17
|
-
host.currentReactContext?.let {
|
|
18
|
-
continuation.resume(it)
|
|
19
|
-
return@suspendCancellableCoroutine
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
val listener = object : ReactInstanceEventListener {
|
|
23
|
-
override fun onReactContextInitialized(context: ReactContext) {
|
|
24
|
-
host.removeReactInstanceEventListener(this)
|
|
25
|
-
continuation.resume(context)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
host.addReactInstanceEventListener(listener)
|
|
11
|
+
val host =
|
|
12
|
+
application.reactHost ?: throw IllegalArgumentException("application host null")
|
|
29
13
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
host.start()
|
|
14
|
+
return suspendCancellableCoroutine { continuation ->
|
|
15
|
+
host.currentReactContext?.let {
|
|
16
|
+
continuation.resume(it)
|
|
17
|
+
return@suspendCancellableCoroutine
|
|
35
18
|
}
|
|
36
|
-
} else {
|
|
37
|
-
val reactInstanceManager = application.reactNativeHost.reactInstanceManager
|
|
38
|
-
return suspendCancellableCoroutine { continuation ->
|
|
39
|
-
reactInstanceManager.currentReactContext?.let {
|
|
40
|
-
continuation.resume(it)
|
|
41
|
-
return@suspendCancellableCoroutine
|
|
42
|
-
}
|
|
43
19
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
reactInstanceManager.addReactInstanceEventListener(listener)
|
|
51
|
-
|
|
52
|
-
continuation.invokeOnCancellation {
|
|
53
|
-
reactInstanceManager.removeReactInstanceEventListener(listener)
|
|
20
|
+
val listener = object : ReactInstanceEventListener {
|
|
21
|
+
override fun onReactContextInitialized(context: ReactContext) {
|
|
22
|
+
host.removeReactInstanceEventListener(this)
|
|
23
|
+
continuation.resume(context)
|
|
54
24
|
}
|
|
25
|
+
}
|
|
26
|
+
host.addReactInstanceEventListener(listener)
|
|
55
27
|
|
|
56
|
-
|
|
28
|
+
continuation.invokeOnCancellation {
|
|
29
|
+
host.removeReactInstanceEventListener(listener)
|
|
57
30
|
}
|
|
31
|
+
|
|
32
|
+
host.start()
|
|
58
33
|
}
|
|
34
|
+
|
|
59
35
|
}
|
|
60
36
|
}
|