Skip to content

Commit 19b6ee3

Browse files
[MSUE-228] Upgraded android sdk 1.3.0 (#43)
1 parent ed66419 commit 19b6ee3

File tree

11 files changed

+8641
-8904
lines changed

11 files changed

+8641
-8904
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## Testing
66

77
## Checklist
8+
89
- [ ] The change was thoroughly tested manually
910
- [ ] The change was covered with unit tests
1011
- [ ] The change was tested with the integration example

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Change Log
22

3+
## [0.1.14] - 2025-04-23
4+
5+
- Upgraded `sift-android` to version `1.3.0`.
6+
37
## [0.1.13] - 2024-09-03
48

59
### Fixed
10+
611
- Fixed non-compatible kotlin versions in example application that resulted in a build error for android.

README.md

Lines changed: 65 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,125 @@
1-
1+
# sift-react-native
22

3-
4-
# sift-react-native
5-
6-
React Native wrapper for Sift [iOS](https://github.com/SiftScience/sift-ios) and [Android](https://github.com/SiftScience/sift-android) SDKs
3+
React Native wrapper for Sift [iOS](https://github.com/SiftScience/sift-ios) and [Android](https://github.com/SiftScience/sift-android) SDKs
74

85
## Installation
96

10-
- Install library from **npm**:
11-
`yarn add sift-react-native`
12-
or
13-
`npm install sift-react-native`
7+
- Install library from **npm**:
8+
`yarn add sift-react-native`
9+
or
10+
`npm install sift-react-native`
1411

15-
## Link native code
12+
## Link native code
1613

1714
### Android React Native 0.60.0 or above
15+
1816
No additional setup is required
1917

2018
### iOS React Native 0.60.0 or above
2119

2220
Mostly autolinking will do the job. If manual linking is required, please follow the below steps:
21+
2322
1. Insert the following line in Podfile where new pods are added:
24-
`pod 'sift-react-native', :path => '../node_modules/sift-react-native'`
25-
2. Navigate to the ios directory of the project via terminal and run `pod install`
23+
`pod 'sift-react-native', :path => '../node_modules/sift-react-native'`
24+
2. Navigate to the ios directory of the project via terminal and run `pod install`
2625

2726
### Android React Native 0.59 or below
27+
2828
#### Automatically
29+
2930
`react-native link`
3031

3132
#### Manually
32-
1. Append the following lines to `android/settings.gradle`:
33-
33+
34+
1. Append the following lines to `android/settings.gradle`:
35+
3436
`include ':sift-react-native'`
35-
37+
3638
`project(':sift-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/sift-react-native/android')`
37-
38-
2. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
39-
39+
40+
2. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
41+
4042
implementation project(':sift-react-native')
41-
42-
3. Open up `android/app/src/main/java/[...]/MainApplication.java`
43-
4443

45-
- Add `import com.siftreactnative.SiftReactNativePackage;` to the imports at the top of the file
46-
- Add `new SiftReactNativePackage()` to the list returned by the `getPackages()` method. Add a comma to the previous item if there's already something there.
44+
3. Open up `android/app/src/main/java/[...]/MainApplication.java`
45+
46+
- Add `import com.siftreactnative.SiftReactNativePackage;` to the imports at the top of the file
47+
- Add `new SiftReactNativePackage()` to the list returned by the `getPackages()` method. Add a comma to the previous item if there's already something there.
4748

49+
Insert the following lines inside the dependencies block in
50+
`android/app/build.gradle`:
4851

49-
Insert the following lines inside the dependencies block in
50-
`android/app/build.gradle`:
51-
5252
implementation 'com.android.support:support-v4:27.0.2'
5353

5454
### iOS React Native 0.59 or below
55-
Support will be available soon
55+
56+
Support will be available soon
5657

5758
## Usage
59+
5860
First, import the module:
61+
5962
```js
60-
import SiftReactNative from "sift-react-native";
63+
import SiftReactNative from 'sift-react-native';
6164
```
65+
6266
Then, invoke the following method to initialise the SDK:
67+
6368
#### Configure the account details
69+
6470
```js
65-
SiftReactNative.setSiftConfig(accountId, beaconKey, disallowCollectingLocationData, serverUrlFormat);
71+
SiftReactNative.setSiftConfig(
72+
accountId,
73+
beaconKey,
74+
disallowCollectingLocationData,
75+
serverUrlFormat
76+
);
6677
```
78+
6779
Where:
80+
6881
- **accountId** (string, the Account ID that needs to be obtained from Sift console under [API Keys](https://console.sift.com/developer/api-keys) tab) **_required_**
6982
- **beaconKey** (string, the Beacon Key that needs to be obtained from Sift console under [API Keys](https://console.sift.com/developer/api-keys) tab) **_required_**
7083
- **disallowCollectingLocationData** (boolean, permission to allow collection of location data from device)
71-
> _Make sure to add location permissions to your application if you want Sift to collect location data.
72-
Sift will not request permissions that are not granted by the user from your application._
84+
> _Make sure to add location permissions to your application if you want Sift to collect location data.
85+
> Sift will not request permissions that are not granted by the user from your application._
7386
- **serverUrlFormat** (string, the format of URL where the data needs to be uploaded)
74-
-- Sample URL format for iOS: `https://api3.siftscience.com/v3/accounts/%@/mobile_events`
75-
-- Sample URL format for Android: `https://api3.siftscience.com/v3/accounts/%s/mobile_events`
76-
> **_NB: This feature is available only in iOS platform_**
87+
-- Sample URL format for iOS: `https://api3.siftscience.com/v3/accounts/%@/mobile_events`
88+
-- Sample URL format for Android: `https://api3.siftscience.com/v3/accounts/%s/mobile_events`
89+
> **_NB: This feature is available only in iOS platform_**
90+
7791
#### Set the User ID
92+
7893
As soon as your application is aware of the user id, set it on the Sift instance using the code below. All subsequent events will include the user id.
94+
7995
```js
8096
SiftReactNative.setUserId(userId);
8197
```
98+
8299
If the user logs out of your application, you should unset the user id:
83-
```js
100+
101+
```js
84102
SiftReactNative.unsetUserId();
85103
```
86-
#### Upload event
104+
105+
#### Upload event
106+
87107
To upload collected events to sift.
108+
88109
```js
89110
SiftReactNative.upload();
90111
```
91-
#### Set page name
92-
>**_NB: This feature is available only in Android platform_**
112+
113+
#### Set page name
114+
115+
> **_NB: This feature is available only in Android platform_**
93116
94117
To set the page name
118+
95119
```js
96-
SiftReactNative.setPageName("HomePage");
120+
SiftReactNative.setPageName('HomePage');
97121
```
122+
98123
## Example
99124

100125
To see `sift-react-native` in action you can check out the source in the `example` folder.
@@ -104,6 +129,7 @@ To see `sift-react-native` in action you can check out the source in the `exampl
104129
yarn bootstrap
105130

106131
When the bootstrap is done, you will be able to start the example app by executing one of the following commands:
132+
107133
### iOS app
108134

109135
yarn example ios
@@ -115,4 +141,3 @@ When the bootstrap is done, you will be able to start the example app by executi
115141
## License
116142

117143
MIT
118-

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,5 @@ dependencies {
139139
// noinspection GradleDynamicVersion
140140
api 'com.facebook.react:react-native:+'
141141
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
142-
implementation "com.siftscience:sift-android:1.1.2"
142+
implementation "com.siftscience:sift-android:1.3.0"
143143
}

example/.watchmanconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

example/app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "sample",
33
"displayName": "sample"
4-
}
4+
}
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
{
2-
"images" : [
2+
"images": [
33
{
4-
"idiom" : "iphone",
5-
"scale" : "2x",
6-
"size" : "20x20"
4+
"idiom": "iphone",
5+
"scale": "2x",
6+
"size": "20x20"
77
},
88
{
9-
"idiom" : "iphone",
10-
"scale" : "3x",
11-
"size" : "20x20"
9+
"idiom": "iphone",
10+
"scale": "3x",
11+
"size": "20x20"
1212
},
1313
{
14-
"idiom" : "iphone",
15-
"scale" : "2x",
16-
"size" : "29x29"
14+
"idiom": "iphone",
15+
"scale": "2x",
16+
"size": "29x29"
1717
},
1818
{
19-
"idiom" : "iphone",
20-
"scale" : "3x",
21-
"size" : "29x29"
19+
"idiom": "iphone",
20+
"scale": "3x",
21+
"size": "29x29"
2222
},
2323
{
24-
"idiom" : "iphone",
25-
"scale" : "2x",
26-
"size" : "40x40"
24+
"idiom": "iphone",
25+
"scale": "2x",
26+
"size": "40x40"
2727
},
2828
{
29-
"idiom" : "iphone",
30-
"scale" : "3x",
31-
"size" : "40x40"
29+
"idiom": "iphone",
30+
"scale": "3x",
31+
"size": "40x40"
3232
},
3333
{
34-
"idiom" : "iphone",
35-
"scale" : "2x",
36-
"size" : "60x60"
34+
"idiom": "iphone",
35+
"scale": "2x",
36+
"size": "60x60"
3737
},
3838
{
39-
"idiom" : "iphone",
40-
"scale" : "3x",
41-
"size" : "60x60"
39+
"idiom": "iphone",
40+
"scale": "3x",
41+
"size": "60x60"
4242
},
4343
{
44-
"idiom" : "ios-marketing",
45-
"scale" : "1x",
46-
"size" : "1024x1024"
44+
"idiom": "ios-marketing",
45+
"scale": "1x",
46+
"size": "1024x1024"
4747
}
4848
],
49-
"info" : {
50-
"author" : "xcode",
51-
"version" : 1
49+
"info": {
50+
"author": "xcode",
51+
"version": 1
5252
}
5353
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"info" : {
3-
"version" : 1,
4-
"author" : "xcode"
2+
"info": {
3+
"version": 1,
4+
"author": "xcode"
55
}
66
}

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"react": "18.1.0",
1515
"react-native": "0.70.6",
16-
"sift-react-native": "^0.1.8"
16+
"sift-react-native": "file:../"
1717
},
1818
"devDependencies": {
1919
"@babel/core": "^7.12.9",

example/yarn.lock

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5929,10 +5929,8 @@ side-channel@^1.0.4:
59295929
get-intrinsic "^1.0.2"
59305930
object-inspect "^1.9.0"
59315931

5932-
sift-react-native@^0.1.8:
5933-
version "0.1.8"
5934-
resolved "https://registry.yarnpkg.com/sift-react-native/-/sift-react-native-0.1.8.tgz#85242b3a92b96b703e2e26bef086486243d75dff"
5935-
integrity sha512-+szVQmzmVY1qx3TB94kYjgASxVXffJ/bj14y1weYvggYNIIRgNUnqMmJyrGvXDqQTebGvQNQho/Z/hCGj/Rvag==
5932+
"sift-react-native@file:..":
5933+
version "0.1.13"
59365934

59375935
signal-exit@^3.0.0, signal-exit@^3.0.2:
59385936
version "3.0.7"

0 commit comments

Comments
 (0)