@bravemobile/react-native-code-push 8.2.4 → 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.
Files changed (3) hide show
  1. package/CodePush.js +8 -3
  2. package/README.md +54 -38
  3. package/package.json +1 -1
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
- const fileName = update && typeof update.downloadUrl === 'string' ? update.downloadUrl.split('/').pop() : null;
99
- if (sharedCodePushOptions.bundleHost && fileName) {
100
- update.downloadUrl = sharedCodePushOptions.bundleHost + fileName;
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
  [![appcenterbanner](https://user-images.githubusercontent.com/31293287/32969262-3cc5d48a-cb99-11e7-91bf-fa57c67a371c.png)](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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bravemobile/react-native-code-push",
3
- "version": "8.2.4",
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",