@qore-id/react-native-qoreid-sdk 1.0.9 → 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/README.md +79 -73
- package/android/build.gradle +0 -1
- package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +29 -33
- 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 -42
- 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 -35
- 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 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/{qoreIdButton.android.d.ts → qoreIdSdk.d.ts} +3 -5
- 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 -47
- 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 -105
- 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 -95
- 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.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 -139
package/README.md
CHANGED
|
@@ -12,6 +12,16 @@ npm install --save @qore-id/react-native-qoreid-sdk
|
|
|
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`
|
|
@@ -44,15 +54,8 @@ import com.qoreidsdk.QoreidSdkModule;
|
|
|
44
54
|
|
|
45
55
|
```
|
|
46
56
|
|
|
47
|
-
<!-- ### iOS
|
|
48
|
-
|
|
49
|
-
From your root directory
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
npm i react-native-webview
|
|
53
|
-
``` -->
|
|
54
|
-
|
|
55
|
-
## Permissions
|
|
58
|
+
#### Permissions
|
|
56
59
|
|
|
57
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.
|
|
58
61
|
|
|
@@ -67,6 +70,66 @@ Verifind required permissions
|
|
|
67
70
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
|
68
71
|
...
|
|
69
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
|
+
}
|
|
112
|
+
|
|
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
|
+
```
|
|
70
133
|
|
|
71
134
|
## Usage
|
|
72
135
|
|
|
@@ -114,7 +177,7 @@ function App() {
|
|
|
114
177
|
lga: lga,
|
|
115
178
|
},
|
|
116
179
|
ocrAcceptedDocuments:
|
|
117
|
-
'DRIVERS_LICENSE_NGA,VOTERS_CARD_NGA,NIN_SLIP_NGA,PASSPORT_NGA',
|
|
180
|
+
['DRIVERS_LICENSE_NGA','VOTERS_CARD_NGA','NIN_SLIP_NGA','PASSPORT_NGA'],
|
|
118
181
|
};
|
|
119
182
|
|
|
120
183
|
QoreIdSdk.launchQoreId(formData);
|
|
@@ -128,69 +191,7 @@ function App() {
|
|
|
128
191
|
}
|
|
129
192
|
```
|
|
130
193
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
```tsx
|
|
134
|
-
//verify.tsx
|
|
135
|
-
import React from 'react'
|
|
136
|
-
import { QoreIdButton } from '@qore-id/react-native-qoreid-sdk';
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
function App() {
|
|
140
|
-
|
|
141
|
-
const customButton = ({ onPress }) => <Button onPress={onPress} title="QoreId Button" />
|
|
142
|
-
|
|
143
|
-
const onError = (data) => {
|
|
144
|
-
console.error(data);
|
|
145
|
-
Alert.alert('Error', data);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const onSumitted = (data) => {
|
|
149
|
-
console.debug(data);
|
|
150
|
-
Alert.alert('Sumitted', data);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const onClosed = (data) => {
|
|
154
|
-
console.debug(data);
|
|
155
|
-
Alert.alert('Closed', data);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
return (
|
|
159
|
-
<View>
|
|
160
|
-
{/* Other components */}
|
|
161
|
-
<QoreIdButton
|
|
162
|
-
title="Verify"
|
|
163
|
-
flowId=""
|
|
164
|
-
clientId="" {/* Required */}
|
|
165
|
-
productCode="" {/* Required */}
|
|
166
|
-
customerReference="" {/* Required */}
|
|
167
|
-
applicantData={{
|
|
168
|
-
firstName:"",
|
|
169
|
-
middleName:"",
|
|
170
|
-
lastName:"",
|
|
171
|
-
gender:"",
|
|
172
|
-
phoneNumber:"",
|
|
173
|
-
email:"",
|
|
174
|
-
}}
|
|
175
|
-
identityData={{ idType: "", idNumber:"" }}
|
|
176
|
-
addressData={{
|
|
177
|
-
address: "",
|
|
178
|
-
city:"",
|
|
179
|
-
lga:"",
|
|
180
|
-
}}
|
|
181
|
-
ocrAcceptedDocuments="DRIVERS_LICENSE_NGA,VOTERS_CARD_NGA,NIN_SLIP_NGA,PASSPORT_NGA"
|
|
182
|
-
onQoreIDSdkSubmitted={onSumitted}
|
|
183
|
-
onQoreIDSdkError={onError}
|
|
184
|
-
onQoreIDSdkClosed={onClosed}
|
|
185
|
-
render={customButton}
|
|
186
|
-
/>
|
|
187
|
-
</View>
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Utilities
|
|
194
|
+
## Utilities
|
|
194
195
|
|
|
195
196
|
QoreId SDK exposes utilities that you can easily use
|
|
196
197
|
|
|
@@ -214,10 +215,15 @@ function App() {
|
|
|
214
215
|
|
|
215
216
|
```
|
|
216
217
|
|
|
217
|
-
## CHANGE LOGS
|
|
218
|
+
## <span style="color: red;">CHANGE LOGS</span>
|
|
218
219
|
|
|
219
220
|
#### 1.0.9
|
|
220
221
|
|
|
221
222
|
- Added qoreid initialization function. You can now launche the sdk in your code implementation - offering you more control.
|
|
222
223
|
- Addition of event listener `QoreIdSdk.events` to listen to events from the sdk.
|
|
223
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
|
|
|
@@ -60,51 +58,48 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
@ReactMethod
|
|
63
|
-
fun
|
|
64
|
-
|
|
61
|
+
fun launchQoreidSdk(readableData: ReadableMap) {
|
|
62
|
+
val data = readableData.toHashMap()
|
|
65
63
|
if (currentActivity == null) {
|
|
66
64
|
Log.e("Error", "No current activity");
|
|
67
65
|
return
|
|
68
66
|
}
|
|
69
67
|
|
|
70
|
-
val
|
|
71
|
-
val
|
|
72
|
-
|
|
73
|
-
val config = qoreIdJSData.config
|
|
74
|
-
val apD = qoreIdJSData.applicantData
|
|
68
|
+
val config = data?.get("config") as? HashMap<*, *>
|
|
69
|
+
val apD = data?.get("applicantData") as? HashMap<*, *>
|
|
75
70
|
val applicantData = ApplicantData(
|
|
76
|
-
apD
|
|
77
|
-
apD
|
|
78
|
-
apD
|
|
79
|
-
apD
|
|
80
|
-
apD
|
|
81
|
-
apD
|
|
82
|
-
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?
|
|
83
77
|
)
|
|
84
78
|
|
|
85
|
-
|
|
79
|
+
|
|
80
|
+
val adD = data?.get("addressData") as? HashMap<*, *>
|
|
86
81
|
val addressData = AddressData(
|
|
87
|
-
adD
|
|
88
|
-
adD
|
|
89
|
-
adD
|
|
90
|
-
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?,
|
|
91
86
|
)
|
|
87
|
+
val flowId = config?.get("flowId") as? Double
|
|
92
88
|
|
|
93
|
-
val qoreIDParams = if (
|
|
89
|
+
val qoreIDParams = if (flowId?.toLong() != 0L) {
|
|
94
90
|
QoreIDParams()
|
|
95
|
-
.clientId(config
|
|
96
|
-
.customerReference(
|
|
91
|
+
.clientId(config?.get("clientId") as String)
|
|
92
|
+
.customerReference(config?.get("customerReference") as String)
|
|
97
93
|
.inputData(applicantData, addressData)
|
|
98
|
-
.ocrAcceptedDocuments(
|
|
99
|
-
.workflow(
|
|
100
|
-
|
|
94
|
+
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
95
|
+
.workflow(flowId!!.toLong())
|
|
101
96
|
} else {
|
|
102
97
|
QoreIDParams()
|
|
103
|
-
.clientId(config
|
|
104
|
-
.customerReference(
|
|
98
|
+
.clientId(config?.get("clientId") as String)
|
|
99
|
+
.customerReference(config?.get("customerReference") as String)
|
|
105
100
|
.inputData(applicantData, addressData)
|
|
106
|
-
.ocrAcceptedDocuments(
|
|
107
|
-
.collection(config
|
|
101
|
+
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
102
|
+
.collection(config?.get("productCode") as String)
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
QoreIDSdk.s(BuildConfig.s);
|
|
@@ -125,6 +120,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
125
120
|
sendEvent(context, "onResult", event)
|
|
126
121
|
|
|
127
122
|
}
|
|
123
|
+
|
|
128
124
|
is SuccessResult -> {
|
|
129
125
|
// Handle success.
|
|
130
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>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ViewController.swift
|
|
3
|
+
// qore-id-react-native-qoreid-sdk
|
|
4
|
+
//
|
|
5
|
+
// Created by Guru King on 03/10/2023.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
import QoreIDSDK
|
|
10
|
+
|
|
11
|
+
class ViewController: UIViewController {
|
|
12
|
+
var param:QoreIDParam?
|
|
13
|
+
var onQoreIdResult:((QoreIDResult) -> ())?
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
override func viewDidLoad() {
|
|
17
|
+
super.viewDidLoad()
|
|
18
|
+
QoreIdSdk.shared.launch(param: param ?? QoreIDParam(), vc: self, "react_native_ios_sdk") { [weak self] result in
|
|
19
|
+
self?.onQoreIdResult!(result)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|