expo-updates 0.20.0 → 0.21.0

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/updates/UpdatesModule.kt +55 -7
  4. package/android/src/main/java/expo/modules/updates/loader/LoaderTask.kt +34 -4
  5. package/android/src/main/java/expo/modules/updates/manifest/BareUpdateManifest.kt +3 -3
  6. package/android/src/main/java/expo/modules/updates/statemachine/UpdatesStateEvent.kt +1 -1
  7. package/build/Updates.types.d.ts +54 -6
  8. package/build/Updates.types.d.ts.map +1 -1
  9. package/build/Updates.types.js +26 -0
  10. package/build/Updates.types.js.map +1 -1
  11. package/e2e/fixtures/App-apitest.tsx +7 -4
  12. package/e2e/fixtures/project_files/eas-hooks/eas-build-on-success.sh +7 -1
  13. package/e2e/fixtures/project_files/eas-hooks/eas-build-pre-install.sh +0 -3
  14. package/e2e/setup/create-eas-project-tv.js +30 -0
  15. package/e2e/setup/create-eas-project.js +1 -1
  16. package/e2e/setup/create-updates-test.js +0 -1
  17. package/e2e/setup/project.js +40 -12
  18. package/ios/EXUpdates/ASN1Decoder/ASN1Decoder.swift +272 -0
  19. package/ios/EXUpdates/ASN1Decoder/ASN1DistinguishedNames.swift +114 -0
  20. package/ios/EXUpdates/ASN1Decoder/ASN1Encoder.swift +60 -0
  21. package/ios/EXUpdates/ASN1Decoder/ASN1Identifier.swift +102 -0
  22. package/ios/EXUpdates/ASN1Decoder/ASN1Object.swift +107 -0
  23. package/ios/EXUpdates/ASN1Decoder/OID.swift +97 -0
  24. package/ios/EXUpdates/ASN1Decoder/PKCS7.swift +98 -0
  25. package/ios/EXUpdates/ASN1Decoder/PKCS7_AppleReceipt.swift +210 -0
  26. package/ios/EXUpdates/ASN1Decoder/PKCS7_Signature.swift +108 -0
  27. package/ios/EXUpdates/ASN1Decoder/README.md +161 -0
  28. package/ios/EXUpdates/ASN1Decoder/X509Certificate.swift +361 -0
  29. package/ios/EXUpdates/ASN1Decoder/X509Extension.swift +71 -0
  30. package/ios/EXUpdates/ASN1Decoder/X509ExtensionAltName.swift +86 -0
  31. package/ios/EXUpdates/ASN1Decoder/X509ExtensionClasses.swift +183 -0
  32. package/ios/EXUpdates/ASN1Decoder/X509PublicKey.swift +77 -0
  33. package/ios/EXUpdates/AppController.swift +1 -1
  34. package/ios/EXUpdates/AppLoader/AppLoader.swift +20 -20
  35. package/ios/EXUpdates/AppLoader/AppLoaderTask.swift +32 -6
  36. package/ios/EXUpdates/AppLoader/Crypto.swift +0 -1
  37. package/ios/EXUpdates/AppLoader/EmbeddedAppLoader.swift +1 -1
  38. package/ios/EXUpdates/AppLoader/FileDownloader.swift +9 -9
  39. package/ios/EXUpdates/AppLoader/RemoteAppLoader.swift +4 -4
  40. package/ios/EXUpdates/AppLoader/ResponseHeaderData.swift +3 -3
  41. package/ios/EXUpdates/AppLoader/UpdateResponse.swift +10 -10
  42. package/ios/EXUpdates/CodeSigning/CertificateChain.swift +0 -1
  43. package/ios/EXUpdates/CodeSigning/CodeSigningConfiguration.swift +0 -1
  44. package/ios/EXUpdates/ErrorRecovery.swift +2 -2
  45. package/ios/EXUpdates/Logging/UpdatesLogReader.swift +0 -1
  46. package/ios/EXUpdates/Update/BareUpdate.swift +2 -2
  47. package/ios/EXUpdates/Update/LegacyUpdate.swift +2 -2
  48. package/ios/EXUpdates/Update/NewUpdate.swift +2 -2
  49. package/ios/EXUpdates/Update/Update.swift +1 -1
  50. package/ios/EXUpdates/UpdatesConfig.swift +1 -1
  51. package/ios/EXUpdates/UpdatesModule.swift +12 -1
  52. package/ios/EXUpdates/UpdatesUtils.swift +57 -9
  53. package/ios/EXUpdates.podspec +1 -2
  54. package/package.json +7 -7
  55. package/src/Updates.types.ts +59 -8
  56. package/e2e/fixtures/project_files/xcode.env.local +0 -4
