expo-updates 0.10.3 → 0.10.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 CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.10.4 — 2021-10-15
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix auto setup `EXUpdatesAppDelegate` breaking reanimated installation. ([#14755](https://github.com/expo/expo/pull/14755) by [@kudo](https://github.com/kudo))
18
+
13
19
  ## 0.10.3 — 2021-10-12
14
20
 
15
21
  ### 🐛 Bug fixes
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.10.3'
6
+ version = '0.10.4'
7
7
 
8
8
  apply from: "../scripts/create-manifest-android.gradle"
9
9
 
@@ -59,7 +59,7 @@ android {
59
59
  minSdkVersion safeExtGet("minSdkVersion", 21)
60
60
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
61
61
  versionCode 31
62
- versionName '0.10.3'
62
+ versionName '0.10.4'
63
63
  consumerProguardFiles("proguard-rules.pro")
64
64
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
65
65
  // uncomment below to export the database schema when making changes
@@ -1,3 +1,3 @@
1
1
  import { NativeModulesProxy } from 'expo-modules-core';
2
- export default NativeModulesProxy.ExpoUpdates ?? {};
2
+ export default NativeModulesProxy.ExpoUpdates || {};
3
3
  //# sourceMappingURL=ExpoUpdates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoUpdates.js","sourceRoot":"","sources":["../src/ExpoUpdates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,eAAe,kBAAkB,CAAC,WAAW,IAAK,EAAU,CAAC","sourcesContent":["import { NativeModulesProxy } from 'expo-modules-core';\nexport default NativeModulesProxy.ExpoUpdates ?? ({} as any);\n"]}
1
+ {"version":3,"file":"ExpoUpdates.js","sourceRoot":"","sources":["../src/ExpoUpdates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,eAAe,kBAAkB,CAAC,WAAW,IAAK,EAAU,CAAC","sourcesContent":["import { NativeModulesProxy } from 'expo-modules-core';\nexport default NativeModulesProxy.ExpoUpdates || ({} as any);\n"]}
@@ -2,15 +2,14 @@ import { EventSubscription } from 'fbemitter';
2
2
  import { LocalAssets, Manifest, UpdateCheckResult, UpdateEvent, UpdateFetchResult } from './Updates.types';
3
3
  export * from './Updates.types';
4
4
  /**
5
- * The UUID that uniquely identifies the currently running update if `expo-updates` is enabled. The
6
- * UUID is represented in its canonical string form (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`) and
7
- * will always use lowercase letters. In development mode, or any other environment in which
5
+ * If `expo-updates` is enabled, the UUID that uniquely identifies the currently running update.
6
+ * The UUID is represented in its canonical string form (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)
7
+ * and will always use lowercase letters. In development mode, or any other environment in which
8
8
  * `expo-updates` is disabled, this value is `null`.
9
9
  */
10
10
  export declare const updateId: string | null;
11
11
  /**
12
- * The name of the release channel currently configured in this standalone or bare app when using
13
- * classic updates. When using Expo Updates, the value of this field is always `"default"`.
12
+ * The name of the release channel currently configured in this standalone or bare app.
14
13
  */
15
14
  export declare const releaseChannel: string;
16
15
  /**
@@ -32,58 +31,52 @@ export declare const isEmergencyLaunch: boolean;
32
31
  */
33
32
  export declare const isUsingEmbeddedAssets: boolean;
34
33
  /**
35
- * If `expo-updates` is enabled, this is the
36
- * [manifest](/guides/how-expo-works#expo-development-server) object for the update that's currently
37
- * running.
34
+ * If `expo-updates` is enabled, this is the [manifest](/guides/how-expo-works#expo-development-server)
35
+ * object for the update that's currently running.
38
36
  *
39
- * In development mode, or any other environment in which `expo-updates` is disabled, this object is
40
- * empty.
37
+ * In development mode, or any other environment in which `expo-updates` is disabled, this object is empty.
41
38
  */
42
- export declare const manifest: Partial<Manifest>;
39
+ export declare const manifest: Manifest | object;
43
40
  /**
44
41
  * Instructs the app to reload using the most recently downloaded version. This is useful for
45
- * triggering a newly downloaded update to launch without the user needing to manually restart the
46
- * app.
42
+ * triggering a newly downloaded update to launch without the user needing to manually restart the app.
47
43
  *
48
- * It is not recommended to place any meaningful logic after a call to `await
49
- * Updates.reloadAsync()`. This is because the promise is resolved after verifying that the app can
50
- * be reloaded, and immediately before posting an asynchronous task to the main thread to actually
51
- * reload the app. It is unsafe to make any assumptions about whether any more JS code will be
52
- * executed after the `Updates.reloadAsync` method call resolves, since that depends on the OS and
53
- * the state of the native module and main threads.
44
+ * It is not recommended to place any meaningful logic after a call to `await Updates.reloadAsync()`.
45
+ * This is because the `Promise` is resolved after verifying that the app can be reloaded, and
46
+ * immediately before posting an asynchronous task to the main thread to actually reload the app.
47
+ * It is unsafe to make any assumptions about whether any more JS code will be executed after the
48
+ * `Updates.reloadAsync` method call resolves, since that depends on the OS and the state of the
49
+ * native module and main threads.
54
50
  *
55
- * This method cannot be used in development mode, and the returned promise will be rejected if you
56
- * try to do so.
51
+ * This method cannot be used in development mode, and the returned `Promise` will be rejected if you try to do so.
57
52
  *
58
- * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or
59
- * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production
60
- * mode, it most likely means you have installed the module incorrectly. Double check you've
61
- * followed the installation instructions. In particular, on iOS ensure that you set the `bridge`
62
- * property on `EXUpdatesAppController` with a pointer to the `RCTBridge` you want to reload, and on
63
- * Android ensure you either call `UpdatesController.initialize` with the instance of
64
- * `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost` with the
65
- * proper instance of `ReactNativeHost`.
53
+ * @return Returns a `Promise` that fulfils right before the reload instruction is sent to the JS runtime,
54
+ * or rejects if it cannot find a reference to the JS runtime.
55
+ * If the `Promise` is rejected in production mode, it most likely means you have installed the
56
+ * module incorrectly. Double check you've followed the instructions above. In particular, on iOS
57
+ * ensure that you set the `bridge` property on `EXUpdatesAppController` with a pointer to the
58
+ * `RCTBridge` you want to reload, and on Android ensure you either call `UpdatesController.initialize`
59
+ * with the instance of `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost`
60
+ * with the proper instance of `ReactNativeHost`.
66
61
  */
67
62
  export declare function reloadAsync(): Promise<void>;
68
63
  /**
69
64
  * Checks the server to see if a newly deployed update to your project is available. Does not
70
65
  * actually download the update. This method cannot be used in development mode, and the returned
71
- * promise will be rejected if you try to do so.
66
+ * `Promise` will be rejected if you try to do so.
67
+ * @return A Promise that fulfils with [`UpdateCheckResult`](#updatecheckresult) object.
72
68
  *
73
- * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.
74
- *
75
- * The promise rejects if the app is in development mode, or if there is an unexpected error or
69
+ * The `Promise` rejects if the app is in development mode, or if there is an unexpected error or
76
70
  * timeout communicating with the server.
77
71
  */
78
72
  export declare function checkForUpdateAsync(): Promise<UpdateCheckResult>;
79
73
  /**
80
- * Downloads the most recently deployed update to your project from server to the device's local
81
- * storage. This method cannot be used in development mode, and the returned promise will be
82
- * rejected if you try to do so.
83
- *
84
- * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.
74
+ * Downloads the most recently deployed update to your project from server to the device's local storage.
75
+ * This method cannot be used in development mode, and the returned `Promise` will be rejected if
76
+ * you try to do so.
77
+ * @return A Promise that fulfils with [`UpdateFetchResult`](#updatefetchresult) object.
85
78
  *
86
- * The promise rejects if the app is in development mode, or if there is an unexpected error or
79
+ * The Promise rejects if the app is in development mode, or if there is an unexpected error or
87
80
  * timeout communicating with the server.
88
81
  */
89
82
  export declare function fetchUpdateAsync(): Promise<UpdateFetchResult>;
@@ -92,12 +85,11 @@ export declare function fetchUpdateAsync(): Promise<UpdateFetchResult>;
92
85
  */
93
86
  export declare function clearUpdateCacheExperimentalAsync(_sdkVersion?: string): void;
94
87
  /**
95
- * Adds a callback to be invoked when updates-related events occur (such as upon the initial app
96
- * load) due to auto-update settings chosen at build-time.
97
- *
98
- * @param listener A function that will be invoked with an [`UpdateEvent`](#updateevent) instance
88
+ * Adds a callback to be invoked when updates-related events occur (such as upon the initial app load)
89
+ * due to auto-update settings chosen at build-time.
90
+ * @param listener A function that will be invoked with an instance of [`UpdateEvent`](#updateevent)
99
91
  * and should not return any value.
100
- * @return An `EventSubscription` object on which you can call `remove()` to unsubscribe the
101
- * listener.
92
+ * @return Returns an `EventSubscription` object on which you can call `remove()` if
93
+ * you would like to unsubscribe from the listener.
102
94
  */
103
95
  export declare function addListener(listener: (event: UpdateEvent) => void): EventSubscription;
package/build/Updates.js CHANGED
@@ -2,18 +2,19 @@ import { RCTDeviceEventEmitter, CodedError, NativeModulesProxy, UnavailabilityEr
2
2
  import { EventEmitter } from 'fbemitter';
3
3
  import ExpoUpdates from './ExpoUpdates';
4
4
  export * from './Updates.types';
5
+ // @needsAudit
5
6
  /**
6
- * The UUID that uniquely identifies the currently running update if `expo-updates` is enabled. The
7
- * UUID is represented in its canonical string form (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`) and
8
- * will always use lowercase letters. In development mode, or any other environment in which
7
+ * If `expo-updates` is enabled, the UUID that uniquely identifies the currently running update.
8
+ * The UUID is represented in its canonical string form (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)
9
+ * and will always use lowercase letters. In development mode, or any other environment in which
9
10
  * `expo-updates` is disabled, this value is `null`.
10
11
  */
11
12
  export const updateId = ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'
12
13
  ? ExpoUpdates.updateId.toLowerCase()
13
14
  : null;
15
+ // @needsAudit
14
16
  /**
15
- * The name of the release channel currently configured in this standalone or bare app when using
16
- * classic updates. When using Expo Updates, the value of this field is always `"default"`.
17
+ * The name of the release channel currently configured in this standalone or bare app.
17
18
  */
18
19
  export const releaseChannel = ExpoUpdates.releaseChannel ?? 'default';
19
20
  // @docsMissing
@@ -21,6 +22,7 @@ export const releaseChannel = ExpoUpdates.releaseChannel ?? 'default';
21
22
  * @hidden
22
23
  */
23
24
  export const localAssets = ExpoUpdates.localAssets ?? {};
25
+ // @needsAudit
24
26
  /**
25
27
  * `expo-updates` does its very best to always launch monotonically newer versions of your app so
26
28
  * you don't need to worry about backwards compatibility when you put out an update. In very rare
@@ -36,16 +38,18 @@ export const isEmergencyLaunch = ExpoUpdates.isEmergencyLaunch || false;
36
38
  * @hidden
37
39
  */
38
40
  export const isUsingEmbeddedAssets = ExpoUpdates.isUsingEmbeddedAssets || false;
41
+ let _manifest = ExpoUpdates.manifest;
42
+ if (ExpoUpdates.manifestString) {
43
+ _manifest = JSON.parse(ExpoUpdates.manifestString);
44
+ }
45
+ // @needsAudit
39
46
  /**
40
- * If `expo-updates` is enabled, this is the
41
- * [manifest](/guides/how-expo-works#expo-development-server) object for the update that's currently
42
- * running.
47
+ * If `expo-updates` is enabled, this is the [manifest](/guides/how-expo-works#expo-development-server)
48
+ * object for the update that's currently running.
43
49
  *
44
- * In development mode, or any other environment in which `expo-updates` is disabled, this object is
45
- * empty.
50
+ * In development mode, or any other environment in which `expo-updates` is disabled, this object is empty.
46
51
  */
47
- export const manifest = (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??
48
- {};
52
+ export const manifest = _manifest ?? {};
49
53
  const isUsingDeveloperTool = !!manifest.developer?.tool;
50
54
  const isUsingExpoDevelopmentClient = NativeModulesProxy.ExponentConstants?.appOwnership === 'expo';
51
55
  const manualUpdatesInstructions = isUsingExpoDevelopmentClient
@@ -53,29 +57,28 @@ const manualUpdatesInstructions = isUsingExpoDevelopmentClient
53
57
  'version in this development client.'
54
58
  : 'To test manual updates, make a release build with `npm run ios --configuration Release` or ' +
55
59
  '`npm run android --variant Release`.';
60
+ // @needsAudit
56
61
  /**
57
62
  * Instructs the app to reload using the most recently downloaded version. This is useful for
58
- * triggering a newly downloaded update to launch without the user needing to manually restart the
59
- * app.
63
+ * triggering a newly downloaded update to launch without the user needing to manually restart the app.
60
64
  *
61
- * It is not recommended to place any meaningful logic after a call to `await
62
- * Updates.reloadAsync()`. This is because the promise is resolved after verifying that the app can
63
- * be reloaded, and immediately before posting an asynchronous task to the main thread to actually
64
- * reload the app. It is unsafe to make any assumptions about whether any more JS code will be
65
- * executed after the `Updates.reloadAsync` method call resolves, since that depends on the OS and
66
- * the state of the native module and main threads.
65
+ * It is not recommended to place any meaningful logic after a call to `await Updates.reloadAsync()`.
66
+ * This is because the `Promise` is resolved after verifying that the app can be reloaded, and
67
+ * immediately before posting an asynchronous task to the main thread to actually reload the app.
68
+ * It is unsafe to make any assumptions about whether any more JS code will be executed after the
69
+ * `Updates.reloadAsync` method call resolves, since that depends on the OS and the state of the
70
+ * native module and main threads.
67
71
  *
68
- * This method cannot be used in development mode, and the returned promise will be rejected if you
69
- * try to do so.
72
+ * This method cannot be used in development mode, and the returned `Promise` will be rejected if you try to do so.
70
73
  *
71
- * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or
72
- * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production
73
- * mode, it most likely means you have installed the module incorrectly. Double check you've
74
- * followed the installation instructions. In particular, on iOS ensure that you set the `bridge`
75
- * property on `EXUpdatesAppController` with a pointer to the `RCTBridge` you want to reload, and on
76
- * Android ensure you either call `UpdatesController.initialize` with the instance of
77
- * `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost` with the
78
- * proper instance of `ReactNativeHost`.
74
+ * @return Returns a `Promise` that fulfils right before the reload instruction is sent to the JS runtime,
75
+ * or rejects if it cannot find a reference to the JS runtime.
76
+ * If the `Promise` is rejected in production mode, it most likely means you have installed the
77
+ * module incorrectly. Double check you've followed the instructions above. In particular, on iOS
78
+ * ensure that you set the `bridge` property on `EXUpdatesAppController` with a pointer to the
79
+ * `RCTBridge` you want to reload, and on Android ensure you either call `UpdatesController.initialize`
80
+ * with the instance of `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost`
81
+ * with the proper instance of `ReactNativeHost`.
79
82
  */
80
83
  export async function reloadAsync() {
81
84
  if (!ExpoUpdates.reload) {
@@ -86,14 +89,14 @@ export async function reloadAsync() {
86
89
  }
87
90
  await ExpoUpdates.reload();
88
91
  }
92
+ // @needsAudit
89
93
  /**
90
94
  * Checks the server to see if a newly deployed update to your project is available. Does not
91
95
  * actually download the update. This method cannot be used in development mode, and the returned
92
- * promise will be rejected if you try to do so.
93
- *
94
- * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.
96
+ * `Promise` will be rejected if you try to do so.
97
+ * @return A Promise that fulfils with [`UpdateCheckResult`](#updatecheckresult) object.
95
98
  *
96
- * The promise rejects if the app is in development mode, or if there is an unexpected error or
99
+ * The `Promise` rejects if the app is in development mode, or if there is an unexpected error or
97
100
  * timeout communicating with the server.
98
101
  */
99
102
  export async function checkForUpdateAsync() {
@@ -110,14 +113,14 @@ export async function checkForUpdateAsync() {
110
113
  }
111
114
  return result;
112
115
  }
116
+ // @needsAudit
113
117
  /**
114
- * Downloads the most recently deployed update to your project from server to the device's local
115
- * storage. This method cannot be used in development mode, and the returned promise will be
116
- * rejected if you try to do so.
118
+ * Downloads the most recently deployed update to your project from server to the device's local storage.
119
+ * This method cannot be used in development mode, and the returned `Promise` will be rejected if
120
+ * you try to do so.
121
+ * @return A Promise that fulfils with [`UpdateFetchResult`](#updatefetchresult) object.
117
122
  *
118
- * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.
119
- *
120
- * The promise rejects if the app is in development mode, or if there is an unexpected error or
123
+ * The Promise rejects if the app is in development mode, or if there is an unexpected error or
121
124
  * timeout communicating with the server.
122
125
  */
123
126
  export async function fetchUpdateAsync() {
@@ -162,14 +165,14 @@ function _emitEvent(params) {
162
165
  }
163
166
  _emitter.emit('Expo.updatesEvent', newParams);
164
167
  }
168
+ // @needsAudit
165
169
  /**
166
- * Adds a callback to be invoked when updates-related events occur (such as upon the initial app
167
- * load) due to auto-update settings chosen at build-time.
168
- *
169
- * @param listener A function that will be invoked with an [`UpdateEvent`](#updateevent) instance
170
+ * Adds a callback to be invoked when updates-related events occur (such as upon the initial app load)
171
+ * due to auto-update settings chosen at build-time.
172
+ * @param listener A function that will be invoked with an instance of [`UpdateEvent`](#updateevent)
170
173
  * and should not return any value.
171
- * @return An `EventSubscription` object on which you can call `remove()` to unsubscribe the
172
- * listener.
174
+ * @return Returns an `EventSubscription` object on which you can call `remove()` if
175
+ * you would like to unsubscribe from the listener.
173
176
  */
174
177
  export function addListener(listener) {
175
178
  const emitter = _getEmitter();
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.js","sourceRoot":"","sources":["../src/Updates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAqB,MAAM,WAAW,CAAC;AAE5D,OAAO,WAAW,MAAM,eAAe,CAAC;AASxC,cAAc,iBAAiB,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GACnB,WAAW,CAAC,QAAQ,IAAI,OAAO,WAAW,CAAC,QAAQ,KAAK,QAAQ;IAC9D,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,EAAE;IACpC,CAAC,CAAC,IAAI,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAW,WAAW,CAAC,cAAc,IAAI,SAAS,CAAC;AAE9E,eAAe;AACf;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgB,WAAW,CAAC,WAAW,IAAI,EAAE,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAY,WAAW,CAAC,iBAAiB,IAAI,KAAK,CAAC;AAEjF,eAAe;AACf;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GA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AC9B,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAChC;IACD,IAAI,SAAS,CAAC,cAAc,EAAE;QAC5B,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAC1D,OAAO,SAAS,CAAC,cAAc,CAAC;KACjC;IAED,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;KAC9E;IACD,QAAQ,CAAC,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,QAAsC;IAChE,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import {\n RCTDeviceEventEmitter,\n CodedError,\n NativeModulesProxy,\n UnavailabilityError,\n} from 'expo-modules-core';\nimport { EventEmitter, EventSubscription } from 'fbemitter';\n\nimport ExpoUpdates from './ExpoUpdates';\nimport {\n LocalAssets,\n Manifest,\n UpdateCheckResult,\n UpdateEvent,\n UpdateFetchResult,\n} from './Updates.types';\n\nexport * from './Updates.types';\n\n/**\n * The UUID that uniquely identifies the currently running update if `expo-updates` is enabled. The\n * UUID is represented in its canonical string form (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`) and\n * will always use lowercase letters. In development mode, or any other environment in which\n * `expo-updates` is disabled, this value is `null`.\n */\nexport const updateId: string | null =\n ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'\n ? ExpoUpdates.updateId.toLowerCase()\n : null;\n\n/**\n * The name of the release channel currently configured in this standalone or bare app when using\n * classic updates. When using Expo Updates, the value of this field is always `\"default\"`.\n */\nexport const releaseChannel: string = ExpoUpdates.releaseChannel ?? 'default';\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const localAssets: LocalAssets = ExpoUpdates.localAssets ?? {};\n\n/**\n * `expo-updates` does its very best to always launch monotonically newer versions of your app so\n * you don't need to worry about backwards compatibility when you put out an update. In very rare\n * cases, it's possible that `expo-updates` may need to fall back to the update that's embedded in\n * the app binary, even after newer updates have been downloaded and run (an \"emergency launch\").\n * This boolean will be `true` if the app is launching under this fallback mechanism and `false`\n * otherwise. If you are concerned about backwards compatibility of future updates to your app, you\n * can use this constant to provide special behavior for this rare case.\n */\nexport const isEmergencyLaunch: boolean = ExpoUpdates.isEmergencyLaunch || false;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const isUsingEmbeddedAssets: boolean = ExpoUpdates.isUsingEmbeddedAssets || false;\n\n/**\n * If `expo-updates` is enabled, this is the\n * [manifest](/guides/how-expo-works#expo-development-server) object for the update that's currently\n * running.\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this object is\n * empty.\n */\nexport const manifest: Partial<Manifest> =\n (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??\n {};\n\nconst isUsingDeveloperTool = !!(manifest as any).developer?.tool;\nconst isUsingExpoDevelopmentClient = NativeModulesProxy.ExponentConstants?.appOwnership === 'expo';\nconst manualUpdatesInstructions = isUsingExpoDevelopmentClient\n ? 'To test manual updates, publish your project using `expo publish` and open the published ' +\n 'version in this development client.'\n : 'To test manual updates, make a release build with `npm run ios --configuration Release` or ' +\n '`npm run android --variant Release`.';\n\n/**\n * Instructs the app to reload using the most recently downloaded version. This is useful for\n * triggering a newly downloaded update to launch without the user needing to manually restart the\n * app.\n *\n * It is not recommended to place any meaningful logic after a call to `await\n * Updates.reloadAsync()`. This is because the promise is resolved after verifying that the app can\n * be reloaded, and immediately before posting an asynchronous task to the main thread to actually\n * reload the app. It is unsafe to make any assumptions about whether any more JS code will be\n * executed after the `Updates.reloadAsync` method call resolves, since that depends on the OS and\n * the state of the native module and main threads.\n *\n * This method cannot be used in development mode, and the returned promise will be rejected if you\n * try to do so.\n *\n * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or\n * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production\n * mode, it most likely means you have installed the module incorrectly. Double check you've\n * followed the installation instructions. In particular, on iOS ensure that you set the `bridge`\n * property on `EXUpdatesAppController` with a pointer to the `RCTBridge` you want to reload, and on\n * Android ensure you either call `UpdatesController.initialize` with the instance of\n * `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost` with the\n * proper instance of `ReactNativeHost`.\n */\nexport async function reloadAsync(): Promise<void> {\n if (!ExpoUpdates.reload) {\n throw new UnavailabilityError('Updates', 'reloadAsync');\n }\n if (__DEV__ && !isUsingExpoDevelopmentClient) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`\n );\n }\n await ExpoUpdates.reload();\n}\n\n/**\n * Checks the server to see if a newly deployed update to your project is available. Does not\n * actually download the update. This method cannot be used in development mode, and the returned\n * promise will be rejected if you try to do so.\n *\n * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.\n *\n * The promise rejects if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server.\n */\nexport async function checkForUpdateAsync(): Promise<UpdateCheckResult> {\n if (!ExpoUpdates.checkForUpdateAsync) {\n throw new UnavailabilityError('Updates', 'checkForUpdateAsync');\n }\n if (__DEV__ || isUsingDeveloperTool) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot check for updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.checkForUpdateAsync();\n if (result.manifestString) {\n result.manifest = JSON.parse(result.manifestString);\n delete result.manifestString;\n }\n\n return result;\n}\n\n/**\n * Downloads the most recently deployed update to your project from server to the device's local\n * storage. This method cannot be used in development mode, and the returned promise will be\n * rejected if you try to do so.\n *\n * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.\n *\n * The promise rejects if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server.\n */\nexport async function fetchUpdateAsync(): Promise<UpdateFetchResult> {\n if (!ExpoUpdates.fetchUpdateAsync) {\n throw new UnavailabilityError('Updates', 'fetchUpdateAsync');\n }\n if (__DEV__ || isUsingDeveloperTool) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot fetch updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.fetchUpdateAsync();\n if (result.manifestString) {\n result.manifest = JSON.parse(result.manifestString);\n delete result.manifestString;\n }\n\n return result;\n}\n\n/**\n * @hidden\n */\nexport function clearUpdateCacheExperimentalAsync(_sdkVersion?: string) {\n console.warn(\n \"This method is no longer necessary. `expo-updates` now automatically deletes your app's old bundle files!\"\n );\n}\n\nlet _emitter: EventEmitter | null;\n\nfunction _getEmitter(): EventEmitter {\n if (!_emitter) {\n _emitter = new EventEmitter();\n RCTDeviceEventEmitter.addListener('Expo.nativeUpdatesEvent', _emitEvent);\n }\n return _emitter;\n}\n\nfunction _emitEvent(params): void {\n let newParams = params;\n if (typeof params === 'string') {\n newParams = JSON.parse(params);\n }\n if (newParams.manifestString) {\n newParams.manifest = JSON.parse(newParams.manifestString);\n delete newParams.manifestString;\n }\n\n if (!_emitter) {\n throw new Error(`EventEmitter must be initialized to use from its listener`);\n }\n _emitter.emit('Expo.updatesEvent', newParams);\n}\n\n/**\n * Adds a callback to be invoked when updates-related events occur (such as upon the initial app\n * load) due to auto-update settings chosen at build-time.\n *\n * @param listener A function that will be invoked with an [`UpdateEvent`](#updateevent) instance\n * and should not return any value.\n * @return An `EventSubscription` object on which you can call `remove()` to unsubscribe the\n * listener.\n */\nexport function addListener(listener: (event: UpdateEvent) => void): EventSubscription {\n const emitter = _getEmitter();\n return emitter.addListener('Expo.updatesEvent', listener);\n}\n"]}
1
+ {"version":3,"file":"Updates.js","sourceRoot":"","sources":["../src/Updates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBA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,cAAc;AACd;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,QAAsC;IAChE,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,WAAW,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["import {\n RCTDeviceEventEmitter,\n CodedError,\n NativeModulesProxy,\n UnavailabilityError,\n} from 'expo-modules-core';\nimport { EventEmitter, EventSubscription } from 'fbemitter';\n\nimport ExpoUpdates from './ExpoUpdates';\nimport {\n LocalAssets,\n Manifest,\n UpdateCheckResult,\n UpdateEvent,\n UpdateFetchResult,\n} from './Updates.types';\n\nexport * from './Updates.types';\n\n// @needsAudit\n/**\n * If `expo-updates` is enabled, the UUID that uniquely identifies the currently running update.\n * The UUID is represented in its canonical string form (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)\n * and will always use lowercase letters. In development mode, or any other environment in which\n * `expo-updates` is disabled, this value is `null`.\n */\nexport const updateId: string | null =\n ExpoUpdates.updateId && typeof ExpoUpdates.updateId === 'string'\n ? ExpoUpdates.updateId.toLowerCase()\n : null;\n\n// @needsAudit\n/**\n * The name of the release channel currently configured in this standalone or bare app.\n */\nexport const releaseChannel: string = ExpoUpdates.releaseChannel ?? 'default';\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const localAssets: LocalAssets = ExpoUpdates.localAssets ?? {};\n\n// @needsAudit\n/**\n * `expo-updates` does its very best to always launch monotonically newer versions of your app so\n * you don't need to worry about backwards compatibility when you put out an update. In very rare\n * cases, it's possible that `expo-updates` may need to fall back to the update that's embedded in\n * the app binary, even after newer updates have been downloaded and run (an \"emergency launch\").\n * This boolean will be `true` if the app is launching under this fallback mechanism and `false`\n * otherwise. If you are concerned about backwards compatibility of future updates to your app, you\n * can use this constant to provide special behavior for this rare case.\n */\nexport const isEmergencyLaunch: boolean = ExpoUpdates.isEmergencyLaunch || false;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport const isUsingEmbeddedAssets: boolean = ExpoUpdates.isUsingEmbeddedAssets || false;\n\nlet _manifest = ExpoUpdates.manifest;\nif (ExpoUpdates.manifestString) {\n _manifest = JSON.parse(ExpoUpdates.manifestString);\n}\n\n// @needsAudit\n/**\n * If `expo-updates` is enabled, this is the [manifest](/guides/how-expo-works#expo-development-server)\n * object for the update that's currently running.\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this object is empty.\n */\nexport const manifest: Manifest | object = _manifest ?? {};\n\nconst isUsingDeveloperTool = !!(manifest as any).developer?.tool;\nconst isUsingExpoDevelopmentClient = NativeModulesProxy.ExponentConstants?.appOwnership === 'expo';\nconst manualUpdatesInstructions = isUsingExpoDevelopmentClient\n ? 'To test manual updates, publish your project using `expo publish` and open the published ' +\n 'version in this development client.'\n : 'To test manual updates, make a release build with `npm run ios --configuration Release` or ' +\n '`npm run android --variant Release`.';\n\n// @needsAudit\n/**\n * Instructs the app to reload using the most recently downloaded version. This is useful for\n * triggering a newly downloaded update to launch without the user needing to manually restart the app.\n *\n * It is not recommended to place any meaningful logic after a call to `await Updates.reloadAsync()`.\n * This is because the `Promise` is resolved after verifying that the app can be reloaded, and\n * immediately before posting an asynchronous task to the main thread to actually reload the app.\n * It is unsafe to make any assumptions about whether any more JS code will be executed after the\n * `Updates.reloadAsync` method call resolves, since that depends on the OS and the state of the\n * native module and main threads.\n *\n * This method cannot be used in development mode, and the returned `Promise` will be rejected if you try to do so.\n *\n * @return Returns a `Promise` that fulfils right before the reload instruction is sent to the JS runtime,\n * or rejects if it cannot find a reference to the JS runtime.\n * If the `Promise` is rejected in production mode, it most likely means you have installed the\n * module incorrectly. Double check you've followed the instructions above. In particular, on iOS\n * ensure that you set the `bridge` property on `EXUpdatesAppController` with a pointer to the\n * `RCTBridge` you want to reload, and on Android ensure you either call `UpdatesController.initialize`\n * with the instance of `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost`\n * with the proper instance of `ReactNativeHost`.\n */\nexport async function reloadAsync(): Promise<void> {\n if (!ExpoUpdates.reload) {\n throw new UnavailabilityError('Updates', 'reloadAsync');\n }\n if (__DEV__ && !isUsingExpoDevelopmentClient) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`\n );\n }\n await ExpoUpdates.reload();\n}\n\n// @needsAudit\n/**\n * Checks the server to see if a newly deployed update to your project is available. Does not\n * actually download the update. This method cannot be used in development mode, and the returned\n * `Promise` will be rejected if you try to do so.\n * @return A Promise that fulfils with [`UpdateCheckResult`](#updatecheckresult) object.\n *\n * The `Promise` rejects if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server.\n */\nexport async function checkForUpdateAsync(): Promise<UpdateCheckResult> {\n if (!ExpoUpdates.checkForUpdateAsync) {\n throw new UnavailabilityError('Updates', 'checkForUpdateAsync');\n }\n if (__DEV__ || isUsingDeveloperTool) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot check for updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.checkForUpdateAsync();\n if (result.manifestString) {\n result.manifest = JSON.parse(result.manifestString);\n delete result.manifestString;\n }\n\n return result;\n}\n\n// @needsAudit\n/**\n * Downloads the most recently deployed update to your project from server to the device's local storage.\n * This method cannot be used in development mode, and the returned `Promise` will be rejected if\n * you try to do so.\n * @return A Promise that fulfils with [`UpdateFetchResult`](#updatefetchresult) object.\n *\n * The Promise rejects if the app is in development mode, or if there is an unexpected error or\n * timeout communicating with the server.\n */\nexport async function fetchUpdateAsync(): Promise<UpdateFetchResult> {\n if (!ExpoUpdates.fetchUpdateAsync) {\n throw new UnavailabilityError('Updates', 'fetchUpdateAsync');\n }\n if (__DEV__ || isUsingDeveloperTool) {\n throw new CodedError(\n 'ERR_UPDATES_DISABLED',\n `You cannot fetch updates in development mode. ${manualUpdatesInstructions}`\n );\n }\n\n const result = await ExpoUpdates.fetchUpdateAsync();\n if (result.manifestString) {\n result.manifest = JSON.parse(result.manifestString);\n delete result.manifestString;\n }\n\n return result;\n}\n\n/**\n * @hidden\n */\nexport function clearUpdateCacheExperimentalAsync(_sdkVersion?: string) {\n console.warn(\n \"This method is no longer necessary. `expo-updates` now automatically deletes your app's old bundle files!\"\n );\n}\n\nlet _emitter: EventEmitter | null;\n\nfunction _getEmitter(): EventEmitter {\n if (!_emitter) {\n _emitter = new EventEmitter();\n RCTDeviceEventEmitter.addListener('Expo.nativeUpdatesEvent', _emitEvent);\n }\n return _emitter;\n}\n\nfunction _emitEvent(params): void {\n let newParams = params;\n if (typeof params === 'string') {\n newParams = JSON.parse(params);\n }\n if (newParams.manifestString) {\n newParams.manifest = JSON.parse(newParams.manifestString);\n delete newParams.manifestString;\n }\n\n if (!_emitter) {\n throw new Error(`EventEmitter must be initialized to use from its listener`);\n }\n _emitter.emit('Expo.updatesEvent', newParams);\n}\n\n// @needsAudit\n/**\n * Adds a callback to be invoked when updates-related events occur (such as upon the initial app load)\n * due to auto-update settings chosen at build-time.\n * @param listener A function that will be invoked with an instance of [`UpdateEvent`](#updateevent)\n * and should not return any value.\n * @return Returns an `EventSubscription` object on which you can call `remove()` if\n * you would like to unsubscribe from the listener.\n */\nexport function addListener(listener: (event: UpdateEvent) => void): EventSubscription {\n const emitter = _getEmitter();\n return emitter.addListener('Expo.updatesEvent', listener);\n}\n"]}
@@ -1,7 +1,4 @@
1
1
  import Constants from 'expo-constants';
2
- /**
3
- * The types of update-related events.
4
- */
5
2
  export declare enum UpdateEventType {
6
3
  /**
7
4
  * A new update has finished downloading to local storage. If you would like to start using this
@@ -10,7 +7,7 @@ export declare enum UpdateEventType {
10
7
  */
11
8
  UPDATE_AVAILABLE = "updateAvailable",
12
9
  /**
13
- * No updates are available, and the most up-to-date update is already running.
10
+ * No updates are available, and the most up-to-date bundle of this experience is already running.
14
11
  */
15
12
  NO_UPDATE_AVAILABLE = "noUpdateAvailable",
16
13
  /**
@@ -26,36 +23,29 @@ export declare type ClassicManifest = typeof Constants.manifest;
26
23
  * @hidden
27
24
  */
28
25
  export declare type Manifest = ClassicManifest | typeof Constants.manifest2;
29
- /**
30
- * The result of checking for a new update.
31
- */
32
26
  export declare type UpdateCheckResult = {
33
27
  /**
34
- * `true` if an update is available, `false` if the app is already running the latest available
35
- * update.
28
+ * `true` if an update is available, `false` if you're already running the most up-to-date JS bundle.
36
29
  */
37
30
  isAvailable: boolean;
38
31
  /**
39
- * If `isAvailable` is `true`, the manifest of the available update, and `undefined` otherwise.
32
+ * If `isAvailable` is `true`, the manifest of the available update. Undefined otherwise.
40
33
  */
41
34
  manifest?: Manifest;
42
35
  };
43
- /**
44
- * The result of fetching a new update.
45
- */
46
36
  export declare type UpdateFetchResult = {
47
37
  /**
48
- * `true` if the fetched bundle is new (that is, a different version than what's currently
49
- * running), `false` otherwise.
38
+ * `true` if the fetched bundle is new (i.e. a different version than what's currently running),
39
+ * `false` otherwise.
50
40
  */
51
41
  isNew: boolean;
52
42
  /**
53
- * If `isNew` is `true`, the manifest of the newly downloaded update, and `undefined` otherwise.
43
+ * If `isNew` is `true`, the manifest of the newly downloaded update. Undefined otherwise.
54
44
  */
55
45
  manifest?: Manifest;
56
46
  };
57
47
  /**
58
- * An object that is passed into each event listener when an auto-update check occurs.
48
+ * An object that is passed into each event listener when an auto-update check has occurred.
59
49
  */
60
50
  export declare type UpdateEvent = {
61
51
  /**
@@ -63,12 +53,12 @@ export declare type UpdateEvent = {
63
53
  */
64
54
  type: UpdateEventType;
65
55
  /**
66
- * If `type` is `Updates.UpdateEventType.UPDATE_AVAILABLE`, the manifest of the newly downloaded
67
- * update, and `undefined` otherwise.
56
+ * If `type === Updates.UpdateEventType.UPDATE_AVAILABLE`, the manifest of the newly downloaded
57
+ * update. Undefined otherwise.
68
58
  */
69
59
  manifest?: Manifest;
70
60
  /**
71
- * If `type` is `Updates.UpdateEventType.ERROR`, the error message, and `undefined` otherwise.
61
+ * If `type === Updates.UpdateEventType.ERROR`, the error message. Undefined otherwise.
72
62
  */
73
63
  message?: string;
74
64
  };
@@ -1,6 +1,4 @@
1
- /**
2
- * The types of update-related events.
3
- */
1
+ // @needsAudit
4
2
  export var UpdateEventType;
5
3
  (function (UpdateEventType) {
6
4
  /**
@@ -10,7 +8,7 @@ export var UpdateEventType;
10
8
  */
11
9
  UpdateEventType["UPDATE_AVAILABLE"] = "updateAvailable";
12
10
  /**
13
- * No updates are available, and the most up-to-date update is already running.
11
+ * No updates are available, and the most up-to-date bundle of this experience is already running.
14
12
  */
15
13
  UpdateEventType["NO_UPDATE_AVAILABLE"] = "noUpdateAvailable";
16
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.types.js","sourceRoot":"","sources":["../src/Updates.types.ts"],"names":[],"mappings":"AAEA;;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","sourcesContent":["import Constants from 'expo-constants';\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\n// @docsMissing\n// TODO(eric): move source of truth for manifest type to this module\n/**\n * @hidden\n */\nexport type ClassicManifest = typeof Constants.manifest;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport type Manifest = ClassicManifest | typeof Constants.manifest2;\n// modern manifest type is intentionally not exported, since the plan is to call it just \"Manifest\"\n// in the future\n\n/**\n * The result of checking for a new update.\n */\nexport type UpdateCheckResult = {\n /**\n * `true` if an update is available, `false` if the app is already running the latest available\n * update.\n */\n isAvailable: boolean;\n /**\n * If `isAvailable` is `true`, the manifest of the available update, and `undefined` otherwise.\n */\n manifest?: Manifest;\n};\n\n/**\n * The result of fetching a new update.\n */\nexport type UpdateFetchResult = {\n /**\n * `true` if the fetched bundle is new (that is, a different version than what's currently\n * running), `false` otherwise.\n */\n isNew: boolean;\n /**\n * If `isNew` is `true`, the manifest of the newly downloaded update, and `undefined` otherwise.\n */\n manifest?: Manifest;\n};\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// @docsMissing\n/**\n * @hidden\n */\nexport type LocalAssets = Record<string, string>;\n"]}
1
+ {"version":3,"file":"Updates.types.js","sourceRoot":"","sources":["../src/Updates.types.ts"],"names":[],"mappings":"AAEA,cAAc;AACd,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","sourcesContent":["import Constants from 'expo-constants';\n\n// @needsAudit\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 bundle of this experience 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\n// @docsMissing\n// TODO(eric): move source of truth for manifest type to this module\n/**\n * @hidden\n */\nexport type ClassicManifest = typeof Constants.manifest;\n\n// @docsMissing\n/**\n * @hidden\n */\nexport type Manifest = ClassicManifest | typeof Constants.manifest2;\n// modern manifest type is intentionally not exported, since the plan is to call it just \"Manifest\" in the future\n\n// @needsAudit\nexport type UpdateCheckResult = {\n /**\n * `true` if an update is available, `false` if you're already running the most up-to-date JS bundle.\n */\n isAvailable: boolean;\n /**\n * If `isAvailable` is `true`, the manifest of the available update. Undefined otherwise.\n */\n manifest?: Manifest;\n};\n\n// @needsAudit\nexport type UpdateFetchResult = {\n /**\n * `true` if the fetched bundle is new (i.e. a different version than what's currently running),\n * `false` otherwise.\n */\n isNew: boolean;\n /**\n * If `isNew` is `true`, the manifest of the newly downloaded update. Undefined otherwise.\n */\n manifest?: Manifest;\n};\n\n// @needsAudit\n/**\n * An object that is passed into each event listener when an auto-update check has occurred.\n */\nexport type UpdateEvent = {\n /**\n * Type of the event.\n */\n type: UpdateEventType;\n /**\n * If `type === Updates.UpdateEventType.UPDATE_AVAILABLE`, the manifest of the newly downloaded\n * update. Undefined otherwise.\n */\n manifest?: Manifest;\n /**\n * If `type === Updates.UpdateEventType.ERROR`, the error message. Undefined otherwise.\n */\n message?: string;\n};\n\n// @docsMissing\n/**\n * @hidden\n */\nexport type LocalAssets = Record<string, string>;\n"]}
@@ -126,6 +126,11 @@ EX_REGISTER_SINGLETON_MODULE(EXUpdatesAppDelegate)
126
126
  return self;
127
127
  }
128
128
 
129
+ - (BOOL)conformsToProtocol:(Protocol *)protocol
130
+ {
131
+ return [self.bridgeDelegate conformsToProtocol:protocol];
132
+ }
133
+
129
134
  - (id)forwardingTargetForSelector:(SEL)selector {
130
135
  if ([self isInterceptedSelector:selector]) {
131
136
  return self;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-updates",
3
- "version": "0.10.3",
3
+ "version": "0.10.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",
@@ -37,8 +37,8 @@
37
37
  "@expo/config": "^5.0.9",
38
38
  "@expo/config-plugins": "^3.1.0",
39
39
  "@expo/metro-config": "~0.1.84",
40
- "expo-manifests": "~0.2.1",
41
- "expo-modules-core": "~0.4.2",
40
+ "expo-manifests": "~0.2.2",
41
+ "expo-modules-core": "~0.4.3",
42
42
  "expo-structured-headers": "~2.0.0",
43
43
  "expo-updates-interface": "~0.4.0",
44
44
  "fbemitter": "^2.1.1",
@@ -50,5 +50,5 @@
50
50
  "fs-extra": "^9.1.0",
51
51
  "memfs": "^3.2.0"
52
52
  },
53
- "gitHead": "9ac727c889fc563cbad3ba6712703da7b159b257"
53
+ "gitHead": "d23e1ac491da96b51c25eb2533efcd56499ee287"
54
54
  }
package/src/.gitkeep ADDED
File without changes
@@ -1,2 +1,2 @@
1
1
  import { NativeModulesProxy } from 'expo-modules-core';
2
- export default NativeModulesProxy.ExpoUpdates ?? ({} as any);
2
+ export default NativeModulesProxy.ExpoUpdates || ({} as any);
package/src/Updates.ts CHANGED
@@ -17,10 +17,11 @@ import {
17
17
 
18
18
  export * from './Updates.types';
19
19
 
20
+ // @needsAudit
20
21
  /**
21
- * The UUID that uniquely identifies the currently running update if `expo-updates` is enabled. The
22
- * UUID is represented in its canonical string form (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`) and
23
- * will always use lowercase letters. In development mode, or any other environment in which
22
+ * If `expo-updates` is enabled, the UUID that uniquely identifies the currently running update.
23
+ * The UUID is represented in its canonical string form (`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`)
24
+ * and will always use lowercase letters. In development mode, or any other environment in which
24
25
  * `expo-updates` is disabled, this value is `null`.
25
26
  */
26
27
  export const updateId: string | null =
@@ -28,9 +29,9 @@ export const updateId: string | null =
28
29
  ? ExpoUpdates.updateId.toLowerCase()
29
30
  : null;
30
31
 
32
+ // @needsAudit
31
33
  /**
32
- * The name of the release channel currently configured in this standalone or bare app when using
33
- * classic updates. When using Expo Updates, the value of this field is always `"default"`.
34
+ * The name of the release channel currently configured in this standalone or bare app.
34
35
  */
35
36
  export const releaseChannel: string = ExpoUpdates.releaseChannel ?? 'default';
36
37
 
@@ -40,6 +41,7 @@ export const releaseChannel: string = ExpoUpdates.releaseChannel ?? 'default';
40
41
  */
41
42
  export const localAssets: LocalAssets = ExpoUpdates.localAssets ?? {};
42
43
 
44
+ // @needsAudit
43
45
  /**
44
46
  * `expo-updates` does its very best to always launch monotonically newer versions of your app so
45
47
  * you don't need to worry about backwards compatibility when you put out an update. In very rare
@@ -57,17 +59,19 @@ export const isEmergencyLaunch: boolean = ExpoUpdates.isEmergencyLaunch || false
57
59
  */
58
60
  export const isUsingEmbeddedAssets: boolean = ExpoUpdates.isUsingEmbeddedAssets || false;
59
61
 
62
+ let _manifest = ExpoUpdates.manifest;
63
+ if (ExpoUpdates.manifestString) {
64
+ _manifest = JSON.parse(ExpoUpdates.manifestString);
65
+ }
66
+
67
+ // @needsAudit
60
68
  /**
61
- * If `expo-updates` is enabled, this is the
62
- * [manifest](/guides/how-expo-works#expo-development-server) object for the update that's currently
63
- * running.
69
+ * If `expo-updates` is enabled, this is the [manifest](/guides/how-expo-works#expo-development-server)
70
+ * object for the update that's currently running.
64
71
  *
65
- * In development mode, or any other environment in which `expo-updates` is disabled, this object is
66
- * empty.
72
+ * In development mode, or any other environment in which `expo-updates` is disabled, this object is empty.
67
73
  */
68
- export const manifest: Partial<Manifest> =
69
- (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??
70
- {};
74
+ export const manifest: Manifest | object = _manifest ?? {};
71
75
 
72
76
  const isUsingDeveloperTool = !!(manifest as any).developer?.tool;
73
77
  const isUsingExpoDevelopmentClient = NativeModulesProxy.ExponentConstants?.appOwnership === 'expo';
@@ -77,29 +81,28 @@ const manualUpdatesInstructions = isUsingExpoDevelopmentClient
77
81
  : 'To test manual updates, make a release build with `npm run ios --configuration Release` or ' +
78
82
  '`npm run android --variant Release`.';
79
83
 
84
+ // @needsAudit
80
85
  /**
81
86
  * Instructs the app to reload using the most recently downloaded version. This is useful for
82
- * triggering a newly downloaded update to launch without the user needing to manually restart the
83
- * app.
87
+ * triggering a newly downloaded update to launch without the user needing to manually restart the app.
84
88
  *
85
- * It is not recommended to place any meaningful logic after a call to `await
86
- * Updates.reloadAsync()`. This is because the promise is resolved after verifying that the app can
87
- * be reloaded, and immediately before posting an asynchronous task to the main thread to actually
88
- * reload the app. It is unsafe to make any assumptions about whether any more JS code will be
89
- * executed after the `Updates.reloadAsync` method call resolves, since that depends on the OS and
90
- * the state of the native module and main threads.
89
+ * It is not recommended to place any meaningful logic after a call to `await Updates.reloadAsync()`.
90
+ * This is because the `Promise` is resolved after verifying that the app can be reloaded, and
91
+ * immediately before posting an asynchronous task to the main thread to actually reload the app.
92
+ * It is unsafe to make any assumptions about whether any more JS code will be executed after the
93
+ * `Updates.reloadAsync` method call resolves, since that depends on the OS and the state of the
94
+ * native module and main threads.
91
95
  *
92
- * This method cannot be used in development mode, and the returned promise will be rejected if you
93
- * try to do so.
96
+ * This method cannot be used in development mode, and the returned `Promise` will be rejected if you try to do so.
94
97
  *
95
- * @return A promise that fulfills right before the reload instruction is sent to the JS runtime, or
96
- * rejects if it cannot find a reference to the JS runtime. If the promise is rejected in production
97
- * mode, it most likely means you have installed the module incorrectly. Double check you've
98
- * followed the installation instructions. In particular, on iOS ensure that you set the `bridge`
99
- * property on `EXUpdatesAppController` with a pointer to the `RCTBridge` you want to reload, and on
100
- * Android ensure you either call `UpdatesController.initialize` with the instance of
101
- * `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost` with the
102
- * proper instance of `ReactNativeHost`.
98
+ * @return Returns a `Promise` that fulfils right before the reload instruction is sent to the JS runtime,
99
+ * or rejects if it cannot find a reference to the JS runtime.
100
+ * If the `Promise` is rejected in production mode, it most likely means you have installed the
101
+ * module incorrectly. Double check you've followed the instructions above. In particular, on iOS
102
+ * ensure that you set the `bridge` property on `EXUpdatesAppController` with a pointer to the
103
+ * `RCTBridge` you want to reload, and on Android ensure you either call `UpdatesController.initialize`
104
+ * with the instance of `ReactApplication` you want to reload, or call `UpdatesController.setReactNativeHost`
105
+ * with the proper instance of `ReactNativeHost`.
103
106
  */
104
107
  export async function reloadAsync(): Promise<void> {
105
108
  if (!ExpoUpdates.reload) {
@@ -114,14 +117,14 @@ export async function reloadAsync(): Promise<void> {
114
117
  await ExpoUpdates.reload();
115
118
  }
116
119
 
120
+ // @needsAudit
117
121
  /**
118
122
  * Checks the server to see if a newly deployed update to your project is available. Does not
119
123
  * actually download the update. This method cannot be used in development mode, and the returned
120
- * promise will be rejected if you try to do so.
121
- *
122
- * @return A promise that fulfills with an [`UpdateCheckResult`](#updatecheckresult) object.
124
+ * `Promise` will be rejected if you try to do so.
125
+ * @return A Promise that fulfils with [`UpdateCheckResult`](#updatecheckresult) object.
123
126
  *
124
- * The promise rejects if the app is in development mode, or if there is an unexpected error or
127
+ * The `Promise` rejects if the app is in development mode, or if there is an unexpected error or
125
128
  * timeout communicating with the server.
126
129
  */
127
130
  export async function checkForUpdateAsync(): Promise<UpdateCheckResult> {
@@ -144,14 +147,14 @@ export async function checkForUpdateAsync(): Promise<UpdateCheckResult> {
144
147
  return result;
145
148
  }
146
149
 
150
+ // @needsAudit
147
151
  /**
148
- * Downloads the most recently deployed update to your project from server to the device's local
149
- * storage. This method cannot be used in development mode, and the returned promise will be
150
- * rejected if you try to do so.
152
+ * Downloads the most recently deployed update to your project from server to the device's local storage.
153
+ * This method cannot be used in development mode, and the returned `Promise` will be rejected if
154
+ * you try to do so.
155
+ * @return A Promise that fulfils with [`UpdateFetchResult`](#updatefetchresult) object.
151
156
  *
152
- * @return A promise that fulfills with an [`UpdateFetchResult`](#updatefetchresult) object.
153
- *
154
- * The promise rejects if the app is in development mode, or if there is an unexpected error or
157
+ * The Promise rejects if the app is in development mode, or if there is an unexpected error or
155
158
  * timeout communicating with the server.
156
159
  */
157
160
  export async function fetchUpdateAsync(): Promise<UpdateFetchResult> {
@@ -209,14 +212,14 @@ function _emitEvent(params): void {
209
212
  _emitter.emit('Expo.updatesEvent', newParams);
210
213
  }
211
214
 
215
+ // @needsAudit
212
216
  /**
213
- * Adds a callback to be invoked when updates-related events occur (such as upon the initial app
214
- * load) due to auto-update settings chosen at build-time.
215
- *
216
- * @param listener A function that will be invoked with an [`UpdateEvent`](#updateevent) instance
217
+ * Adds a callback to be invoked when updates-related events occur (such as upon the initial app load)
218
+ * due to auto-update settings chosen at build-time.
219
+ * @param listener A function that will be invoked with an instance of [`UpdateEvent`](#updateevent)
217
220
  * and should not return any value.
218
- * @return An `EventSubscription` object on which you can call `remove()` to unsubscribe the
219
- * listener.
221
+ * @return Returns an `EventSubscription` object on which you can call `remove()` if
222
+ * you would like to unsubscribe from the listener.
220
223
  */
221
224
  export function addListener(listener: (event: UpdateEvent) => void): EventSubscription {
222
225
  const emitter = _getEmitter();
@@ -1,8 +1,6 @@
1
1
  import Constants from 'expo-constants';
2
2
 
3
- /**
4
- * The types of update-related events.
5
- */
3
+ // @needsAudit
6
4
  export enum UpdateEventType {
7
5
  /**
8
6
  * A new update has finished downloading to local storage. If you would like to start using this
@@ -11,7 +9,7 @@ export enum UpdateEventType {
11
9
  */
12
10
  UPDATE_AVAILABLE = 'updateAvailable',
13
11
  /**
14
- * No updates are available, and the most up-to-date update is already running.
12
+ * No updates are available, and the most up-to-date bundle of this experience is already running.
15
13
  */
16
14
  NO_UPDATE_AVAILABLE = 'noUpdateAvailable',
17
15
  /**
@@ -32,41 +30,36 @@ export type ClassicManifest = typeof Constants.manifest;
32
30
  * @hidden
33
31
  */
34
32
  export type Manifest = ClassicManifest | typeof Constants.manifest2;
35
- // modern manifest type is intentionally not exported, since the plan is to call it just "Manifest"
36
- // in the future
33
+ // modern manifest type is intentionally not exported, since the plan is to call it just "Manifest" in the future
37
34
 
38
- /**
39
- * The result of checking for a new update.
40
- */
35
+ // @needsAudit
41
36
  export type UpdateCheckResult = {
42
37
  /**
43
- * `true` if an update is available, `false` if the app is already running the latest available
44
- * update.
38
+ * `true` if an update is available, `false` if you're already running the most up-to-date JS bundle.
45
39
  */
46
40
  isAvailable: boolean;
47
41
  /**
48
- * If `isAvailable` is `true`, the manifest of the available update, and `undefined` otherwise.
42
+ * If `isAvailable` is `true`, the manifest of the available update. Undefined otherwise.
49
43
  */
50
44
  manifest?: Manifest;
51
45
  };
52
46
 
53
- /**
54
- * The result of fetching a new update.
55
- */
47
+ // @needsAudit
56
48
  export type UpdateFetchResult = {
57
49
  /**
58
- * `true` if the fetched bundle is new (that is, a different version than what's currently
59
- * running), `false` otherwise.
50
+ * `true` if the fetched bundle is new (i.e. a different version than what's currently running),
51
+ * `false` otherwise.
60
52
  */
61
53
  isNew: boolean;
62
54
  /**
63
- * If `isNew` is `true`, the manifest of the newly downloaded update, and `undefined` otherwise.
55
+ * If `isNew` is `true`, the manifest of the newly downloaded update. Undefined otherwise.
64
56
  */
65
57
  manifest?: Manifest;
66
58
  };
67
59
 
60
+ // @needsAudit
68
61
  /**
69
- * An object that is passed into each event listener when an auto-update check occurs.
62
+ * An object that is passed into each event listener when an auto-update check has occurred.
70
63
  */
71
64
  export type UpdateEvent = {
72
65
  /**
@@ -74,12 +67,12 @@ export type UpdateEvent = {
74
67
  */
75
68
  type: UpdateEventType;
76
69
  /**
77
- * If `type` is `Updates.UpdateEventType.UPDATE_AVAILABLE`, the manifest of the newly downloaded
78
- * update, and `undefined` otherwise.
70
+ * If `type === Updates.UpdateEventType.UPDATE_AVAILABLE`, the manifest of the newly downloaded
71
+ * update. Undefined otherwise.
79
72
  */
80
73
  manifest?: Manifest;
81
74
  /**
82
- * If `type` is `Updates.UpdateEventType.ERROR`, the error message, and `undefined` otherwise.
75
+ * If `type === Updates.UpdateEventType.ERROR`, the error message. Undefined otherwise.
83
76
  */
84
77
  message?: string;
85
78
  };