expo-updates 0.18.13 → 0.18.14

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,10 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.18.14 — 2023-09-27
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
13
17
  ## 0.18.13 — 2023-09-15
14
18
 
15
19
  ### 🐛 Bug fixes
@@ -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.18.13'
7
+ version = '0.18.14'
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
@@ -95,7 +95,7 @@ android {
95
95
  minSdkVersion safeExtGet("minSdkVersion", 21)
96
96
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
97
97
  versionCode 31
98
- versionName '0.18.13'
98
+ versionName '0.18.14'
99
99
  consumerProguardFiles("proguard-rules.pro")
100
100
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
101
101
 
package/build/Updates.js CHANGED
@@ -114,7 +114,7 @@ export async function reloadAsync() {
114
114
  if (!ExpoUpdates.reload) {
115
115
  throw new UnavailabilityError('Updates', 'reloadAsync');
116
116
  }
117
- if (!ExpoUpdates?.nativeDebug && (__DEV__ || isUsingExpoDevelopmentClient)) {
117
+ if (!ExpoUpdates?.nativeDebug && __DEV__ && !isUsingExpoDevelopmentClient) {
118
118
  throw new CodedError('ERR_UPDATES_DISABLED', `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`);
119
119
  }
120
120
  await ExpoUpdates.reload();
@@ -1 +1 @@
1
- {"version":3,"file":"Updates.js","sourceRoot":"","sources":["../src/Updates.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,mBAAmB,GAC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M,EAAE,CAAC;IAC9B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,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;;;;;;;;;GASG;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 DeviceEventEmitter,\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 UpdatesCheckAutomaticallyValue,\n UpdatesLogEntry,\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/**\n * The channel name of the current build, if configured for use with EAS Update. Null otherwise.\n */\nexport const channel: string | null = ExpoUpdates.channel ?? null;\n\n/**\n * The runtime version of the current build.\n */\nexport const runtimeVersion: string | null = ExpoUpdates.runtimeVersion ?? null;\n\nconst _checkAutomaticallyMapNativeToJS = {\n ALWAYS: 'ON_LOAD',\n ERROR_RECOVERY_ONLY: 'ON_ERROR_RECOVERY',\n NEVER: 'NEVER',\n WIFI_ONLY: 'WIFI_ONLY',\n};\n\n/**\n * Determines if and when expo-updates checks for and downloads updates automatically on startup.\n */\nexport const checkAutomatically: UpdatesCheckAutomaticallyValue | null =\n _checkAutomaticallyMapNativeToJS[ExpoUpdates.checkAutomatically] ?? null;\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/**\n * This will be true if the currently running update is the one embedded in the build,\n * and not one downloaded from the updates server.\n */\nexport const isEmbeddedLaunch: boolean = ExpoUpdates.isEmbeddedLaunch || 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](/versions/latest/sdk/constants/#manifest) (or\n * [classic manifest](/versions/latest/sdk/constants/#appmanifest))\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\n * empty.\n */\nexport const manifest: Partial<Manifest> =\n (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??\n {};\n\n/**\n * If `expo-updates` is enabled, this is a `Date` object representing the creation time of the update that's currently running (whether it was embedded or downloaded at runtime).\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is\n * null.\n */\nexport const createdAt: Date | null = ExpoUpdates.commitTime\n ? new Date(ExpoUpdates.commitTime)\n : null;\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 (!ExpoUpdates?.nativeDebug && (__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 * Checking for an update uses a device's bandwidth and battery life like any network call.\n * Additionally, updates served by Expo may be rate limited. A good rule of thumb to check for\n * updates judiciously is to check when the user launches or foregrounds the app. Avoid polling for\n * updates in a frequent loop.\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 (!ExpoUpdates?.nativeDebug && (__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 * Retrieves the current extra params.\n */\nexport async function getExtraParamsAsync(): Promise<{ [key: string]: string }> {\n if (!ExpoUpdates.getExtraParamsAsync) {\n throw new UnavailabilityError('Updates', 'getExtraParamsAsync');\n }\n\n return await ExpoUpdates.getExtraParamsAsync();\n}\n\n/**\n * Sets an extra param if value is non-null, otherwise unsets the param.\n * Extra params are sent in a header of update requests.\n * The update server may use these params when evaluating logic to determine which update to serve.\n * EAS Update merges these params into the fields used to evaluate channel–branch mapping logic.\n *\n * @example An app may want to add a feature where users can opt-in to beta updates. In this instance,\n * extra params could be set to `{userType: 'beta'}`, and then the server can use this information\n * when deciding which update to serve. If using EAS Update, the channel-branch mapping can be set to\n * discriminate branches based on the `userType`.\n */\nexport async function setExtraParamAsync(\n key: string,\n value: string | null | undefined\n): Promise<void> {\n if (!ExpoUpdates.setExtraParamAsync) {\n throw new UnavailabilityError('Updates', 'setExtraParamAsync');\n }\n\n return await ExpoUpdates.setExtraParamAsync(key, value ?? null);\n}\n\n/**\n * Retrieves the most recent expo-updates log entries.\n *\n * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to 3600000 ms (1 hour).\n *\n * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;\n *\n * The promise rejects if there is an unexpected error in retrieving the logs.\n */\nexport async function readLogEntriesAsync(maxAge: number = 3600000): Promise<UpdatesLogEntry[]> {\n if (!ExpoUpdates.readLogEntriesAsync) {\n throw new UnavailabilityError('Updates', 'readLogEntriesAsync');\n }\n return await ExpoUpdates.readLogEntriesAsync(maxAge);\n}\n\n/**\n * Clears existing expo-updates log entries.\n *\n * > For now, this operation does nothing on the client. Once log persistence has been\n * > implemented, this operation will actually remove existing logs.\n *\n * @return A promise that fulfills if the clear operation was successful.\n *\n * The promise rejects if there is an unexpected error in clearing the logs.\n *\n */\nexport async function clearLogEntriesAsync(): Promise<void> {\n if (!ExpoUpdates.clearLogEntriesAsync) {\n throw new UnavailabilityError('Updates', 'clearLogEntriesAsync');\n }\n await ExpoUpdates.clearLogEntriesAsync();\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 (!ExpoUpdates?.nativeDebug && (__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 DeviceEventEmitter.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. See also the\n * [`useUpdateEvents`](#useupdateeventslistener) React hook.\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,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC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AAM,KAAK,QAAQ,EAAE;QAC9B,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;;;;;;;;;GASG;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 DeviceEventEmitter,\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 UpdatesCheckAutomaticallyValue,\n UpdatesLogEntry,\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/**\n * The channel name of the current build, if configured for use with EAS Update. Null otherwise.\n */\nexport const channel: string | null = ExpoUpdates.channel ?? null;\n\n/**\n * The runtime version of the current build.\n */\nexport const runtimeVersion: string | null = ExpoUpdates.runtimeVersion ?? null;\n\nconst _checkAutomaticallyMapNativeToJS = {\n ALWAYS: 'ON_LOAD',\n ERROR_RECOVERY_ONLY: 'ON_ERROR_RECOVERY',\n NEVER: 'NEVER',\n WIFI_ONLY: 'WIFI_ONLY',\n};\n\n/**\n * Determines if and when expo-updates checks for and downloads updates automatically on startup.\n */\nexport const checkAutomatically: UpdatesCheckAutomaticallyValue | null =\n _checkAutomaticallyMapNativeToJS[ExpoUpdates.checkAutomatically] ?? null;\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/**\n * This will be true if the currently running update is the one embedded in the build,\n * and not one downloaded from the updates server.\n */\nexport const isEmbeddedLaunch: boolean = ExpoUpdates.isEmbeddedLaunch || 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](/versions/latest/sdk/constants/#manifest) (or\n * [classic manifest](/versions/latest/sdk/constants/#appmanifest))\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\n * empty.\n */\nexport const manifest: Partial<Manifest> =\n (ExpoUpdates.manifestString ? JSON.parse(ExpoUpdates.manifestString) : ExpoUpdates.manifest) ??\n {};\n\n/**\n * If `expo-updates` is enabled, this is a `Date` object representing the creation time of the update that's currently running (whether it was embedded or downloaded at runtime).\n *\n * In development mode, or any other environment in which `expo-updates` is disabled, this value is\n * null.\n */\nexport const createdAt: Date | null = ExpoUpdates.commitTime\n ? new Date(ExpoUpdates.commitTime)\n : null;\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 (!ExpoUpdates?.nativeDebug && __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 * Checking for an update uses a device's bandwidth and battery life like any network call.\n * Additionally, updates served by Expo may be rate limited. A good rule of thumb to check for\n * updates judiciously is to check when the user launches or foregrounds the app. Avoid polling for\n * updates in a frequent loop.\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 (!ExpoUpdates?.nativeDebug && (__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 * Retrieves the current extra params.\n */\nexport async function getExtraParamsAsync(): Promise<{ [key: string]: string }> {\n if (!ExpoUpdates.getExtraParamsAsync) {\n throw new UnavailabilityError('Updates', 'getExtraParamsAsync');\n }\n\n return await ExpoUpdates.getExtraParamsAsync();\n}\n\n/**\n * Sets an extra param if value is non-null, otherwise unsets the param.\n * Extra params are sent in a header of update requests.\n * The update server may use these params when evaluating logic to determine which update to serve.\n * EAS Update merges these params into the fields used to evaluate channel–branch mapping logic.\n *\n * @example An app may want to add a feature where users can opt-in to beta updates. In this instance,\n * extra params could be set to `{userType: 'beta'}`, and then the server can use this information\n * when deciding which update to serve. If using EAS Update, the channel-branch mapping can be set to\n * discriminate branches based on the `userType`.\n */\nexport async function setExtraParamAsync(\n key: string,\n value: string | null | undefined\n): Promise<void> {\n if (!ExpoUpdates.setExtraParamAsync) {\n throw new UnavailabilityError('Updates', 'setExtraParamAsync');\n }\n\n return await ExpoUpdates.setExtraParamAsync(key, value ?? null);\n}\n\n/**\n * Retrieves the most recent expo-updates log entries.\n *\n * @param maxAge Sets the max age of retrieved log entries in milliseconds. Default to 3600000 ms (1 hour).\n *\n * @return A promise that fulfills with an array of [`UpdatesLogEntry`](#updateslogentry) objects;\n *\n * The promise rejects if there is an unexpected error in retrieving the logs.\n */\nexport async function readLogEntriesAsync(maxAge: number = 3600000): Promise<UpdatesLogEntry[]> {\n if (!ExpoUpdates.readLogEntriesAsync) {\n throw new UnavailabilityError('Updates', 'readLogEntriesAsync');\n }\n return await ExpoUpdates.readLogEntriesAsync(maxAge);\n}\n\n/**\n * Clears existing expo-updates log entries.\n *\n * > For now, this operation does nothing on the client. Once log persistence has been\n * > implemented, this operation will actually remove existing logs.\n *\n * @return A promise that fulfills if the clear operation was successful.\n *\n * The promise rejects if there is an unexpected error in clearing the logs.\n *\n */\nexport async function clearLogEntriesAsync(): Promise<void> {\n if (!ExpoUpdates.clearLogEntriesAsync) {\n throw new UnavailabilityError('Updates', 'clearLogEntriesAsync');\n }\n await ExpoUpdates.clearLogEntriesAsync();\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 (!ExpoUpdates?.nativeDebug && (__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 DeviceEventEmitter.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. See also the\n * [`useUpdateEvents`](#useupdateeventslistener) React hook.\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-updates",
3
- "version": "0.18.13",
3
+ "version": "0.18.14",
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",
@@ -64,5 +64,5 @@
64
64
  "peerDependencies": {
65
65
  "expo": "*"
66
66
  },
67
- "gitHead": "0fa20c9cbad0c73a30089ffc09073e6d94a6dabb"
67
+ "gitHead": "ad4c3294898ce319585bad3fe6de839443863a55"
68
68
  }
package/src/Updates.ts CHANGED
@@ -147,7 +147,7 @@ export async function reloadAsync(): Promise<void> {
147
147
  if (!ExpoUpdates.reload) {
148
148
  throw new UnavailabilityError('Updates', 'reloadAsync');
149
149
  }
150
- if (!ExpoUpdates?.nativeDebug && (__DEV__ || isUsingExpoDevelopmentClient)) {
150
+ if (!ExpoUpdates?.nativeDebug && __DEV__ && !isUsingExpoDevelopmentClient) {
151
151
  throw new CodedError(
152
152
  'ERR_UPDATES_DISABLED',
153
153
  `You cannot use the Updates module in development mode in a production app. ${manualUpdatesInstructions}`