@bravemobile/react-native-code-push 12.1.2 → 12.1.4

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.
@@ -44,7 +44,7 @@ export function modifyMainApplicationKt(mainApplicationContent: string) {
44
44
  }
45
45
 
46
46
  function addJsBundleFilePathArgument(mainApplicationContent: string) {
47
- const packageListArgumentPattern = /(packageList\s*=\s*\n\s*PackageList\(this\)[\s\S]+?\},\s*\n)/;
47
+ const packageListArgumentPattern = /(packageList\s*=\s*\n\s*PackageList\(this\)[\s\S]+?\},?\s*\n)/;
48
48
 
49
49
  if (!packageListArgumentPattern.test(mainApplicationContent)) {
50
50
  console.log('log: Could not find packageList argument while updating MainApplication.kt.');
@@ -34,7 +34,7 @@ export function modifyMainApplicationKt(mainApplicationContent) {
34
34
  throw new Error('Unsupported MainApplication.kt structure.');
35
35
  }
36
36
  function addJsBundleFilePathArgument(mainApplicationContent) {
37
- const packageListArgumentPattern = /(packageList\s*=\s*\n\s*PackageList\(this\)[\s\S]+?\},\s*\n)/;
37
+ const packageListArgumentPattern = /(packageList\s*=\s*\n\s*PackageList\(this\)[\s\S]+?\},?\s*\n)/;
38
38
  if (!packageListArgumentPattern.test(mainApplicationContent)) {
39
39
  console.log('log: Could not find packageList argument while updating MainApplication.kt.');
40
40
  return mainApplicationContent;
@@ -1,7 +1,7 @@
1
1
  const { withMainApplication, WarningAggregator } = require('expo/config-plugins');
2
2
 
3
3
  const IMPORT_CODE_PUSH = 'import com.microsoft.codepush.react.CodePush';
4
- const RN_082_MARKER = ' getDefaultReactHost(';
4
+ const RN_082_MARKER = 'ExpoReactHostFactory.getDefaultReactHost(';
5
5
  const JS_BUNDLE_FILE_PATH_ARGUMENT = 'jsBundleFilePath = CodePush.getJSBundleFile()';
6
6
 
7
7
  function androidMainApplicationApplyImplementation(mainApplication, find, add, reverse = false) {
@@ -32,7 +32,7 @@ function addJsBundleFilePathArgument(mainApplication) {
32
32
  return mainApplication;
33
33
  }
34
34
 
35
- const packageListArgumentPattern = /(packageList\s*=\s*\n\s*PackageList\(this\)[\s\S]+?\},\s*\n)/;
35
+ const packageListArgumentPattern = /(packageList\s*=\s*\n\s*PackageList\(this\)[\s\S]+?\},?\s*\n)/;
36
36
 
37
37
  if (!packageListArgumentPattern.test(mainApplication)) {
38
38
  WarningAggregator.addWarningAndroid(
@@ -68,10 +68,19 @@ const withAndroidMainApplicationDependency = (config) => {
68
68
  if (action.modResults.contents.includes(RN_082_MARKER)) {
69
69
  action.modResults.contents = addJsBundleFilePathArgument(action.modResults.contents);
70
70
  } else {
71
+ // https://github.com/Soomgo-Mobile/react-native-code-push/issues/97
72
+ const isExpoSDK54 = config.sdkVersion?.startsWith('54.') ?? false;
73
+ const addingCode = isExpoSDK54
74
+ ? ' override fun getJSBundleFile(): String {\n' +
75
+ ' CodePush.getInstance(applicationContext, BuildConfig.DEBUG)\n' +
76
+ ' return CodePush.getJSBundleFile()\n' +
77
+ ' }\n'
78
+ : ' override fun getJSBundleFile(): String = CodePush.getJSBundleFile()\n';
71
79
  action.modResults.contents = androidMainApplicationApplyImplementation(
72
80
  action.modResults.contents,
73
81
  'object : DefaultReactNativeHost(this) {',
74
- ' override fun getJSBundleFile(): String = CodePush.getJSBundleFile()\n');
82
+ addingCode,
83
+ );
75
84
  }
76
85
  }
77
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bravemobile/react-native-code-push",
3
- "version": "12.1.2",
3
+ "version": "12.1.4",
4
4
  "description": "React Native plugin for the CodePush service",
5
5
  "main": "src/CodePush.js",
6
6
  "react-native": "src/CodePush.js",
@@ -69,7 +69,7 @@
69
69
  "prepack": "npm run build:cli",
70
70
  "publish": "npm publish --access=public",
71
71
  "eslint": "eslint --quiet .",
72
- "jest": "jest src/versioning/* && npm run --workspace cli test"
72
+ "jest": "jest src/versioning/* expo/* && npm run --workspace cli test"
73
73
  },
74
74
  "repository": {
75
75
  "type": "git",