pushwave-client 0.1.4 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/plugin/index.js +13 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushwave-client",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "PushWave Client, Expo Push Notifications SaaS SDK",
5
5
  "homepage": "https://github.com/luruk-hai/pushwave-client#readme",
6
6
  "bugs": {
package/plugin/index.js CHANGED
@@ -8,44 +8,30 @@ const pkg = require("../package.json");
8
8
 
9
9
  const PLAY_INTEGRITY_DEP = 'implementation("com.google.android.play:integrity:1.4.0")';
10
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
+ }
18
+
11
19
  function withPushwaveAndroid(config) {
12
- // Inject into module-level build.gradle (Groovy)
20
+ // Inject into module-level build.gradle / build.gradle.kts
13
21
  config = withAppBuildGradle(config, (config) => {
14
22
  const { language, contents } = config.modResults;
15
- if (language !== "groovy") return config;
23
+ if (language !== "groovy" && language !== "kts") return config;
16
24
 
17
- if (!contents.includes(PLAY_INTEGRITY_DEP)) {
18
- config.modResults.contents = contents.replace(
19
- /dependencies\s?{[^}]*}/,
20
- (match) => {
21
- if (match.includes(PLAY_INTEGRITY_DEP)) return match;
22
- return match.replace(
23
- /dependencies\s?{/,
24
- `dependencies {\n ${PLAY_INTEGRITY_DEP}\n`
25
- );
26
- }
27
- );
28
- }
25
+ config.modResults.contents = injectDependency(contents);
29
26
  return config;
30
27
  });
31
28
 
32
- // Inject into project-level build.gradle.kts (Kotlin DSL)
29
+ // Inject into project-level build.gradle.kts (some setups place deps here)
33
30
  config = withProjectBuildGradle(config, (config) => {
34
31
  const { language, contents } = config.modResults;
35
32
  if (language !== "kts") return config;
36
33
 
37
- if (!contents.includes(PLAY_INTEGRITY_DEP)) {
38
- config.modResults.contents = contents.replace(
39
- /dependencies\s?{[^}]*}/,
40
- (match) => {
41
- if (match.includes(PLAY_INTEGRITY_DEP)) return match;
42
- return match.replace(
43
- /dependencies\s?{/,
44
- `dependencies {\n ${PLAY_INTEGRITY_DEP}\n`
45
- );
46
- }
47
- );
48
- }
34
+ config.modResults.contents = injectDependency(contents);
49
35
  return config;
50
36
  });
51
37