react-native-risk-sdk 1.4.15 → 1.4.20

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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "java.configuration.updateBuildConfiguration": "interactive"
3
+ }
package/README.md CHANGED
@@ -2,16 +2,14 @@
2
2
 
3
3
  ## Getting started
4
4
 
5
- `$ npm install react-native-risk-sdk --save`
6
-
7
- ### Mostly automatic installation
8
-
9
- `$ react-native link react-native-risk-sdk`
5
+ ```commandline
6
+ npm install react-native-risk-sdk --save
7
+ ```
10
8
 
11
9
  ## Usage
10
+
12
11
  ```javascript
13
12
  import RiskSdk from 'react-native-risk-sdk';
14
-
15
- // TODO: What to do with the module?
16
- RiskSdk;
17
13
  ```
14
+
15
+ For more details on integration, refer to <https://docs.finbox.in/device-connect/react-native.html>
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <classpath>
3
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
3
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14/"/>
4
4
  <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5
5
  <classpathentry kind="output" path="bin/default"/>
6
6
  </classpath>
@@ -1,2 +1,2 @@
1
- #Fri Jan 05 12:31:09 IST 2024
1
+ #Fri May 24 11:55:21 IST 2024
2
2
  gradle.version=8.0.1
package/android/.project CHANGED
@@ -22,12 +22,12 @@
22
22
  </natures>
23
23
  <filteredResources>
24
24
  <filter>
25
- <id>1603091989182</id>
25
+ <id>1667324496906</id>
26
26
  <name></name>
27
27
  <type>30</type>
28
28
  <matcher>
29
29
  <id>org.eclipse.core.resources.regexFilterMatcher</id>
30
- <arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
30
+ <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
31
31
  </matcher>
32
32
  </filter>
33
33
  </filteredResources>
@@ -1,4 +1,4 @@
1
- arguments=--init-script /var/folders/qb/tczpkktd3h142bb8mbn10kkw0000gn/T/d146c9752a26f79b52047fb6dc6ed385d064e120494f96f08ca63a317c41f94c.gradle --init-script /var/folders/qb/tczpkktd3h142bb8mbn10kkw0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
1
+ arguments=--init-script /var/folders/qk/lnk1fgv10flcdrwx293w8wxw0000gn/T/d146c9752a26f79b52047fb6dc6ed385d064e120494f96f08ca63a317c41f94c.gradle --init-script /var/folders/qk/lnk1fgv10flcdrwx293w8wxw0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
2
2
  auto.sync=false
3
3
  build.scans.enabled=false
4
4
  connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
@@ -10,9 +10,9 @@
10
10
  // original location:
11
11
  // - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
12
12
 
13
- def DEFAULT_COMPILE_SDK_VERSION = 30
13
+ def DEFAULT_COMPILE_SDK_VERSION = 34
14
14
  def DEFAULT_MIN_SDK_VERSION = 21
15
- def DEFAULT_TARGET_SDK_VERSION = 30
15
+ def DEFAULT_TARGET_SDK_VERSION = 34
16
16
 
17
17
  Properties properties = new Properties()
18
18
  properties.load(project.rootProject.file('local.properties').newDataInputStream())
@@ -28,35 +28,37 @@ def safeExtGet(prop, fallback) {
28
28
  }
29
29
 
30
30
  apply plugin: 'com.android.library'
31
- apply plugin: 'maven'
31
+ apply plugin: 'maven-publish'
32
32
 
33
33
  buildscript {
34
34
  // The Android Gradle plugin is only required when opening the android folder stand-alone.
35
35
  // This avoids unnecessary downloads and potential conflicts when the library is included as a
36
36
  // module dependency in an application project.
37
37
  // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
38
+
38
39
  if (project == rootProject) {
39
40
  repositories {
40
41
  google()
41
42
  jcenter()
43
+ mavenCentral()
42
44
  }
43
45
  dependencies {
44
- classpath 'com.android.tools.build:gradle:3.5.1'
46
+ classpath 'com.android.tools.build:gradle:8.0.2'
45
47
  }
46
48
  }
47
49
  }
48
50
 
49
51
  apply plugin: 'com.android.library'
50
- apply plugin: 'maven'
52
+ apply plugin: 'maven-publish'
51
53
 
