Skip to content

Commit b98f75c

Browse files
authored
Merge pull request #135 from fingerprintjs/update-agents-to-2-7-0
feat: update ios and android agents to v2.7.0 INTER-1002
2 parents 6b188b5 + 538808f commit b98f75c

27 files changed

+1448
-974
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Test React Native Library
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
android-build:
8+
name: Android - Build and Test React Native Library
9+
runs-on: macos-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
18+
- name: Install dependencies
19+
run: |
20+
yarn install
21+
yarn build
22+
cd TestProject
23+
yarn install
24+
25+
- name: Build Android
26+
run: |
27+
cd TestProject/android
28+
./gradlew assembleDebug
29+
30+
- name: Start Metro Bundler # and Test App
31+
run: |
32+
cd TestProject
33+
yarn start &
34+
sleep 10 # Allow Metro Bundler to start
35+
# yarn test
36+
37+
ios-build:
38+
name: iOS - Build and Test React Native Library
39+
runs-on: macos-latest
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Set up Node.js
46+
uses: actions/setup-node@v4
47+
48+
- name: Install dependencies
49+
run: |
50+
yarn install
51+
yarn build
52+
cd TestProject
53+
yarn install
54+
55+
- name: Install Pods
56+
run: |
57+
cd TestProject/ios
58+
pod install
59+
60+
- name: Build iOS
61+
env:
62+
CI: true
63+
run: |
64+
cd TestProject/ios
65+
xcodebuild -workspace TestProject.xcworkspace -scheme TestProject -sdk iphonesimulator -configuration Debug build
66+
67+
- name: Start Metro Bundler # and Test App
68+
run: |
69+
cd TestProject
70+
yarn start &
71+
sleep 10 # Allow Metro Bundler to start
72+
# yarn test

README.md

Lines changed: 71 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,32 @@
2828
</a>
2929
</p>
3030

31-
# Fingerprint Pro React Native
31+
# Fingerprint Pro React Native
3232

