Skip to content

Commit eadf826

Browse files
authored
Merge pull request #5 from Soomgo-Mobile/feature/update-readme
docs: clearly state differences from the original
2 parents 8907351 + 9a89c5c commit eadf826

File tree

1 file changed

+54
-38
lines changed

1 file changed

+54
-38
lines changed

README.md

Lines changed: 54 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
155
[![appcenterbanner](https://user-images.githubusercontent.com/31293287/32969262-3cc5d48a-cb99-11e7-91bf-fa57c67a371c.png)](http://microsoft.github.io/code-push/)
256

357
#### [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")
246300
247301
*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.*
248302
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-
287303
### Store Guideline Compliance
288304
289305
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.

0 commit comments

Comments
 (0)