react-native-shield-fraud-plugin 1.0.6 → 1.0.8
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.
- package/README.md +18 -12
- package/android/src/main/java/com/shieldfraudplugin/ShieldFraudPluginModule.java +141 -136
- package/ios/ShieldFraudPlugin.m +10 -3
- package/ios/ShieldFraudPlugin.xcodeproj/project.pbxproj +0 -44
- package/ios/ShieldFraudPlugin.xcodeproj/project.xcworkspace/xcuserdata/deepakraj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/package.json +1 -1
- package/ios/Podfile +0 -10
- package/ios/Podfile.lock +0 -16
- package/ios/Pods/Manifest.lock +0 -16
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -536
- package/ios/Pods/Pods.xcodeproj/xcuserdata/deepakraj.xcuserdatad/xcschemes/Pods-ShieldFraudPlugin.xcscheme +0 -58
- package/ios/Pods/Pods.xcodeproj/xcuserdata/deepakraj.xcuserdatad/xcschemes/ShieldFraud.xcscheme +0 -58
- package/ios/Pods/Pods.xcodeproj/xcuserdata/deepakraj.xcuserdatad/xcschemes/xcschememanagement.plist +0 -21
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/Info.plist +0 -40
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/Headers/ShieldFraud-Swift.h +0 -425
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/Headers/ShieldFraud.h +0 -20
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/Info.plist +0 -0
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/arm64-apple-ios.abi.json +0 -20535
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/arm64-apple-ios.private.swiftinterface +0 -207
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/arm64-apple-ios.swiftinterface +0 -207
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/Modules/module.modulemap +0 -11
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/ShieldFraud +0 -0
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64/ShieldFraud.framework/_CodeSignature/CodeResources +0 -222
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Headers/ShieldFraud-Swift.h +0 -846
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Headers/ShieldFraud.h +0 -20
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Info.plist +0 -0
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/arm64-apple-ios-simulator.abi.json +0 -20535
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +0 -207
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/arm64-apple-ios-simulator.swiftinterface +0 -207
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/x86_64-apple-ios-simulator.abi.json +0 -19653
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +0 -207
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/ShieldFraud.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +0 -207
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/Modules/module.modulemap +0 -11
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/ShieldFraud +0 -0
- package/ios/Pods/ShieldFraud/ShieldFraud.xcframework/ios-arm64_x86_64-simulator/ShieldFraud.framework/_CodeSignature/CodeResources +0 -297
- package/ios/Pods/Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin-Info.plist +0 -26
- package/ios/Pods/Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin-acknowledgements.markdown +0 -7
- package/ios/Pods/Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin-acknowledgements.plist +0 -39
- package/ios/Pods/Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin-dummy.m +0 -5
- package/ios/Pods/Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin-umbrella.h +0 -16
- package/ios/Pods/Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin.debug.xcconfig +0 -13
- package/ios/Pods/Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin.modulemap +0 -6
- package/ios/Pods/Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin.release.xcconfig +0 -13
- package/ios/Pods/Target Support Files/ShieldFraud/ShieldFraud-xcframeworks.sh +0 -121
- package/ios/Pods/Target Support Files/ShieldFraud/ShieldFraud.debug.xcconfig +0 -15
- package/ios/Pods/Target Support Files/ShieldFraud/ShieldFraud.release.xcconfig +0 -15
- package/ios/ShieldFraudPlugin.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/ShieldFraudPlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/ShieldFraudPlugin.xcworkspace/xcuserdata/deepakraj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/ShieldFraudPlugin.xcworkspace/xcuserdata/deepakraj.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
package/README.md
CHANGED
|
@@ -41,13 +41,9 @@ You can refer to the Changelog to see more details about our updates.
|
|
|
41
41
|
|
|
42
42
|
### Initialize the SDK
|
|
43
43
|
|
|
44
|
-
The SDK initialization should be configured
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
You need both the SHIELD_SITE_ID and SHIELD_SECRET_KEY to initialize the SDK. You can locate them at the top of the page.
|
|
48
|
-
|
|
49
|
-
You can initialize the SDK by calling it inside UseEffect()
|
|
44
|
+
The SDK initialization should be configured on `useEffect` *(for **Functional Components**)* or `componentDidMount` *(for **Class Components**)* in your **App.tsx** or on **App launch** to ensure successful generation and processing of the device fingerprint. The SDK is to be initialized only once and will throw an exception if it is initialized more than once.
|
|
50
45
|
|
|
46
|
+
You need both the **SHIELD_SITE_ID** and **SHIELD_SECRET_KEY** to initialize the SDK. You can locate them at the top of the page.
|
|
51
47
|
```
|
|
52
48
|
const config: Config = {
|
|
53
49
|
siteID: 'SHIELD_SITE_ID',
|
|
@@ -55,14 +51,19 @@ const config: Config = {
|
|
|
55
51
|
};
|
|
56
52
|
|
|
57
53
|
useEffect(() => {
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
const initializeShield = async () => {
|
|
55
|
+
await ShieldFraud.initShield(config);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
initializeShield();
|
|
59
|
+
}, []);
|
|
60
60
|
```
|
|
61
|
+
**Note** - ```await ShieldFraud.initShield(config)``` - *The await keyword is used to wait for the promise returned by the initShield function to resolve. In React Native, It is best practice to use `await` when calling native modules from React Native, especially during `asynchronous` operations such as SDK Initialization. This is because using `await` ensures that the main thread is not blocked while the native module is initializing.*
|
|
61
62
|
|
|
62
63
|
`Config` has these **optional** parameters:
|
|
63
64
|
|
|
64
|
-
1. `logLevel` Set your log level to debug
|
|
65
|
-
2. `environmentInfo` Set your environment info to prod
|
|
65
|
+
1. `logLevel` Set your log level to `debug`, `info` or `none`. | Receives high-level information about how the SDK processes network requests, responses or error information during SDK integration. Default log level is `none`.
|
|
66
|
+
2. `environmentInfo` Set your environment info to `prod`, `dev` or `staging`. Default environment info is `prod`.
|
|
66
67
|
3. `blockedDialog` Set your dialog for the blocked dialog both title and body or you can send it as null as well
|
|
67
68
|
|
|
68
69
|
Note: You can check whether Shield SDK is ready or not by using isSDKready function
|
|
@@ -107,7 +108,7 @@ You can register a callback if you would like to be notified in the event that t
|
|
|
107
108
|
|
|
108
109
|
Add an additional parameter during intialization in order to register a callback.
|
|
109
110
|
|
|
110
|
-
For example - ShieldFraud.initShield(config,
|
|
111
|
+
**For example - `await ShieldFraud.initShield(config, callbacks);`**
|
|
111
112
|
```
|
|
112
113
|
const callbacks: ShieldCallback = {
|
|
113
114
|
onSuccess: (data) => {
|
|
@@ -125,7 +126,12 @@ const config: Config = {
|
|
|
125
126
|
secretKey: 'SHIELD_SECRET_KEY'
|
|
126
127
|
};
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
const initializeShield = async () => {
|
|
131
|
+
await ShieldFraud.initShield(config, callbacks);
|
|
132
|
+
};
|
|
133
|
+
initializeShield();
|
|
134
|
+
}, []);
|
|
129
135
|
```
|
|
130
136
|
|
|
131
137
|
#### Retrieve device results via Customized Pull
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
package com.shieldfraudplugin;
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
|
+
import android.os.Handler;
|
|
5
|
+
import android.os.Looper;
|
|
4
6
|
|
|
5
7
|
import androidx.annotation.NonNull;
|
|
6
8
|
|
|
@@ -30,161 +32,164 @@ import javax.annotation.Nullable;
|
|
|
30
32
|
|
|
31
33
|
@ReactModule(name = ShieldFraudPluginModule.NAME)
|
|
32
34
|
public class ShieldFraudPluginModule extends ReactContextBaseJavaModule implements ShieldCallback<JSONObject> {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
48
|
-
public boolean isShieldInitialized() {
|
|
49
|
-
try {
|
|
50
|
-
return Shield.getInstance() != null;
|
|
51
|
-
} catch (IllegalStateException e) {
|
|
52
|
-
return false;
|
|
35
|
+
public static final String NAME = "ShieldFraudPlugin";
|
|
36
|
+
private final ReactApplicationContext reactContext;
|
|
37
|
+
|
|
38
|
+
public ShieldFraudPluginModule(ReactApplicationContext reactContext) {
|
|
39
|
+
super(reactContext);
|
|
40
|
+
this.reactContext = reactContext;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Override
|
|
44
|
+
@NonNull
|
|
45
|
+
public String getName() {
|
|
46
|
+
return NAME;
|
|
53
47
|
}
|
|
54
|
-
}
|
|
55
48
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
50
|
+
public boolean isShieldInitialized() {
|
|
51
|
+
try {
|
|
52
|
+
return Shield.getInstance() != null;
|
|
53
|
+
} catch (IllegalStateException e) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
60
56
|
}
|
|
61
|
-
Activity currentActivity = getCurrentActivity();
|
|
62
|
-
if (currentActivity != null) {
|
|
63
|
-
Shield.Builder builder = new Shield.Builder(currentActivity, siteID, secretKey)
|
|
64
|
-
.setAutoBlockDialog(getBlockedDialogFromReadableMap(blockedDialog));
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
@ReactMethod
|
|
59
|
+
public void initShield(String siteID, String secretKey, Boolean isOptimizedListener, ReadableMap blockedDialog, Integer logLevel, Integer environment) {
|
|
60
|
+
if (isShieldInitialized()) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
Activity currentActivity = getCurrentActivity();
|
|
64
|
+
if (currentActivity != null) {
|
|
65
|
+
Shield.Builder builder = new Shield.Builder(currentActivity, siteID, secretKey)
|
|
66
|
+
.setAutoBlockDialog(getBlockedDialogFromReadableMap(blockedDialog));
|
|
67
|
+
|
|
68
|
+
if (isOptimizedListener) {
|
|
69
|
+
builder.registerDeviceShieldCallback(this);
|
|
70
|
+
}
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
String environmentString = getEnvironmentStringFromInteger(environment);
|
|
73
|
+
builder.setEnvironment(environmentString);
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
Shield.LogLevel logLevelEnum = getLogLevelEnumFromInteger(logLevel);
|
|
76
|
+
builder.setLogLevel(logLevelEnum);
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
Shield shield = builder.build();
|
|
79
|
+
Shield.setSingletonInstance(shield);
|
|
80
|
+
}
|
|
78
81
|
}
|
|
79
|
-
}
|
|
80
82
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
private BlockedDialog getBlockedDialogFromReadableMap(ReadableMap blockedDialog) {
|
|
84
|
+
if (blockedDialog != null) {
|
|
85
|
+
String title = blockedDialog.hasKey("title") ? blockedDialog.getString("title") : null;
|
|
86
|
+
String body = blockedDialog.hasKey("body") ? blockedDialog.getString("body") : null;
|
|
87
|
+
return new BlockedDialog(title, body);
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
86
90
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
|
|
92
|
+
private String getEnvironmentStringFromInteger(Integer environment) {
|
|
93
|
+
String environmentString;
|
|
94
|
+
switch (environment) {
|
|
95
|
+
case 1:
|
|
96
|
+
environmentString = Shield.ENVIRONMENT_DEV;
|
|
97
|
+
break;
|
|
98
|
+
case 2:
|
|
99
|
+
environmentString = Shield.ENVIRONMENT_STAGING;
|
|
100
|
+
break;
|
|
101
|
+
default:
|
|
102
|
+
environmentString = Shield.ENVIRONMENT_PROD;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
return environmentString;
|
|
102
106
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
107
|
+
|
|
108
|
+
private Shield.LogLevel getLogLevelEnumFromInteger(Integer logLevel) {
|
|
109
|
+
Shield.LogLevel logLevelEnum;
|
|
110
|
+
switch (logLevel) {
|
|
111
|
+
case 1:
|
|
112
|
+
logLevelEnum = Shield.LogLevel.NONE;
|
|
113
|
+
break;
|
|
114
|
+
case 2:
|
|
115
|
+
logLevelEnum = Shield.LogLevel.INFO;
|
|
116
|
+
break;
|
|
117
|
+
case 3:
|
|
118
|
+
logLevelEnum = Shield.LogLevel.DEBUG;
|
|
119
|
+
break;
|
|
120
|
+
default:
|
|
121
|
+
logLevelEnum = Shield.LogLevel.VERBOSE;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
return logLevelEnum;
|
|
121
125
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
144
|
-
public String getSessionId() {
|
|
145
|
-
return Shield.getInstance().getSessionId();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
@Override
|
|
149
|
-
public void onSuccess(@Nullable JSONObject jsonObject) {
|
|
150
|
-
if (jsonObject != null) {
|
|
151
|
-
reactContext
|
|
152
|
-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
153
|
-
.emit("success", jsonObject.toString());
|
|
126
|
+
|
|
127
|
+
@ReactMethod
|
|
128
|
+
public void setDeviceResultStateListener() {
|
|
129
|
+
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
|
130
|
+
@Override
|
|
131
|
+
public void run() {
|
|
132
|
+
Shield.getInstance().setDeviceResultStateListener(new Shield.DeviceResultStateListener() {
|
|
133
|
+
@Override
|
|
134
|
+
public void isReady() {
|
|
135
|
+
// Emit an event when the device is ready
|
|
136
|
+
WritableMap params = Arguments.createMap();
|
|
137
|
+
params.putString("status", "isSDKReady");
|
|
138
|
+
reactContext
|
|
139
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
140
|
+
.emit("device_result_state", params);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}, 1500);
|
|
154
145
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
reactContext
|
|
161
|
-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
162
|
-
.emit("error", e.getLocalizedMessage());
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
149
|
+
public String getSessionId() {
|
|
150
|
+
return Shield.getInstance().getSessionId();
|
|
163
151
|
}
|
|
164
152
|
|
|
165
|
-
|
|
153
|
+
@Override
|
|
154
|
+
public void onSuccess(@Nullable JSONObject jsonObject) {
|
|
155
|
+
if (jsonObject != null) {
|
|
156
|
+
reactContext
|
|
157
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
158
|
+
.emit("success", jsonObject.toString());
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@Override
|
|
163
|
+
public void onFailure(@Nullable ShieldException e) {
|
|
164
|
+
if (e != null) {
|
|
165
|
+
reactContext
|
|
166
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
167
|
+
.emit("error", e.getLocalizedMessage());
|
|
168
|
+
}
|
|
166
169
|
|
|
167
|
-
@ReactMethod
|
|
168
|
-
public void sendAttributes(String screenName, ReadableMap json) {
|
|
169
|
-
HashMap<String,String> data =new HashMap<String,String>();
|
|
170
|
-
for (Map.Entry<String, Object> entry : json.toHashMap().entrySet()) {
|
|
171
|
-
data.put(entry.getKey(), (String) entry.getValue());
|
|
172
170
|
}
|
|
173
|
-
Shield.getInstance().sendAttributes(screenName, data);
|
|
174
|
-
}
|
|
175
171
|
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
@ReactMethod
|
|
173
|
+
public void sendAttributes(String screenName, ReadableMap json) {
|
|
174
|
+
HashMap<String, String> data = new HashMap<String, String>();
|
|
175
|
+
for (Map.Entry<String, Object> entry : json.toHashMap().entrySet()) {
|
|
176
|
+
data.put(entry.getKey(), (String) entry.getValue());
|
|
177
|
+
}
|
|
178
|
+
Shield.getInstance().sendAttributes(screenName, data);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@ReactMethod
|
|
182
|
+
public void getLatestDeviceResult(Callback successCallback, Callback errorCallback) {
|
|
178
183
|
if (Shield.getInstance().getLatestDeviceResult() != null) {
|
|
179
|
-
|
|
180
|
-
|
|
184
|
+
JSONObject deviceResult = Shield.getInstance().getLatestDeviceResult();
|
|
185
|
+
successCallback.invoke(deviceResult.toString());
|
|
181
186
|
} else {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
ShieldException error = Shield.getInstance().getResponseError();
|
|
188
|
+
String errorMessage = "unknown error";
|
|
189
|
+
if (error != null) {
|
|
190
|
+
errorMessage = error.getMessage();
|
|
191
|
+
}
|
|
192
|
+
errorCallback.invoke(errorMessage);
|
|
188
193
|
}
|
|
189
|
-
|
|
194
|
+
}
|
|
190
195
|
}
|
package/ios/ShieldFraudPlugin.m
CHANGED
|
@@ -54,11 +54,18 @@ RCT_EXPORT_METHOD(getLatestDeviceResult:(RCTResponseSenderBlock)successCallback
|
|
|
54
54
|
|
|
55
55
|
RCT_EXPORT_METHOD(setDeviceResultStateListener)
|
|
56
56
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
double delayInSeconds = 1.5;
|
|
58
|
+
|
|
59
|
+
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
|
|
60
|
+
|
|
61
|
+
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
|
62
|
+
[[Shield shared] setDeviceResultStateListener:^{
|
|
63
|
+
[self sendEventWithName:@"device_result_state" body:@{@"status": @"isSDKReady"}];
|
|
64
|
+
}];
|
|
65
|
+
});
|
|
60
66
|
}
|
|
61
67
|
|
|
68
|
+
|
|
62
69
|
- (NSArray<NSString *> *)supportedEvents {
|
|
63
70
|
return @[@"success", @"error", @"device_result_state"];
|
|
64
71
|
}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
10
|
4DC15CAF29F27C9B002A8B6C /* ShieldFraudPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* ShieldFraudPlugin.m */; };
|
|
11
|
-
F167571A67B6200098CBA80C /* Pods_ShieldFraudPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F046944AE9395EF1AEB8DB39 /* Pods_ShieldFraudPlugin.framework */; };
|
|
12
11
|
/* End PBXBuildFile section */
|
|
13
12
|
|
|
14
13
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -25,11 +24,8 @@
|
|
|
25
24
|
|
|
26
25
|
/* Begin PBXFileReference section */
|
|
27
26
|
134814201AA4EA6300B7C361 /* libShieldFraudPlugin.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libShieldFraudPlugin.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
28
|
-
665385E0D17A9E1D0BC4BB56 /* Pods-ShieldFraudPlugin.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShieldFraudPlugin.release.xcconfig"; path = "Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin.release.xcconfig"; sourceTree = "<group>"; };
|
|
29
27
|
B3E7B5881CC2AC0600A0062D /* ShieldFraudPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShieldFraudPlugin.h; sourceTree = "<group>"; };
|
|
30
28
|
B3E7B5891CC2AC0600A0062D /* ShieldFraudPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShieldFraudPlugin.m; sourceTree = "<group>"; };
|
|
31
|
-
C1AD94D3D1982FF842092419 /* Pods-ShieldFraudPlugin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShieldFraudPlugin.debug.xcconfig"; path = "Target Support Files/Pods-ShieldFraudPlugin/Pods-ShieldFraudPlugin.debug.xcconfig"; sourceTree = "<group>"; };
|
|
32
|
-
F046944AE9395EF1AEB8DB39 /* Pods_ShieldFraudPlugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ShieldFraudPlugin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
33
29
|
/* End PBXFileReference section */
|
|
34
30
|
|
|
35
31
|
/* Begin PBXFrameworksBuildPhase section */
|
|
@@ -37,7 +33,6 @@
|
|
|
37
33
|
isa = PBXFrameworksBuildPhase;
|
|
38
34
|
buildActionMask = 2147483647;
|
|
39
35
|
files = (
|
|
40
|
-
F167571A67B6200098CBA80C /* Pods_ShieldFraudPlugin.framework in Frameworks */,
|
|
41
36
|
);
|
|
42
37
|
runOnlyForDeploymentPostprocessing = 0;
|
|
43
38
|
};
|
|
@@ -55,8 +50,6 @@
|
|
|
55
50
|
31EC8772E7BF66C38E51DB38 /* Pods */ = {
|
|
56
51
|
isa = PBXGroup;
|
|
57
52
|
children = (
|
|
58
|
-
C1AD94D3D1982FF842092419 /* Pods-ShieldFraudPlugin.debug.xcconfig */,
|
|
59
|
-
665385E0D17A9E1D0BC4BB56 /* Pods-ShieldFraudPlugin.release.xcconfig */,
|
|
60
53
|
);
|
|
61
54
|
path = Pods;
|
|
62
55
|
sourceTree = "<group>";
|
|
@@ -68,18 +61,9 @@
|
|
|
68
61
|
B3E7B5891CC2AC0600A0062D /* ShieldFraudPlugin.m */,
|
|
69
62
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
70
63
|
31EC8772E7BF66C38E51DB38 /* Pods */,
|
|
71
|
-
DB1BDC55CCE65888ED19A665 /* Frameworks */,
|
|
72
64
|
);
|
|
73
65
|
sourceTree = "<group>";
|
|
74
66
|
};
|
|
75
|
-
DB1BDC55CCE65888ED19A665 /* Frameworks */ = {
|
|
76
|
-
isa = PBXGroup;
|
|
77
|
-
children = (
|
|
78
|
-
F046944AE9395EF1AEB8DB39 /* Pods_ShieldFraudPlugin.framework */,
|
|
79
|
-
);
|
|
80
|
-
name = Frameworks;
|
|
81
|
-
sourceTree = "<group>";
|
|
82
|
-
};
|
|
83
67
|
/* End PBXGroup section */
|
|
84
68
|
|
|
85
69
|
/* Begin PBXNativeTarget section */
|
|
@@ -87,7 +71,6 @@
|
|
|
87
71
|
isa = PBXNativeTarget;
|
|
88
72
|
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ShieldFraudPlugin" */;
|
|
89
73
|
buildPhases = (
|
|
90
|
-
D6EA6B2BCE68BAE66D6746A6 /* [CP] Check Pods Manifest.lock */,
|
|
91
74
|
58B511D71A9E6C8500147676 /* Sources */,
|
|
92
75
|
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
93
76
|
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
@@ -133,31 +116,6 @@
|
|
|
133
116
|
};
|
|
134
117
|
/* End PBXProject section */
|
|
135
118
|
|
|
136
|
-
/* Begin PBXShellScriptBuildPhase section */
|
|
137
|
-
D6EA6B2BCE68BAE66D6746A6 /* [CP] Check Pods Manifest.lock */ = {
|
|
138
|
-
isa = PBXShellScriptBuildPhase;
|
|
139
|
-
buildActionMask = 2147483647;
|
|
140
|
-
files = (
|
|
141
|
-
);
|
|
142
|
-
inputFileListPaths = (
|
|
143
|
-
);
|
|
144
|
-
inputPaths = (
|
|
145
|
-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
|
146
|
-
"${PODS_ROOT}/Manifest.lock",
|
|
147
|
-
);
|
|
148
|
-
name = "[CP] Check Pods Manifest.lock";
|
|
149
|
-
outputFileListPaths = (
|
|
150
|
-
);
|
|
151
|
-
outputPaths = (
|
|
152
|
-
"$(DERIVED_FILE_DIR)/Pods-ShieldFraudPlugin-checkManifestLockResult.txt",
|
|
153
|
-
);
|
|
154
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
155
|
-
shellPath = /bin/sh;
|
|
156
|
-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
|
157
|
-
showEnvVarsInLog = 0;
|
|
158
|
-
};
|
|
159
|
-
/* End PBXShellScriptBuildPhase section */
|
|
160
|
-
|
|
161
119
|
/* Begin PBXSourcesBuildPhase section */
|
|
162
120
|
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
163
121
|
isa = PBXSourcesBuildPhase;
|
|
@@ -267,7 +225,6 @@
|
|
|
267
225
|
};
|
|
268
226
|
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
269
227
|
isa = XCBuildConfiguration;
|
|
270
|
-
baseConfigurationReference = C1AD94D3D1982FF842092419 /* Pods-ShieldFraudPlugin.debug.xcconfig */;
|
|
271
228
|
buildSettings = {
|
|
272
229
|
HEADER_SEARCH_PATHS = (
|
|
273
230
|
"$(inherited)",
|
|
@@ -284,7 +241,6 @@
|
|
|
284
241
|
};
|
|
285
242
|
58B511F11A9E6C8500147676 /* Release */ = {
|
|
286
243
|
isa = XCBuildConfiguration;
|
|
287
|
-
baseConfigurationReference = 665385E0D17A9E1D0BC4BB56 /* Pods-ShieldFraudPlugin.release.xcconfig */;
|
|
288
244
|
buildSettings = {
|
|
289
245
|
HEADER_SEARCH_PATHS = (
|
|
290
246
|
"$(inherited)",
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-shield-fraud-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "React Native Shield Fraud Plugin helps developers to assess malicious activities performed on mobile devices and return risk intelligence based on user's behaviour. It collects device's fingerprint, social metrics and network information.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
package/ios/Podfile
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# Uncomment the next line to define a global platform for your project
|
|
2
|
-
platform :ios, '11.0'
|
|
3
|
-
|
|
4
|
-
target 'ShieldFraudPlugin' do
|
|
5
|
-
# Comment the next line if you don't want to use dynamic frameworks
|
|
6
|
-
use_frameworks!
|
|
7
|
-
|
|
8
|
-
# Pods for ShieldFraudPlugin
|
|
9
|
-
pod 'ShieldFraud'
|
|
10
|
-
end
|
package/ios/Podfile.lock
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
PODS:
|
|
2
|
-
- ShieldFraud (1.5.28)
|
|
3
|
-
|
|
4
|
-
DEPENDENCIES:
|
|
5
|
-
- ShieldFraud
|
|
6
|
-
|
|
7
|
-
SPEC REPOS:
|
|
8
|
-
trunk:
|
|
9
|
-
- ShieldFraud
|
|
10
|
-
|
|
11
|
-
SPEC CHECKSUMS:
|
|
12
|
-
ShieldFraud: d79af5280f65ba8b99188bffec32c33df18931ff
|
|
13
|
-
|
|
14
|
-
PODFILE CHECKSUM: bb1ff44dc7cfd449bde1bb035f6a1eb25a54d48c
|
|
15
|
-
|
|
16
|
-
COCOAPODS: 1.12.1
|
package/ios/Pods/Manifest.lock
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
PODS:
|
|
2
|
-
- ShieldFraud (1.5.28)
|
|
3
|
-
|
|
4
|
-
DEPENDENCIES:
|
|
5
|
-
- ShieldFraud
|
|
6
|
-
|
|
7
|
-
SPEC REPOS:
|
|
8
|
-
trunk:
|
|
9
|
-
- ShieldFraud
|
|
10
|
-
|
|
11
|
-
SPEC CHECKSUMS:
|
|
12
|
-
ShieldFraud: d79af5280f65ba8b99188bffec32c33df18931ff
|
|
13
|
-
|
|
14
|
-
PODFILE CHECKSUM: bb1ff44dc7cfd449bde1bb035f6a1eb25a54d48c
|
|
15
|
-
|
|
16
|
-
COCOAPODS: 1.12.1
|