@bravemobile/react-native-code-push 8.2.3 → 8.2.5
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/.azurepipelines/build-rn-code-push-1es.yml +39 -1
- package/CodePush.js +8 -3
- package/README.md +55 -39
- package/android/app/build.gradle +1 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +10 -1
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +4 -3
- package/package.json +2 -2
- package/typings/react-native-code-push.d.ts +1 -1
|
@@ -63,4 +63,42 @@ extends:
|
|
|
63
63
|
archiveFile: '$(Build.ArtifactStagingDirectory)/npm/$(Build.BuildId).tgz'
|
|
64
64
|
replaceExistingArchive: true
|
|
65
65
|
verbose: true
|
|
66
|
-
displayName: 'Prepare npm artifact'
|
|
66
|
+
displayName: 'Prepare npm artifact'
|
|
67
|
+
|
|
68
|
+
- stage: APIScan
|
|
69
|
+
dependsOn: Stage
|
|
70
|
+
pool:
|
|
71
|
+
name: 1ES-PT-Windows-2022
|
|
72
|
+
os: windows
|
|
73
|
+
variables:
|
|
74
|
+
"agent.source.skip": true
|
|
75
|
+
jobs:
|
|
76
|
+
- job: APIScan
|
|
77
|
+
steps:
|
|
78
|
+
- task: DownloadPipelineArtifact@2
|
|
79
|
+
displayName: Download Build Artifacts for APIScan
|
|
80
|
+
inputs:
|
|
81
|
+
artifactName: npm
|
|
82
|
+
targetPath: '$(Agent.BuildDirectory)/npm'
|
|
83
|
+
- task: ExtractFiles@1
|
|
84
|
+
inputs:
|
|
85
|
+
archiveFilePatterns: '$(Agent.BuildDirectory)/npm/*.tgz'
|
|
86
|
+
destinationFolder: '$(Agent.BuildDirectory)/npm_extracted'
|
|
87
|
+
- task: AzureKeyVault@2
|
|
88
|
+
inputs:
|
|
89
|
+
azureSubscription: 'AC - Dev Infra & Build Pool'
|
|
90
|
+
KeyVaultName: 'mobile-center-sdk'
|
|
91
|
+
SecretsFilter: 'appcenter-sdk-managed-identity-clientid'
|
|
92
|
+
RunAsPreJob: false
|
|
93
|
+
- task: APIScan@2
|
|
94
|
+
displayName: 'Run APIScan'
|
|
95
|
+
inputs:
|
|
96
|
+
softwareFolder: '$(Agent.BuildDirectory)\npm_extracted'
|
|
97
|
+
softwareName: 'react-native-code-push'
|
|
98
|
+
softwareVersionNum: '$(Build.BuildId)'
|
|
99
|
+
isLargeApp: false
|
|
100
|
+
toolVersion: 'Latest'
|
|
101
|
+
verbosityLevel: verbose
|
|
102
|
+
condition: and(succeeded(), ne(variables['DisableAPIScan'], 'true'))
|
|
103
|
+
env:
|
|
104
|
+
AzureServicesAuthConnectionString: 'runAs=App;AppId=$(appcenter-sdk-managed-identity-clientid)'
|
package/CodePush.js
CHANGED
|
@@ -90,14 +90,19 @@ async function checkForUpdate(deploymentKey = null, handleBinaryVersionMismatchC
|
|
|
90
90
|
log(`An error has occurred at update checker : ${error.stack}`);
|
|
91
91
|
if (sharedCodePushOptions.fallbackToAppCenter) {
|
|
92
92
|
return await sdk.queryUpdateWithCurrentPackage(queryPackage);
|
|
93
|
+
} else {
|
|
94
|
+
// update will not happen
|
|
95
|
+
return undefined;
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
})()
|
|
96
99
|
: await sdk.queryUpdateWithCurrentPackage(queryPackage);
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
if (sharedCodePushOptions.bundleHost && update) {
|
|
102
|
+
const fileName = typeof update.downloadUrl === 'string' ? update.downloadUrl.split('/').pop() : null;
|
|
103
|
+
if (fileName) {
|
|
104
|
+
update.downloadUrl = sharedCodePushOptions.bundleHost + fileName;
|
|
105
|
+
}
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
/*
|
package/README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
## @bravemobile/react-native-code-push
|
|
2
|
+
|
|
3
|
+
Fork of `code-push-react-native`
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @bravemobile/react-native-code-push
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
You'll have more flexibility and freedom in your deployment strategy.
|
|
10
|
+
You can still use CodePush, but become independent of AppCenter's cloud infrastructure.
|
|
11
|
+
|
|
12
|
+
### Self-host the update bundle file
|
|
13
|
+
|
|
14
|
+
Specify the host and path using the `bundleHost` option.
|
|
15
|
+
|
|
16
|
+
Upload the code-push bundle file to your server. The file name should be exactly same as the file on AppCenter.
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
const codePushOptions = {
|
|
20
|
+
bundlehost: 'https://cdn.yours.com/codepush/bundle/',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default codePush(codePushOptions)(MyApp);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Customize the update check behavior
|
|
27
|
+
|
|
28
|
+
Specify a function to perform the update check using the `updateChecker` option.
|
|
29
|
+
|
|
30
|
+
(The `bundleHost` option can be used in combination.)
|
|
31
|
+
|
|
32
|
+
`fallbackToAppCenter` : If an error occurs during the execution of the updateChecker function, the original update check behavior is performed as a fallback. (default: true)
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
const codePushOptions = {
|
|
36
|
+
updateChecker: async (updateCheckRequest) => {
|
|
37
|
+
// It's up to you to decide what to do.
|
|
38
|
+
// However, you need to have a good understanding of Code Push's interface to configure your response.
|
|
39
|
+
const { data: response } = await axios.get('https://your.api.com/update_check', {
|
|
40
|
+
params: { app_version: updateCheckRequest.app_version }
|
|
41
|
+
});
|
|
42
|
+
return response;
|
|
43
|
+
},
|
|
44
|
+
fallbackToAppCenter: true,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default codePush(codePushOptions)(MyApp);
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Original README.md is below.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
1
55
|
[](http://microsoft.github.io/code-push/)
|
|
2
56
|
|
|
3
57
|
#### [Sign up With App Center](https://appcenter.ms/signup?utm_source=CodePush&utm_medium=Azure) to use CodePush
|
|
@@ -246,44 +300,6 @@ If you would like to display an update confirmation dialog (an "active install")
|
|
|
246
300
|
|
|
247
301
|
*NOTE: If you are using [Redux](http://redux.js.org) and [Redux Saga](https://redux-saga.js.org/), you can alternatively use the [react-native-code-push-saga](http://github.com/lostintangent/react-native-code-push-saga) module, which allows you to customize when `sync` is called in a perhaps simpler/more idiomatic way.*
|
|
248
302
|
|
|
249
|
-
You can self-host the update's file. Upload the file to your server exactly as you uploaded it to AppCenter. And specify the host and path using the `bundleHost` option.
|
|
250
|
-
|
|
251
|
-
```javascript
|
|
252
|
-
let codePushOptions = {
|
|
253
|
-
checkFrequency: codePush.CheckFrequency.MANUAL,
|
|
254
|
-
bundlehost: 'https://cdn.yours.com/codepush/bundle/',
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
let MyApp: () => React$Node = () => {
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
MyApp = codePush(codePushOptions)(MyApp);
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
You can customize the behavior by specifying a function to perform the update check instead. (The 'bundleHost' option can be used with it.)
|
|
264
|
-
|
|
265
|
-
```javascript
|
|
266
|
-
let codePushOptions = {
|
|
267
|
-
checkFrequency: codePush.CheckFrequency.MANUAL,
|
|
268
|
-
bundlehost: 'https://cdn.yours.com/codepush/bundle/',
|
|
269
|
-
updateChecker: async (updateCheckRequest) => {
|
|
270
|
-
// It's up to you to decide what to do.
|
|
271
|
-
const { data: response } = await axios.get('https://your.api.com/update_check', {
|
|
272
|
-
params: { app_version: updateCheckRequest.app_version }
|
|
273
|
-
});
|
|
274
|
-
return response;
|
|
275
|
-
},
|
|
276
|
-
// If an error occurs during the execution of the updateChecker function, the original update check behavior is performed as a fallback. (default: true)
|
|
277
|
-
fallbackToAppCenter: true,
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
let MyApp: () => React$Node = () => {
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
MyApp = codePush(codePushOptions)(MyApp);
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
|
|
287
303
|
### Store Guideline Compliance
|
|
288
304
|
|
|
289
305
|
Android Google Play and iOS App Store have corresponding guidelines that have rules you should be aware of before integrating the CodePush solution within your application.
|
|
@@ -315,7 +331,7 @@ Once your app is configured and distributed to your users, and you have made som
|
|
|
315
331
|
|
|
316
332
|
*NOTE: Before you can start releasing updates, please log into App Center by running the `appcenter login` command.*
|
|
317
333
|
|
|
318
|
-
In
|
|
334
|
+
In its most basic form, this command only requires one parameter: your owner name + "/" + app name.
|
|
319
335
|
|
|
320
336
|
```shell
|
|
321
337
|
appcenter codepush release-react -a <ownerName>/<appName>
|
package/android/app/build.gradle
CHANGED
|
@@ -295,7 +295,16 @@ public class CodePush implements ReactPackage {
|
|
|
295
295
|
|
|
296
296
|
JSONObject pendingUpdate = mSettingsManager.getPendingUpdate();
|
|
297
297
|
if (pendingUpdate != null) {
|
|
298
|
-
JSONObject packageMetadata =
|
|
298
|
+
JSONObject packageMetadata = null;
|
|
299
|
+
|
|
300
|
+
try {
|
|
301
|
+
packageMetadata = this.mUpdateManager.getCurrentPackage();
|
|
302
|
+
} catch (CodePushMalformedDataException e) {
|
|
303
|
+
// We need to recover the app in case 'codepush.json' is corrupted
|
|
304
|
+
CodePushUtils.log(e);
|
|
305
|
+
clearUpdates();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
299
308
|
if (packageMetadata == null || !isPackageBundleLatest(packageMetadata) && hasBinaryVersionChanged(packageMetadata)) {
|
|
300
309
|
CodePushUtils.log("Skipping initializeUpdateAfterRestart(), binary version is newer");
|
|
301
310
|
return;
|
|
@@ -3,11 +3,12 @@ package com.microsoft.codepush.react;
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.util.Base64;
|
|
5
5
|
|
|
6
|
+
import com.nimbusds.jose.JWSVerifier;
|
|
7
|
+
import com.nimbusds.jose.crypto.RSASSAVerifier;
|
|
8
|
+
import com.nimbusds.jwt.SignedJWT;
|
|
9
|
+
|
|
6
10
|
import java.security.interfaces.*;
|
|
7
11
|
|
|
8
|
-
import com.nimbusds.jose.*;
|
|
9
|
-
import com.nimbusds.jose.crypto.*;
|
|
10
|
-
import com.nimbusds.jwt.*;
|
|
11
12
|
|
|
12
13
|
import org.json.JSONArray;
|
|
13
14
|
import org.json.JSONException;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bravemobile/react-native-code-push",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.5",
|
|
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",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"url": "https://github.com/Soomgo-Mobile/react-native-code-push"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"code-push": "^4.2.
|
|
39
|
+
"code-push": "^4.2.1",
|
|
40
40
|
"glob": "^7.1.7",
|
|
41
41
|
"hoist-non-react-statics": "^3.3.2",
|
|
42
42
|
"inquirer": "^8.1.5",
|
|
@@ -176,7 +176,7 @@ export interface SyncOptions {
|
|
|
176
176
|
* value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as
|
|
177
177
|
* overriding one or more of the default strings.
|
|
178
178
|
*/
|
|
179
|
-
updateDialog?: UpdateDialog;
|
|
179
|
+
updateDialog?: UpdateDialog | true;
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions
|