diff --git a/CodePush.js b/CodePush.js index e2e197f..7baa35b 100644 --- a/CodePush.js +++ b/CodePush.js @@ -1,5 +1,3 @@ -"use strict"; - import { AcquisitionManager as Sdk } from "code-push/script/acquisition-sdk"; import { Alert } from "./AlertAdapter"; import requestFetchAdapter from "./request-fetch-adapter"; @@ -19,6 +17,7 @@ async function checkForUpdate(deploymentKey = null) { * different from the CodePush update they have already installed. */ const nativeConfig = await getConfiguration(); + /* * If a deployment key was explicitly provided, * then let's override the one we retrieved @@ -26,11 +25,12 @@ async function checkForUpdate(deploymentKey = null) { * dynamically "redirecting" end-users at different * deployments (e.g. an early access deployment for insiders). */ - const config = deploymentKey ? { ...nativeConfig, ...{ deploymentKey } } - : nativeConfig; + const config = deploymentKey ? { ...nativeConfig, ...{ deploymentKey } } : nativeConfig; const sdk = getPromisifiedSdk(requestFetchAdapter, config); + // Use dynamically overridden getCurrentPackage() during tests. const localPackage = await module.exports.getCurrentPackage(); + /* * If the app has a previously installed update, and that update * was targetted at the same app version that is currently running, @@ -43,6 +43,7 @@ async function checkForUpdate(deploymentKey = null) { ? localPackage : { appVersion: config.appVersion }; const update = await sdk.queryUpdateWithCurrentPackage(queryPackage); + /* * There are three cases where checkForUpdate will resolve to null: * ---------------------------------------------------------------- diff --git a/package-mixins.js b/package-mixins.js index f85e367..6b2f75e 100644 --- a/package-mixins.js +++ b/package-mixins.js @@ -1,5 +1,3 @@ -"use strict"; - import { DeviceEventEmitter } from "react-native"; // This function is used to augment remote and local @@ -40,7 +38,7 @@ module.exports = (NativeCodePush) => { await NativeCodePush.installUpdate(this, installMode); updateInstalledCallback && updateInstalledCallback(); if (installMode == NativeCodePush.codePushInstallModeImmediate) { - NativeCodePush.restartApp(); + NativeCodePush.restartApp(false); } else { localPackage.isPending = true; // Mark the package as pending since it hasn't been applied yet } diff --git a/request-fetch-adapter.js b/request-fetch-adapter.js index d2cad43..6254def 100644 --- a/request-fetch-adapter.js +++ b/request-fetch-adapter.js @@ -1,5 +1,3 @@ -"use strict"; - module.exports = { async request(verb, url, body, callback) { if (typeof body === "function") { @@ -30,4 +28,4 @@ module.exports = { callback(err); } } -}; +}; \ No newline at end of file