@novacraft-engineering/pulsar-code-push 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CodePush.js +10 -3
  2. package/package.json +18 -6
package/CodePush.js CHANGED
@@ -8,7 +8,7 @@ import hoistStatics from 'hoist-non-react-statics';
8
8
  let NativeCodePush = require("react-native").NativeModules.CodePush;
9
9
  const PackageMixins = require("./package-mixins")(NativeCodePush);
10
10
 
11
- async function checkForUpdate(deploymentKey = null, handleBinaryVersionMismatchCallback = null) {
11
+ async function checkForUpdate(deploymentKey = null, handleBinaryVersionMismatchCallback = null, serverUrl = null) {
12
12
  /*
13
13
  * Before we ask the server if an update exists, we
14
14
  * need to retrieve three pieces of information from the
@@ -26,7 +26,13 @@ async function checkForUpdate(deploymentKey = null, handleBinaryVersionMismatchC
26
26
  * dynamically "redirecting" end-users at different
27
27
  * deployments (e.g. an early access deployment for insiders).
28
28
  */
29
- const config = deploymentKey ? { ...nativeConfig, ...{ deploymentKey } } : nativeConfig;
29
+ // Allow the deployment key AND server URL to be overridden per-call, so one client can
30
+ // check multiple backends (e.g. RevoPush and Pulsar) in a single update cycle.
31
+ const config = {
32
+ ...nativeConfig,
33
+ ...(deploymentKey ? { deploymentKey } : {}),
34
+ ...(serverUrl ? { serverUrl } : {}),
35
+ };
30
36
  const sdk = getPromisifiedSdk(requestFetchAdapter, config);
31
37
 
32
38
  // Use dynamically overridden getCurrentPackage() during tests.
@@ -364,6 +370,7 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
364
370
  let resolvedInstallMode;
365
371
  const syncOptions = {
366
372
  deploymentKey: null,
373
+ serverUrl: null,
367
374
  ignoreFailedUpdates: true,
368
375
  rollbackRetryOptions: null,
369
376
  installMode: CodePush.InstallMode.ON_NEXT_RESTART,
@@ -416,7 +423,7 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
416
423
  await CodePush.notifyApplicationReady();
417
424
 
418
425
  syncStatusChangeCallback(CodePush.SyncStatus.CHECKING_FOR_UPDATE);
419
- const remotePackage = await checkForUpdate(syncOptions.deploymentKey, handleBinaryVersionMismatchCallback);
426
+ const remotePackage = await checkForUpdate(syncOptions.deploymentKey, handleBinaryVersionMismatchCallback, syncOptions.serverUrl);
420
427
 
421
428
  const doDownloadAndInstall = async () => {
422
429
  syncStatusChangeCallback(CodePush.SyncStatus.DOWNLOADING_PACKAGE);
package/package.json CHANGED
@@ -1,18 +1,28 @@
1
1
  {
2
2
  "name": "@novacraft-engineering/pulsar-code-push",
3
- "version": "1.5.0",
4
- "description": "Pulsar OTA client for React Native — over-the-air JavaScript updates. A CodePush-compatible client (RevoPush lineage) pointed at Pulsar.",
3
+ "version": "1.5.1",
4
+ "description": "Pulsar OTA client for React Native \u2014 over-the-air JavaScript updates. A CodePush-compatible client (RevoPush lineage) pointed at Pulsar.",
5
5
  "main": "CodePush.js",
6
6
  "typings": "typings/react-native-code-push.d.ts",
7
7
  "homepage": "https://pulsar.novacraft.africa",
8
- "keywords": ["react-native", "code-push", "codepush", "pulsar", "ota", "over-the-air", "hot-update"],
8
+ "keywords": [
9
+ "react-native",
10
+ "code-push",
11
+ "codepush",
12
+ "pulsar",
13
+ "ota",
14
+ "over-the-air",
15
+ "hot-update"
16
+ ],
9
17
  "author": "Novacraft Engineering",
10
18
  "license": "MIT",
11
19
  "repository": {
12
20
  "type": "git",
13
21
  "url": "git+https://github.com/Novacraft-Africa/pulsar-code-push.git"
14
22
  },
15
- "publishConfig": {"access": "public"},
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
16
26
  "files": [
17
27
  "CodePush.js",
18
28
  "AlertAdapter.js",
@@ -45,7 +55,9 @@
45
55
  "packageInstance": "new CodePush(getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)"
46
56
  },
47
57
  "ios": {
48
- "sharedLibraries": ["libz"]
58
+ "sharedLibraries": [
59
+ "libz"
60
+ ]
49
61
  }
50
62
  }
51
- }
63
+ }