assentify-sdk-react-native 0.0.36 → 0.0.38
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 +17 -0
- package/android/build.gradle +1 -1
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +18 -16
- package/android/src/main/java/com/assentifysdk/QrActivity.kt +363 -0
- package/android/src/main/res/layout/activity_qr.xml +233 -0
- package/assentify-sdk.podspec +1 -1
- package/ios/NativeAssentifySdk.mm +4 -5
- package/ios/NativeAssentifySdk.swift +30 -18
- package/ios/View/PassportController.swift +6 -2
- package/ios/View/QrController.swift +213 -0
- package/lib/commonjs/AssentifyProvider.js +21 -0
- package/lib/commonjs/AssentifyProvider.js.map +1 -1
- package/lib/commonjs/AssentifyWrapper.js +6 -2
- package/lib/commonjs/AssentifyWrapper.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/AssentifyProvider.js +21 -0
- package/lib/module/AssentifyProvider.js.map +1 -1
- package/lib/module/AssentifyWrapper.js +6 -2
- package/lib/module/AssentifyWrapper.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/example/src/Home.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +2 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +2 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/module/index.d.ts +2 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts +2 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +2 -0
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/AssentifyProvider.tsx +17 -0
- package/src/AssentifyWrapper.ts +5 -10
- package/src/types.ts +3 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
4
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
5
|
+
android:layout_width="match_parent"
|
|
6
|
+
android:layout_height="match_parent"
|
|
7
|
+
android:textColor="@color/white"
|
|
8
|
+
tools:context=".QrActivity">
|
|
9
|
+
|
|
10
|
+
<androidx.appcompat.widget.Toolbar
|
|
11
|
+
android:id="@+id/toolbar"
|
|
12
|
+
android:layout_width="match_parent"
|
|
13
|
+
android:layout_height="70dp"
|
|
14
|
+
android:background="@color/transparent"
|
|
15
|
+
android:elevation="4dp"
|
|
16
|
+
tools:ignore="MissingConstraints">
|
|
17
|
+
|
|
18
|
+
<LinearLayout
|
|
19
|
+
android:layout_width="match_parent"
|
|
20
|
+
android:layout_height="wrap_content"
|
|
21
|
+
android:layout_gravity="center"
|
|
22
|
+
android:orientation="horizontal">
|
|
23
|
+
|
|
24
|
+
<LinearLayout
|
|
25
|
+
android:layout_width="wrap_content"
|
|
26
|
+
android:layout_height="wrap_content"
|
|
27
|
+
android:layout_gravity="center"
|
|
28
|
+
android:layout_weight="1"
|
|
29
|
+
android:orientation="horizontal">
|
|
30
|
+
|
|
31
|
+
<RelativeLayout
|
|
32
|
+
android:id="@+id/backButton"
|
|
33
|
+
android:layout_width="45dp"
|
|
34
|
+
android:layout_height="45dp"
|
|
35
|
+
android:elevation="4dp">
|
|
36
|
+
|
|
37
|
+
<ImageView
|
|
38
|
+
android:id="@+id/back_icon"
|
|
39
|
+
android:layout_width="23dp"
|
|
40
|
+
android:layout_height="23dp"
|
|
41
|
+
android:layout_centerHorizontal="true"
|
|
42
|
+
android:layout_centerVertical="true"
|
|
43
|
+
android:src="@drawable/back_icon" />
|
|
44
|
+
|
|
45
|
+
</RelativeLayout>
|
|
46
|
+
|
|
47
|
+
</LinearLayout>
|
|
48
|
+
<TextView
|
|
49
|
+
android:id="@+id/toolbar_title"
|
|
50
|
+
android:layout_weight="1"
|
|
51
|
+
android:layout_width="wrap_content"
|
|
52
|
+
android:layout_height="wrap_content"
|
|
53
|
+
android:gravity="center"
|
|
54
|
+
android:paddingTop="5dp"
|
|
55
|
+
android:textColor="@color/white"
|
|
56
|
+
android:textSize="18sp"
|
|
57
|
+
android:text="Qr Capture" />
|
|
58
|
+
<RelativeLayout
|
|
59
|
+
android:layout_weight="1"
|
|
60
|
+
android:layout_width="45dp"
|
|
61
|
+
android:layout_height="45dp"
|
|
62
|
+
android:elevation="4dp">
|
|
63
|
+
</RelativeLayout>
|
|
64
|
+
|
|
65
|
+
</LinearLayout>
|
|
66
|
+
|
|
67
|
+
</androidx.appcompat.widget.Toolbar>
|
|
68
|
+
|
|
69
|
+
<LinearLayout
|
|
70
|
+
android:layout_width="match_parent"
|
|
71
|
+
android:layout_height="match_parent"
|
|
72
|
+
android:gravity="center_horizontal"
|
|
73
|
+
android:orientation="horizontal">
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
<androidx.cardview.widget.CardView
|
|
77
|
+
android:id="@+id/fragmentContainer"
|
|
78
|
+
android:layout_width="match_parent"
|
|
79
|
+
android:layout_height="match_parent"
|
|
80
|
+
android:gravity="center_horizontal"
|
|
81
|
+
app:cardBackgroundColor="@android:color/white"
|
|
82
|
+
app:elevation="0dp" />
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</LinearLayout>
|
|
86
|
+
|
|
87
|
+
<LinearLayout
|
|
88
|
+
android:layout_width="match_parent"
|
|
89
|
+
android:layout_height="match_parent"
|
|
90
|
+
android:layout_gravity="center_vertical"
|
|
91
|
+
android:layout_marginTop="00dp"
|
|
92
|
+
android:gravity="center"
|
|
93
|
+
android:orientation="vertical"
|
|
94
|
+
android:paddingLeft="16dp"
|
|
95
|
+
android:paddingRight="16dp"
|
|
96
|
+
android:paddingBottom="2dp"
|
|
97
|
+
android:visibility="visible">
|
|
98
|
+
|
|
99
|
+
<LinearLayout
|
|
100
|
+
android:layout_width="wrap_content"
|
|
101
|
+
android:layout_height="wrap_content"
|
|
102
|
+
android:layout_gravity="center_horizontal"
|
|
103
|
+
android:gravity="center"
|
|
104
|
+
android:orientation="horizontal">
|
|
105
|
+
|
|
106
|
+
<LinearLayout
|
|
107
|
+
android:id="@+id/popUpContainer"
|
|
108
|
+
android:layout_width="wrap_content"
|
|
109
|
+
android:layout_height="wrap_content"
|
|
110
|
+
android:layout_gravity="center_horizontal"
|
|
111
|
+
android:gravity="center"
|
|
112
|
+
android:orientation="vertical">
|
|
113
|
+
|
|
114
|
+
<ImageView
|
|
115
|
+
android:id="@+id/popUpIcon"
|
|
116
|
+
android:layout_width="130dp"
|
|
117
|
+
android:layout_height="100dp"
|
|
118
|
+
android:layout_centerHorizontal="true"
|
|
119
|
+
android:layout_centerVertical="true"
|
|
120
|
+
android:paddingLeft="30dp"
|
|
121
|
+
android:paddingTop="5dp"
|
|
122
|
+
android:paddingRight="30dp"
|
|
123
|
+
android:visibility="gone" />
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<TextView
|
|
127
|
+
android:id="@+id/popUpText"
|
|
128
|
+
android:layout_width="wrap_content"
|
|
129
|
+
android:layout_height="wrap_content"
|
|
130
|
+
android:fontFamily="sans-serif"
|
|
131
|
+
android:paddingLeft="40dp"
|
|
132
|
+
android:paddingTop="5dp"
|
|
133
|
+
android:paddingRight="40dp"
|
|
134
|
+
android:paddingBottom="20dp"
|
|
135
|
+
android:text=""
|
|
136
|
+
android:textSize="15sp" />
|
|
137
|
+
|
|
138
|
+
<TextView
|
|
139
|
+
android:id="@+id/popUpSubText"
|
|
140
|
+
android:layout_width="wrap_content"
|
|
141
|
+
android:layout_height="wrap_content"
|
|
142
|
+
android:paddingLeft="40dp"
|
|
143
|
+
android:paddingRight="40dp"
|
|
144
|
+
android:paddingBottom="20dp"
|
|
145
|
+
android:text="Let's try again"
|
|
146
|
+
android:textSize="10sp" />
|
|
147
|
+
|
|
148
|
+
<Button
|
|
149
|
+
android:id="@+id/popUpButton"
|
|
150
|
+
android:layout_width="100dp"
|
|
151
|
+
android:layout_height="35dp"
|
|
152
|
+
android:layout_gravity="center_horizontal"
|
|
153
|
+
android:layout_marginLeft="50dp"
|
|
154
|
+
android:layout_marginRight="50dp"
|
|
155
|
+
android:layout_marginBottom="20dp"
|
|
156
|
+
android:text="Retry ?"
|
|
157
|
+
android:textSize="10sp" />
|
|
158
|
+
</LinearLayout>
|
|
159
|
+
|
|
160
|
+
</LinearLayout>
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
</LinearLayout>
|
|
164
|
+
<LinearLayout
|
|
165
|
+
android:id="@+id/messageLayout"
|
|
166
|
+
android:layout_width="match_parent"
|
|
167
|
+
android:layout_height="match_parent"
|
|
168
|
+
android:layout_gravity="center"
|
|
169
|
+
android:gravity="bottom"
|
|
170
|
+
android:orientation="vertical"
|
|
171
|
+
android:visibility="visible">
|
|
172
|
+
|
|
173
|
+
<LinearLayout
|
|
174
|
+
android:layout_width="match_parent"
|
|
175
|
+
android:layout_height="wrap_content"
|
|
176
|
+
android:layout_gravity="center_vertical"
|
|
177
|
+
android:background="@color/transparent"
|
|
178
|
+
android:gravity="center"
|
|
179
|
+
android:orientation="horizontal"
|
|
180
|
+
android:paddingBottom="40px"
|
|
181
|
+
android:visibility="visible">
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
<LinearLayout
|
|
185
|
+
android:id="@+id/infoLayout"
|
|
186
|
+
android:layout_width="wrap_content"
|
|
187
|
+
android:layout_height="wrap_content"
|
|
188
|
+
android:orientation="horizontal"
|
|
189
|
+
android:layout_gravity="center_vertical"
|
|
190
|
+
android:paddingLeft="15dp"
|
|
191
|
+
android:paddingRight="20dp"
|
|
192
|
+
android:paddingBottom="5dp"
|
|
193
|
+
android:paddingTop="5dp"
|
|
194
|
+
android:gravity="center"
|
|
195
|
+
>
|
|
196
|
+
<ImageView
|
|
197
|
+
android:id="@+id/info_icon"
|
|
198
|
+
android:layout_width="40dp"
|
|
199
|
+
android:layout_height="40dp"
|
|
200
|
+
android:paddingLeft="5dp"
|
|
201
|
+
android:paddingRight="10dp"
|
|
202
|
+
android:layout_centerVertical="true"
|
|
203
|
+
android:layout_centerHorizontal="true"
|
|
204
|
+
/>
|
|
205
|
+
<TextView
|
|
206
|
+
android:id="@+id/infoText"
|
|
207
|
+
android:layout_width="wrap_content"
|
|
208
|
+
android:layout_height="wrap_content"
|
|
209
|
+
android:text=""
|
|
210
|
+
android:textSize="15sp"
|
|
211
|
+
android:fontFamily="sans-serif"
|
|
212
|
+
android:textColor="@color/white"
|
|
213
|
+
/>
|
|
214
|
+
</LinearLayout>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
</LinearLayout>
|
|
218
|
+
</LinearLayout>
|
|
219
|
+
<Button
|
|
220
|
+
android:id="@+id/takePhoto"
|
|
221
|
+
android:layout_width="0dp"
|
|
222
|
+
android:layout_height="56dp"
|
|
223
|
+
android:layout_marginStart="16dp"
|
|
224
|
+
android:layout_marginEnd="16dp"
|
|
225
|
+
android:layout_marginBottom="70dp"
|
|
226
|
+
android:text="Take Photo"
|
|
227
|
+
android:textAllCaps="false"
|
|
228
|
+
android:textColor="@android:color/white"
|
|
229
|
+
app:cornerRadius="12dp"
|
|
230
|
+
app:layout_constraintBottom_toBottomOf="parent"
|
|
231
|
+
app:layout_constraintEnd_toEndOf="parent"
|
|
232
|
+
app:layout_constraintStart_toStartOf="parent" />
|
|
233
|
+
</androidx.constraintlayout.widget.ConstraintLayout>
|
package/assentify-sdk.podspec
CHANGED
|
@@ -6,12 +6,7 @@
|
|
|
6
6
|
RCT_EXTERN_METHOD(initialize: (NSString *)apiKey
|
|
7
7
|
tenantIdentifier:(NSString *)tenantIdentifier
|
|
8
8
|
instanceHash:(NSString *)interaction
|
|
9
|
-
processMrz:(BOOL *)processMrz
|
|
10
|
-
storeCapturedDocument:(BOOL *)storeCapturedDocument
|
|
11
9
|
performLivenessFace:(BOOL *)performLivenessFace
|
|
12
|
-
storeImageStream:(BOOL *)storeImageStream
|
|
13
|
-
saveCapturedVideoID:(BOOL *)saveCapturedVideoID
|
|
14
|
-
saveCapturedVideoFace:(BOOL *)saveCapturedVideoFace
|
|
15
10
|
ENV_CustomColor:(NSString *)ENV_CustomColor
|
|
16
11
|
enableDetect:(BOOL *)enableDetect
|
|
17
12
|
enableGuide:(BOOL *)enableGuide
|
|
@@ -45,6 +40,10 @@ RCT_EXTERN_METHOD(startScanIDPage:(NSString *)kycDocumentDetails
|
|
|
45
40
|
flippingCard:(BOOL)flippingCard
|
|
46
41
|
stepID:(nonnull NSNumber *)stepID
|
|
47
42
|
)
|
|
43
|
+
RCT_EXTERN_METHOD(startScanQrPage:(NSString *)kycDocumentDetails
|
|
44
|
+
language:(NSString *)language
|
|
45
|
+
stepID:(nonnull NSNumber *)stepID
|
|
46
|
+
)
|
|
48
47
|
RCT_EXTERN_METHOD(startFaceMatch:(NSString *)imageUrl
|
|
49
48
|
showCountDown:(BOOL)showCountDown
|
|
50
49
|
stepID:(nonnull NSNumber *)stepID
|
|
@@ -27,12 +27,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
27
27
|
apiKey: String,
|
|
28
28
|
tenantIdentifier: String,
|
|
29
29
|
instanceHash: String,
|
|
30
|
-
processMrz: Bool = true,
|
|
31
|
-
storeCapturedDocument: Bool = true,
|
|
32
30
|
performLivenessFace: Bool = false,
|
|
33
|
-
storeImageStream: Bool = true,
|
|
34
|
-
saveCapturedVideoID: Bool = true,
|
|
35
|
-
saveCapturedVideoFace: Bool = true,
|
|
36
31
|
ENV_CustomColor: String = "#f5a103",
|
|
37
32
|
enableDetect: Bool = true,
|
|
38
33
|
enableGuide: Bool = true,
|
|
@@ -68,12 +63,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
68
63
|
print("\(tag) apiKey: \(apiKey)")
|
|
69
64
|
print("\(tag) tenantIdentifier: \(tenantIdentifier)")
|
|
70
65
|
print("\(tag) instanceHash: \(instanceHash)")
|
|
71
|
-
print("\(tag) processMrz: \(processMrz)")
|
|
72
|
-
print("\(tag) storeCapturedDocument: \(storeCapturedDocument)")
|
|
73
66
|
print("\(tag) performLivenessFace: \(performLivenessFace)")
|
|
74
|
-
print("\(tag) storeImageStream: \(storeImageStream)")
|
|
75
|
-
print("\(tag) saveCapturedVideoID: \(saveCapturedVideoID)")
|
|
76
|
-
print("\(tag) saveCapturedVideoFace: \(saveCapturedVideoFace)")
|
|
77
67
|
print("\(tag) ENV_CustomColor: \(ENV_CustomColor)")
|
|
78
68
|
print("\(tag) enableDetect: \(enableDetect)")
|
|
79
69
|
print("\(tag) enableGuide: \(enableGuide)")
|
|
@@ -152,12 +142,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
152
142
|
interaction: instanceHash,
|
|
153
143
|
environmentalConditions: environmentalConditions,
|
|
154
144
|
assentifySdkDelegate: self,
|
|
155
|
-
|
|
156
|
-
storeCapturedDocument: storeCapturedDocument,
|
|
157
|
-
performActiveLivenessFace: performLivenessFace,
|
|
158
|
-
storeImageStream: storeImageStream,
|
|
159
|
-
saveCapturedVideoID: saveCapturedVideoID,
|
|
160
|
-
saveCapturedVideoFace: saveCapturedVideoFace
|
|
145
|
+
performActiveLivenessFace: performLivenessFace
|
|
161
146
|
)
|
|
162
147
|
|
|
163
148
|
|
|
@@ -229,7 +214,10 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
229
214
|
"SubmitResult",
|
|
230
215
|
"onHasTokens",
|
|
231
216
|
"onCreateUserDocumentInstance",
|
|
232
|
-
"onSignature"
|
|
217
|
+
"onSignature",
|
|
218
|
+
"onCompleteQrScan",
|
|
219
|
+
"onStartQrScan",
|
|
220
|
+
"onErrorQrScan"
|
|
233
221
|
]
|
|
234
222
|
}
|
|
235
223
|
|
|
@@ -279,6 +267,24 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
279
267
|
}
|
|
280
268
|
|
|
281
269
|
|
|
270
|
+
func navigateToQrController(jsonStringKycDocumentDetails: String,language: String,stepID:Int) {
|
|
271
|
+
if(jsonStringKycDocumentDetails.isEmpty) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
let jsonData = Data(jsonStringKycDocumentDetails.utf8)
|
|
275
|
+
let kycDocumentDetails: [KycDocumentDetails] = try! JSONDecoder().decode([KycDocumentDetails].self, from: jsonData)
|
|
276
|
+
DispatchQueue.main.async {
|
|
277
|
+
self.timeStarted = self.getTimeUTC();
|
|
278
|
+
if let currentViewController = UIApplication.shared.keyWindow?.rootViewController {
|
|
279
|
+
let viewController = QrController(assentifySdk: self.assentifySdk!,nativeAssentifySdk: self,holdHandColor: self.holdHandColor!,processingColor: self.processingColor!,kycDocumentDetails: kycDocumentDetails,language:language,titleID:self.getIdTitle(kycDocumentDetails:kycDocumentDetails ), showCountDown: true,apiKey: self.apiKey!,
|
|
280
|
+
stepID: stepID,manualClickColor:self.manualClickColor!)
|
|
281
|
+
viewController.modalPresentationStyle = .fullScreen
|
|
282
|
+
currentViewController.present(viewController, animated: true, completion: nil)
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
|
|
282
288
|
func navigateToFaceMatchontroller(imageUrl: String ,showCountDown:Bool,stepID:Int) {
|
|
283
289
|
DispatchQueue.main.async {
|
|
284
290
|
let imageDocUrl = URL(string: imageUrl)
|
|
@@ -323,6 +329,12 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
323
329
|
navigateToIDCardController(jsonStringKycDocumentDetails: kycDocumentDetails,language:language,flippingCard:flippingCard,stepID:stepIDValue)
|
|
324
330
|
}
|
|
325
331
|
|
|
332
|
+
@objc
|
|
333
|
+
func startScanQrPage(_ kycDocumentDetails: String ,language: String,stepID:NSNumber) {
|
|
334
|
+
let stepIDValue = stepID.intValue
|
|
335
|
+
navigateToQrController(jsonStringKycDocumentDetails: kycDocumentDetails,language:language,stepID:stepIDValue)
|
|
336
|
+
}
|
|
337
|
+
|
|
326
338
|
@objc
|
|
327
339
|
func startFaceMatch(_ imageUrl: String ,showCountDown:Bool,stepID:NSNumber) {
|
|
328
340
|
let stepIDValue = stepID.intValue
|
|
@@ -495,7 +507,7 @@ class NativeAssentifySdk: RCTEventEmitter ,AssentifySdkDelegate , SubmitDataDel
|
|
|
495
507
|
}else{
|
|
496
508
|
stringDict[key] = "\(value)"
|
|
497
509
|
}
|
|
498
|
-
|
|
510
|
+
|
|
499
511
|
}
|
|
500
512
|
}
|
|
501
513
|
|
|
@@ -237,9 +237,13 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
|
|
|
237
237
|
} else {
|
|
238
238
|
if(!isDone){
|
|
239
239
|
isDone = true;
|
|
240
|
-
|
|
241
|
-
|
|
240
|
+
if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.passportExtractedModel?.transformedProperties, options: []) {
|
|
241
|
+
if UserDefaults.standard.object(forKey: String(self.stepID)) != nil {
|
|
242
|
+
UserDefaults.standard.removeObject(forKey: String(self.stepID))
|
|
242
243
|
}
|
|
244
|
+
UserDefaults.standard.set(nil, forKey:String(self.stepID))
|
|
245
|
+
UserDefaults.standard.set(outputProperties, forKey: String(self.stepID))
|
|
246
|
+
}
|
|
243
247
|
triggerCompleteEvent(eventName:"onComplete",dataModel:dataModel.passportExtractedModel,doneFlag: doneFlag)
|
|
244
248
|
DispatchQueue.main.async {
|
|
245
249
|
self.scanPassport?.stopScanning();
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
|
|
2
|
+
import UIKit
|
|
3
|
+
import AVFoundation
|
|
4
|
+
import AssentifySdk
|
|
5
|
+
|
|
6
|
+
class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelegate
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
private var imageUrl: String? = "";
|
|
14
|
+
private var apiKey: String? = "";
|
|
15
|
+
private var isDone:Bool = false;
|
|
16
|
+
private var assentifySdk:AssentifySdk?;
|
|
17
|
+
private var start:Bool = false;
|
|
18
|
+
var infoLabel : UILabel?;
|
|
19
|
+
var infoImage : UIImageView?;
|
|
20
|
+
var popUpMessage : UIView?;
|
|
21
|
+
private var holdHandColor: String;
|
|
22
|
+
private var processingColor: String;
|
|
23
|
+
private var language: String;
|
|
24
|
+
private var showCountDown:Bool = true;
|
|
25
|
+
private var _kycDocumentDetails:[KycDocumentDetails];
|
|
26
|
+
private var titleID:String? = "";
|
|
27
|
+
private var nativeAssentifySdk:NativeAssentifySdk?;
|
|
28
|
+
private var outputResultProperties: [String: Any]? = [:];
|
|
29
|
+
private var stepID:Int;
|
|
30
|
+
private var manualClickColor: String;
|
|
31
|
+
private var takePhotoButton: UIButton?;
|
|
32
|
+
private var backIDPage: UIView?;
|
|
33
|
+
private var scanQr:ScanQr?;
|
|
34
|
+
|
|
35
|
+
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String,kycDocumentDetails:[KycDocumentDetails],language:String,titleID:String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
|
|
36
|
+
self.assentifySdk = assentifySdk
|
|
37
|
+
self.nativeAssentifySdk = nativeAssentifySdk
|
|
38
|
+
self.holdHandColor = holdHandColor
|
|
39
|
+
self.processingColor = processingColor
|
|
40
|
+
self._kycDocumentDetails = kycDocumentDetails
|
|
41
|
+
self.language = language
|
|
42
|
+
self.titleID = titleID
|
|
43
|
+
self.showCountDown = showCountDown
|
|
44
|
+
self.apiKey = apiKey
|
|
45
|
+
self.stepID = stepID;
|
|
46
|
+
self.manualClickColor = manualClickColor;
|
|
47
|
+
super.init(nibName: nil, bundle: nil)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
required init?(coder: NSCoder) {
|
|
51
|
+
fatalError("init(coder:) has not been implemented")
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override var prefersStatusBarHidden: Bool {
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
57
|
+
override func viewDidLoad() {
|
|
58
|
+
super.viewDidLoad()
|
|
59
|
+
self.view.backgroundColor = .clear
|
|
60
|
+
UIApplication.shared.isStatusBarHidden = false;
|
|
61
|
+
DispatchQueue.main.async {
|
|
62
|
+
self.scanQr = self.assentifySdk?.startScanQr(scanQrDelegate: self, kycDocumentDetails: self._kycDocumentDetails,language:self.language,stepId: self.stepID)
|
|
63
|
+
self.addChild(self.scanQr!)
|
|
64
|
+
self.view.addSubview(self.scanQr!.view)
|
|
65
|
+
self.scanQr!.view.translatesAutoresizingMaskIntoConstraints = false
|
|
66
|
+
NSLayoutConstraint.activate([
|
|
67
|
+
self.scanQr!.view.topAnchor.constraint(equalTo: self.view.topAnchor,constant: 0),
|
|
68
|
+
self.scanQr!.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
|
|
69
|
+
self.scanQr!.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
|
|
70
|
+
self.scanQr!.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
|
|
71
|
+
])
|
|
72
|
+
self.scanQr!.didMove(toParent: self)
|
|
73
|
+
showNavigationBarWithBackArrow(view: self.view, target: self, action: #selector(self.backButtonTapped), initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,title: "Qr Capture")
|
|
74
|
+
|
|
75
|
+
if(self.assentifySdk!.isManual()){
|
|
76
|
+
self.takePhotoButton = createTakePhotoButton(initialTextColorHex: self.manualClickColor, target: self, action: #selector(self.takePhoteTapped))
|
|
77
|
+
self.view.addSubview(self.takePhotoButton!)
|
|
78
|
+
|
|
79
|
+
NSLayoutConstraint.activate([
|
|
80
|
+
self.takePhotoButton!.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
|
|
81
|
+
self.takePhotoButton!.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor, constant: -30),
|
|
82
|
+
self.takePhotoButton!.widthAnchor.constraint(equalToConstant: 300),
|
|
83
|
+
self.takePhotoButton!.heightAnchor.constraint(equalToConstant: 50)
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
}else{
|
|
87
|
+
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@objc func takePhoteTapped() {
|
|
93
|
+
DispatchQueue.main.async {
|
|
94
|
+
self.scanQr?.takePicture();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@objc func backButtonTapped() {
|
|
99
|
+
triggerEvent(eventName:"onBackClick",dataModel:nil)
|
|
100
|
+
DispatchQueue.main.async {
|
|
101
|
+
self.scanQr?.stopScanning()
|
|
102
|
+
self.scanQr?.willMove(toParent: nil)
|
|
103
|
+
self.scanQr?.view.removeFromSuperview()
|
|
104
|
+
self.scanQr?.removeFromParent()
|
|
105
|
+
self.scanQr = nil
|
|
106
|
+
self.dismiss(animated: false)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
func dismissParentViewController() {
|
|
111
|
+
triggerEvent(eventName:"onBackClick",dataModel:nil)
|
|
112
|
+
DispatchQueue.main.async {
|
|
113
|
+
self.scanQr?.stopScanning()
|
|
114
|
+
self.scanQr?.willMove(toParent: nil)
|
|
115
|
+
self.scanQr?.view.removeFromSuperview()
|
|
116
|
+
self.scanQr?.removeFromParent()
|
|
117
|
+
self.scanQr = nil
|
|
118
|
+
self.dismiss(animated: false)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@objc func dismissPopUpMessage() {
|
|
124
|
+
DispatchQueue.main.async {
|
|
125
|
+
if(!self.start){
|
|
126
|
+
self.popUpMessage!.removeFromSuperview();
|
|
127
|
+
if(!self.assentifySdk!.isManual()){
|
|
128
|
+
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
func onStartQrScan() {
|
|
136
|
+
triggerEvent(eventName:"onStartQrScan",dataModel:nil)
|
|
137
|
+
DispatchQueue.main.async {
|
|
138
|
+
if(self.popUpMessage != nil){
|
|
139
|
+
self.popUpMessage!.removeFromSuperview();
|
|
140
|
+
}
|
|
141
|
+
self.start = true;
|
|
142
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Transmitting", subTitle: "",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "id", isGif: true,target: self, action: #selector(self.dismissPopUpMessage))
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
func onErrorQrScan(message: String) {
|
|
147
|
+
triggerEvent(eventName:"onErrorQrScan",dataModel:nil)
|
|
148
|
+
DispatchQueue.main.async {
|
|
149
|
+
self.start = false;
|
|
150
|
+
self.popUpMessage!.removeFromSuperview();
|
|
151
|
+
self.popUpMessage = showPopUpMessage(view: self.view, title: "Unable to Scan", subTitle: "Let's try again",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "warning", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
func onCompleteQrScan(dataModel: IDResponseModel) {
|
|
156
|
+
if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.iDExtractedModel?.transformedProperties, options: []) {
|
|
157
|
+
if UserDefaults.standard.object(forKey: String(self.stepID)) != nil {
|
|
158
|
+
UserDefaults.standard.removeObject(forKey: String(self.stepID))
|
|
159
|
+
}
|
|
160
|
+
UserDefaults.standard.set(nil, forKey:String(self.stepID))
|
|
161
|
+
UserDefaults.standard.set(outputProperties, forKey: String(self.stepID))
|
|
162
|
+
}
|
|
163
|
+
triggerCompleteEvent(eventName:"onCompleteQrScan",dataModel:dataModel.iDExtractedModel)
|
|
164
|
+
self.start = false;
|
|
165
|
+
DispatchQueue.main.async {
|
|
166
|
+
self.popUpMessage!.removeFromSuperview();
|
|
167
|
+
(self.infoLabel, self.infoImage) = showInfo(view: self.view, text: "Please Present Your ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor,initialImageName:"info_icon")
|
|
168
|
+
self.scanQr?.stopScanning()
|
|
169
|
+
self.scanQr?.willMove(toParent: nil)
|
|
170
|
+
self.scanQr?.view.removeFromSuperview()
|
|
171
|
+
self.scanQr?.removeFromParent()
|
|
172
|
+
self.scanQr = nil
|
|
173
|
+
self.dismiss(animated: false)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
func triggerCompleteEvent(eventName:String, dataModel: IDExtractedModel?){
|
|
185
|
+
var eventResultMap: [String: Any] = [:]
|
|
186
|
+
if(dataModel != nil){
|
|
187
|
+
var doneFlagValue = "";
|
|
188
|
+
eventResultMap = ["IdQrDataModel": iDModelToJsonString(dataModel:dataModel) as Any]
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
DispatchQueue.main.async {
|
|
192
|
+
self.nativeAssentifySdk?.sendEvent(withName: eventName, body: eventResultMap)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
func triggerEvent(eventName:String, dataModel: RemoteProcessingModel?){
|
|
198
|
+
var eventResultMap: [String: Any] = [:]
|
|
199
|
+
if(dataModel != nil){
|
|
200
|
+
eventResultMap = ["IdQrDataModel": dataModel?.response as Any]
|
|
201
|
+
}
|
|
202
|
+
DispatchQueue.main.async {
|
|
203
|
+
self.nativeAssentifySdk?.sendEvent(withName: eventName, body: eventResultMap)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
@@ -73,8 +73,26 @@ const AssentifyProvider = () => {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
+
const onCompleteQrScan = emitter.addListener('onCompleteQrScan', result => {
|
|
77
|
+
if (result !== null && result !== void 0 && result.IdQrDataModel) {
|
|
78
|
+
const response = (0, _IDCardParser.default)(result === null || result === void 0 ? void 0 : result.IdQrDataModel);
|
|
79
|
+
_reactNative.DeviceEventEmitter.emit('onCompleteQr', {
|
|
80
|
+
"iDExtractedModel": response
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
76
84
|
|
|
77
85
|
// General
|
|
86
|
+
const onStartQrScan = emitter.addListener('onStartQrScan', _result => {
|
|
87
|
+
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
88
|
+
"eventName": "onStartQrScan"
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
const onErrorQrScan = emitter.addListener('onErrorQrScan', _result => {
|
|
92
|
+
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
93
|
+
"eventName": "onErrorQrScan"
|
|
94
|
+
});
|
|
95
|
+
});
|
|
78
96
|
const onSendEvent = emitter.addListener('onSend', _result => {
|
|
79
97
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
80
98
|
"eventName": "onSend"
|
|
@@ -235,6 +253,9 @@ const AssentifyProvider = () => {
|
|
|
235
253
|
onHasTokens.remove();
|
|
236
254
|
onCreateUserDocumentInstance.remove();
|
|
237
255
|
onSignature.remove();
|
|
256
|
+
onCompleteQrScan.remove();
|
|
257
|
+
onErrorQrScan.remove();
|
|
258
|
+
onErrorQrScan.remove();
|
|
238
259
|
};
|
|
239
260
|
}, []);
|
|
240
261
|
return /*#__PURE__*/_react.default.createElement(AssentifyContext.Provider, {
|