pushwave-client 0.1.3 → 0.1.5
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/index.js +26 -22
package/package.json
CHANGED
package/plugin/index.js
CHANGED
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
const {
|
|
2
2
|
createRunOncePlugin,
|
|
3
3
|
withAppBuildGradle,
|
|
4
|
+
withProjectBuildGradle,
|
|
4
5
|
} = require("@expo/config-plugins");
|
|
5
6
|
|
|
6
7
|
const pkg = require("../package.json");
|
|
7
8
|
|
|
8
|
-
const PLAY_INTEGRITY_DEP = 'implementation("com.google.android.play:integrity:1.
|
|
9
|
+
const PLAY_INTEGRITY_DEP = 'implementation("com.google.android.play:integrity:1.4.0")';
|
|
10
|
+
|
|
11
|
+
function injectDependency(contents) {
|
|
12
|
+
if (contents.includes(PLAY_INTEGRITY_DEP)) return contents;
|
|
13
|
+
return contents.replace(/dependencies\s?{[^}]*}/, (match) => {
|
|
14
|
+
if (match.includes(PLAY_INTEGRITY_DEP)) return match;
|
|
15
|
+
return match.replace(/dependencies\s?{/, `dependencies {\n ${PLAY_INTEGRITY_DEP}\n`);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
9
18
|
|
|
10
19
|
function withPushwaveAndroid(config) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const content = config.modResults.contents;
|
|
17
|
-
|
|
18
|
-
if (content.includes(PLAY_INTEGRITY_DEP)) {
|
|
19
|
-
return config;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
config.modResults.contents = content.replace(
|
|
23
|
-
/dependencies\s?{[^}]*}/,
|
|
24
|
-
(match) => {
|
|
25
|
-
if (match.includes(PLAY_INTEGRITY_DEP)) return match;
|
|
26
|
-
return match.replace(
|
|
27
|
-
/dependencies\s?{/,
|
|
28
|
-
`dependencies {\n ${PLAY_INTEGRITY_DEP}\n`
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
);
|
|
20
|
+
// Inject into module-level build.gradle / build.gradle.kts
|
|
21
|
+
config = withAppBuildGradle(config, (config) => {
|
|
22
|
+
const { language, contents } = config.modResults;
|
|
23
|
+
if (language !== "groovy" && language !== "kts") return config;
|
|
32
24
|
|
|
25
|
+
config.modResults.contents = injectDependency(contents);
|
|
33
26
|
return config;
|
|
34
27
|
});
|
|
28
|
+
|
|
29
|
+
// Inject into project-level build.gradle.kts (some setups place deps here)
|
|
30
|
+
config = withProjectBuildGradle(config, (config) => {
|
|
31
|
+
const { language, contents } = config.modResults;
|
|
32
|
+
if (language !== "kts") return config;
|
|
33
|
+
|
|
34
|
+
config.modResults.contents = injectDependency(contents);
|
|
35
|
+
return config;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
return config;
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
const withPushwaveClient = (config) => {
|