@bravemobile/react-native-code-push 12.0.0-beta.5 → 12.0.0-beta.7

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/README.md CHANGED
@@ -8,10 +8,16 @@
8
8
 
9
9
  ### 🚀 New Architecture support
10
10
 
11
- Supports React Native 0.74 ~ 0.80.
11
+ Supports React Native 0.74 ~ 0.81.
12
12
 
13
13
  (Tested on the React Native CLI template apps)
14
14
 
15
+ ### ✅ Requirements
16
+
17
+ - **React Native**: 0.74 or higher
18
+ - **iOS**: 15.5 or higher
19
+ - **Android**: API level 16 or higher
20
+
15
21
  ## 🚗 Migration Guide
16
22
 
17
23
  If you have been using `react-native-code-push`, replace the NPM package first.
@@ -265,6 +265,8 @@ public class CodePushUpdateManager {
265
265
  CodePushUtils.log("Applying full update.");
266
266
  }
267
267
 
268
+ CodePushUpdateUtils.verifyFolderHash(newUpdateFolderPath, newUpdateHash);
269
+
268
270
  boolean isSignatureVerificationEnabled = (stringPublicKey != null);
269
271
 
270
272
  String signaturePath = CodePushUpdateUtils.getSignatureFilePath(newUpdateFolderPath);
@@ -272,7 +274,6 @@ public class CodePushUpdateManager {
272
274
 
273
275
  if (isSignatureVerificationEnabled) {
274
276
  if (isSignatureAppearedInBundle) {
275
- CodePushUpdateUtils.verifyFolderHash(newUpdateFolderPath, newUpdateHash);
276
277
  CodePushUpdateUtils.verifyUpdateSignature(newUpdateFolderPath, newUpdateHash, stringPublicKey);
277
278
  } else {
278
279
  throw new CodePushInvalidUpdateException(
@@ -288,11 +289,6 @@ public class CodePushUpdateManager {
288
289
  "Warning! JWT signature exists in codepush update but code integrity check couldn't be performed because there is no public key configured. " +
289
290
  "Please ensure that public key is properly configured within your application."
290
291
  );
291
- CodePushUpdateUtils.verifyFolderHash(newUpdateFolderPath, newUpdateHash);
292
- } else {
293
- if (isDiffUpdate) {
294
- CodePushUpdateUtils.verifyFolderHash(newUpdateFolderPath, newUpdateHash);
295
- }
296
292
  }
297
293
  }
298
294
 
@@ -68,7 +68,7 @@ async function release(
68
68
  const { downloadUrl } = await bundleUploader(bundleFilePath, platform, identifier);
69
69
  return downloadUrl
70
70
  } catch (error) {
71
- console.error('Failed to upload the bundle file. Exiting the program.', error)
71
+ console.error('Failed to upload the bundle file. Exiting the program.\n', error)
72
72
  process.exit(1)
73
73
  }
74
74
  })();
@@ -237,27 +237,28 @@ static NSString *const UnzippedFolderName = @"unzipped";
237
237
  }
238
238
 
239
239
  CPLog((isDiffUpdate) ? @"Applying diff update." : @"Applying full update.");
240
-
240
+
241
+ if (![CodePushUpdateUtils verifyFolderHash:newUpdateFolderPath
242
+ expectedHash:newUpdateHash
243
+ error:&error]) {
244
+ CPLog(@"The update contents failed the data integrity check.");
245
+ if (!error) {
246
+ error = [CodePushErrorUtils errorWithMessage:@"The update contents failed the data integrity check."];
247
+ }
248
+
249
+ failCallback(error);
250
+ return;
251
+ } else {
252
+ CPLog(@"The update contents succeeded the data integrity check.");
253
+ }
254
+
241
255
  BOOL isSignatureVerificationEnabled = (publicKey != nil);
242
-
256
+
243
257
  NSString *signatureFilePath = [CodePushUpdateUtils getSignatureFilePath:newUpdateFolderPath];
244
258
  BOOL isSignatureAppearedInBundle = [[NSFileManager defaultManager] fileExistsAtPath:signatureFilePath];
