expo-updates 0.11.3 → 0.11.4
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/CHANGELOG.md +7 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/updates/UpdatesController.kt +22 -5
- package/android/src/main/java/expo/modules/updates/UpdatesUtils.kt +8 -4
- package/android/src/main/java/expo/modules/updates/errorrecovery/ErrorRecovery.kt +4 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.11.4 — 2022-01-13
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Fix `IllegalThreadStateException` that occurred when creating an event to send to React Native early in the app lifecycle. ([#15880](https://github.com/expo/expo/pull/15880) by [@esamelson](https://github.com/esamelson))
|
|
18
|
+
- Ensure we return early when updates are disabled on Android. ([#15882](https://github.com/expo/expo/pull/15882) by [@esamelson](https://github.com/esamelson))
|
|
19
|
+
|
|
13
20
|
## 0.11.3 — 2021-12-22
|
|
14
21
|
|
|
15
22
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
|
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-kapt'
|
|
|
4
4
|
apply plugin: 'maven'
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '0.11.
|
|
7
|
+
version = '0.11.4'
|
|
8
8
|
|
|
9
9
|
apply from: "../scripts/create-manifest-android.gradle"
|
|
10
10
|
|
|
@@ -64,7 +64,7 @@ android {
|
|
|
64
64
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
65
65
|
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
66
66
|
versionCode 31
|
|
67
|
-
versionName '0.11.
|
|
67
|
+
versionName '0.11.4'
|
|
68
68
|
consumerProguardFiles("proguard-rules.pro")
|
|
69
69
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
70
70
|
// uncomment below to export the database schema when making changes
|
|
@@ -56,10 +56,13 @@ class UpdatesController private constructor(
|
|
|
56
56
|
private val databaseHandlerThread = HandlerThread("expo-updates-database")
|
|
57
57
|
private lateinit var databaseHandler: Handler
|
|
58
58
|
private fun initializeDatabaseHandler() {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if (!::databaseHandler.isInitialized) {
|
|
60
|
+
databaseHandlerThread.start()
|
|
61
|
+
databaseHandler = Handler(databaseHandlerThread.looper)
|
|
62
|
+
}
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
private var isStarted = false
|
|
63
66
|
private var loaderTask: LoaderTask? = null
|
|
64
67
|
private var remoteLoadStatus = ErrorRecoveryDelegate.RemoteLoadStatus.IDLE
|
|
65
68
|
|
|
@@ -81,7 +84,7 @@ class UpdatesController private constructor(
|
|
|
81
84
|
private set
|
|
82
85
|
|
|
83
86
|
fun onDidCreateReactInstanceManager(reactInstanceManager: ReactInstanceManager) {
|
|
84
|
-
if (isEmergencyLaunch) {
|
|
87
|
+
if (isEmergencyLaunch || !updatesConfiguration.isEnabled) {
|
|
85
88
|
return
|
|
86
89
|
}
|
|
87
90
|
errorRecovery.startMonitoring(reactInstanceManager)
|
|
@@ -191,8 +194,15 @@ class UpdatesController private constructor(
|
|
|
191
194
|
*/
|
|
192
195
|
@Synchronized
|
|
193
196
|
fun start(context: Context) {
|
|
197
|
+
if (isStarted) {
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
isStarted = true
|
|
201
|
+
|
|
194
202
|
if (!updatesConfiguration.isEnabled) {
|
|
195
203
|
launcher = NoDatabaseLauncher(context, updatesConfiguration)
|
|
204
|
+
notifyController()
|
|
205
|
+
return
|
|
196
206
|
}
|
|
197
207
|
if (updatesConfiguration.updateUrl == null || updatesConfiguration.scopeKey == null) {
|
|
198
208
|
throw AssertionError("expo-updates is enabled, but no valid URL is configured in AndroidManifest.xml. If you are making a release build for the first time, make sure you have run `expo publish` at least once.")
|
|
@@ -200,6 +210,8 @@ class UpdatesController private constructor(
|
|
|
200
210
|
if (updatesDirectory == null) {
|
|
201
211
|
launcher = NoDatabaseLauncher(context, updatesConfiguration, updatesDirectoryException)
|
|
202
212
|
isEmergencyLaunch = true
|
|
213
|
+
notifyController()
|
|
214
|
+
return
|
|
203
215
|
}
|
|
204
216
|
|
|
205
217
|
initializeDatabaseHandler()
|
|
@@ -280,6 +292,9 @@ class UpdatesController private constructor(
|
|
|
280
292
|
|
|
281
293
|
@Synchronized
|
|
282
294
|
private fun notifyController() {
|
|
295
|
+
if (launcher == null) {
|
|
296
|
+
throw AssertionError("UpdatesController.notifyController was called with a null launcher, which is an error. This method should only be called when an update is ready to launch.")
|
|
297
|
+
}
|
|
283
298
|
isLoaderTaskFinished = true
|
|
284
299
|
(this as java.lang.Object).notify()
|
|
285
300
|
}
|
|
@@ -444,8 +459,10 @@ class UpdatesController private constructor(
|
|
|
444
459
|
* @param context the base context of the application, ideally a [ReactApplication]
|
|
445
460
|
*/
|
|
446
461
|
@JvmStatic fun initialize(context: Context) {
|
|
447
|
-
|
|
448
|
-
|
|
462
|
+
if (singletonInstance == null) {
|
|
463
|
+
initializeWithoutStarting(context)
|
|
464
|
+
singletonInstance!!.start(context)
|
|
465
|
+
}
|
|
449
466
|
}
|
|
450
467
|
|
|
451
468
|
/**
|
|
@@ -136,16 +136,20 @@ object UpdatesUtils {
|
|
|
136
136
|
) {
|
|
137
137
|
val host = reactNativeHost?.get()
|
|
138
138
|
if (host != null) {
|
|
139
|
-
val instanceManager = host.reactInstanceManager
|
|
140
139
|
AsyncTask.execute {
|
|
141
140
|
try {
|
|
142
141
|
var reactContext: ReactContext? = null
|
|
143
142
|
// in case we're trying to send an event before the reactContext has been initialized
|
|
144
143
|
// continue to retry for 5000ms
|
|
145
144
|
for (i in 0..4) {
|
|
146
|
-
|
|
147
|
-
if
|
|
148
|
-
|
|
145
|
+
// Calling host.reactInstanceManager has a side effect of creating a new
|
|
146
|
+
// reactInstanceManager if there isn't already one. We want to avoid this so we check
|
|
147
|
+
// if it has an instance first.
|
|
148
|
+
if (host.hasInstance()) {
|
|
149
|
+
reactContext = host.reactInstanceManager.currentReactContext
|
|
150
|
+
if (reactContext != null) {
|
|
151
|
+
break
|
|
152
|
+
}
|
|
149
153
|
}
|
|
150
154
|
Thread.sleep(1000)
|
|
151
155
|
}
|
|
@@ -19,8 +19,10 @@ class ErrorRecovery {
|
|
|
19
19
|
private var previousExceptionHandler: DefaultNativeModuleCallExceptionHandler? = null
|
|
20
20
|
|
|
21
21
|
fun initialize(delegate: ErrorRecoveryDelegate) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if (!::handler.isInitialized) {
|
|
23
|
+
handlerThread.start()
|
|
24
|
+
handler = ErrorRecoveryHandler(handlerThread.looper, delegate)
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
fun startMonitoring(reactInstanceManager: ReactInstanceManager) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-updates",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"expo": "*"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b4c5971e76728660c1b851da17ec049a343deb40"
|
|
56
56
|
}
|