@novacraft-engineering/pulsar-code-push 1.6.1 → 1.6.2

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/CodePush.js CHANGED
@@ -206,6 +206,15 @@ async function notifyApplicationReadyInternal() {
206
206
  return statusReport;
207
207
  }
208
208
 
209
+ // Report an install to the Pulsar server that delivered it. Its download links are
210
+ // `<server>/download/...`, so the package names its own server — which matters when the native
211
+ // config points elsewhere (an Android strings.xml that spells the key `CodePushServerURL`, the iOS
212
+ // spelling, is ignored and falls back to the SDK's default).
213
+ function pulsarServerFor(localPackage) {
214
+ const match = /^(https?:\/\/[^/?#]+)\/download\//.exec(localPackage?.downloadUrl || '');
215
+ return match ? match[1] : null;
216
+ }
217
+
209
218
  async function tryReportStatus(statusReport, retryOnAppResume) {
210
219
  const nativeConfig = await getConfiguration();
211
220
  const config = nativeConfig.deploymentKey || !fallbackDeployment ? nativeConfig : { ...nativeConfig, ...fallbackDeployment };
@@ -231,8 +240,9 @@ async function tryReportStatus(statusReport, retryOnAppResume) {
231
240
  await NativeCodePush.setLatestRollbackInfo(statusReport.package.packageHash);
232
241
  }
233
242
 
234
- config.deploymentKey = statusReport.package.deploymentKey;
235
- const sdk = getPromisifiedSdk(requestFetchAdapter, config);
243
+ const deliveredBy = pulsarServerFor(statusReport.package);
244
+ const reportConfig = {...config, deploymentKey: statusReport.package.deploymentKey, ...(deliveredBy ? {serverUrl: deliveredBy} : {})};
245
+ const sdk = getPromisifiedSdk(requestFetchAdapter, reportConfig);
236
246
  await sdk.reportStatusDeploy(statusReport.package, statusReport.status, previousLabelOrAppVersion, previousDeploymentKey);
237
247
  }
238
248
 
@@ -93,6 +93,7 @@ public class CodePush implements ReactPackage {
93
93
  if (publicKeyFromStrings != null) mPublicKey = publicKeyFromStrings;
94
94
 
95
95
  String serverUrlFromStrings = getCustomPropertyFromStringsIfExist("ServerUrl");
96
+ if (serverUrlFromStrings == null) serverUrlFromStrings = getCustomPropertyFromStringsIfExist("ServerURL");
96
97
  if (serverUrlFromStrings != null) mServerUrl = serverUrlFromStrings;
97
98
 
98
99
  // ignore liveReload when CodePush is initializing so that unneccessary cache could be cleared
@@ -34,7 +34,7 @@ static NSString * const PublicKeyKey = @"publicKey";
34
34
  NSString *appVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
35
35
  NSString *buildVersion = [infoDictionary objectForKey:(NSString *)kCFBundleVersionKey];
36
36
  NSString *deploymentKey = [infoDictionary objectForKey:@"CodePushDeploymentKey"];
37
- NSString *serverURL = [infoDictionary objectForKey:@"CodePushServerURL"];
37
+ NSString *serverURL = [infoDictionary objectForKey:@"CodePushServerURL"] ?: [infoDictionary objectForKey:@"CodePushServerUrl"];
38
38
  NSString *publicKey = [infoDictionary objectForKey:@"CodePushPublicKey"];
39
39
 
40
40
  NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novacraft-engineering/pulsar-code-push",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Pulsar OTA client for React Native — 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",