react-native-ota-hot-update 2.2.3 → 2.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ota-hot-update",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "Hot update for react native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -3,20 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const config_plugins_1 = require("@expo/config-plugins");
4
4
  const withAndroidAction = (config) => {
5
5
  return (0, config_plugins_1.withMainApplication)(config, (config) => {
6
- config.modResults.contents = config.modResults.contents.replace(/override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED/g, `
6
+ if (!config.modResults.contents.includes('override fun getJSBundleFile(): String = OtaHotUpdate.bundleJS(this@MainApplication)')) {
7
+ config.modResults.contents = config.modResults.contents.replace(/override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED/g, `
7
8
  override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
8
9
 
9
10
  override fun getJSBundleFile(): String = OtaHotUpdate.bundleJS(this@MainApplication)`);
10
- config.modResults.contents = config.modResults.contents.replace(/import expo.modules.ReactNativeHostWrapper/g, `
11
+ }
12
+ if (!config.modResults.contents.includes('import com.otahotupdate.OtaHotUpdate')) {
13
+ config.modResults.contents = config.modResults.contents.replace(/import expo.modules.ReactNativeHostWrapper/g, `
11
14
  import expo.modules.ReactNativeHostWrapper
12
15
  import com.otahotupdate.OtaHotUpdate`);
16
+ }
13
17
  return config;
14
18
  });
15
19
  };
16
20
  const withIosAction = (config) => {
17
21
  return (0, config_plugins_1.withAppDelegate)(config, (config) => {
18
- config.modResults.contents = config.modResults.contents.replace(/#import "AppDelegate.h"/g, `#import "AppDelegate.h"
22
+ if (!config.modResults.contents.includes('#import "OtaHotUpdate.h')) {
23
+ config.modResults.contents = config.modResults.contents.replace(/#import "AppDelegate.h"/g, `#import "AppDelegate.h"
19
24
  #import "OtaHotUpdate.h"`);
25
+ }
20
26
  config.modResults.contents = config.modResults.contents.replace(/\[\[NSBundle mainBundle\] URLForResource:@\"main\" withExtension:@\"jsbundle\"\]/, `[OtaHotUpdate getBundle]`);
21
27
  return config;
22
28
  });
@@ -1,30 +1,38 @@
1
1
  import { withMainApplication, withAppDelegate } from '@expo/config-plugins';
2
2
  const withAndroidAction: any = (config: any) => {
3
3
  return withMainApplication(config, (config) => {
4
- config.modResults.contents = config.modResults.contents.replace(
5
- /override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED/g,
6
- `
4
+ if (!config.modResults.contents.includes('override fun getJSBundleFile(): String = OtaHotUpdate.bundleJS(this@MainApplication)')) {
5
+ config.modResults.contents = config.modResults.contents.replace(
6
+ /override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED/g,
7
+ `
7
8
  override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
8
9
 
9
10
  override fun getJSBundleFile(): String = OtaHotUpdate.bundleJS(this@MainApplication)`
10
- );
11
- config.modResults.contents = config.modResults.contents.replace(
12
- /import expo.modules.ReactNativeHostWrapper/g,
13
- `
11
+ );
12
+ }
13
+
14
+ if (!config.modResults.contents.includes('import com.otahotupdate.OtaHotUpdate')) {
15
+ config.modResults.contents = config.modResults.contents.replace(
16
+ /import expo.modules.ReactNativeHostWrapper/g,
17
+ `
14
18
  import expo.modules.ReactNativeHostWrapper
15
19
  import com.otahotupdate.OtaHotUpdate`
16
- );
20
+ );
21
+ }
17
22
  return config;
18
23
  });
19
24
  };
20
25
 
21
26
  const withIosAction: any = (config: any) => {
22
27
  return withAppDelegate(config, (config) => {
23
- config.modResults.contents = config.modResults.contents.replace(
24
- /#import "AppDelegate.h"/g,
25
- `#import "AppDelegate.h"
28
+ if (!config.modResults.contents.includes('#import "OtaHotUpdate.h')) {
29
+ config.modResults.contents = config.modResults.contents.replace(
30
+ /#import "AppDelegate.h"/g,
31
+ `#import "AppDelegate.h"
26
32
  #import "OtaHotUpdate.h"`
27
- );
33
+ );
34
+ }
35
+
28
36
  config.modResults.contents = config.modResults.contents.replace(
29
37
  /\[\[NSBundle mainBundle\] URLForResource:@\"main\" withExtension:@\"jsbundle\"\]/,
30
38
  `[OtaHotUpdate getBundle]`