Skip to content

Commit 16eefde

Browse files
authored
Merge pull request Expensify#68429 from Expensify/cristi_integrate-group-ib-fp
[No QA] Integrate Group-IB FP module
2 parents c0631c2 + 6fb819b commit 16eefde

148 files changed

Lines changed: 35174 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ help/_scripts/**
1717
modules/ExpensifyNitroUtils/nitrogen/**
1818
Mobile-Expensify/**
1919
vendor
20+
modules/group-ib-fp/**

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ src/libs/SearchParser/autocompleteParser.js
2626

2727
# Disable prettier in the submodule
2828
Mobile-Expensify
29+
modules/group-ib-fp

android/settings.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ project(':react-native-plaid-link-sdk').projectDir = new File(rootProject.projec
1515
include ':app'
1616
includeBuild('../node_modules/@react-native/gradle-plugin')
1717

18+
include ':gibsdk'
19+
project(':gibsdk').projectDir = new File(rootProject.projectDir, '../node_modules/group-ib-fp/android/gibsdk')
20+
include ':package'
21+
project(':package').projectDir = new File(rootProject.projectDir, '../node_modules/group-ib-fp/android/package')
22+
1823
if(settings.extensions.patchedArtifacts.buildFromSource) {
1924
includeBuild('../node_modules/react-native') {
2025
dependencySubstitution {

cspell.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
"genkey",
254254
"GEOLOCATION",
255255
"getprop",
256+
"gibsdk",
256257
"glcode",
257258
"gödecke",
258259
"googleusercontent",
@@ -782,7 +783,8 @@
782783
"tests/unit/currencyList.json",
783784
"tests/unit/ValidationUtilsTest.ts",
784785
"src/CONST/index.ts",
785-
"src/libs/SearchParser/*"
786+
"src/libs/SearchParser/*",
787+
"modules/group-ib-fp"
786788
],
787789
"ignoreRegExpList": ["@assets/.*"],
788790
"useGitignore": true

modules/group-ib-fp/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# group-ib-fp
2+
3+
React Native module with Group-IB FP
4+
5+
## Installation
6+
7+
```sh
8+
npm install group-ib-fp
9+
```
10+
11+
# Android
12+
13+
Add to the project `android/settings.gradle` file:
14+
```groovy
15+
include ':gibsdk'
16+
include ':package'
17+
18+
project(':gibsdk').projectDir = new File(rootProject.projectDir, '../node_modules/group-ib-fp/android/gibsdk')
19+
project(':package').projectDir = new File(rootProject.projectDir, '../node_modules/group-ib-fp/android/package')
20+
```
21+
22+
## Usage
23+
24+
```js
25+
import { FP, Capability, Format, AndroidCapability } from 'group-ib-fp';
26+
27+
// ...
28+
29+
const fp = FP.getInstance();
30+
fp.enableDebugLogs();
31+
fp.changeBehaviorExtendedData(true);
32+
fp.setCustomerId("gib-i-test", (error: any) => {
33+
console.log(error);
34+
});
35+
36+
fp.setTargetURL("https://fhp-de-back.group-ib.com/api/fl", (error: any) => {
37+
console.log(error);
38+
});
39+
40+
fp.enableCapability(Capability.Swizzle, (error: any, isRun: Boolean) => {
41+
if (error) {
42+
console.log(error);
43+
}
44+
console.log("Capability run status " + isRun);
45+
});
46+
47+
fp.enableCapability(Capability.Behavior, (error: any, isRun: Boolean) => {
48+
if (error) {
49+
console.log(error);
50+
}
51+
console.log("Capability run status " + isRun);
52+
});
53+
54+
fp.enableCapability(Capability.Motion, (error: any, isRun: Boolean) => {
55+
if (error) {
56+
console.log(error);
57+
}
58+
console.log("Capability run status " + isRun);
59+
});
60+
61+
fp.run((error: any) => {
62+
console.log(error);
63+
});
64+
65+
66+
fp.getCookies((cookies: any) => {
67+
console.log(cookies); // Dictionary with cookies
68+
});
69+
70+
```
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
buildscript {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
jcenter()
6+
}
7+
8+
dependencies {
9+
classpath 'com.android.tools.build:gradle:3.5.3'
10+
}
11+
}
12+
13+
def isNewArchitectureEnabled() {
14+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
15+
}
16+
17+
apply plugin: 'com.android.library'
18+
19+
if (isNewArchitectureEnabled()) {
20+
apply plugin: 'com.facebook.react'
21+
}
22+
23+
def getExtOrDefault(name) {
24+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ModuleFhpIos_' + name]
25+
}
26+
27+
def getExtOrIntegerDefault(name) {
28+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ModuleFhpIos_' + name]).toInteger()
29+
}
30+
31+
android {
32+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
33+
34+
defaultConfig {
35+
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
36+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
37+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
38+
}
39+
buildTypes {
40+
release {
41+
minifyEnabled false
42+
}
43+
}
44+
45+
lintOptions {
46+
disable 'GradleCompatible'
47+
}
48+
49+
compileOptions {
50+
sourceCompatibility JavaVersion.VERSION_1_8
51+
targetCompatibility JavaVersion.VERSION_1_8
52+
}
53+
54+
}
55+
56+
repositories {
57+
mavenCentral()
58+
google()
59+
60+
def found = false
61+
def defaultDir = null
62+
def androidSourcesName = 'React Native sources'
63+
64+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
65+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
66+
} else {
67+
defaultDir = new File(
68+
projectDir,
69+
'/../../../node_modules/react-native/android'
70+
)
71+
}
72+
73+
if (defaultDir.exists()) {
74+
maven {
75+
url defaultDir.toString()
76+
name androidSourcesName
77+
}
78+
79+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
80+
found = true
81+
} else {
82+
def parentDir = rootProject.projectDir
83+
84+
1.upto(5, {
85+
if (found) return true
86+
parentDir = parentDir.parentFile
87+
88+
def androidSourcesDir = new File(
89+
parentDir,
90+
'node_modules/react-native'
91+
)
92+
93+
def androidPrebuiltBinaryDir = new File(
94+
parentDir,
95+
'node_modules/react-native/android'
96+
)
97+
98+
if (androidPrebuiltBinaryDir.exists()) {
99+
maven {
100+
url androidPrebuiltBinaryDir.toString()
101+
name androidSourcesName
102+
}
103+
104+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
105+
found = true
106+
} else if (androidSourcesDir.exists()) {
107+
maven {
108+
url androidSourcesDir.toString()
109+
name androidSourcesName
110+
}
111+
112+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
113+
found = true
114+
}
115+
})
116+
}
117+
118+
if (!found) {
119+
throw new GradleException(
120+
"${project.name}: unable to locate React Native android sources. " +
121+
"Ensure you have you installed React Native as a dependency in your project and try again."
122+
)
123+
}
124+
}
125+
126+
dependencies {
127+
//noinspection GradleDynamicVersion
128+
implementation "com.facebook.react:react-native:+"
129+
implementation(project(':gibsdk'))
130+
implementation(project(':package'))
131+
// From node_modules
132+
}
133+
134+
if (isNewArchitectureEnabled()) {
135+
react {
136+
jsRootDir = file("../src/")
137+
libraryName = "ModuleFhpIos"
138+
codegenJavaPackageName = "com.group_ib.react"
139+
}
140+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// empty config
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
configurations.maybeCreate("default")
2+
artifacts.add("default", file('gibsdk-androidx-2.0.1335201224.aar'))
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ModuleFhpIos_kotlinVersion=1.7.0
2+
ModuleFhpIos_minSdkVersion=21
3+
ModuleFhpIos_targetSdkVersion=31
4+
ModuleFhpIos_compileSdkVersion=31
5+
ModuleFhpIos_ndkversion=21.4.7075529

0 commit comments

Comments
 (0)