package/CHANGELOG.md CHANGED
@@ -10,6 +10,23 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.21.0 — 2023-09-15
14
+
15
+ ### 🎉 New features
16
+
17
+ - Added support for Apple tvOS. ([#24329](https://github.com/expo/expo/pull/24329) by [@douglowder](https://github.com/douglowder))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fix updates enabled defaulting on iOS. ([#24327](https://github.com/expo/expo/pull/24327) by [@wschurman](https://github.com/wschurman))
22
+ - [Android] Make scopekey only required when getting database entity. ([#24466](https://github.com/expo/expo/pull/24466) by [@wschurman](https://github.com/wschurman))
23
+
24
+ ### 💡 Others
25
+
26
+ - Update E2E test. ([#24272](https://github.com/expo/expo/pull/24272) by [@EvanBacon](https://github.com/EvanBacon))
27
+ - [iOS] Disable packager and bundle JS when `EX_UPDATES_NATIVE_DEBUG` set. ([#24366](https://github.com/expo/expo/pull/24366) by [@douglowder](https://github.com/douglowder))
28
+ - Add Apple TV to Updates E2E (build only). ([#24411](https://github.com/expo/expo/pull/24411) by [@douglowder](https://github.com/douglowder))
29
+
13
30
  ## 0.20.0 — 2023-09-04
14
31
 
15
32
  ### 🛠 Breaking changes
@@ -28,6 +45,7 @@
28
45
  - [Android] Fixed the `node` execution on Windows. ([#23983](https://github.com/expo/expo/pull/23983) by [@kudo](https://github.com/kudo))
29
46
  - Bare update manifest non-nullability parity. ([#23166](https://github.com/expo/expo/pull/23166) by [@wschurman](https://github.com/wschurman))
30
47
  - Support importing assets from out of the project root when working in monorepos. ([#24090](https://github.com/expo/expo/pull/24090) by [@EvanBacon](https://github.com/EvanBacon))
48
+ - Prevent failed updates from passing checkForUpdateAsync(). ([#24112](https://github.com/expo/expo/pull/24112) by [@douglowder](https://github.com/douglowder))
31
49
 
32
50
  ## 0.19.1 — 2023-08-02
33
51
 
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-kapt'
4
4
  apply plugin: 'maven-publish'
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '0.20.0'
7
+ version = '0.21.0'
8
8
 
9
9
  // Utility method to derive boolean values from the environment or from Java properties,
10
10
  // and return them as strings to be used in BuildConfig fields
@@ -98,7 +98,7 @@ android {
98
98
  minSdkVersion safeExtGet("minSdkVersion", 21)
99
99
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
100
100
  versionCode 31
101
- versionName '0.20.0'
101
+ versionName '0.21.0'
102
102
  consumerProguardFiles("proguard-rules.pro")
103
103
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
104
104
 
@@ -27,7 +27,6 @@ import expo.modules.updates.manifest.UpdateManifest
27
27
 
28
28
  // these unused imports must stay because of versioning
29
29
  /* ktlint-disable no-unused-imports */
30
- import expo.modules.updates.UpdatesConfiguration
31
30
 
32
31
  /* ktlint-enable no-unused-imports */
33
32
 
@@ -199,13 +198,23 @@ class UpdatesModule(
199
198
  if (updateDirective != null) {
200
199
  if (updateDirective is UpdateDirective.RollBackToEmbeddedUpdateDirective) {
201
200
  if (!updatesServiceLocal.configuration.hasEmbeddedUpdate) {
202
- promise.resolveWithCheckForUpdateAsyncResult(CheckForUpdateAsyncResult.NoUpdateAvailable(), updatesServiceLocal)
201
+ promise.resolveWithCheckForUpdateAsyncResult(
202
+ CheckForUpdateAsyncResult.NoUpdateAvailable(
203
+ LoaderTask.RemoteCheckResultNotAvailableReason.ROLLBACK_NO_EMBEDDED
204
+ ),
205
+ updatesServiceLocal
206
+ )
203
207
  return
204
208
  }
205
209
 
206
210
  val embeddedUpdate = EmbeddedManifest.get(context, updatesServiceLocal.configuration)!!.updateEntity
207
211
  if (embeddedUpdate == null) {
208
- promise.resolveWithCheckForUpdateAsyncResult(CheckForUpdateAsyncResult.NoUpdateAvailable(), updatesServiceLocal)
212
+ promise.resolveWithCheckForUpdateAsyncResult(
213
+ CheckForUpdateAsyncResult.NoUpdateAvailable(
214
+ LoaderTask.RemoteCheckResultNotAvailableReason.ROLLBACK_NO_EMBEDDED
215
+ ),
216
+ updatesServiceLocal
217
+ )
209
218
  return
210
219
  }
211
220
 
@@ -216,7 +225,12 @@ class UpdatesModule(
216
225
  updateResponse.responseHeaderData?.manifestFilters
217
226
  )
218
227
  ) {
219
- promise.resolveWithCheckForUpdateAsyncResult(CheckForUpdateAsyncResult.NoUpdateAvailable(), updatesServiceLocal)
228
+ promise.resolveWithCheckForUpdateAsyncResult(
229
+ CheckForUpdateAsyncResult.NoUpdateAvailable(
230
+ LoaderTask.RemoteCheckResultNotAvailableReason.ROLLBACK_REJECTED_BY_SELECTION_POLICY
231
+ ),
232
+ updatesServiceLocal
233
+ )
220
234
  return
221
235
  }
222
236
 
@@ -226,7 +240,12 @@ class UpdatesModule(
226
240
  }
227
241
 
228
242
  if (updateManifest == null) {
229
- promise.resolveWithCheckForUpdateAsyncResult(CheckForUpdateAsyncResult.NoUpdateAvailable(), updatesServiceLocal)
243
+ promise.resolveWithCheckForUpdateAsyncResult(
244
+ CheckForUpdateAsyncResult.NoUpdateAvailable(
245
+ LoaderTask.RemoteCheckResultNotAvailableReason.NO_UPDATE_AVAILABLE_ON_SERVER
246
+ ),
247
+ updatesServiceLocal
248
+ )
230
249
  return
231
250
  }
232
251
 
@@ -237,15 +256,43 @@ class UpdatesModule(
237
256
  return
238
257
  }
239
258
 
259
+ var shouldLaunch = false
260
+ var failedPreviously = false
240
261
  if (updatesServiceLocal.selectionPolicy.shouldLoadNewUpdate(
241
262
  updateManifest.updateEntity,
242
263
  launchedUpdate,
243
264
  updateResponse.responseHeaderData?.manifestFilters
244
265
  )
245
266
  ) {
267
+ // If "update" has failed to launch previously, then
268
+ // "launchedUpdate" will be an earlier update, and the test above
269
+ // will return true (incorrectly).
270
+ // We check to see if the new update is already in the DB, and if so,
271
+ // only allow the update if it has had no launch failures.
272
+ shouldLaunch = true
273
+ updateManifest.updateEntity?.let { updateEntity ->
274
+ val storedUpdateEntity = updatesServiceLocal.databaseHolder.database.updateDao().loadUpdateWithId(
275
+ updateEntity.id
276
+ )
277
+ updatesServiceLocal.databaseHolder.releaseDatabase()
278
+ storedUpdateEntity?.let { storedUpdateEntity ->
279
+ shouldLaunch = storedUpdateEntity.failedLaunchCount == 0
280
+ logger.info("Stored update found: ID = ${updateEntity.id}, failureCount = ${storedUpdateEntity.failedLaunchCount}")
281
+ failedPreviously = !shouldLaunch
282
+ }
283
+ }
284
+ }
285
+ if (shouldLaunch) {
246
286
  promise.resolveWithCheckForUpdateAsyncResult(CheckForUpdateAsyncResult.UpdateAvailable(updateManifest), updatesServiceLocal)
247
287
  } else {
248
- promise.resolveWithCheckForUpdateAsyncResult(CheckForUpdateAsyncResult.NoUpdateAvailable(), updatesServiceLocal)
288
+ val reason = when (failedPreviously) {
289
+ true -> LoaderTask.RemoteCheckResultNotAvailableReason.UPDATE_PREVIOUSLY_FAILED
290
+ else -> LoaderTask.RemoteCheckResultNotAvailableReason.UPDATE_REJECTED_BY_SELECTION_POLICY
291
+ }
292
+ promise.resolveWithCheckForUpdateAsyncResult(
293
+ CheckForUpdateAsyncResult.NoUpdateAvailable(reason),
294
+ updatesServiceLocal
295
+ )
249
296
  }
250
297
  }
251
298
  }
@@ -266,7 +313,7 @@ class UpdatesModule(
266
313
  ROLL_BACK_TO_EMBEDDED
267
314
  }
268
315
 
269
- class NoUpdateAvailable : CheckForUpdateAsyncResult(Status.NO_UPDATE_AVAILABLE)
316
+ class NoUpdateAvailable(val reason: LoaderTask.RemoteCheckResultNotAvailableReason) : CheckForUpdateAsyncResult(Status.NO_UPDATE_AVAILABLE)
270
317
  class UpdateAvailable(val updateManifest: UpdateManifest) : CheckForUpdateAsyncResult(Status.UPDATE_AVAILABLE)
271
318
  class RollBackToEmbedded(val commitTime: Date) : CheckForUpdateAsyncResult(Status.ROLL_BACK_TO_EMBEDDED)
272
319
  }
@@ -278,6 +325,7 @@ class UpdatesModule(
278
325
  is CheckForUpdateAsyncResult.NoUpdateAvailable -> {
279
326
  putBoolean("isRollBackToEmbedded", false)
280
327
  putBoolean("isAvailable", false)
328
+ putString("reason", checkForUpdateAsyncResult.reason.value)
281
329
  }
282
330
 
283
331
  is CheckForUpdateAsyncResult.RollBackToEmbedded -> {
@@ -54,6 +54,32 @@ class LoaderTask(
54
54
  ERROR, NO_UPDATE_AVAILABLE, UPDATE_AVAILABLE
55
55
  }
56
56
 
57
+ enum class RemoteCheckResultNotAvailableReason(val value: String) {
58
+ /**
59
+ * No update manifest or rollback directive received from the update server.
60
+ */
61
+ NO_UPDATE_AVAILABLE_ON_SERVER("noUpdateAvailableOnServer"),
62
+ /**
63
+ * An update manifest was received from the update server, but the update is not launchable,
64
+ * or does not pass the configured selection policy.
65
+ */
66
+ UPDATE_REJECTED_BY_SELECTION_POLICY("updateRejectedBySelectionPolicy"),
67
+ /**
68
+ * An update manifest was received from the update server, but the update has been previously
69
+ * launched on this device and never successfully launched.
70
+ */
71
+ UPDATE_PREVIOUSLY_FAILED("updatePreviouslyFailed"),
72
+ /**
73
+ * A rollback directive was received from the update server, but the directive does not pass
74
+ * the configured selection policy.
75
+ */
76
+ ROLLBACK_REJECTED_BY_SELECTION_POLICY("rollbackRejectedBySelectionPolicy"),
77
+ /**
78
+ * A rollback directive was received from the update server, but this app has no embedded update.
79
+ */
80
+ ROLLBACK_NO_EMBEDDED("rollbackNoEmbeddedConfiguration"),
81
+ }
82
+
57
83
  sealed class RemoteCheckResult(private val status: Status) {
58
84
  private enum class Status {
59
85
  NO_UPDATE_AVAILABLE,
@@ -61,7 +87,7 @@ class LoaderTask(
61
87
  ROLL_BACK_TO_EMBEDDED
62
88
  }
63
89
 
64
- class NoUpdateAvailable : RemoteCheckResult(Status.NO_UPDATE_AVAILABLE)
90
+ class NoUpdateAvailable(val reason: RemoteCheckResultNotAvailableReason) : RemoteCheckResult(Status.NO_UPDATE_AVAILABLE)
65
91
  class UpdateAvailable(val manifest: JSONObject) : RemoteCheckResult(Status.UPDATE_AVAILABLE)
66
92
  class RollBackToEmbedded(val commitTime: Date) : RemoteCheckResult(Status.ROLL_BACK_TO_EMBEDDED)
67
93
  }
@@ -341,7 +367,7 @@ class LoaderTask(
341
367
  }
342
368
  is UpdateDirective.NoUpdateAvailableUpdateDirective -> {
343
369
  isUpToDate = true
344
- callback.onRemoteCheckForUpdateFinished(RemoteCheckResult.NoUpdateAvailable())
370
+ callback.onRemoteCheckForUpdateFinished(RemoteCheckResult.NoUpdateAvailable(RemoteCheckResultNotAvailableReason.NO_UPDATE_AVAILABLE_ON_SERVER))
345
371
  Loader.OnUpdateResponseLoadedResult(shouldDownloadManifestIfPresentInResponse = false)
346
372
  }
347
373
  }
@@ -350,7 +376,7 @@ class LoaderTask(
350
376
  val updateManifest = updateResponse.manifestUpdateResponsePart?.updateManifest
351
377
  if (updateManifest == null) {
352
378
  isUpToDate = true
353
- callback.onRemoteCheckForUpdateFinished(RemoteCheckResult.NoUpdateAvailable())
379
+ callback.onRemoteCheckForUpdateFinished(RemoteCheckResult.NoUpdateAvailable(RemoteCheckResultNotAvailableReason.NO_UPDATE_AVAILABLE_ON_SERVER))
354
380
  return Loader.OnUpdateResponseLoadedResult(shouldDownloadManifestIfPresentInResponse = false)
355
381
  }
356
382
 
@@ -367,7 +393,11 @@ class LoaderTask(
367
393
  Loader.OnUpdateResponseLoadedResult(shouldDownloadManifestIfPresentInResponse = true)
368
394
  } else {
369
395
  isUpToDate = true
370
- callback.onRemoteCheckForUpdateFinished(RemoteCheckResult.NoUpdateAvailable())
396
+ callback.onRemoteCheckForUpdateFinished(
397
+ RemoteCheckResult.NoUpdateAvailable(
398
+ RemoteCheckResultNotAvailableReason.UPDATE_REJECTED_BY_SELECTION_POLICY
399
+ )
400
+ )
371
401
  Loader.OnUpdateResponseLoadedResult(shouldDownloadManifestIfPresentInResponse = false)
372
402
  }
373
403
  }
@@ -22,13 +22,13 @@ import java.util.*
22
22
  class BareUpdateManifest private constructor(
23
23
  override val manifest: BareManifest,
24
24
  private val mId: UUID,
25
- private val mScopeKey: String,
25
+ private val mScopeKey: String?,
26
26
  private val mCommitTime: Date,
27
27
  private val mRuntimeVersion: String,
28
28
  private val mAssets: JSONArray?
29
29
  ) : UpdateManifest {
30
30
  override val updateEntity: UpdateEntity by lazy {
31
- UpdateEntity(mId, mCommitTime, mRuntimeVersion, mScopeKey, this@BareUpdateManifest.manifest.getRawJson()).apply {
31
+ UpdateEntity(mId, mCommitTime, mRuntimeVersion, mScopeKey!!, this@BareUpdateManifest.manifest.getRawJson()).apply {
32
32
  status = UpdateStatus.EMBEDDED
33
33
  }
34
34
  }
@@ -94,7 +94,7 @@ class BareUpdateManifest private constructor(
94
94
  return BareUpdateManifest(
95
95
  manifest,
96
96
  id,
97
- configuration.scopeKey!!,
97
+ configuration.scopeKey,
98
98
  commitTime,
99
99
  runtimeVersion,
100
100
  assets
@@ -21,7 +21,7 @@ sealed class UpdatesStateEvent(val type: UpdatesStateEventType) {
21
21
  return UpdatesStateError(errorMessage)
22
22
  }
23
23
  }
24
- class CheckCompleteUnavailable : UpdatesStateEvent(UpdatesStateEventType.CheckCompleteUnavailable)
24
+ class CheckCompleteUnavailable() : UpdatesStateEvent(UpdatesStateEventType.CheckCompleteUnavailable)
25
25
  class CheckCompleteWithUpdate(val manifest: JSONObject) : UpdatesStateEvent(UpdatesStateEventType.CheckCompleteAvailable)
26
26
  class CheckCompleteWithRollback(val commitTime: Date) : UpdatesStateEvent(UpdatesStateEventType.CheckCompleteAvailable)
27
27
  class DownloadComplete : UpdatesStateEvent(UpdatesStateEventType.DownloadComplete)
@@ -19,7 +19,35 @@ export declare enum UpdateEventType {
19
19
  */
20
20
  ERROR = "error"
21
21
  }
22
- type UpdateCheckResultRollBackToEmbedded = {
22
+ declare enum UpdateCheckResultNotAvailableReason {
23
+ /**
24
+ * No update manifest or rollback directive received from the update server.
25
+ */
26
+ NO_UPDATE_AVAILABLE_ON_SERVER = "noUpdateAvailableOnServer",
27
+ /**
28
+ * An update manifest was received from the update server, but the update is not launchable,
29
+ * or does not pass the configured selection policy.
30
+ */
31
+ UPDATE_REJECTED_BY_SELECTION_POLICY = "updateRejectedBySelectionPolicy",
32
+ /**
33
+ * An update manifest was received from the update server, but the update has been previously
34
+ * launched on this device and never successfully launched.
35
+ */
36
+ UPDATE_PREVIOUSLY_FAILED = "updatePreviouslyFailed",
37
+ /**
38
+ * A rollback directive was received from the update server, but the directive does not pass
39
+ * the configured selection policy.
40
+ */
41
+ ROLLBACK_REJECTED_BY_SELECTION_POLICY = "rollbackRejectedBySelectionPolicy",
42
+ /**
43
+ * A rollback directive was received from the update server, but this app has no embedded update.
44
+ */
45
+ ROLLBACK_NO_EMBEDDED = "rollbackNoEmbeddedConfiguration"
46
+ }
47
+ /**
48
+ * The update check result when a rollback directive is received.
49
+ */
50
+ export type UpdateCheckResultRollBack = {
23
51
  /**
24
52
  * Whether an update is available. This property is false for a roll back update.
25
53
  */
@@ -32,11 +60,15 @@ type UpdateCheckResultRollBackToEmbedded = {
32
60
  * Whether a roll back to embedded update is available.
33
61
  */
34
62
  isRollBackToEmbedded: true;
63
+ /**
64
+ * If no new update is found, this contains one of several enum values indicating the reason.
65
+ */
66
+ reason: undefined;
35
67
  };
36
68
  /**
37
- * The successful result of checking for a new update.
69
+ * The update check result when a new update is found on the server.
38
70
  */
39
- export type UpdateCheckResultSuccess = {
71
+ export type UpdateCheckResultAvailable = {
40
72
  /**
41
73
  * Whether an update is available. This property is false for a roll back update.
42
74
  */
@@ -49,11 +81,15 @@ export type UpdateCheckResultSuccess = {
49
81
  * Whether a roll back to embedded update is available.
50
82
  */
51
83
  isRollBackToEmbedded: false;
84
+ /**
85
+ * If no new update is found, this contains one of several enum values indicating the reason.
86
+ */
87
+ reason: undefined;
52
88
  };
53
89
  /**
54
- * The failed result of checking for a new update.
90
+ * The update check result if no new update was found.
55
91
  */
56
- export type UpdateCheckResultFailure = {
92
+ export type UpdateCheckResultNotAvailable = {
57
93
  /**
58
94
  * Whether an update is available. This property is false for a roll back update.
59
95
  */
@@ -66,11 +102,23 @@ export type UpdateCheckResultFailure = {
66
102
  * Whether a roll back to embedded update is available.
67
103
  */
68
104
  isRollBackToEmbedded: false;
105
+ /**
106
+ * If no new update is found, this contains one of several enum values indicating the reason.
107
+ */
108
+ reason: UpdateCheckResultNotAvailableReason;
69
109
  };
70
110
  /**
71
111
  * The result of checking for a new update.
72
112
  */
73
- export type UpdateCheckResult = UpdateCheckResultRollBackToEmbedded | UpdateCheckResultSuccess | UpdateCheckResultFailure;
113
+ export type UpdateCheckResult = UpdateCheckResultRollBack | UpdateCheckResultAvailable | UpdateCheckResultNotAvailable;
114
+ /**
115
+ * @deprecated
116
+ */
117
+ export type UpdateCheckResultSuccess = UpdateCheckResultAvailable;
118
+ /**
119
+ * @deprecated
120
+ */
121
+ export type UpdateCheckResultFailure = UpdateCheckResultNotAvailable;
74
122
  /**
75
123
  * The successful result of fetching a new update.
76
124
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.types.d.ts","sourceRoot":"","sources":["../src/Updates.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAC;AAElD;;GAEG;AACH,oBAAY,eAAe;IACzB;;;;OAIG;IACH,gBAAgB,oBAAoB;IACpC;;OAEG;IACH,mBAAmB,sBAAsB;IACzC;;OAEG;IACH,KAAK,UAAU;CAChB;AAED,KAAK,mCAAmC,GAAG;IACzC;;OAEG;IACH,WAAW,EAAE,KAAK,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,oBAAoB,EAAE,IAAI,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;OAEG;IACH,oBAAoB,EAAE,KAAK,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,WAAW,EAAE,KAAK,CAAC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BAAiB,EAAE,OAAO,CAAC;IAC3B,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,kBAAkB,CAAC,EAAE,QAAQ,CAAC;IAC9B,QAAQ,CAAC,EAAE,0BAA0B,CAAC;IACtC,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,sBAAsB,CAAC,EAAE,IAAI,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAE1C,OAAO,EAAE,gCAAgC,CAAC;CAC3C,CAAC"}
@@ -18,6 +18,32 @@ export var UpdateEventType;
18
18
  */
19
19
  UpdateEventType["ERROR"] = "error";
20
20
  })(UpdateEventType || (UpdateEventType = {}));
21
+ var UpdateCheckResultNotAvailableReason;
22
+ (function (UpdateCheckResultNotAvailableReason) {
23
+ /**
24
+ * No update manifest or rollback directive received from the update server.
25
+ */
26
+ UpdateCheckResultNotAvailableReason["NO_UPDATE_AVAILABLE_ON_SERVER"] = "noUpdateAvailableOnServer";
27
+ /**
28
+ * An update manifest was received from the update server, but the update is not launchable,
29
+ * or does not pass the configured selection policy.
30
+ */
31
+ UpdateCheckResultNotAvailableReason["UPDATE_REJECTED_BY_SELECTION_POLICY"] = "updateRejectedBySelectionPolicy";
32
+ /**
33
+ * An update manifest was received from the update server, but the update has been previously
34
+ * launched on this device and never successfully launched.
35
+ */
36
+ UpdateCheckResultNotAvailableReason["UPDATE_PREVIOUSLY_FAILED"] = "updatePreviouslyFailed";
37
+ /**
38
+ * A rollback directive was received from the update server, but the directive does not pass
39
+ * the configured selection policy.
40
+ */
41
+ UpdateCheckResultNotAvailableReason["ROLLBACK_REJECTED_BY_SELECTION_POLICY"] = "rollbackRejectedBySelectionPolicy";
42
+ /**
43
+ * A rollback directive was received from the update server, but this app has no embedded update.
44
+ */
45
+ UpdateCheckResultNotAvailableReason["ROLLBACK_NO_EMBEDDED"] = "rollbackNoEmbeddedConfiguration";
46
+ })(UpdateCheckResultNotAvailableReason || (UpdateCheckResultNotAvailableReason = {}));
21
47
  /**
22
48
  * The possible code values for expo-updates log entries
23
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.types.js","sourceRoot":"","sources":["../src/Updates.types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAN,IAAY,eAeX;AAfD,WAAY,eAAe;IACzB;;;;OAIG;IACH,uDAAoC,CAAA;IACpC;;OAEG;IACH,4DAAyC,CAAA;IACzC;;OAEG;IACH,kCAAe,CAAA;AACjB,CAAC,EAfW,eAAe,KAAf,eAAe,QAe1B;AAmLD;;GAEG;AACH,MAAM,CAAN,IAAY,mBAWX;AAXD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,kEAA2C,CAAA;IAC3C,+EAAwD,CAAA;IACxD,4EAAqD,CAAA;IACrD,iFAA0D,CAAA;IAC1D,2EAAoD,CAAA;IACpD,mEAA4C,CAAA;IAC5C,mEAA4C,CAAA;IAC5C,0DAAmC,CAAA;IACnC,0CAAmB,CAAA;AACrB,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,QAW9B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,uCAAe,CAAA;IACf,uCAAe,CAAA;IACf,qCAAa,CAAA;IACb,qCAAa,CAAA;IACb,uCAAe,CAAA;IACf,uCAAe,CAAA;AACjB,CAAC,EAPW,oBAAoB,KAApB,oBAAoB,QAO/B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,8BAiBX;AAjBD,WAAY,8BAA8B;IACxC;;OAEG;IACH,qDAAmB,CAAA;IACnB;;OAEG;IACH,yEAAuC,CAAA;IACvC;;OAEG;IACH,yDAAuB,CAAA;IACvB;;OAEG;IACH,iDAAe,CAAA;AACjB,CAAC,EAjBW,8BAA8B,KAA9B,8BAA8B,QAiBzC","sourcesContent":["import { NewManifest, BareManifest } from 'expo-manifests';\n\nexport type Manifest = NewManifest | BareManifest;\n\n/**\n * The types of update-related events.\n */\nexport enum UpdateEventType {\n /**\n * A new update has finished downloading to local storage. If you would like to start using this\n * update at any point before the user closes and restarts the app on their own, you can call\n * [`Updates.reloadAsync()`](#reloadasync) to launch this new update.\n */\n UPDATE_AVAILABLE = 'updateAvailable',\n /**\n * No updates are available, and the most up-to-date update is already running.\n */\n NO_UPDATE_AVAILABLE = 'noUpdateAvailable',\n /**\n * An error occurred trying to fetch the latest update.\n */\n ERROR = 'error',\n}\n\ntype UpdateCheckResultRollBackToEmbedded = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: false;\n /**\n * The manifest of the update when available.\n */\n manifest: undefined;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: true;\n};\n\n/**\n * The successful result of checking for a new update.\n */\nexport type UpdateCheckResultSuccess = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: true;\n /**\n * The manifest of the update when available.\n */\n manifest: Manifest;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The failed result of checking for a new update.\n */\nexport type UpdateCheckResultFailure = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: false;\n /**\n * The manifest of the update when available.\n */\n manifest: undefined;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The result of checking for a new update.\n */\nexport type UpdateCheckResult =\n | UpdateCheckResultRollBackToEmbedded\n | UpdateCheckResultSuccess\n | UpdateCheckResultFailure;\n\n/**\n * The successful result of fetching a new update.\n */\nexport type UpdateFetchResultSuccess = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * False when roll back to embedded is true.\n */\n isNew: true;\n /**\n * The manifest of the fetched update.\n */\n manifest: Manifest;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The failed result of fetching a new update.\n */\nexport type UpdateFetchResultFailure = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * False when roll back to embedded is true.\n */\n isNew: false;\n /**\n * The manifest of the fetched update.\n */\n manifest: undefined;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The roll back to embedded result of fetching a new update.\n */\ntype UpdateFetchResultRollBackToEmbedded = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * False when roll back to embedded is true.\n */\n isNew: false;\n /**\n * The manifest of the fetched update.\n */\n manifest: undefined;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: true;\n};\n\n/**\n * The result of fetching a new update.\n */\nexport type UpdateFetchResult =\n | UpdateFetchResultSuccess\n | UpdateFetchResultFailure\n | UpdateFetchResultRollBackToEmbedded;\n\n/**\n * An object that is passed into each event listener when an auto-update check occurs.\n */\nexport type UpdateEvent = {\n /**\n * Type of the event.\n */\n type: UpdateEventType;\n /**\n * If `type` is `Updates.UpdateEventType.UPDATE_AVAILABLE`, the manifest of the newly downloaded\n * update, and `undefined` otherwise.\n */\n manifest?: Manifest;\n /**\n * If `type` is `Updates.UpdateEventType.ERROR`, the error message, and `undefined` otherwise.\n */\n message?: string;\n};\n\n/**\n * An object representing a single log entry from expo-updates logging on the client.\n */\nexport type UpdatesLogEntry = {\n /**\n * The time the log was written, in milliseconds since Jan 1 1970 UTC.\n */\n timestamp: number;\n /**\n * The log entry message.\n */\n message: string;\n /**\n * One of the defined code values for expo-updates log entries.\n */\n code: UpdatesLogEntryCode;\n /**\n * One of the defined log level or severity values.\n */\n level: UpdatesLogEntryLevel;\n /**\n * If present, the unique ID of an update associated with this log entry.\n */\n updateId?: string;\n /**\n * If present, the unique ID or hash of an asset associated with this log entry.\n */\n assetId?: string;\n /**\n * If present, an iOS or Android native stack trace associated with this log entry.\n */\n stacktrace?: string[];\n};\n\n/**\n * The possible code values for expo-updates log entries\n */\nexport enum UpdatesLogEntryCode {\n NONE = 'None',\n NO_UPDATES_AVAILABLE = 'NoUpdatesAvailable',\n UPDATE_ASSETS_NOT_AVAILABLE = 'UpdateAssetsNotAvailable',\n UPDATE_SERVER_UNREACHABLE = 'UpdateServerUnreachable',\n UPDATE_HAS_INVALID_SIGNATURE = 'UpdateHasInvalidSignature',\n UPDATE_CODE_SIGNING_ERROR = 'UpdateCodeSigningError',\n UPDATE_FAILED_TO_LOAD = 'UpdateFailedToLoad',\n ASSETS_FAILED_TO_LOAD = 'AssetsFailedToLoad',\n JS_RUNTIME_ERROR = 'JSRuntimeError',\n UNKNOWN = 'Unknown',\n}\n\n/**\n * The possible log levels for expo-updates log entries\n */\nexport enum UpdatesLogEntryLevel {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n FATAL = 'fatal',\n}\n\n/**\n * The possible settings that determine if expo-updates will check for updates on app startup.\n * By default, Expo will check for updates every time the app is loaded. Set this to `ON_ERROR_RECOVERY` to disable automatic checking unless recovering from an error. Set this to `NEVER` to completely disable automatic checking. Must be one of `ON_LOAD` (default value), `ON_ERROR_RECOVERY`, `WIFI_ONLY`, or `NEVER`\n */\nexport enum UpdatesCheckAutomaticallyValue {\n /**\n * Checks for updates whenever the app is loaded. This is the default setting.\n */\n ON_LOAD = 'ON_LOAD',\n /**\n * Only checks for updates when the app starts up after an error recovery.\n */\n ON_ERROR_RECOVERY = 'ON_ERROR_RECOVERY',\n /**\n * Only checks for updates when the app starts and has a WiFi connection.\n */\n WIFI_ONLY = 'WIFI_ONLY',\n /**\n * Automatic update checks are off, and update checks must be done through the JS API.\n */\n NEVER = 'NEVER',\n}\n\n// @docsMissing\n/**\n * @hidden\n */\nexport type LocalAssets = Record<string, string>;\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateRollback = {\n // ISO date string with the rollback commit time\n commitTime: string;\n};\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateMachineContext = {\n // The native state machine context, either read directly from a native module method,\n // or received in a state change event. Used internally by this module and not exported publicly.\n isUpdateAvailable: boolean;\n isUpdatePending: boolean;\n isChecking: boolean;\n isDownloading: boolean;\n isRestarting: boolean;\n latestManifest?: Manifest;\n downloadedManifest?: Manifest;\n rollback?: UpdatesNativeStateRollback;\n checkError?: Error;\n downloadError?: Error;\n lastCheckForUpdateTime?: Date;\n};\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateChangeEvent = {\n // Change event emitted by native\n context: UpdatesNativeStateMachineContext;\n};\n"]}
1
+ {"version":3,"file":"Updates.types.js","sourceRoot":"","sources":["../src/Updates.types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,CAAN,IAAY,eAeX;AAfD,WAAY,eAAe;IACzB;;;;OAIG;IACH,uDAAoC,CAAA;IACpC;;OAEG;IACH,4DAAyC,CAAA;IACzC;;OAEG;IACH,kCAAe,CAAA;AACjB,CAAC,EAfW,eAAe,KAAf,eAAe,QAe1B;AAED,IAAK,mCAwBJ;AAxBD,WAAK,mCAAmC;IACtC;;OAEG;IACH,kGAA2D,CAAA;IAC3D;;;OAGG;IACH,8GAAuE,CAAA;IACvE;;;OAGG;IACH,0FAAmD,CAAA;IACnD;;;OAGG;IACH,kHAA2E,CAAA;IAC3E;;OAEG;IACH,+FAAwD,CAAA;AAC1D,CAAC,EAxBI,mCAAmC,KAAnC,mCAAmC,QAwBvC;AA4MD;;GAEG;AACH,MAAM,CAAN,IAAY,mBAWX;AAXD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,kEAA2C,CAAA;IAC3C,+EAAwD,CAAA;IACxD,4EAAqD,CAAA;IACrD,iFAA0D,CAAA;IAC1D,2EAAoD,CAAA;IACpD,mEAA4C,CAAA;IAC5C,mEAA4C,CAAA;IAC5C,0DAAmC,CAAA;IACnC,0CAAmB,CAAA;AACrB,CAAC,EAXW,mBAAmB,KAAnB,mBAAmB,QAW9B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,uCAAe,CAAA;IACf,uCAAe,CAAA;IACf,qCAAa,CAAA;IACb,qCAAa,CAAA;IACb,uCAAe,CAAA;IACf,uCAAe,CAAA;AACjB,CAAC,EAPW,oBAAoB,KAApB,oBAAoB,QAO/B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,8BAiBX;AAjBD,WAAY,8BAA8B;IACxC;;OAEG;IACH,qDAAmB,CAAA;IACnB;;OAEG;IACH,yEAAuC,CAAA;IACvC;;OAEG;IACH,yDAAuB,CAAA;IACvB;;OAEG;IACH,iDAAe,CAAA;AACjB,CAAC,EAjBW,8BAA8B,KAA9B,8BAA8B,QAiBzC","sourcesContent":["import { NewManifest, BareManifest } from 'expo-manifests';\n\nexport type Manifest = NewManifest | BareManifest;\n\n/**\n * The types of update-related events.\n */\nexport enum UpdateEventType {\n /**\n * A new update has finished downloading to local storage. If you would like to start using this\n * update at any point before the user closes and restarts the app on their own, you can call\n * [`Updates.reloadAsync()`](#reloadasync) to launch this new update.\n */\n UPDATE_AVAILABLE = 'updateAvailable',\n /**\n * No updates are available, and the most up-to-date update is already running.\n */\n NO_UPDATE_AVAILABLE = 'noUpdateAvailable',\n /**\n * An error occurred trying to fetch the latest update.\n */\n ERROR = 'error',\n}\n\nenum UpdateCheckResultNotAvailableReason {\n /**\n * No update manifest or rollback directive received from the update server.\n */\n NO_UPDATE_AVAILABLE_ON_SERVER = 'noUpdateAvailableOnServer',\n /**\n * An update manifest was received from the update server, but the update is not launchable,\n * or does not pass the configured selection policy.\n */\n UPDATE_REJECTED_BY_SELECTION_POLICY = 'updateRejectedBySelectionPolicy',\n /**\n * An update manifest was received from the update server, but the update has been previously\n * launched on this device and never successfully launched.\n */\n UPDATE_PREVIOUSLY_FAILED = 'updatePreviouslyFailed',\n /**\n * A rollback directive was received from the update server, but the directive does not pass\n * the configured selection policy.\n */\n ROLLBACK_REJECTED_BY_SELECTION_POLICY = 'rollbackRejectedBySelectionPolicy',\n /**\n * A rollback directive was received from the update server, but this app has no embedded update.\n */\n ROLLBACK_NO_EMBEDDED = 'rollbackNoEmbeddedConfiguration',\n}\n\n/**\n * The update check result when a rollback directive is received.\n */\nexport type UpdateCheckResultRollBack = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: false;\n /**\n * The manifest of the update when available.\n */\n manifest: undefined;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: true;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: undefined;\n};\n\n/**\n * The update check result when a new update is found on the server.\n */\nexport type UpdateCheckResultAvailable = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: true;\n /**\n * The manifest of the update when available.\n */\n manifest: Manifest;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: false;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: undefined;\n};\n\n/**\n * The update check result if no new update was found.\n */\nexport type UpdateCheckResultNotAvailable = {\n /**\n * Whether an update is available. This property is false for a roll back update.\n */\n isAvailable: false;\n /**\n * The manifest of the update when available.\n */\n manifest: undefined;\n /**\n * Whether a roll back to embedded update is available.\n */\n isRollBackToEmbedded: false;\n /**\n * If no new update is found, this contains one of several enum values indicating the reason.\n */\n reason: UpdateCheckResultNotAvailableReason;\n};\n\n/**\n * The result of checking for a new update.\n */\nexport type UpdateCheckResult =\n | UpdateCheckResultRollBack\n | UpdateCheckResultAvailable\n | UpdateCheckResultNotAvailable;\n\n/**\n * @deprecated\n */\nexport type UpdateCheckResultSuccess = UpdateCheckResultAvailable;\n\n/**\n * @deprecated\n */\nexport type UpdateCheckResultFailure = UpdateCheckResultNotAvailable;\n\n/**\n * The successful result of fetching a new update.\n */\nexport type UpdateFetchResultSuccess = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * False when roll back to embedded is true.\n */\n isNew: true;\n /**\n * The manifest of the fetched update.\n */\n manifest: Manifest;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The failed result of fetching a new update.\n */\nexport type UpdateFetchResultFailure = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * False when roll back to embedded is true.\n */\n isNew: false;\n /**\n * The manifest of the fetched update.\n */\n manifest: undefined;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: false;\n};\n\n/**\n * The roll back to embedded result of fetching a new update.\n */\ntype UpdateFetchResultRollBackToEmbedded = {\n /**\n * Whether the fetched update is new (that is, a different version than what's currently running).\n * False when roll back to embedded is true.\n */\n isNew: false;\n /**\n * The manifest of the fetched update.\n */\n manifest: undefined;\n /**\n * Whether the fetched update is a roll back to the embedded update.\n */\n isRollBackToEmbedded: true;\n};\n\n/**\n * The result of fetching a new update.\n */\nexport type UpdateFetchResult =\n | UpdateFetchResultSuccess\n | UpdateFetchResultFailure\n | UpdateFetchResultRollBackToEmbedded;\n\n/**\n * An object that is passed into each event listener when an auto-update check occurs.\n */\nexport type UpdateEvent = {\n /**\n * Type of the event.\n */\n type: UpdateEventType;\n /**\n * If `type` is `Updates.UpdateEventType.UPDATE_AVAILABLE`, the manifest of the newly downloaded\n * update, and `undefined` otherwise.\n */\n manifest?: Manifest;\n /**\n * If `type` is `Updates.UpdateEventType.ERROR`, the error message, and `undefined` otherwise.\n */\n message?: string;\n};\n\n/**\n * An object representing a single log entry from expo-updates logging on the client.\n */\nexport type UpdatesLogEntry = {\n /**\n * The time the log was written, in milliseconds since Jan 1 1970 UTC.\n */\n timestamp: number;\n /**\n * The log entry message.\n */\n message: string;\n /**\n * One of the defined code values for expo-updates log entries.\n */\n code: UpdatesLogEntryCode;\n /**\n * One of the defined log level or severity values.\n */\n level: UpdatesLogEntryLevel;\n /**\n * If present, the unique ID of an update associated with this log entry.\n */\n updateId?: string;\n /**\n * If present, the unique ID or hash of an asset associated with this log entry.\n */\n assetId?: string;\n /**\n * If present, an iOS or Android native stack trace associated with this log entry.\n */\n stacktrace?: string[];\n};\n\n/**\n * The possible code values for expo-updates log entries\n */\nexport enum UpdatesLogEntryCode {\n NONE = 'None',\n NO_UPDATES_AVAILABLE = 'NoUpdatesAvailable',\n UPDATE_ASSETS_NOT_AVAILABLE = 'UpdateAssetsNotAvailable',\n UPDATE_SERVER_UNREACHABLE = 'UpdateServerUnreachable',\n UPDATE_HAS_INVALID_SIGNATURE = 'UpdateHasInvalidSignature',\n UPDATE_CODE_SIGNING_ERROR = 'UpdateCodeSigningError',\n UPDATE_FAILED_TO_LOAD = 'UpdateFailedToLoad',\n ASSETS_FAILED_TO_LOAD = 'AssetsFailedToLoad',\n JS_RUNTIME_ERROR = 'JSRuntimeError',\n UNKNOWN = 'Unknown',\n}\n\n/**\n * The possible log levels for expo-updates log entries\n */\nexport enum UpdatesLogEntryLevel {\n TRACE = 'trace',\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n FATAL = 'fatal',\n}\n\n/**\n * The possible settings that determine if expo-updates will check for updates on app startup.\n * By default, Expo will check for updates every time the app is loaded. Set this to `ON_ERROR_RECOVERY` to disable automatic checking unless recovering from an error. Set this to `NEVER` to completely disable automatic checking. Must be one of `ON_LOAD` (default value), `ON_ERROR_RECOVERY`, `WIFI_ONLY`, or `NEVER`\n */\nexport enum UpdatesCheckAutomaticallyValue {\n /**\n * Checks for updates whenever the app is loaded. This is the default setting.\n */\n ON_LOAD = 'ON_LOAD',\n /**\n * Only checks for updates when the app starts up after an error recovery.\n */\n ON_ERROR_RECOVERY = 'ON_ERROR_RECOVERY',\n /**\n * Only checks for updates when the app starts and has a WiFi connection.\n */\n WIFI_ONLY = 'WIFI_ONLY',\n /**\n * Automatic update checks are off, and update checks must be done through the JS API.\n */\n NEVER = 'NEVER',\n}\n\n// @docsMissing\n/**\n * @hidden\n */\nexport type LocalAssets = Record<string, string>;\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateRollback = {\n // ISO date string with the rollback commit time\n commitTime: string;\n};\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateMachineContext = {\n // The native state machine context, either read directly from a native module method,\n // or received in a state change event. Used internally by this module and not exported publicly.\n isUpdateAvailable: boolean;\n isUpdatePending: boolean;\n isChecking: boolean;\n isDownloading: boolean;\n isRestarting: boolean;\n latestManifest?: Manifest;\n downloadedManifest?: Manifest;\n rollback?: UpdatesNativeStateRollback;\n checkError?: Error;\n downloadError?: Error;\n lastCheckForUpdateTime?: Date;\n};\n\n/**\n * @hidden\n */\nexport type UpdatesNativeStateChangeEvent = {\n // Change event emitted by native\n context: UpdatesNativeStateMachineContext;\n};\n"]}
@@ -31,12 +31,12 @@ export default function App() {
31
31
  function UpdatesStatusView(props: { index: number }) {
32
32
  const [updateMessage, setUpdateMessage] = React.useState('');
33
33
  const [isRollback, setIsRollback] = React.useState(false);
34
+ const [noUpdateReason, setNoUpdateReason] = React.useState('');
34
35
 
35
36
  // Displays a message showing whether or not the app is running
36
37
  // a downloaded update
37
38
  const runTypeMessage =
38
- `isEmbeddedLaunch = ${Updates.isEmbeddedLaunch}\n` +
39
- `isUsingEmbeddedAssets = ${Updates.isUsingEmbeddedAssets}`;
39
+ `isEmbeddedLaunch = ${Updates.isEmbeddedLaunch}\n` + `noUpdateReason = ${noUpdateReason}`;
40
40
 
41
41
  const checkAutomaticallyMessage = `Automatic check setting = ${Updates.checkAutomatically}`;
42
42
 
@@ -53,7 +53,6 @@ function UpdatesStatusView(props: { index: number }) {
53
53
 
54
54
  useEffect(() => {
55
55
  const handleAsync = async () => {
56
- const state = await Updates.getNativeStateMachineContextAsync();
57
56
  setIsRollback(availableUpdate?.type === Updates.UpdateInfoType.ROLLBACK);
58
57
  };
59
58
  if (isUpdateAvailable) {
@@ -111,7 +110,11 @@ function UpdatesStatusView(props: { index: number }) {
111
110
  }, [isUpdatePending]);
112
111
 
113
112
  const handleCheckButtonPress = () => {
114
- Updates.checkForUpdateAsync();
113
+ Updates.checkForUpdateAsync().then((result) => {
114
+ if (result.isAvailable === false) {
115
+ setNoUpdateReason(result.reason ?? '');
116
+ }
117
+ });
115
118
  };
116
119
 
117
120
  const handleDownloadButtonPress = () => {
@@ -15,9 +15,15 @@ set -eox pipefail
15
15
  trap cleanup EXIT
16
16
 
17
17
  if [[ "$EAS_BUILD_PROFILE" != "updates_testing" ]]; then
18
- exit
18
+ exit 0
19
19
  fi
20
20
 
21
+ if [[ "$TEST_TV_BUILD" == "1" ]]; then
22
+ mkdir ./logs
23
+ echo "TV built successfully" > ./logs/detox-tests.log
24
+ exit 0
25
+ fi
26
+
21
27
  ANDROID_EMULATOR=pixel_4
22
28
 
23
29
  #export UPDATES_HOST=$(ifconfig -l | xargs -n1 ipconfig getifaddr)
@@ -2,9 +2,6 @@
2
2
 
3
3
  set -eox pipefail
4
4
 
5
- # Use custom local Xcode env file
6
- cp xcode.env.local ios/.xcode.env.local
7
-
8
5
  if [[ "$LOCAL_TESTING" == "1" ]]; then
9
6
  exit 0
10
7
  fi
@@ -0,0 +1,30 @@
1
+ const path = require('path');
2
+
3
+ const { initAsync, setupE2EAppAsync } = require('./project');
4
+
5
+ const repoRoot = process.env.EXPO_REPO_ROOT;
6
+ const workingDir = path.resolve(repoRoot, '..');
7
+ const runtimeVersion = '1.0.0';
8
+
9
+ /**
10
+ *
11
+ * This generates a project at the location TEST_PROJECT_ROOT,
12
+ * that is configured to build a test app and run both suites
13
+ * of updates E2E tests in the Detox environment.
14
+ *
15
+ * See `packages/expo-updates/e2e/README.md` for instructions on how
16
+ * to run these tests locally.
17
+ *
18
+ */
19
+
20
+ (async function () {
21
+ if (!process.env.EXPO_REPO_ROOT || !process.env.UPDATES_HOST || !process.env.UPDATES_PORT) {
22
+ throw new Error('Missing one or more environment variables; see instructions in e2e/README.md');
23
+ }
24
+ const projectRoot = process.env.TEST_PROJECT_ROOT || path.join(workingDir, 'updates-e2e');
25
+ const localCliBin = path.join(repoRoot, 'packages/@expo/cli/build/bin/cli');
26
+
27
+ await initAsync(projectRoot, { repoRoot, runtimeVersion, localCliBin, isTV: true });
28
+
29
+ await setupE2EAppAsync(projectRoot, { localCliBin, repoRoot, isTV: true });
30
+ })();
@@ -26,5 +26,5 @@ const runtimeVersion = '1.0.0';
26
26
 
27
27
  await initAsync(projectRoot, { repoRoot, runtimeVersion, localCliBin });
28
28
 
29
- await setupE2EAppAsync(projectRoot, localCliBin, repoRoot);
29
+ await setupE2EAppAsync(projectRoot, { localCliBin, repoRoot });
30
30
  })();
@@ -22,7 +22,6 @@ function transformAppJson(appJson, projectName, runtimeVersion) {
22
22
  ...appJson.expo,
23
23
  name: projectName,
24
24
  runtimeVersion,
25
- jsEngine: 'jsc',
26
25
  updates: {
27
26
  ...appJson.expo.updates,
28
27
  requestHeaders: {