52
54
  android {
53
- compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
54
-
55
+ compileSdk safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
56
+ namespace 'in.finbox.mobileriskmanagerreact'
55
57
  defaultConfig {
56
58
  minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
57
59
  targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
58
- versionCode 1
59
- versionName "1.0"
60
+ versionCode 3
61
+ versionName "1.2"
60
62
  }
61
63
  lintOptions {
62
64
  abortOnError false
@@ -76,6 +78,7 @@ repositories {
76
78
  // }
77
79
  google()
78
80
  jcenter()
81
+ mavenCentral()
79
82
  maven {
80
83
  url "s3://risk-manager-android-sdk/artifacts"
81
84
  credentials(AwsCredentials) {
@@ -91,7 +94,7 @@ repositories {
91
94
 
92
95
  dependencies {
93
96
  //noinspection GradleDynamicVersion
94
- implementation 'com.facebook.react:react-native:+' // From node_modules
97
+ implementation "com.facebook.react:react-android:0.73.6" // From node_modules
95
98
  implementation("in.finbox:mobileriskmanager:${riskVersion}:parent-release@aar") {
96
99
  transitive = true
97
100
  }
@@ -147,17 +150,24 @@ afterEvaluate { project ->
147
150
  task androidJavadoc(type: Javadoc) {
148
151
  source = android.sourceSets.main.java.srcDirs
149
152
  classpath += files(android.bootClasspath)
150
- classpath += files(project.getConfigurations().getByName('compile').asList())
153
+ // classpath += files(project.getConfigurations().getByName('compile').asList())
154
+ // subprojects { subproject ->
155
+ // if(project['name'] == 'react-native-risk-sdk'){
156
+ // project.configurations { compile { } }
157
+ // }
158
+ // }
159
+ project.getConfigurations().getByName('implementation').setCanBeResolved(true)
160
+ // classpath += files(project.getConfigurations().getByName('implementation').asList())
151
161
  include '**/*.java'
152
162
  }
153
163
 
154
164
  task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
155
- classifier = 'javadoc'
165
+ archiveClassifier = 'javadoc'
156
166
  from androidJavadoc.destinationDir
157
167
  }
158
168
 
159
169
  task androidSourcesJar(type: Jar) {
160
- classifier = 'sources'
170
+ archiveClassifier = 'sources'
161
171
  from android.sourceSets.main.java.srcDirs
162
172
  include '**/*.java'
163
173
  }
@@ -181,12 +191,11 @@ afterEvaluate { project ->
181
191
  archives androidJavadocJar
182
192
  }
183
193
 
184
- task installArchives(type: Upload) {
185
- configuration = configurations.archives
186
- repositories.mavenDeployer {
187
- // Deploy to react-native-event-bridge/maven, ready to publish to npm
188
- repository url: "file://${projectDir}/../android/maven"
189
- configureReactNativePom pom
190
- }
191
- }
194
+ // task installArchives(type: Upload) {
195
+ // configuration = configurations.archives
196
+ // repositories.maven {
197
+ // // Deploy to react-native-event-bridge/maven, ready to publish to npm
198
+ // url = uri("file://${projectDir}/../android/maven")
199
+ // }
200
+ // }
192
201
  }
@@ -1,6 +1,6 @@
1
1
  #Wed Nov 02 18:15:26 IST 2022
2
2
  distributionBase=GRADLE_USER_HOME
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
4
4
  distributionPath=wrapper/dists
5
5
  zipStorePath=wrapper/dists
6
6
  zipStoreBase=GRADLE_USER_HOME
@@ -1,4 +1,3 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="in.finbox.mobileriskmanagerreact">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
 
4
3
  </manifest>
@@ -2,23 +2,28 @@ package in.finbox.mobileriskmanagerreact;
2
2
 
3
3
 
4
4
  import androidx.annotation.NonNull;
5
+ import androidx.annotation.Nullable;
5
6
 
6
7
  import com.facebook.react.bridge.Callback;
7
8
  import com.facebook.react.bridge.ReactApplicationContext;
8
9
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
9
10
  import com.facebook.react.bridge.ReactMethod;
11
+ import com.facebook.react.bridge.ReadableMap;
10
12
 
11
13
  import java.util.HashMap;
12
14
  import java.util.Map;
13
15
  import java.util.concurrent.TimeUnit;
14
16
 
15
- import javax.annotation.Nullable;
16
17
 
17
18
  import in.finbox.mobileriskmanager.FinBox;
18
19
  import in.finbox.mobileriskmanager.common.annotations.FinBoxErrorCode;
20
+ import in.finbox.mobileriskmanager.devicematch.DeviceMatch;
21
+ import in.finbox.mobileriskmanager.notifications.MessagingService;
19
22
 
20
23
  public class RiskSdkModule extends ReactContextBaseJavaModule {
21
24
 
25
+ private final FinBox finbox = new FinBox();
26
+
22
27
  private final ReactApplicationContext reactContext;
23
28
  private static String QUOTA_LIMIT_EXCEEDED = "QUOTA_LIMIT_EXCEEDED";
24
29
  private static String AUTHENTICATE_FAILED = "AUTHENTICATE_FAILED";
@@ -79,21 +84,74 @@ public class RiskSdkModule extends ReactContextBaseJavaModule {
79
84
  }
80
85
 
81
86
  @ReactMethod
82
- public void startPeriodicSync(Integer duration) {
83
- FinBox finbox = new FinBox();
87
+ public void startPeriodicSync(int duration) {
84
88
  finbox.setRealTime(true);
85
89
  finbox.setSyncFrequency(TimeUnit.HOURS.toSeconds(duration));
86
90
  finbox.startPeriodicSync();
87
91
  }
88
92
 
93
+ @ReactMethod
94
+ public void setDeviceMatch(@Nullable String email, @Nullable String name, @Nullable String phone) {
95
+ final DeviceMatch.Builder deviceMatchBuilder = new DeviceMatch.Builder();
96
+ if (email != null) {
97
+ deviceMatchBuilder.setEmail(email);
98
+ }
99
+ if (name != null) {
100
+ deviceMatchBuilder.setName(name);
101
+ }
102
+ if (phone != null) {
103
+ deviceMatchBuilder.setPhone(phone);
104
+ }
105
+ finbox.setDeviceMatch(deviceMatchBuilder.build());
106
+ }
107
+
108
+ /**
109
+ * Forward the FCM notifications to SDK
110
+ */
111
+ @ReactMethod
112
+ public void forwardFinBoxNotificationToSDK(@NonNull ReadableMap data) {
113
+ Map<String, String> dataMap = (Map) data.toHashMap();
114
+ if (MessagingService.forwardToFinBoxSDK(dataMap)) {
115
+ // FinBox Firebase Message
116
+ MessagingService firebaseMessagingService = new MessagingService(reactContext);
117
+ firebaseMessagingService.onMessageReceived(dataMap);
118
+ } else {
119
+ // Nothing to do
120
+ // Irrelevant to FinBox SDk
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Set the sync frequency
126
+ * @param duration Time to set the frequency
127
+ */
128
+ @ReactMethod
129
+ public void setSyncFrequency(Integer duration) {
130
+ finbox.setSyncFrequency(duration);
131
+ }
132
+
133
+ /**
134
+ * Stop sending the data
135
+ */
89
136
  @ReactMethod
90
137
  public void stopPeriodicSync() {
91
- new FinBox().stopPeriodicSync();
138
+ finbox.stopPeriodicSync();
92
139
  }
93
140
 
141
+ /**
142
+ * Delete the user information from the local device
143
+ */
94
144
  @ReactMethod
95
- public void resetUserData() {
145
+ public void resetData() {
96
146
  FinBox.resetData();
97
147
  }
98
148
 
149
+ /**
150
+ * Delete the user information from the server
151
+ */
152
+ @ReactMethod
153
+ public void forgetUser() {
154
+ FinBox.forgetUser();
155
+ }
156
+
99
157
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-risk-sdk",
3
3
  "title": "React Native Risk Sdk",
4
- "version": "1.4.15",
4
+ "version": "1.4.20",
5
5
  "description": "A Wrapper around the Risk Android SDK",
6
6
  "main": "index.js",
7
7
  "scripts": {
@@ -16,8 +16,8 @@
16
16
  "react-native"
17
17
  ],
18
18
  "author": {
19
- "name": "Your Name",
20
- "email": "yourname@email.com"
19
+ "name": "Srikar Reddy",
20
+ "email": "srikar@finbox.in"
21
21
  },
22
22
  "license": "MIT",
23
23
  "licenseFilename": "LICENSE",
@@ -26,6 +26,9 @@
26
26
  "react-native": ">=0.59.0-rc.0 <1.0.x"
27
27
  },
28
28
  "devDependencies": {
29
- "react-native": "^0.59.10"
29
+ "react-native": "0.73.6"
30
+ },
31
+ "dependencies": {
32
+ "react": "18.2.0"
30
33
  }
31
- }
34
+ }
package/android/README.md DELETED
@@ -1,14 +0,0 @@
1
- README
2
- ======
3
-
4
- If you want to publish the lib as a maven dependency, follow these steps before publishing a new version to npm:
5
-
6
- 1. Be sure to have the Android [SDK](https://developer.android.com/studio/index.html) and [NDK](https://developer.android.com/ndk/guides/index.html) installed
7
- 2. Be sure to have a `local.properties` file in this folder that points to the Android SDK and NDK
8
- ```
9
- ndk.dir=/Users/{username}/Library/Android/sdk/ndk-bundle
10
- sdk.dir=/Users/{username}/Library/Android/sdk
11
- ```
12
- 3. Delete the `maven` folder
13
- 4. Run `./gradlew installArchives`
14
- 5. Verify that latest set of generated files is in the maven folder with the correct version number