expo-updates 55.0.29 → 55.0.31
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 +16 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/updates/launcher/DatabaseLauncher.kt +9 -0
- package/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt +85 -33
- package/android/src/main/java/expo/modules/updates/loader/Loader.kt +5 -1
- package/android/src/main/java/expo/modules/updates/loader/RemoteLoader.kt +23 -3
- package/ios/EXUpdates/AppLoader/FileDownloader.swift +23 -2
- package/ios/EXUpdates/Database/UpdatesDatabase.swift +20 -4
- package/package.json +2 -2
- package/utils/build/createManifestForBuildAsync.js +4 -2
- package/utils/src/createManifestForBuildAsync.ts +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,22 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 55.0.31 — 2026-09-17
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [iOS] Apply bundle diffs against the embedded bundle in the app binary when the launched update is the embedded one, instead of failing to resolve a patch base and downloading the full bundle. ([#50018](https://github.com/expo/expo/pull/50018) by [@alanjhughes](https://github.com/alanjhughes))
|
|
18
|
+
- [Android] Apply bundle diffs against the embedded bundle in the app binary when the launched update is the embedded one, instead of failing to resolve a patch base and downloading the full bundle. ([#50019](https://github.com/expo/expo/pull/50019) by [@alanjhughes](https://github.com/alanjhughes))
|
|
19
|
+
|
|
20
|
+
## 55.0.30 — 2026-08-28
|
|
21
|
+
|
|
22
|
+
### 🐛 Bug fixes
|
|
23
|
+
|
|
24
|
+
- [iOS] Propagate database failures from `addNewAssets` instead of swallowing them, which let an update be marked ready without its launch asset and then fail every launch. ([#49456](https://github.com/expo/expo/pull/49456) by [@alanjhughes](https://github.com/alanjhughes))
|
|
25
|
+
- [iOS] Repair ready updates that are missing their launch asset by demoting them to pending during launcher selection, so a corrupted row is skipped and retried instead of failing every launch. ([#49457](https://github.com/expo/expo/pull/49457) by [@alanjhughes](https://github.com/alanjhughes))
|
|
26
|
+
- [Android] Skip and repair updates that are missing their launch asset instead of selecting them for launch, which previously failed every cold start with "Launch asset not found for update". ([#49470](https://github.com/expo/expo/pull/49470) by [@alanjhughes](https://github.com/alanjhughes), based on [#48733](https://github.com/expo/expo/pull/48733) by [@martintreurnicht](https://github.com/martintreurnicht))
|
|
27
|
+
- [iOS] Fix the embedded manifest recording the wrong `packagerHash` for assets that ship scale variants iOS does not allow (such as `@1.5x` and `@4x`): the hashes were read by the filtered scale index instead of the asset's own, so those images resolved to an empty URI and rendered blank in release builds. ([#48811](https://github.com/expo/expo/pull/48811) by [@expo-bot](https://github.com/expo-bot))
|
|
28
|
+
|
|
13
29
|
## 55.0.29 — 2026-08-27
|
|
14
30
|
|
|
15
31
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
|
@@ -42,7 +42,7 @@ expoModule {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
group = 'host.exp.exponent'
|
|
45
|
-
version = '55.0.
|
|
45
|
+
version = '55.0.31'
|
|
46
46
|
|
|
47
47
|
// Utility method to derive boolean values from the environment or from Java properties,
|
|
48
48
|
// and return them as strings to be used in BuildConfig fields
|
|
@@ -89,7 +89,7 @@ android {
|
|
|
89
89
|
namespace "expo.modules.updates"
|
|
90
90
|
defaultConfig {
|
|
91
91
|
versionCode 31
|
|
92
|
-
versionName '55.0.
|
|
92
|
+
versionName '55.0.31'
|
|
93
93
|
consumerProguardFiles("proguard-rules.pro")
|
|
94
94
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
95
95
|
|
|
@@ -161,6 +161,15 @@ class DatabaseLauncher(
|
|
|
161
161
|
if (!configuration.hasEmbeddedUpdate && embeddedUpdate?.updateEntity?.id == update.id) {
|
|
162
162
|
continue
|
|
163
163
|
}
|
|
164
|
+
|
|
165
|
+
// An update with no launch asset can never launch. Excluding it here lets the loader
|
|
166
|
+
// re-run and repair the row instead of failing every cold start.
|
|
167
|
+
if (update.status != UpdateStatus.DEVELOPMENT &&
|
|
168
|
+
database.updateDao().loadLaunchAssetForUpdate(update.id) == null
|
|
169
|
+
) {
|
|
170
|
+
logger.warn("Skipping launchable update with no launch asset. Debug info: ${update.debugInfo()}")
|
|
171
|
+
continue
|
|
172
|
+
}
|
|
164
173
|
filteredLaunchableUpdates.add(update)
|
|
165
174
|
}
|
|
166
175
|
val manifestFilters = ManifestMetadata.getManifestFilters(database, configuration)
|
|
@@ -22,6 +22,7 @@ import expo.modules.updates.manifest.ResponsePartHeaderData
|
|
|
22
22
|
import expo.modules.updates.manifest.ResponsePartInfo
|
|
23
23
|
import expo.modules.updates.manifest.UpdateFactory
|
|
24
24
|
import expo.modules.updates.selectionpolicy.SelectionPolicies
|
|
25
|
+
import expo.modules.updates.utils.AndroidResourceAssetUtils
|
|
25
26
|
import kotlinx.coroutines.suspendCancellableCoroutine
|
|
26
27
|
import okhttp3.Cache
|
|
27
28
|
import okhttp3.Headers
|
|
@@ -51,6 +52,7 @@ import kotlin.math.min
|
|
|
51
52
|
|
|
52
53
|
private const val PATCH_TEMP_SUFFIX = ".patch"
|
|
53
54
|
private const val PATCHED_TEMP_SUFFIX = ".patched"
|
|
55
|
+
private const val PATCH_BASE_TEMP_SUFFIX = ".base"
|
|
54
56
|
private const val A_IM_HEADER = "A-IM"
|
|
55
57
|
private const val IM_HEADER = "im"
|
|
56
58
|
private const val EXPO_BASE_UPDATE_ID_RESPONSE_HEADER = "expo-base-update-id"
|
|
@@ -58,6 +60,8 @@ private const val EXPO_CURRENT_UPDATE_ID_HEADER = "Expo-Current-Update-ID"
|
|
|
58
60
|
private const val EXPO_REQUESTED_UPDATE_ID_HEADER = "Expo-Requested-Update-ID"
|
|
59
61
|
private const val EXPO_EMBEDDED_UPDATE_ID_HEADER = "Expo-Embedded-Update-ID"
|
|
60
62
|
|
|
63
|
+
internal typealias EmbeddedAssetExtractor = (AssetEntity, File) -> Unit
|
|
64
|
+
|
|
61
65
|
/**
|
|
62
66
|
* Utility class that holds all the logic for downloading data and files, such as update manifests
|
|
63
67
|
* and assets, using an instance of [OkHttpClient].
|
|
@@ -107,7 +111,8 @@ class FileDownloader(
|
|
|
107
111
|
progressListener: FileDownloadProgressListener? = null,
|
|
108
112
|
allowPatch: Boolean,
|
|
109
113
|
launchedUpdate: UpdateEntity? = null,
|
|
110
|
-
requestedUpdate: UpdateEntity? = null
|
|
114
|
+
requestedUpdate: UpdateEntity? = null,
|
|
115
|
+
embeddedAssetExtractor: EmbeddedAssetExtractor? = null
|
|
111
116
|
): FileDownloadResult {
|
|
112
117
|
try {
|
|
113
118
|
val response = downloadData(request, progressListener)
|
|
@@ -176,7 +181,8 @@ class FileDownloader(
|
|
|
176
181
|
updatesDirectory = updatesDirectory,
|
|
177
182
|
launchedUpdate = launchedUpdate,
|
|
178
183
|
requestedUpdate = requestedUpdate,
|
|
179
|
-
expectedBase64URLEncodedSHA256Hash = expectedBase64URLEncodedSHA256Hash
|
|
184
|
+
expectedBase64URLEncodedSHA256Hash = expectedBase64URLEncodedSHA256Hash,
|
|
185
|
+
embeddedAssetExtractor = embeddedAssetExtractor
|
|
180
186
|
)
|
|
181
187
|
}.getOrElse {
|
|
182
188
|
logger.warn(
|
|
@@ -294,36 +300,47 @@ class FileDownloader(
|
|
|
294
300
|
updatesDirectory: File,
|
|
295
301
|
launchedUpdate: UpdateEntity,
|
|
296
302
|
requestedUpdate: UpdateEntity?,
|
|
297
|
-
expectedBase64URLEncodedSHA256Hash: String
|
|
303
|
+
expectedBase64URLEncodedSHA256Hash: String?,
|
|
304
|
+
embeddedAssetExtractor: EmbeddedAssetExtractor? = null
|
|
298
305
|
): ByteArray {
|
|
299
306
|
val launchAssetContext = prepareAssetForDiff(
|
|
300
307
|
asset = asset,
|
|
301
308
|
responseBody = responseBody,
|
|
309
|
+
destination = destination,
|
|
302
310
|
updatesDirectory = updatesDirectory,
|
|
303
|
-
launchedUpdate = launchedUpdate
|
|
311
|
+
launchedUpdate = launchedUpdate,
|
|
312
|
+
embeddedAssetExtractor = embeddedAssetExtractor
|
|
304
313
|
)
|
|
305
314
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
315
|
+
try {
|
|
316
|
+
return applyHermesDiff(
|
|
317
|
+
baseFile = launchAssetContext.baseFile,
|
|
318
|
+
diffBody = responseBody,
|
|
319
|
+
destination = destination,
|
|
320
|
+
expectedBase64URLEncodedSHA256Hash = expectedBase64URLEncodedSHA256Hash,
|
|
321
|
+
asset = asset,
|
|
322
|
+
requestedUpdateId = requestedUpdate?.id?.toString()
|
|
323
|
+
)
|
|
324
|
+
} finally {
|
|
325
|
+
if (launchAssetContext.isTemporary) {
|
|
326
|
+
launchAssetContext.baseFile.delete()
|
|
327
|
+
}
|
|
328
|
+
}
|
|
314
329
|
}
|
|
315
330
|
|
|
316
|
-
internal data class LaunchAssetContext(val baseFile: File)
|
|
331
|
+
internal data class LaunchAssetContext(val baseFile: File, val isTemporary: Boolean = false)
|
|
317
332
|
|
|
318
333
|
@VisibleForTesting
|
|
319
334
|
internal fun prepareAssetForDiff(
|
|
320
335
|
asset: AssetEntity,
|
|
321
336
|
responseBody: ResponseBody,
|
|
337
|
+
destination: File,
|
|
322
338
|
updatesDirectory: File,
|
|
323
|
-
launchedUpdate: UpdateEntity
|
|
339
|
+
launchedUpdate: UpdateEntity,
|
|
340
|
+
embeddedAssetExtractor: EmbeddedAssetExtractor? = null
|
|
324
341
|
): LaunchAssetContext {
|
|
325
342
|
return try {
|
|
326
|
-
preparePatchBaseAsset(asset, updatesDirectory, launchedUpdate)
|
|
343
|
+
preparePatchBaseAsset(asset, destination, updatesDirectory, launchedUpdate, embeddedAssetExtractor)
|
|
327
344
|
} catch (e: Exception) {
|
|
328
345
|
responseBody.close()
|
|
329
346
|
if (e is IOException) {
|
|
@@ -336,8 +353,10 @@ class FileDownloader(
|
|
|
336
353
|
|
|
337
354
|
private fun preparePatchBaseAsset(
|
|
338
355
|
asset: AssetEntity,
|
|
356
|
+
destination: File,
|
|
339
357
|
updatesDirectory: File,
|
|
340
|
-
launchedUpdate: UpdateEntity
|
|
358
|
+
launchedUpdate: UpdateEntity,
|
|
359
|
+
embeddedAssetExtractor: EmbeddedAssetExtractor? = null
|
|
341
360
|
): LaunchAssetContext {
|
|
342
361
|
if (!asset.isLaunchAsset) {
|
|
343
362
|
throw IOException("Received patch for non-launch asset ${asset.key}")
|
|
@@ -351,29 +370,60 @@ class FileDownloader(
|
|
|
351
370
|
val launchAssetRelativePath = launchAssetEntity.relativePath
|
|
352
371
|
?: throw IOException("Launch asset for update $currentUpdateId is missing a relative path")
|
|
353
372
|
|
|
354
|
-
|
|
373
|
+
// BSPatch needs a real path, so an asset inside the APK is extracted first.
|
|
374
|
+
val isEmbeddedLaunchAsset = AndroidResourceAssetUtils.isAndroidResourceAsset(launchAssetRelativePath)
|
|
375
|
+
val baseFile = if (isEmbeddedLaunchAsset) {
|
|
376
|
+
extractEmbeddedPatchBaseAsset(launchAssetEntity, destination, embeddedAssetExtractor)
|
|
377
|
+
} else {
|
|
378
|
+
File(updatesDirectory, launchAssetRelativePath)
|
|
379
|
+
}
|
|
355
380
|
if (!baseFile.exists()) {
|
|
356
381
|
throw IOException("Base asset $baseFile is missing; cannot apply patch")
|
|
357
382
|
}
|
|
358
383
|
|
|
359
|
-
val
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
384
|
+
val expectedBaseHash = launchAssetEntity.expectedHash
|
|
385
|
+
if (expectedBaseHash != null) {
|
|
386
|
+
val actualBaseHash = try {
|
|
387
|
+
UpdatesUtils.toBase64Url(UpdatesUtils.sha256(baseFile))
|
|
388
|
+
} catch (_: Exception) {
|
|
389
|
+
null
|
|
390
|
+
}
|
|
391
|
+
if (actualBaseHash != null && expectedBaseHash != actualBaseHash) {
|
|
392
|
+
logger.warn(
|
|
393
|
+
"Asset hash mismatch for update $currentUpdateId; expected=$expectedBaseHash actual=$actualBaseHash",
|
|
394
|
+
UpdatesErrorCode.AssetsFailedToLoad,
|
|
395
|
+
currentUpdateId.toString(),
|
|
396
|
+
asset.key
|
|
397
|
+
)
|
|
398
|
+
if (isEmbeddedLaunchAsset) {
|
|
399
|
+
baseFile.delete()
|
|
400
|
+
}
|
|
401
|
+
throw IOException("Asset hash mismatch for update $currentUpdateId; expected=$expectedBaseHash actual=$actualBaseHash")
|
|
402
|
+
}
|
|
363
403
|
}
|
|
364
404
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
405
|
+
return LaunchAssetContext(baseFile, isTemporary = isEmbeddedLaunchAsset)
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
@Throws(IOException::class)
|
|
409
|
+
private fun extractEmbeddedPatchBaseAsset(
|
|
410
|
+
launchAssetEntity: AssetEntity,
|
|
411
|
+
destination: File,
|
|
412
|
+
embeddedAssetExtractor: EmbeddedAssetExtractor?
|
|
413
|
+
): File {
|
|
414
|
+
if (embeddedAssetExtractor == null) {
|
|
415
|
+
throw IOException("The launch asset lives in the app binary and cannot be extracted without an extractor")
|
|
374
416
|
}
|
|
375
417
|
|
|
376
|
-
|
|
418
|
+
val baseFile = File(destination.absolutePath + PATCH_BASE_TEMP_SUFFIX)
|
|
419
|
+
try {
|
|
420
|
+
baseFile.parentFile?.mkdirs()
|
|
421
|
+
embeddedAssetExtractor(launchAssetEntity, baseFile)
|
|
422
|
+
} catch (e: Exception) {
|
|
423
|
+
baseFile.delete()
|
|
424
|
+
throw e as? IOException ?: IOException("Failed to extract the embedded launch asset", e)
|
|
425
|
+
}
|
|
426
|
+
return baseFile
|
|
377
427
|
}
|
|
378
428
|
|
|
379
429
|
@VisibleForTesting
|
|
@@ -678,7 +728,8 @@ class FileDownloader(
|
|
|
678
728
|
extraHeaders: JSONObject,
|
|
679
729
|
launchedUpdate: UpdateEntity?,
|
|
680
730
|
requestedUpdate: UpdateEntity?,
|
|
681
|
-
assetLoadProgressListener: ((Double) -> Unit)? = null
|
|
731
|
+
assetLoadProgressListener: ((Double) -> Unit)? = null,
|
|
732
|
+
embeddedAssetExtractor: EmbeddedAssetExtractor? = null
|
|
682
733
|
): AssetDownloadResult {
|
|
683
734
|
if (asset.url == null) {
|
|
684
735
|
val message = "Failed to download asset ${asset.key}"
|
|
@@ -722,7 +773,8 @@ class FileDownloader(
|
|
|
722
773
|
assetLoadProgressListener?.let { listener -> { listener.invoke(it) } },
|
|
723
774
|
allowPatch = canApplyPatch,
|
|
724
775
|
launchedUpdate = launchedUpdate,
|
|
725
|
-
requestedUpdate = requestedUpdate
|
|
776
|
+
requestedUpdate = requestedUpdate,
|
|
777
|
+
embeddedAssetExtractor = embeddedAssetExtractor
|
|
726
778
|
)
|
|
727
779
|
|
|
728
780
|
asset.downloadTime = Date()
|
|
@@ -166,7 +166,11 @@ abstract class Loader protected constructor(
|
|
|
166
166
|
database.updateDao().setUpdateScopeKey(existingUpdateEntity, newUpdateEntity.scopeKey)
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
// A READY update with no launch asset is not actually ready. Fall through to
|
|
170
|
+
// downloadAllAssets so its assets are re-registered instead of staying broken forever.
|
|
171
|
+
if (existingUpdateEntity != null && existingUpdateEntity.status == UpdateStatus.READY &&
|
|
172
|
+
database.updateDao().loadLaunchAssetForUpdate(existingUpdateEntity.id) != null
|
|
173
|
+
) {
|
|
170
174
|
// hooray, we already have this update downloaded and ready to go!
|
|
171
175
|
updateEntity = existingUpdateEntity
|
|
172
176
|
return finish()
|
|
@@ -14,6 +14,7 @@ import kotlinx.coroutines.CoroutineScope
|
|
|
14
14
|
import kotlinx.coroutines.Dispatchers
|
|
15
15
|
import kotlinx.coroutines.SupervisorJob
|
|
16
16
|
import java.io.File
|
|
17
|
+
import java.io.IOException
|
|
17
18
|
|
|
18
19
|
data class ProcessSuccessLoaderResult(
|
|
19
20
|
val availableUpdate: UpdateEntity?,
|
|
@@ -66,9 +67,28 @@ class RemoteLoader internal constructor(
|
|
|
66
67
|
embeddedUpdate: UpdateEntity?
|
|
67
68
|
): FileDownloader.AssetDownloadResult {
|
|
68
69
|
val extraHeaders = FileDownloader.getExtraHeadersForRemoteAssetRequest(launchedUpdate, embeddedUpdate, requestedUpdate)
|
|
69
|
-
return mFileDownloader.downloadAsset(
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
return mFileDownloader.downloadAsset(
|
|
71
|
+
asset = assetEntity,
|
|
72
|
+
destinationDirectory = updatesDirectory,
|
|
73
|
+
extraHeaders = extraHeaders,
|
|
74
|
+
launchedUpdate = launchedUpdate,
|
|
75
|
+
requestedUpdate = requestedUpdate,
|
|
76
|
+
embeddedAssetExtractor = { launchAsset, destination ->
|
|
77
|
+
// The stored path is not the APK asset name; resolve it through the embedded manifest by key.
|
|
78
|
+
val embeddedLaunchAsset = loaderFiles.readEmbeddedUpdate(context, configuration)
|
|
79
|
+
?.assetEntityList
|
|
80
|
+
?.find { it.key == launchAsset.key }
|
|
81
|
+
?: throw IOException("No embedded asset matches launch asset ${launchAsset.key}")
|
|
82
|
+
val assetName = embeddedLaunchAsset.embeddedAssetFilename
|
|
83
|
+
?: throw IOException("Embedded launch asset ${launchAsset.key} has no APK asset filename")
|
|
84
|
+
context.assets.open(assetName).use { input ->
|
|
85
|
+
destination.outputStream().use { output -> input.copyTo(output) }
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
assetLoadProgressListener = { progress ->
|
|
89
|
+
assetLoadProgressListener(assetEntity, progress)
|
|
90
|
+
}
|
|
91
|
+
)
|
|
72
92
|
}
|
|
73
93
|
|
|
74
94
|
companion object {
|
|
@@ -84,6 +84,12 @@ public final class FileDownloader {
|
|
|
84
84
|
private let updatesDirectory: URL
|
|
85
85
|
private let database: UpdatesDatabase
|
|
86
86
|
|
|
87
|
+
/// Overridable for testing, where the fixture is not in `updatesBundle`.
|
|
88
|
+
internal var embeddedLaunchAssetUrl: URL? = updatesBundle.url(
|
|
89
|
+
forResource: EmbeddedAppLoader.EXUpdatesBareEmbeddedBundleFilename,
|
|
90
|
+
withExtension: EmbeddedAppLoader.EXUpdatesBareEmbeddedBundleFileType
|
|
91
|
+
)
|
|
92
|
+
|
|
87
93
|
public convenience init(
|
|
88
94
|
config: UpdatesConfig,
|
|
89
95
|
logger: UpdatesLogger,
|
|
@@ -557,8 +563,7 @@ public final class FileDownloader {
|
|
|
557
563
|
throw DiffError.assetNotLaunch
|
|
558
564
|
}
|
|
559
565
|
|
|
560
|
-
let
|
|
561
|
-
let baseFileUrl = try loadAndVerifyAsset(baseAsset)
|
|
566
|
+
let baseFileUrl = try resolveBaseFileUrl(launchedUpdate: launchedUpdate)
|
|
562
567
|
let requestedUpdateId = requestedUpdate?.updateId.uuidString
|
|
563
568
|
|
|
564
569
|
return try createPatchedAsset(
|
|
@@ -571,6 +576,19 @@ public final class FileDownloader {
|
|
|
571
576
|
)
|
|
572
577
|
}
|
|
573
578
|
|
|
579
|
+
private func resolveBaseFileUrl(launchedUpdate: Update) throws -> URL {
|
|
580
|
+
if launchedUpdate.status == UpdateStatus.StatusEmbedded {
|
|
581
|
+
// StatusEmbedded only launches for this binary's embedded update.
|
|
582
|
+
guard let embeddedLaunchAssetUrl else {
|
|
583
|
+
throw DiffError.embeddedBaseAssetMissing
|
|
584
|
+
}
|
|
585
|
+
return embeddedLaunchAssetUrl
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
let baseAsset = try resolveLaunchAsset(launchedUpdate: launchedUpdate)
|
|
589
|
+
return try loadAndVerifyAsset(baseAsset)
|
|
590
|
+
}
|
|
591
|
+
|
|
574
592
|
private func resolveLaunchAsset(launchedUpdate: Update) throws -> UpdateAsset {
|
|
575
593
|
let currentUpdateId = launchedUpdate.updateId
|
|
576
594
|
var launchAsset: UpdateAsset?
|
|
@@ -1238,6 +1256,7 @@ extension FileDownloader {
|
|
|
1238
1256
|
case missingHeader(String)
|
|
1239
1257
|
case invalidHeader(String)
|
|
1240
1258
|
case launchAssetNotFound
|
|
1259
|
+
case embeddedBaseAssetMissing
|
|
1241
1260
|
case baseAssetMissing(path: String)
|
|
1242
1261
|
case failedToReadBaseAsset(cause: Error)
|
|
1243
1262
|
case failedToWritePatch(cause: Error, path: String)
|
|
@@ -1265,6 +1284,8 @@ extension FileDownloader.DiffError: CustomStringConvertible {
|
|
|
1265
1284
|
return "Invalid \(header) header"
|
|
1266
1285
|
case .launchAssetNotFound:
|
|
1267
1286
|
return "Launch asset not found for current update"
|
|
1287
|
+
case .embeddedBaseAssetMissing:
|
|
1288
|
+
return "Embedded bundle not found in the app binary"
|
|
1268
1289
|
case let .baseAssetMissing(path):
|
|
1269
1290
|
return "Base asset is missing at path \(path)"
|
|
1270
1291
|
case let .failedToReadBaseAsset(cause):
|
|
@@ -160,7 +160,7 @@ public final class UpdatesDatabase: NSObject {
|
|
|
160
160
|
)
|
|
161
161
|
} catch {
|
|
162
162
|
sqlite3_exec(db, "ROLLBACK;", nil, nil, nil)
|
|
163
|
-
|
|
163
|
+
throw error
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
// statements must stay in precisely this order for last_insert_rowid() to work correctly
|
|
@@ -170,7 +170,7 @@ public final class UpdatesDatabase: NSObject {
|
|
|
170
170
|
_ = try execute(sql: updateSql, withArgs: [updateId])
|
|
171
171
|
} catch {
|
|
172
172
|
sqlite3_exec(db, "ROLLBACK;", nil, nil, nil)
|
|
173
|
-
|
|
173
|
+
throw error
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
@@ -181,7 +181,7 @@ public final class UpdatesDatabase: NSObject {
|
|
|
181
181
|
_ = try execute(sql: updateInsertSql, withArgs: [updateId])
|
|
182
182
|
} catch {
|
|
183
183
|
sqlite3_exec(db, "ROLLBACK;", nil, nil, nil)
|
|
184
|
-
|
|
184
|
+
throw error
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -444,7 +444,23 @@ public final class UpdatesDatabase: NSObject {
|
|
|
444
444
|
)
|
|
445
445
|
|
|
446
446
|
let rows = try execute(sql: sql, withArgs: [config.scopeKey])
|
|
447
|
-
|
|
447
|
+
|
|
448
|
+
// A ready row with no launch asset is corrupt (e.g. from an interrupted registration) and
|
|
449
|
+
// would fail every launch. Demote it for the loader to retry instead of offering it.
|
|
450
|
+
var launchableRows: [[String: Any?]] = []
|
|
451
|
+
for row in rows {
|
|
452
|
+
let status: NSNumber = row.requiredValue(forKey: "status")
|
|
453
|
+
let launchAssetId: NSNumber? = row.optionalValue(forKey: "launch_asset_id")
|
|
454
|
+
if status.intValue == UpdateStatus.StatusReady.rawValue && launchAssetId == nil {
|
|
455
|
+
let updateId: UUID = row.requiredValue(forKey: "id")
|
|
456
|
+
let demoteSql = "UPDATE updates SET status = ?1 WHERE id = ?2;"
|
|
457
|
+
_ = try execute(sql: demoteSql, withArgs: [UpdateStatus.StatusPending.rawValue, updateId])
|
|
458
|
+
} else {
|
|
459
|
+
launchableRows.append(row)
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return launchableRows.map { row in
|
|
448
464
|
update(withRow: row, config: config)
|
|
449
465
|
}
|
|
450
466
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-updates",
|
|
3
|
-
"version": "55.0.
|
|
3
|
+
"version": "55.0.31",
|
|
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",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"react": "*",
|
|
72
72
|
"react-native": "*"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "167ec74a43d77e1b61f751440334f9e645f8d2be"
|
|
75
75
|
}
|
|
@@ -45,12 +45,14 @@ async function createManifestForBuildAsync(platform, projectRoot, destinationDir
|
|
|
45
45
|
if (!asset.fileHashes) {
|
|
46
46
|
throw new Error('The hashAssetFiles Metro plugin is not configured. You need to add a metro.config.js to your project that configures Metro to use this plugin. See https://github.com/expo/expo/blob/main/packages/expo-updates/README.md#metroconfigjs for an example.');
|
|
47
47
|
}
|
|
48
|
-
(0, filterPlatformAssetScales_1.filterPlatformAssetScales)(platform, asset.scales).forEach(function (scale
|
|
48
|
+
(0, filterPlatformAssetScales_1.filterPlatformAssetScales)(platform, asset.scales).forEach(function (scale) {
|
|
49
49
|
const baseAssetInfoForManifest = {
|
|
50
50
|
name: asset.name,
|
|
51
51
|
type: asset.type,
|
|
52
52
|
scale,
|
|
53
|
-
|
|
53
|
+
// `fileHashes` is parallel to the unfiltered `asset.scales`, so it must be indexed by the
|
|
54
|
+
// scale's position there rather than by its position in the filtered list.
|
|
55
|
+
packagerHash: asset.fileHashes[asset.scales.indexOf(scale)],
|
|
54
56
|
subdirectory: asset.httpServerLocation,
|
|
55
57
|
};
|
|
56
58
|
if (platform === 'ios') {
|
|
@@ -64,12 +64,14 @@ export async function createManifestForBuildAsync(
|
|
|
64
64
|
'The hashAssetFiles Metro plugin is not configured. You need to add a metro.config.js to your project that configures Metro to use this plugin. See https://github.com/expo/expo/blob/main/packages/expo-updates/README.md#metroconfigjs for an example.'
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
|
-
filterPlatformAssetScales(platform, asset.scales).forEach(function (scale
|
|
67
|
+
filterPlatformAssetScales(platform, asset.scales).forEach(function (scale) {
|
|
68
68
|
const baseAssetInfoForManifest = {
|
|
69
69
|
name: asset.name,
|
|
70
70
|
type: asset.type,
|
|
71
71
|
scale,
|
|
72
|
-
|
|
72
|
+
// `fileHashes` is parallel to the unfiltered `asset.scales`, so it must be indexed by the
|
|
73
|
+
// scale's position there rather than by its position in the filtered list.
|
|
74
|
+
packagerHash: asset.fileHashes[asset.scales.indexOf(scale)],
|
|
73
75
|
subdirectory: asset.httpServerLocation,
|
|
74
76
|
};
|
|
75
77
|
if (platform === 'ios') {
|