pushwave-client 0.1.4 → 0.1.6
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.
|
@@ -6,9 +6,9 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
6
6
|
import com.facebook.react.bridge.ReactMethod
|
|
7
7
|
import com.google.android.gms.tasks.OnFailureListener
|
|
8
8
|
import com.google.android.gms.tasks.OnSuccessListener
|
|
9
|
-
import com.google.android.play.
|
|
10
|
-
import com.google.android.play.
|
|
11
|
-
import com.google.android.play.
|
|
9
|
+
import com.google.android.play.integrity.IntegrityManagerFactory
|
|
10
|
+
import com.google.android.play.integrity.StandardIntegrityManager
|
|
11
|
+
import com.google.android.play.integrity.StandardIntegrityTokenRequest
|
|
12
12
|
|
|
13
13
|
class PushwaveAttestationModule(private val context: ReactApplicationContext) :
|
|
14
14
|
ReactContextBaseJavaModule(context) {
|
package/package.json
CHANGED
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
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
|