3333
[Fingerprint](https://fingerprint.com/) is a device intelligence platform offering 99.5% accurate visitor
3434
identification. Fingerprint Pro React Native SDK is an easy way to integrate Fingerprint Pro into your React Native
3535
application to call the native Fingerprint Pro libraries (Android and iOS) and identify devices.
3636

3737
## Table of contents
38-
* [Requirements and limitations](#requirements-and-limitations)
39-
* [Dependencies](#dependencies)
40-
* [How to install](#how-to-install)
41-
* [Usage](#usage)
42-
* [Hooks approach](#hooks-approach)
43-
* [API Client approach](#api-client-approach)
44-
* [`extendedResponseFormat`](#extendedresponseformat)
45-
* [Linking and tagging information](#linking-and-tagging-information)
46-
* [API Reference](#api-reference)
47-
* [Additional Resources](#additional-resources)
48-
* [Support and feedback](#support-and-feedback)
49-
* [License](#license)
38+
- [Fingerprint Pro React Native](#fingerprint-pro-react-native)
39+
- [Table of contents](#table-of-contents)
40+
- [Requirements and limitations](#requirements-and-limitations)
41+
- [Dependencies](#dependencies)
42+
- [How to install](#how-to-install)
43+
- [1. Install the package using your favorite package manager:](#1-install-the-package-using-your-favorite-package-manager)
44+
- [2. Configure iOS dependencies](#2-configure-ios-dependencies)
45+
- [3. Configure Android dependencies](#3-configure-android-dependencies)
46+
- [Gradle versions before 7.0](#gradle-versions-before-70)
47+
- [Gradle versions 7.0 and higher](#gradle-versions-70-and-higher)
48+
- [Usage](#usage)
49+
- [Hooks approach](#hooks-approach)
50+
- [API Client approach](#api-client-approach)
51+
- [`extendedResponseFormat`](#extendedresponseformat)
52+
- [Linking and tagging information](#linking-and-tagging-information)
53+
- [API Reference](#api-reference)
54+
- [Additional Resources](#additional-resources)
55+
- [Support and feedback](#support-and-feedback)
56+
- [License](#license)
5057

5158
## Requirements and limitations
5259

@@ -81,51 +88,65 @@ application to call the native Fingerprint Pro libraries (Android and iOS) and i
8188
pnpm add @fingerprintjs/fingerprintjs-pro-react-native
8289
```
8390

84-
### 2. Configure native dependencies
91+
### 2. Configure iOS dependencies
92+
8593

86-
* **iOS**
8794
```shell
8895
cd ios && pod install
8996
```
9097

91-
* **Android**
98+
### 3. Configure Android dependencies
9299

93-
Add a declaration of the Fingerprint Android repository to your app main `build.gradle` file to the `allprojects` section:
94-
```groovy
95-
maven {
96-
url("https://maven.fpregistry.io/releases")
97-
}
98-
maven {
99-
url("https://www.jitpack.io")
100-
}
101-
```
100+
To declare the Fingerprint Maven repository, add the following declarations:
101+
```groovy
102+
maven {
103+
url("https://maven.fpregistry.io/releases")
104+
}
105+
```
106+
107+
Add the repositories to your Gradle configuration file. The location for these additions depends on your project's structure and the Gradle version you're using:
102108

103-
The file location is `{rootDir}/android/build.gradle`.
104-
After the changes the `build.gradle` file should look as following:
109+
#### Gradle versions before 7.0
110+
111+
For Gradle versions before 7.0, you likely have an `allprojects` block in `{rootDir}/android/build.gradle`. Add the Maven repositories within this block:
105112

106113
```groovy
107-
allprojects {
108-
repositories {
109-
mavenCentral()
110-
mavenLocal()
111-
maven {
112-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
113-
url("$rootDir/../node_modules/react-native/android")
114-
}
115-
maven {
116-
// Android JSC is installed from npm
117-
url("$rootDir/../node_modules/jsc-android/dist")
118-
}
119-
maven {
120-
url("https://maven.fpregistry.io/releases")
121-
}
122-
maven {
123-
url("https://www.jitpack.io")
124-
}
125-
google()
126-
}
114+
allprojects {
115+
repositories {
116+
mavenCentral()
117+
mavenLocal()
118+
maven {
119+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
120+
url("$rootDir/../node_modules/react-native/android")
121+
}
122+
maven {
123+
// Android JSC is installed from npm
124+
url("$rootDir/../node_modules/jsc-android/dist")
125+
}
126+
maven {
127+
url("https://maven.fpregistry.io/releases") // Add this
128+
}
129+
google()
130+
}
131+
}
132+
```
133+
134+
#### Gradle versions 7.0 and higher
135+
136+
For Gradle 7.0 and higher (if you've adopted [the new Gradle settings file approach](https://developer.android.com/build#settings-file)), you likely manage repositories in the `dependencyResolutionManagement` block in `{rootDir}/android/settings.gradle`. Add the Maven repositories in this block:
137+
138+
```groovy
139+
dependencyResolutionManagement {
140+
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
141+
repositories {
142+
google()
143+
mavenCentral()
144+
maven {
145+
url("https://maven.fpregistry.io/releases") // Add this
146+
}
127147
}
128-
```
148+
}
149+
```
129150

130151
## Usage
131152

@@ -228,7 +249,7 @@ Two types of responses are supported: "default" and "extended". You don't need t
228249
"Extended" is an extended result format that includes geolocation, incognito mode and other information.
229250
It can be requested using the `extendedResponseFormat`: true parameter. See more details about the responses in the [documentation](https://dev.fingerprint.com/reference/get-function#extendedresult).
230251

231-
#### Providing `extendedResponseFormat` with hooks approach
252+
Providing `extendedResponseFormat` using hooks:
232253

233254
```javascript
234255
return (
@@ -238,7 +259,7 @@ It can be requested using the `extendedResponseFormat`: true parameter. See more
238259
)
239260
```
240261

241-
#### Providing `extendedResponseFormat` with API Client approach
262+
Providing `extendedResponseFormat` using the API Client:
242263

243264
```javascript
244265
const FingerprintClient = new FingerprintJsProAgent({ apiKey: 'PUBLIC_API_KEY', region: 'eu', extendedResponseFormat: true }); // Region may be 'us', 'eu', or 'ap'

RNFingerprintjsPro.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ Pod::Spec.new do |s|
1414
# s.requires_arc = true
1515

1616
s.dependency "React-Core"
17-
s.dependency "FingerprintPro", '~> 2.6.0'
17+
s.dependency "FingerprintPro", '>= 2.7.0', '< 3.0.0'
1818
end

TestProject/App.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import { SafeAreaView, StatusBar, useColorScheme } from 'react-native'
44
import { Colors } from 'react-native/Libraries/NewAppScreen'
55
import { FingerprintJsProProvider } from '@fingerprintjs/fingerprintjs-pro-react-native'
66
import { Visitor } from './src/Visitor'
7-
import { PUBLIC_API_KEY, REGION, ENDPOINT } from '@env'
7+
import { PUBLIC_API_KEY, REGION, ENDPOINT, CUSTOM_TIMEOUT } from '@env'
88

99
const App = () => {
1010
const isDarkMode = useColorScheme() === 'dark'
1111
const apiKey = PUBLIC_API_KEY
1212
const region = REGION
1313
const endpoint = ENDPOINT
14+
const customTimeout = Number(CUSTOM_TIMEOUT ?? '60000')
1415

1516
const backgroundStyle = {
1617
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
@@ -19,7 +20,13 @@ const App = () => {
1920
}
2021

2122
return (
22-
<FingerprintJsProProvider apiKey={apiKey} extendedResponseFormat={true} region={region} endpointUrl={endpoint}>
23+
<FingerprintJsProProvider
24+
apiKey={apiKey}
25+
extendedResponseFormat={true}
26+
region={region}
27+
endpointUrl={endpoint}
28+
requestOptions={{ timeout: customTimeout }}
29+
>
2330
<SafeAreaView style={backgroundStyle}>
2431
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
2532
<Visitor />

TestProject/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.testproject">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
<uses-permission android:name="android.permission.INTERNET" />
54

TestProject/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ buildscript {
2121
}
2222

2323
dependencies {
24-
classpath("com.android.tools.build:gradle:8.1.1")
24+
classpath("com.android.tools.build:gradle:8.2.1")
2525
classpath("com.facebook.react:react-native-gradle-plugin")
2626
classpath("de.undercouch:gradle-download-task:5.0.1")
2727
// NOTE: Do not place your application dependencies here; they belong

TestProject/ios/Podfile.lock

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PODS:
99
- React-Core (= 0.73.2)
1010
- React-jsi (= 0.73.2)
1111
- ReactCommon/turbomodule/core (= 0.73.2)
12-
- FingerprintPro (2.6.0)
12+
- FingerprintPro (2.7.0)
1313
- fmt (6.2.1)
1414
- glog (0.3.5)
1515
- hermes-engine (0.73.2):
@@ -1055,7 +1055,7 @@ PODS:
10551055
- React-logger (= 0.73.2)
10561056
- React-perflogger (= 0.73.2)
10571057
- RNFingerprintjsPro (1.0.4):
1058-
- FingerprintPro (~> 2.6.0)
1058+
- FingerprintPro (< 3.0.0, >= 2.7.0)
10591059
- React-Core
10601060
- SocketRocket (0.6.1)
10611061
- Yoga (1.14.0)
@@ -1224,12 +1224,12 @@ EXTERNAL SOURCES:
12241224

12251225
SPEC CHECKSUMS:
12261226
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
1227-
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
1227+
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
12281228
FBLazyVector: fbc4957d9aa695250b55d879c1d86f79d7e69ab4
12291229
FBReactNativeSpec: 86de768f89901ef6ed3207cd686362189d64ac88
1230-
FingerprintPro: 3f06f491c77d871ab543b49fd25fddc52dc34f8c
1230+
FingerprintPro: 0c7dbd28fc83751ca64b06328e2fb22bbc7ed118
12311231
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
1232-
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
1232+
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
12331233
hermes-engine: b361c9ef5ef3cda53f66e195599b47e1f84ffa35
12341234
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
12351235
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
@@ -1273,10 +1273,10 @@ SPEC CHECKSUMS:
12731273
React-runtimescheduler: df8945a656356ff10f58f65a70820478bfcf33ad
12741274
React-utils: f5bc61e7ea3325c0732ae2d755f4441940163b85
12751275
ReactCommon: 45b5d4f784e869c44a6f5a8fad5b114ca8f78c53
1276-
RNFingerprintjsPro: 5a6f377649bc343770e4c28dd2ba9476a918b9fc
1276+
RNFingerprintjsPro: 7437638503c6257e54b6d84406c1b6c65a50c499
12771277
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
1278-
Yoga: 13c8ef87792450193e117976337b8527b49e8c03
1278+
Yoga: e64aa65de36c0832d04e8c7bd614396c77a80047
12791279

12801280
PODFILE CHECKSUM: ab81067ce8c7c4c73b9d3ab72ba8cc955f098393
12811281

1282-
COCOAPODS: 1.15.2
1282+
COCOAPODS: 1.16.2

TestProject/jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
preset: 'react-native',
3+
testEnvironment: 'jsdom',
4+
}

TestProject/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
"@react-native/metro-config": "0.73.3",
2424
"babel-jest": "^29.6.3",
2525
"eslint": "^8.19.0",
26-
"jest": "^27.4.7",
26+
"jest": "^29.4.1",
27+
"jest-circus": "^29.4.1",
28+
"jest-environment-jsdom": "^29.4.1",
29+
"jest-react-native": "18.0.0",
2730
"metro-react-native-babel-preset": "^0.77.0",
2831
"react-test-renderer": "18.2.0"
2932
},
3033
"engines": {
31-
"node": "^20"
32-
},
33-
"jest": {
34-
"preset": "react-native"
34+
"node": "^20 || ^22"
3535
}
3636
}

0 commit comments

Comments
 (0)