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 +1 -1
- package/plugin/build/index.js +9 -3
- package/plugin/src/index.ts +20 -12
package/package.json
CHANGED
package/plugin/build/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
});
|
package/plugin/src/index.ts
CHANGED
|
@@ -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 =
|
|
5
|
-
|
|
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
|
-
|
|
12
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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]`
|