Skip to content

Commit 4c56153

Browse files
andreidubovLakshminarasimhan ks
authored andcommitted
Add compatibility with react-native v0.62 (microsoft#1829)
1 parent 35c58df commit 4c56153

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

android/app/src/main/java/com/microsoft/codepush/react/CodePush.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,8 @@ private String getCustomPropertyFromStringsIfExist(String propertyName) {
150150
}
151151

152152
private boolean isLiveReloadEnabled(ReactInstanceManager instanceManager) {
153-
// Use instanceManager for checking if we use LiveReload mode. In this case we
154-
// should not remove ReactNativeDevBundle.js file
155-
// because we get error with trying to get this after reloading. Issue:
156-
// https://github.com/microsoft/react-native-code-push/issues/1272
153+
// Use instanceManager for checking if we use LiveReload mode. In this case we should not remove ReactNativeDevBundle.js file
154+
// because we get error with trying to get this after reloading. Issue: https://github.com/microsoft/react-native-code-push/issues/1272
157155
if (instanceManager != null) {
158156
DevSupportManager devSupportManager = instanceManager.getDevSupportManager();
159157
if (devSupportManager != null) {
@@ -176,8 +174,7 @@ private boolean isLiveReloadEnabled(ReactInstanceManager instanceManager) {
176174

177175
public void clearDebugCacheIfNeeded(ReactInstanceManager instanceManager) {
178176
if (mIsDebugMode && mSettingsManager.isPendingUpdate(null) && !isLiveReloadEnabled(instanceManager)) {
179-
// This needs to be kept in sync with
180-
// https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java#L78
177+
// This needs to be kept in sync with https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java#L78
181178
File cachedDevBundle = new File(mContext.getFilesDir(), "ReactNativeDevBundle.js");
182179
if (cachedDevBundle.exists()) {
183180
cachedDevBundle.delete();

test/test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ class RNAndroid extends Platform.Android implements RNPlatform {
9494
"include ':app'",
9595
"include ':app', ':react-native-code-push'\nproject(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')");
9696

97+
// Add CodePush to android/settings.gradle
98+
const settingsGradle = path.join(innerprojectDirectory, "android", "settings.gradle");
99+
TestUtil.replaceString(settingsGradle,
100+
"include ':app'",
101+
"include ':app', ':react-native-code-push'\nproject(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')");
102+
97103
//// Set the app version to 1.0.0 instead of 1.0
98104
// Set the app version to 1.0.0 in android/app/build.gradle
99105
TestUtil.replaceString(buildGradle, "versionName \"1.0\"", "versionName \"1.0.0\"");

0 commit comments

Comments
 (0)