@qore-id/react-native-qoreid-sdk 1.0.8 → 1.1.0
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/LICENSE +1 -1
- package/README.md +139 -63
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +29 -34
- package/ios/QoreidSdk-Bridging-Header.h +7 -0
- package/ios/QoreidSdk.m +21 -0
- package/ios/QoreidSdk.swift +104 -0
- package/ios/QoreidSdk.xcodeproj/project.pbxproj +22 -4
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/QoreidSdk.xcodeproj/project.xcworkspace/xcuserdata/e.ugwuoke.xcuserdatad/WorkspaceSettings.xcsettings +14 -0
- package/ios/QoreidSdk.xcodeproj/xcuserdata/e.ugwuoke.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/ViewController.swift +22 -0
- package/lib/commonjs/index.js +10 -28
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/qoreIdSdk.js +57 -0
- package/lib/commonjs/qoreIdSdk.js.map +1 -0
- package/lib/module/index.js +1 -24
- package/lib/module/index.js.map +1 -1
- package/lib/module/qoreIdSdk.js +50 -0
- package/lib/module/qoreIdSdk.js.map +1 -0
- package/lib/typescript/index.d.ts +1 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/qoreIdSdk.d.ts +16 -0
- package/lib/typescript/qoreIdSdk.d.ts.map +1 -0
- package/package.json +1 -2
- package/qore-id-react-native-qoreid-sdk.podspec +3 -3
- package/src/index.tsx +1 -29
- package/src/qoreIdSdk.tsx +60 -0
- package/src/types.d.ts +14 -49
- package/ios/QoreidSdk.h +0 -12
- package/ios/QoreidSdk.mm +0 -27
- package/lib/commonjs/qoreIdButton.android.js +0 -56
- package/lib/commonjs/qoreIdButton.android.js.map +0 -1
- package/lib/commonjs/qoreIdButton.ios.js +0 -129
- package/lib/commonjs/qoreIdButton.ios.js.map +0 -1
- package/lib/module/qoreIdButton.android.js +0 -47
- package/lib/module/qoreIdButton.android.js.map +0 -1
- package/lib/module/qoreIdButton.ios.js +0 -121
- package/lib/module/qoreIdButton.ios.js.map +0 -1
- package/lib/typescript/qoreIdButton.android.d.ts +0 -4
- package/lib/typescript/qoreIdButton.android.d.ts.map +0 -1
- package/lib/typescript/qoreIdButton.ios.d.ts +0 -4
- package/lib/typescript/qoreIdButton.ios.d.ts.map +0 -1
- package/src/qoreIdButton.android.tsx +0 -63
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2023
|
|
3
|
+
Copyright (c) 2023 QoreID
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
6
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
QoreID React Native SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
Link to [documentation](https://docs.qoreid.com/docs/qoreid-react-native-sdk)
|
|
5
4
|
|
|
6
5
|
## Installation
|
|
@@ -8,10 +7,21 @@ Link to [documentation](https://docs.qoreid.com/docs/qoreid-react-native-sdk)
|
|
|
8
7
|
```c npm
|
|
9
8
|
npm install --save @qore-id/react-native-qoreid-sdk
|
|
10
9
|
```
|
|
10
|
+
|
|
11
11
|
```c yarn
|
|
12
12
|
yarn add @qore-id/react-native-qoreid-sdk
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
//in your project directory
|
|
18
|
+
|
|
19
|
+
cd ios
|
|
20
|
+
pod install
|
|
21
|
+
```
|
|
22
|
+
> Note: You are required to rebuild your application after installing the package.
|
|
23
|
+
|
|
24
|
+
|
|
15
25
|
### Android
|
|
16
26
|
|
|
17
27
|
Add the following to your `app/build.gradle`
|
|
@@ -27,6 +37,7 @@ Add the following to your `app/build.gradle`
|
|
|
27
37
|
```
|
|
28
38
|
|
|
29
39
|
Add this snippet of code to your `~/java/com.<app name>/MainActivity`
|
|
40
|
+
|
|
30
41
|
```java
|
|
31
42
|
@Override
|
|
32
43
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -43,92 +54,144 @@ import com.qoreidsdk.QoreidSdkModule;
|
|
|
43
54
|
|
|
44
55
|
```
|
|
45
56
|
|
|
46
|
-
<!-- ### iOS
|
|
47
57
|
|
|
48
|
-
|
|
58
|
+
#### Permissions
|
|
49
59
|
|
|
50
|
-
```sh
|
|
51
|
-
npm i react-native-webview
|
|
52
|
-
``` -->
|
|
53
|
-
## Permissions
|
|
54
60
|
Certain services on QoreID require device permissions to work properly. Follow the instructions [here](https://docs.qoreid.com/docs/permissions) to add the required permissions to your `~/android/app/src/main/AndroidManifest.xml` file.
|
|
55
61
|
|
|
56
62
|
Verifind required permissions
|
|
63
|
+
|
|
57
64
|
```xml
|
|
58
65
|
...
|
|
59
|
-
<!-- Required for Verifind -->
|
|
66
|
+
<!-- Required for Verifind -->
|
|
60
67
|
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
|
|
61
68
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
62
69
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
63
70
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
|
64
71
|
...
|
|
65
72
|
```
|
|
73
|
+
### iOS
|
|
74
|
+
|
|
75
|
+
#### Update your AppDelegate.m
|
|
76
|
+
> QoreidSdK requires the UINavigationController to push a new ViewController to your app. To wrap your app's rootViewController in a UINavigationController, add the following code to your AppDelegate.m file.
|
|
77
|
+
|
|
78
|
+
```mm
|
|
79
|
+
//AppDelegate.m
|
|
80
|
+
|
|
81
|
+
// 1. Import necessary headers
|
|
82
|
+
#import "AppDelegate.h"
|
|
83
|
+
#import <React/RCTBridge.h>
|
|
84
|
+
#import <React/RCTRootView.h>
|
|
85
|
+
|
|
86
|
+
@implementation AppDelegate
|
|
87
|
+
|
|
88
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
89
|
+
{
|
|
90
|
+
...
|
|
91
|
+
|
|
92
|
+
// 2. Create an instance of UIWindow
|
|
93
|
+
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
94
|
+
|
|
95
|
+
// 3. Set up the UINavigationController with a UIViewController
|
|
96
|
+
UIViewController *viewController = [UIViewController new];
|
|
97
|
+
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
|
|
98
|
+
[navigationController setNavigationBarHidden:YES animated:NO];
|
|
99
|
+
|
|
100
|
+
// 4. Set the RN bridge to use the UIWindow as the root view controller
|
|
101
|
+
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
102
|
+
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
|
103
|
+
moduleName:self.moduleName
|
|
104
|
+
initialProperties:self.initialProps];
|
|
105
|
+
viewController.view = rootView;
|
|
106
|
+
self.window.rootViewController = navigationController; // Use the UINavigationController as the root
|
|
107
|
+
|
|
108
|
+
[self.window makeKeyAndVisible];
|
|
109
|
+
|
|
110
|
+
return YES;
|
|
111
|
+
}
|
|
66
112
|
|
|
67
|
-
|
|
113
|
+
...
|
|
114
|
+
@end
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Permissions
|
|
119
|
+
Added the following to your `~/ios/<app name>/Info.plist` file
|
|
120
|
+
|
|
121
|
+
```xml
|
|
122
|
+
...
|
|
123
|
+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
|
124
|
+
<string>We need access to your location to provide you with location-based services, even when the app is in the background.</string>
|
|
125
|
+
<key>NSLocationWhenInUseUsageDescription</key>
|
|
126
|
+
<string>We need access to your location while you are using the app to provide you with location-based services.</string>
|
|
127
|
+
<key>NSCameraUsageDescription</key>
|
|
128
|
+
<string>We need access to your camera to take photos for profile pictures.</string>
|
|
129
|
+
<key>NSPhotoLibraryUsageDescription</key>
|
|
130
|
+
<string>We need access to your photo library to allow you to select and upload images.</string>
|
|
131
|
+
...
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Usage
|
|
68
135
|
|
|
69
136
|
```tsx
|
|
70
137
|
//verify.tsx
|
|
71
|
-
import React from 'react'
|
|
72
|
-
import {
|
|
73
|
-
|
|
138
|
+
import React from 'react';
|
|
139
|
+
import { Button, View } from 'react-native';
|
|
140
|
+
import { QoreIdSdk } from '@qore-id/react-native-qoreid-sdk';
|
|
74
141
|
|
|
75
142
|
function App() {
|
|
76
|
-
|
|
77
|
-
const customButton = ({ onPress }) => <Button onPress={onPress} title="QoreId Button" />
|
|
78
143
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
144
|
+
const onError = (data) => {
|
|
145
|
+
console.error(data);
|
|
146
|
+
Alert.alert('Error', data);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const onSuccess = (data) => {
|
|
150
|
+
console.debug(data);
|
|
151
|
+
Alert.alert('Sumitted', data);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
QoreIdSdk.events(onSuccess, onError);
|
|
155
|
+
|
|
156
|
+
function onSubmit() {
|
|
157
|
+
const formData = {
|
|
158
|
+
flowId: parseInt(flowId),
|
|
159
|
+
clientId: clientId,
|
|
160
|
+
productCode: selectedProductId,
|
|
161
|
+
customerReference: customerRef,
|
|
162
|
+
applicantData: {
|
|
163
|
+
firstName: firstName,
|
|
164
|
+
middleName: middleName,
|
|
165
|
+
lastName: lastName,
|
|
166
|
+
gender: gender,
|
|
167
|
+
phoneNumber: phoneNumber,
|
|
168
|
+
email: email,
|
|
169
|
+
},
|
|
170
|
+
identityData: {
|
|
171
|
+
idType: idCardType,
|
|
172
|
+
idNumber: idNumber,
|
|
173
|
+
},
|
|
174
|
+
addressData: {
|
|
175
|
+
address: phyAddress,
|
|
176
|
+
city: city,
|
|
177
|
+
lga: lga,
|
|
178
|
+
},
|
|
179
|
+
ocrAcceptedDocuments:
|
|
180
|
+
['DRIVERS_LICENSE_NGA','VOTERS_CARD_NGA','NIN_SLIP_NGA','PASSPORT_NGA'],
|
|
82
181
|
};
|
|
83
182
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Alert.alert('Sumitted', data);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const onClosed = (data) => {
|
|
90
|
-
console.debug(data);
|
|
91
|
-
Alert.alert('Closed', data);
|
|
92
|
-
};
|
|
183
|
+
QoreIdSdk.launchQoreId(formData);
|
|
184
|
+
}
|
|
93
185
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
flowId=""
|
|
100
|
-
clientId="" {/* Required */}
|
|
101
|
-
productCode="" {/* Required */}
|
|
102
|
-
customerReference="" {/* Required */}
|
|
103
|
-
applicantData={{
|
|
104
|
-
firstName:"",
|
|
105
|
-
middleName:"",
|
|
106
|
-
lastName:"",
|
|
107
|
-
gender:"",
|
|
108
|
-
phoneNumber:"",
|
|
109
|
-
email:"",
|
|
110
|
-
}}
|
|
111
|
-
identityData={{ idType: "", idNumber:"" }}
|
|
112
|
-
addressData={{
|
|
113
|
-
address: "",
|
|
114
|
-
city:"",
|
|
115
|
-
lga:"",
|
|
116
|
-
}}
|
|
117
|
-
ocrAcceptedDocuments="DRIVERS_LICENSE_NGA,VOTERS_CARD_NGA,NIN_SLIP_NGA,PASSPORT_NGA"
|
|
118
|
-
onQoreIDSdkSubmitted={onSumitted}
|
|
119
|
-
onQoreIDSdkError={onError}
|
|
120
|
-
onQoreIDSdkClosed={onClosed}
|
|
121
|
-
render={customButton}
|
|
122
|
-
/>
|
|
123
|
-
</View>
|
|
124
|
-
)
|
|
186
|
+
return (
|
|
187
|
+
<View>
|
|
188
|
+
<Button title="Launch QoreIdSdk" onPress={onSubmit} />
|
|
189
|
+
</View>
|
|
190
|
+
);
|
|
125
191
|
}
|
|
126
|
-
|
|
127
192
|
```
|
|
128
193
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
### Utilities
|
|
194
|
+
## Utilities
|
|
132
195
|
|
|
133
196
|
QoreId SDK exposes utilities that you can easily use
|
|
134
197
|
|
|
@@ -141,7 +204,7 @@ function App() {
|
|
|
141
204
|
|
|
142
205
|
// Array of string
|
|
143
206
|
//For more information check -> https://docs.qoreid.com/docs/product-codes
|
|
144
|
-
const productIds = utils.productCodes;
|
|
207
|
+
const productIds = utils.productCodes;
|
|
145
208
|
|
|
146
209
|
|
|
147
210
|
//An array of accepted documents in a specific country
|
|
@@ -150,4 +213,17 @@ function App() {
|
|
|
150
213
|
...
|
|
151
214
|
}
|
|
152
215
|
|
|
153
|
-
```
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## <span style="color: red;">CHANGE LOGS</span>
|
|
219
|
+
|
|
220
|
+
#### 1.0.9
|
|
221
|
+
|
|
222
|
+
- Added qoreid initialization function. You can now launche the sdk in your code implementation - offering you more control.
|
|
223
|
+
- Addition of event listener `QoreIdSdk.events` to listen to events from the sdk.
|
|
224
|
+
- QoreIdButton component will be deprecated in the next major release. Use `QoreIdSdk.launchQoreId` instead.
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
#### 1.1.0 Breaking Changes
|
|
228
|
+
- Removed `QoreIdButton` component. Use `QoreIdSdk.launchQoreId` instead.
|
|
229
|
+
- QoreIdSdk is now available on iOS.
|
package/android/build.gradle
CHANGED
|
@@ -93,7 +93,6 @@ dependencies {
|
|
|
93
93
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
94
94
|
//noinspection GradleDynamicVersion
|
|
95
95
|
implementation 'com.qoreid:qoreid-sdk:1.1.32'
|
|
96
|
-
implementation "com.google.code.gson:gson:2.8.5"
|
|
97
96
|
implementation "com.facebook.react:react-native:+"
|
|
98
97
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
99
98
|
|
|
@@ -7,7 +7,6 @@ import android.os.Build
|
|
|
7
7
|
import android.util.Log
|
|
8
8
|
import com.facebook.react.bridge.*
|
|
9
9
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
10
|
-
import com.google.gson.Gson
|
|
11
10
|
import com.qoreid.sdk.core.QoreIDParams
|
|
12
11
|
import com.qoreid.sdk.core.QoreIDSdk
|
|
13
12
|
import com.qoreid.sdk.core.QoreIDSdk.QORE_ID_RESULT_CODE
|
|
@@ -17,12 +16,11 @@ import com.qoreid.sdk.core.models.ApplicantData
|
|
|
17
16
|
import com.qoreid.sdk.core.models.ErrorResult
|
|
18
17
|
import com.qoreid.sdk.core.models.QoreIDResult
|
|
19
18
|
import com.qoreid.sdk.core.models.SuccessResult
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
import java.util.HashMap
|
|
22
20
|
|
|
23
21
|
|
|
24
22
|
class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
25
|
-
ReactContextBaseJavaModule(reactContext){
|
|
23
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
26
24
|
private var qoreIdResult: QoreIDResult? = null;
|
|
27
25
|
|
|
28
26
|
|
|
@@ -59,53 +57,49 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
59
57
|
return NAME
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
|
|
63
60
|
@ReactMethod
|
|
64
|
-
fun
|
|
65
|
-
|
|
61
|
+
fun launchQoreidSdk(readableData: ReadableMap) {
|
|
62
|
+
val data = readableData.toHashMap()
|
|
66
63
|
if (currentActivity == null) {
|
|
67
64
|
Log.e("Error", "No current activity");
|
|
68
65
|
return
|
|
69
66
|
}
|
|
70
67
|
|
|
71
|
-
val
|
|
72
|
-
val
|
|
73
|
-
|
|
74
|
-
val config = qoreIdJSData.config
|
|
75
|
-
val apD = qoreIdJSData.applicantData
|
|
68
|
+
val config = data?.get("config") as? HashMap<*, *>
|
|
69
|
+
val apD = data?.get("applicantData") as? HashMap<*, *>
|
|
76
70
|
val applicantData = ApplicantData(
|
|
77
|
-
apD
|
|
78
|
-
apD
|
|
79
|
-
apD
|
|
80
|
-
apD
|
|
81
|
-
apD
|
|
82
|
-
apD
|
|
83
|
-
apD.gender
|
|
71
|
+
apD?.get("firstName") as String,
|
|
72
|
+
apD?.get("lastName") as String,
|
|
73
|
+
apD?.get("phoneNumber") as String?,
|
|
74
|
+
apD?.get("middleName") as String?,
|
|
75
|
+
apD?.get("dob") as String?,
|
|
76
|
+
apD?.get("gender") as String?
|
|
84
77
|
)
|
|
85
78
|
|
|
86
|
-
|
|
79
|
+
|
|
80
|
+
val adD = data?.get("addressData") as? HashMap<*, *>
|
|
87
81
|
val addressData = AddressData(
|
|
88
|
-
adD
|
|
89
|
-
adD
|
|
90
|
-
adD
|
|
91
|
-
adD
|
|
82
|
+
adD?.get("address") as String?,
|
|
83
|
+
adD?.get("city") as String?,
|
|
84
|
+
adD?.get("lga") as String?,
|
|
85
|
+
adD?.get("state") as String?,
|
|
92
86
|
)
|
|
87
|
+
val flowId = config?.get("flowId") as? Double
|
|
93
88
|
|
|
94
|
-
val qoreIDParams = if (
|
|
89
|
+
val qoreIDParams = if (flowId?.toLong() != 0L) {
|
|
95
90
|
QoreIDParams()
|
|
96
|
-
.clientId(config
|
|
97
|
-
.customerReference(
|
|
91
|
+
.clientId(config?.get("clientId") as String)
|
|
92
|
+
.customerReference(config?.get("customerReference") as String)
|
|
98
93
|
.inputData(applicantData, addressData)
|
|
99
|
-
.ocrAcceptedDocuments(
|
|
100
|
-
.workflow(
|
|
101
|
-
|
|
94
|
+
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
95
|
+
.workflow(flowId!!.toLong())
|
|
102
96
|
} else {
|
|
103
97
|
QoreIDParams()
|
|
104
|
-
.clientId(config
|
|
105
|
-
.customerReference(
|
|
98
|
+
.clientId(config?.get("clientId") as String)
|
|
99
|
+
.customerReference(config?.get("customerReference") as String)
|
|
106
100
|
.inputData(applicantData, addressData)
|
|
107
|
-
.ocrAcceptedDocuments(
|
|
108
|
-
.collection(config
|
|
101
|
+
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
102
|
+
.collection(config?.get("productCode") as String)
|
|
109
103
|
}
|
|
110
104
|
|
|
111
105
|
QoreIDSdk.s(BuildConfig.s);
|
|
@@ -126,6 +120,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
126
120
|
sendEvent(context, "onResult", event)
|
|
127
121
|
|
|
128
122
|
}
|
|
123
|
+
|
|
129
124
|
is SuccessResult -> {
|
|
130
125
|
// Handle success.
|
|
131
126
|
val event = Arguments.createMap().apply {
|
package/ios/QoreidSdk.m
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <UIKit/UIKit.h>
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@interface RCT_EXTERN_MODULE(QoreidSdk, NSObject)
|
|
7
|
+
|
|
8
|
+
RCT_EXTERN_METHOD (launchQoreidSdk: (NSDictionary *) data)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// Don't compile this code when we build for the old architecture.
|
|
12
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
13
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
14
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
15
|
+
{
|
|
16
|
+
return std::make_shared<facebook::react::NativeQoreidSdkSpecJSI>(params);
|
|
17
|
+
}
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
@end
|
|
21
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
//
|
|
2
|
+
// QoreidSdk.swift
|
|
3
|
+
// QoreidSdk
|
|
4
|
+
//
|
|
5
|
+
// Created by Emmanuel Ugwuoke on 29/09/2023.
|
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
import React
|
|
11
|
+
import UIKit
|
|
12
|
+
import QoreIDSDK
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@objc(QoreidSdk)
|
|
16
|
+
class QoreidSdk: RCTEventEmitter {
|
|
17
|
+
|
|
18
|
+
@objc func launchQoreidSdk(_ data: NSDictionary) -> Void {
|
|
19
|
+
let config = data["config"] as? NSDictionary
|
|
20
|
+
let _applicant = data["applicantData"] as? NSDictionary
|
|
21
|
+
let _identity = data["identityData"] as? NSDictionary
|
|
22
|
+
let _address = data["addressData"] as? NSDictionary
|
|
23
|
+
let ocrs = data["acceptedDocuments"] as? NSArray
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
let applicant = ApplicantData(
|
|
27
|
+
firstname:_applicant?["firstName"] as? String,
|
|
28
|
+
lastname:_applicant?["lastName"] as? String,
|
|
29
|
+
phone: _applicant?["phoneNumber"] as? String,
|
|
30
|
+
middlename: _applicant?["middleName"] as? String
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
let addressData = AddressData(
|
|
34
|
+
address: _address?["address"] as? String,
|
|
35
|
+
city: _address?["city"] as? String,
|
|
36
|
+
lga: _address?["lga"] as? String,
|
|
37
|
+
state: _address?["state"] as? String,
|
|
38
|
+
county: _address?["country"] as? String,
|
|
39
|
+
subCounty: _address?["region"] as? String,
|
|
40
|
+
ccc: _address?["ccc"] as? String ?? ""
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
let identityData = IdentityData(
|
|
44
|
+
idType: _identity?["idType"] as? String,
|
|
45
|
+
idNumber: _identity?["idNumber"] as? String
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
var param:QoreIDParam?
|
|
49
|
+
|
|
50
|
+
if (config!["flowId"] as! Int != 0) {
|
|
51
|
+
param = QoreIDParam()
|
|
52
|
+
.clientId(clientId: config?["clientId"] as? String)
|
|
53
|
+
.customerReference(config?["customerReference"] as? String)
|
|
54
|
+
.inputData(InputData(applicant: applicant,address: addressData, identity: identityData))
|
|
55
|
+
.ocrAcceptedDocuments(ocrs as? Array<String>)
|
|
56
|
+
.workFlow(config!["flowId"] as! Int)
|
|
57
|
+
.build()
|
|
58
|
+
} else {
|
|
59
|
+
param = QoreIDParam()
|
|
60
|
+
.clientId(clientId: config?["clientId"] as? String)
|
|
61
|
+
.customerReference(config?["customerReference"] as? String)
|
|
62
|
+
.inputData(InputData(applicant: applicant,address: addressData, identity: identityData))
|
|
63
|
+
.ocrAcceptedDocuments(ocrs as? Array<String>)
|
|
64
|
+
.collection((config?["productCode"] as? String)!)
|
|
65
|
+
.build()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if let params = param {
|
|
69
|
+
DispatchQueue.main.async {
|
|
70
|
+
let vc = ViewController()
|
|
71
|
+
vc.param = param
|
|
72
|
+
vc.onQoreIdResult = { [weak self] result in
|
|
73
|
+
self?.onQoreIdResultReceived(result: result)
|
|
74
|
+
}
|
|
75
|
+
self.controller().pushViewController(vc, animated: false)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
func onQoreIdResultReceived(result: QoreIDResult?) {
|
|
81
|
+
if let result = result {
|
|
82
|
+
if let errorResult = result as? ErrorResult {
|
|
83
|
+
self.sendEvent(withName: "onResult", body:["code": String(describing: errorResult.code), "data":errorResult.data as Any, "message": errorResult.message])
|
|
84
|
+
} else if let successResult = result as? SuccessResult {
|
|
85
|
+
self.sendEvent(withName: "onResult", body:["data":successResult.data as Any, "message": successResult.message as Any])
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
self.controller().popViewController(animated: false)
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
override func supportedEvents() -> [String] {
|
|
93
|
+
return ["onResult"]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
97
|
+
return false
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private func controller() -> UINavigationController {
|
|
101
|
+
let rootViewController = UIApplication.shared.keyWindow?.rootViewController
|
|
102
|
+
return rootViewController as! UINavigationController
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
-
|
|
10
|
+
2A18B1372AC6CA26005CB836 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A18B1362AC6CA26005CB836 /* File.swift */; };
|
|
11
11
|
/* End PBXBuildFile section */
|
|
12
12
|
|
|
13
13
|
/* Begin PBXCopyFilesBuildPhase section */
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
/* Begin PBXFileReference section */
|
|
26
26
|
134814201AA4EA6300B7C361 /* libQoreidSdk.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libQoreidSdk.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
27
|
+
2A18B1352AC6CA25005CB836 /* QoreidSdk-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "QoreidSdk-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
28
|
+
2A18B1362AC6CA26005CB836 /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
|
|
27
29
|
B3E7B5881CC2AC0600A0062D /* QoreidSdk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QoreidSdk.h; sourceTree = "<group>"; };
|
|
28
30
|
B3E7B5891CC2AC0600A0062D /* QoreidSdk.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QoreidSdk.m; sourceTree = "<group>"; };
|
|
29
31
|
/* End PBXFileReference section */
|
|
@@ -50,9 +52,11 @@
|
|
|
50
52
|
58B511D21A9E6C8500147676 = {
|
|
51
53
|
isa = PBXGroup;
|
|
52
54
|
children = (
|
|
55
|
+
2A18B1362AC6CA26005CB836 /* File.swift */,
|
|
53
56
|
B3E7B5881CC2AC0600A0062D /* QoreidSdk.h */,
|
|
54
57
|
B3E7B5891CC2AC0600A0062D /* QoreidSdk.m */,
|
|
55
58
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
59
|
+
2A18B1352AC6CA25005CB836 /* QoreidSdk-Bridging-Header.h */,
|
|
56
60
|
);
|
|
57
61
|
sourceTree = "<group>";
|
|
58
62
|
};
|
|
@@ -87,6 +91,7 @@
|
|
|
87
91
|
TargetAttributes = {
|
|
88
92
|
58B511DA1A9E6C8500147676 = {
|
|
89
93
|
CreatedOnToolsVersion = 6.1.1;
|
|
94
|
+
LastSwiftMigration = 1500;
|
|
90
95
|
};
|
|
91
96
|
};
|
|
92
97
|
};
|
|
@@ -113,7 +118,7 @@
|
|
|
113
118
|
isa = PBXSourcesBuildPhase;
|
|
114
119
|
buildActionMask = 2147483647;
|
|
115
120
|
files = (
|
|
116
|
-
|
|
121
|
+
2A18B1372AC6CA26005CB836 /* File.swift in Sources */,
|
|
117
122
|
);
|
|
118
123
|
runOnlyForDeploymentPostprocessing = 0;
|
|
119
124
|
};
|
|
@@ -218,6 +223,7 @@
|
|
|
218
223
|
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
219
224
|
isa = XCBuildConfiguration;
|
|
220
225
|
buildSettings = {
|
|
226
|
+
CLANG_ENABLE_MODULES = YES;
|
|
221
227
|
HEADER_SEARCH_PATHS = (
|
|
222
228
|
"$(inherited)",
|
|
223
229
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
@@ -225,15 +231,22 @@
|
|
|
225
231
|
"$(SRCROOT)/../../react-native/React/**",
|
|
226
232
|
);
|
|
227
233
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
228
|
-
OTHER_LDFLAGS =
|
|
234
|
+
OTHER_LDFLAGS = (
|
|
235
|
+
"-ObjC",
|
|
236
|
+
"$(inherit)",
|
|
237
|
+
);
|
|
229
238
|
PRODUCT_NAME = QoreidSdk;
|
|
230
239
|
SKIP_INSTALL = YES;
|
|
240
|
+
SWIFT_OBJC_BRIDGING_HEADER = "QoreidSdk-Bridging-Header.h";
|
|
241
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
242
|
+
SWIFT_VERSION = 5.0;
|
|
231
243
|
};
|
|
232
244
|
name = Debug;
|
|
233
245
|
};
|
|
234
246
|
58B511F11A9E6C8500147676 /* Release */ = {
|
|
235
247
|
isa = XCBuildConfiguration;
|
|
236
248
|
buildSettings = {
|
|
249
|
+
CLANG_ENABLE_MODULES = YES;
|
|
237
250
|
HEADER_SEARCH_PATHS = (
|
|
238
251
|
"$(inherited)",
|
|
239
252
|
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
@@ -241,9 +254,14 @@
|
|
|
241
254
|
"$(SRCROOT)/../../react-native/React/**",
|
|
242
255
|
);
|
|
243
256
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
244
|
-
OTHER_LDFLAGS =
|
|
257
|
+
OTHER_LDFLAGS = (
|
|
258
|
+
"-ObjC",
|
|
259
|
+
"$(inherit)",
|
|
260
|
+
);
|
|
245
261
|
PRODUCT_NAME = QoreidSdk;
|
|
246
262
|
SKIP_INSTALL = YES;
|
|
263
|
+
SWIFT_OBJC_BRIDGING_HEADER = "QoreidSdk-Bridging-Header.h";
|
|
264
|
+
SWIFT_VERSION = 5.0;
|
|
247
265
|
};
|
|
248
266
|
name = Release;
|
|
249
267
|
};
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>BuildLocationStyle</key>
|
|
6
|
+
<string>UseAppPreferences</string>
|
|
7
|
+
<key>CustomBuildLocationType</key>
|
|
8
|
+
<string>RelativeToDerivedData</string>
|
|
9
|
+
<key>DerivedDataLocationStyle</key>
|
|
10
|
+
<string>Default</string>
|
|
11
|
+
<key>ShowSharedSchemesAutomaticallyEnabled</key>
|
|
12
|
+
<true/>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
package/ios/QoreidSdk.xcodeproj/xcuserdata/e.ugwuoke.xcuserdatad/xcschemes/xcschememanagement.plist
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>QoreidSdk.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|