Skip to content

Commit 74bab1b

Browse files
authored
Update README & Setup Guide (#7)
* update readme * update setup guide * unnecessary setup guide * update setup guide * add expo guideline
1 parent 1a2e28f commit 74bab1b

File tree

5 files changed

+23
-704
lines changed

5 files changed

+23
-704
lines changed

README.md

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
[![appcenterbanner](https://user-images.githubusercontent.com/31293287/32969262-3cc5d48a-cb99-11e7-91bf-fa57c67a371c.png)](http://microsoft.github.io/code-push/)
2-
31
#### [Sign up With App Center](https://appcenter.ms/signup?utm_source=CodePush&utm_medium=Azure) to use CodePush
42

53
# React Native Module for CodePush
6-
> [!WARNING]
7-
> React Native CodePush won't support new Architecture. In order to use this plugin on React Native versions starting from 0.76 you will need to [opt out](https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here#opt-out) from new architecture.
8-
>
9-
*Note: This README is only relevant to the latest version of our plugin. If you are using an older version, please switch to the relevant tag on [our GitHub repo](https://github.com/microsoft/react-native-code-push) to view the docs for that particular version.*
10-
11-
![Switching tags](https://user-images.githubusercontent.com/42337914/57237511-0835de80-7030-11e9-88fa-64eb200478d0.png)
124

135
This plugin provides client-side integration for the [CodePush service](https://microsoft.github.io/code-push/), allowing you to easily add a dynamic update experience to your React Native app(s).
146

@@ -53,36 +45,16 @@ In order to ensure that your end users always have a functioning version of your
5345

5446
- iOS (7+)
5547
- Android (4.1+) on TLS 1.2 compatible devices
56-
- Windows (UWP)
48+
- Windows (UWP) - Not Tested. We recommend to use [microsoft/code-push-react-native](https://github.com/microsoft/react-native-code-push)
5749

5850
We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the CodePush plugin in order to support the exact version of React Native you are using. The following table outlines which CodePush plugin versions officially support the respective React Native versions:
5951

60-
| React Native version(s) | Supporting CodePush version(s) |
61-
|-------------------------|-------------------------------------------------------|
62-
| <0.14 | **Unsupported** |
63-
| v0.14 | v1.3 *(introduced Android support)* |
64-
| v0.15-v0.18 | v1.4-v1.6 *(introduced iOS asset support)* |
65-
| v0.19-v0.28 | v1.7-v1.17 *(introduced Android asset support)* |
66-
| v0.29-v0.30 | v1.13-v1.17 *(RN refactored native hosting code)* |
67-
| v0.31-v0.33 | v1.14.6-v1.17 *(RN refactored native hosting code)* |
68-
| v0.34-v0.35 | v1.15-v1.17 *(RN refactored native hosting code)* |
69-
| v0.36-v0.39 | v1.16-v1.17 *(RN refactored resume handler)* |
70-
| v0.40-v0.42 | v1.17 *(RN refactored iOS header files)* |
71-
| v0.43-v0.44 | v2.0+ *(RN refactored uimanager dependencies)* |
72-
| v0.45 | v3.0+ *(RN refactored instance manager code)* |
73-
| v0.46 | v4.0+ *(RN refactored js bundle loader code)* |
74-
| v0.46-v0.53 | v5.1+ *(RN removed unused registration of JS modules)*|
75-
| v0.54-v0.55 | v5.3+ *(Android Gradle Plugin 3.x integration)* |
76-
| v0.56-v0.58 | v5.4+ *(RN upgraded versions for Android tools)* |
77-
| v0.59 | v5.6+ *(RN refactored js bundle loader code)* |
78-
| v0.60-v0.61 | v6.0+ *(RN migrated to Autolinking)* |
79-
| v0.62-v0.64 | v6.2+ *(RN removed LiveReload)* |
80-
| v0.65-v0.70 | v7.0+ *(RN updated iPhone-target-version)* |
81-
| v0.71 | v8.0+ *(RN moved to react-native-gradle-plugin)* |
82-
83-
*NOTE: `react-native-code-push` versions lower than **[v5.7.0](https://github.com/microsoft/react-native-code-push/releases/tag/v5.7.0)** will stop working in the near future. You can find more information in our [documentation](https://github.com/microsoft/code-push/blob/master/migration-notice.md).*
84-
85-
We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is.
52+
| React Native version(s) | Supporting CodePush version(s) |
53+
|-------------------------|------------------------------------------------------------------------------------------------------|
54+
| <v0.76 | **Consider [microsoft/code-push-react-native](https://github.com/microsoft/react-native-code-push)** |
55+
| v0.76 | v10.0+ *(Available for Old/New Architecture)* |
56+
57+
8658

8759
### Supported Components
8860

@@ -117,7 +89,7 @@ As new core components are released, which support referencing assets, we'll upd
11789
Once you've followed the general-purpose ["getting started"](https://docs.microsoft.com/en-us/appcenter/distribution/codepush/index) instructions for setting up your CodePush account, you can start CodePush-ifying your React Native app by running the following command from within your app's root directory:
11890

11991
```shell
120-
npm install --save react-native-code-push
92+
yarn add @code-push-next/react-native-code-push
12193
```
12294

12395
As with all other React Native plugins, the integration experience is different for iOS and Android, so perform the following setup steps depending on which platform(s) you are targeting. Note, if you are targeting both platforms it is recommended to create separate CodePush applications for each platform.

docs/api-android.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
### Java API Reference (Android)
2-
3-
### API for React Native 0.60 version and above
1+
### Resource Configuration
42

53
Since `autolinking` uses `react-native.config.js` to link plugins, constructors are specified in that file. But you can override custom variables to manage the CodePush plugin by placing these values in string resources.
64

@@ -16,10 +14,10 @@ Since `autolinking` uses `react-native.config.js` to link plugins, constructors
1614
<string moduleConfig="true" name="CodePushServerUrl">https://yourcodepush.server.com</string>
1715
```
1816

19-
### API for React Native lower than 0.60
20-
2117
The Java API is made available by importing the `com.microsoft.codepush.react.CodePush` class into your `MainActivity.java` file, and consists of a single public class named `CodePush`.
2218

19+
### Java API Reference (Android)
20+
2321
#### CodePush
2422

2523
Constructs the CodePush client runtime and represents the `ReactPackage` instance that you add to you app's list of packages.

docs/multi-deployment-testing-android.md

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The [Android Gradle plugin](https://google.github.io/android-gradle-dsl/current/
1010

1111
To set this up, perform the following steps:
1212

13-
**For React Native >= v0.60**
13+
**For React Native >= v0.76**
1414

1515
1. Open the project's app level `build.gradle` file (for example `android/app/build.gradle` in standard React Native projects)
1616

@@ -51,98 +51,5 @@ To set this up, perform the following steps:
5151
5252
*NOTE: The naming convention for `releaseStaging` is significant due to [this line](https://github.com/facebook/react-native/blob/e083f9a139b3f8c5552528f8f8018529ef3193b9/react.gradle#L79).*
5353
54-
**For React Native v0.29 - v0.59**
55-
56-
1. Open up your `MainApplication.java` file and make the following changes:
57-
58-
```java
59-
@Override
60-
protected List<ReactPackage> getPackages() {
61-
return Arrays.<ReactPackage>asList(
62-
...
63-
new CodePush(BuildConfig.CODEPUSH_KEY, MainApplication.this, BuildConfig.DEBUG), // Add/change this line.
64-
...
65-
);
66-
}
67-
```
68-
69-
2. Open your app's `build.gradle` file (for example `android/app/build.gradle` in standard React Native projects)
70-
71-
3. Find the `android { buildTypes {} }` section and define `buildConfigField` entries for both your `debug` and `release` build types, which reference your `Staging` and `Production` deployment keys respectively. If you prefer, you can define the key literals in your `gradle.properties` file, and then reference them here. Either way will work, and it's just a matter of personal preference.
72-
73-
```groovy
74-
android {
75-
...
76-
buildTypes {
77-
debug {
78-
...
79-
// Note: CodePush updates should not be tested in Debug mode as they are overriden by the RN packager. However, because CodePush checks for updates in all modes, we must supply a key.
80-
buildConfigField "String", "CODEPUSH_KEY", '""'
81-
...
82-
}
83-
84-
releaseStaging {
85-
...
86-
buildConfigField "String", "CODEPUSH_KEY", '"<INSERT_STAGING_KEY>"'
87-
// Note: It is a good idea to provide matchingFallbacks for the new buildType you create to prevent build issues
88-
// Add the following line if not already there
89-
matchingFallbacks = ['release']
90-
...
91-
}
92-
93-
release {
94-
...
95-
buildConfigField "String", "CODEPUSH_KEY", '"<INSERT_PRODUCTION_KEY>"'
96-
...
97-
}
98-
}
99-
...
100-
}
101-
```
102-
103-
*NOTE: The naming convention for `releaseStaging` is significant due to [this line](https://github.com/facebook/react-native/blob/e083f9a139b3f8c5552528f8f8018529ef3193b9/react.gradle#L79).*
104-
105-
4. Pass the deployment key to the `CodePush` constructor via the build config you defined, as opposed to a string literal.
106-
107-
**For React Native v0.19 - v0.28**
108-
109-
Open up your `MainActivity.java` file and make the following changes:
110-
111-
```java
112-
@Override
113-
protected List<ReactPackage> getPackages() {
114-
return Arrays.<ReactPackage>asList(
115-
...
116-
new CodePush(BuildConfig.CODEPUSH_KEY, this, BuildConfig.DEBUG), // Add/change this line.
117-
...
118-
);
119-
}
120-
```
121-
122-
*Note: If you gave your build setting a different name in your Gradle file, simply make sure to reflect that in your Java code.*
123-
124-
And that's it! Now when you run or build your app, your debug builds will automatically be configured to sync with your `Staging` deployment, and your release builds will be configured to sync with your `Production` deployment.
125-
126-
*NOTE: By default, the `react-native run-android` command builds and deploys the debug version of your app, so if you want to test out a release/production build, simply run `react-native run-android --variant release. Refer to the [React Native docs](http://facebook.github.io/react-native/docs/signed-apk-android.html#conten) for details about how to configure and create release builds for your Android apps.*
127-
128-
If you want to be able to install both debug and release builds simultaneously on the same device (highly recommended!), then you need to ensure that your debug build has a unique identity and icon from your release build. Otherwise, neither the OS nor you will be able to differentiate between the two. You can achieve this by performing the following steps:
129-
130-
1. In your `build.gradle` file, specify the [`applicationIdSuffix`](http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.BuildType.html#com.android.build.gradle.internal.dsl.BuildType:applicationIdSuffix) field for your debug build type, which gives your debug build a unique identity for the OS (like `com.foo` vs. `com.foo.debug`).
131-
132-
```groovy
133-
buildTypes {
134-
debug {
135-
applicationIdSuffix ".debug"
136-
}
137-
}
138-
```
139-
140-
2. Create the `app/src/debug/res` directory structure in your app, which allows overriding resources (like strings, icons, layouts) for your debug builds
141-
142-
3. Create a `values` directory underneath the debug res directory created in #2, and copy the existing `strings.xml` file from the `app/src/main/res/values` directory
143-
144-
4. Open up the new debug `strings.xml` file and change the `<string name="app_name">` element's value to something else (like `foo-debug`). This ensures that your debug build now has a distinct display name, so that you can differentiate it from your release build.
145-
146-
5. Optionally, create "mirrored" directories in the `app/src/debug/res` directory for all of your app's icons that you want to change for your debug build. This part isn't technically critical, but it can make it easier to quickly spot your debug builds on a device if its icon is noticeable different.
14754
14855
And that's it! View [here](http://tools.android.com/tech-docs/new-build-system/resource-merging) for more details on how resource merging works in Android.

0 commit comments

Comments
 (0)