245
-
259
+
246
260
  if (isSignatureVerificationEnabled) {
247
261
  if (isSignatureAppearedInBundle) {
248
- if (![CodePushUpdateUtils verifyFolderHash:newUpdateFolderPath
249
- expectedHash:newUpdateHash
250
- error:&error]) {
251
- CPLog(@"The update contents failed the data integrity check.");
252
- if (!error) {
253
- error = [CodePushErrorUtils errorWithMessage:@"The update contents failed the data integrity check."];
254
- }
255
-
256
- failCallback(error);
257
- return;
258
- } else {
259
- CPLog(@"The update contents succeeded the data integrity check.");
260
- }
261
262
  BOOL isSignatureValid = [CodePushUpdateUtils verifyUpdateSignatureFor:newUpdateFolderPath
262
263
  expectedHash:newUpdateHash
263
264
  withPublicKey:publicKey
@@ -283,29 +284,10 @@ static NSString *const UnzippedFolderName = @"unzipped";
283
284
  }
284
285
 
285
286
  } else {
286
- BOOL needToVerifyHash;
287
287
  if (isSignatureAppearedInBundle) {
288
288
  CPLog(@"Warning! JWT signature exists in codepush update but code integrity check couldn't be performed" \
289
289
  " because there is no public key configured. " \
290
290
  "Please ensure that public key is properly configured within your application.");
291
- needToVerifyHash = true;
292
- } else {
293
- needToVerifyHash = isDiffUpdate;
294
- }
295
- if(needToVerifyHash){
296
- if (![CodePushUpdateUtils verifyFolderHash:newUpdateFolderPath
297
- expectedHash:newUpdateHash
298
- error:&error]) {
299
- CPLog(@"The update contents failed the data integrity check.");
300
- if (!error) {
301
- error = [CodePushErrorUtils errorWithMessage:@"The update contents failed the data integrity check."];
302
- }
303
-
304
- failCallback(error);
305
- return;
306
- } else {
307
- CPLog(@"The update contents succeeded the data integrity check.");
308
- }
309
291
  }
310
292
  }
311
293
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bravemobile/react-native-code-push",
3
- "version": "12.0.0-beta.5",
3
+ "version": "12.0.0-beta.7",
4
4
  "description": "React Native plugin for the CodePush service",
5
5
  "main": "CodePush.js",
6
6
  "typings": "typings/react-native-code-push.d.ts",
@@ -49,6 +49,7 @@
49
49
  "hoist-non-react-statics": "^3.3.2",
50
50
  "semver": "^7.3.5",
51
51
  "shelljs": "^0.8.5",
52
+ "xcode": "^3.0.1",
52
53
  "yazl": "^3.3.1"
53
54
  },
54
55
  "peerDependencies": {
@@ -89,8 +90,7 @@
89
90
  "ts-node": "^10.9.2",
90
91
  "tslint": "^6.1.3",
91
92
  "typescript": "5.0.4",
92
- "typescript-eslint": "^8.11.0",
93
- "xcode": "^3.0.1"
93
+ "typescript-eslint": "^8.11.0"
94
94
  },
95
95
  "engines": {
96
96
  "node": ">=18"
@@ -48,6 +48,10 @@ export interface UpdateCheckResponse {
48
48
  }
49
49
 
50
50
  export interface CodePushOptions extends SyncOptions {
51
+ /**
52
+ * The `ignoreFailedUpdates` option is only available as an option for `CodePush.sync()`.
53
+ */
54
+ ignoreFailedUpdates?: never;
51
55
  /**
52
56
  * Specifies when you would like to synchronize updates with the CodePush server.
53
57
  * Defaults to codePush.CheckFrequency.ON_APP_START.
@@ -557,7 +561,7 @@ export interface CliConfigInterface {
557
561
  *
558
562
  * @param source The relative path of the generated bundle file. (e.g. build/bundleOutput/1087bc338fc45a961c...)
559
563
  * @param platform The target platform of the bundle file. This is the string passed when executing the CLI command. ('ios'/'android')
560
- * @param identifier An additional identifier string. This can be used to distinguish execution environments by incorporating it into the upload path or file name. This string is passed when executing the CLI command.
564
+ * @return {Promise<{downloadUrl: string}>} An object containing the `downloadUrl` property, which is the URL from which the uploaded bundle file can be downloaded. This URL will be recorded in the release history.
561
565
  */
562
566
  bundleUploader: (
563
567
  source: string,