@regulaforensics/face-sdk 7.2.415-beta → 7.2.421-beta

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.
Files changed (170) hide show
  1. package/README.md +3 -2
  2. package/RNFaceSDK.podspec +2 -2
  3. package/android/build.gradle +2 -2
  4. package/android/cordova.gradle +2 -2
  5. package/android/src/main/java/com/regula/plugin/facesdk/JSONConstructor.kt +0 -2
  6. package/android/src/main/java/com/regula/plugin/facesdk/Main.kt +0 -18
  7. package/examples/capacitor/android/app/src/main/AndroidManifest.xml +2 -2
  8. package/examples/capacitor/index.html +7 -2
  9. package/examples/capacitor/package-lock.json +3 -17
  10. package/examples/capacitor/package.json +3 -3
  11. package/examples/capacitor/scripts/setup.sh +2 -4
  12. package/examples/capacitor/src/main.css +6 -60
  13. package/examples/capacitor/src/main.html +1 -1
  14. package/examples/capacitor/src/main.tsx +87 -51
  15. package/examples/cordova/.vscode/launch.json +28 -0
  16. package/examples/cordova/README.md +25 -0
  17. package/examples/cordova/config.xml +26 -0
  18. package/examples/cordova/package-lock.json +1313 -0
  19. package/examples/cordova/package.json +30 -0
  20. package/examples/cordova/scripts/android.sh +8 -0
  21. package/examples/cordova/scripts/ios.sh +8 -0
  22. package/examples/cordova/scripts/setup.sh +8 -0
  23. package/examples/cordova/www/images/logo.png +0 -0
  24. package/examples/cordova/www/index.html +21 -0
  25. package/examples/cordova/www/src/main.css +83 -0
  26. package/examples/cordova/www/src/main.html +25 -0
  27. package/examples/cordova/www/src/main.js +152 -0
  28. package/examples/ionic/angular.json +3 -3
  29. package/examples/ionic/config.xml +1 -1
  30. package/examples/ionic/index.ts +17 -0
  31. package/examples/ionic/package-lock.json +765 -851
  32. package/examples/ionic/package.json +3 -3
  33. package/examples/ionic/src/images/portrait.png +0 -0
  34. package/examples/ionic/src/main.css +6 -60
  35. package/examples/ionic/src/main.html +1 -1
  36. package/examples/ionic/src/{main.tsx → main.ts} +97 -52
  37. package/examples/ionic/tsconfig.json +2 -3
  38. package/examples/react_native/index.tsx +7 -49
  39. package/examples/react_native/package-lock.json +621 -618
  40. package/examples/react_native/package.json +9 -9
  41. package/examples/react_native/src/main.css +6 -60
  42. package/examples/react_native/src/main.html +1 -1
  43. package/examples/react_native/src/main.tsx +79 -54
  44. package/ios/RFSWJSONConstructor.h +1 -0
  45. package/ios/RFSWJSONConstructor.m +14 -5
  46. package/ios/RFSWMain.m +0 -30
  47. package/package.json +1 -1
  48. package/plugin.xml +2 -2
  49. package/www/capacitor/customization/customization_fonts.js +1 -1
  50. package/www/capacitor/customization/customization_images.js +1 -1
  51. package/www/capacitor/customization/font.js +0 -8
  52. package/www/capacitor/detect_faces/detect_face_result.js +0 -12
  53. package/www/capacitor/detect_faces/detect_faces_attribute_result.js +0 -9
  54. package/www/capacitor/detect_faces/detect_faces_backend_exception.js +0 -7
  55. package/www/capacitor/detect_faces/detect_faces_config.js +0 -34
  56. package/www/capacitor/detect_faces/detect_faces_exception.js +0 -8
  57. package/www/capacitor/detect_faces/detect_faces_request.js +0 -22
  58. package/www/capacitor/detect_faces/detect_faces_response.js +0 -9
  59. package/www/capacitor/face_capture/face_capture_config.js +0 -37
  60. package/www/capacitor/face_capture/face_capture_exception.js +0 -7
  61. package/www/capacitor/face_capture/face_capture_image.js +0 -8
  62. package/www/capacitor/face_capture/face_capture_response.js +0 -7
  63. package/www/capacitor/image_params/output_image_crop.js +0 -23
  64. package/www/capacitor/image_params/output_image_params.js +0 -19
  65. package/www/capacitor/image_params/point.js +0 -7
  66. package/www/capacitor/image_params/rect.js +0 -9
  67. package/www/capacitor/image_params/size.js +0 -12
  68. package/www/capacitor/image_quality/image_quality_characteristic.js +0 -22
  69. package/www/capacitor/image_quality/image_quality_range.js +0 -7
  70. package/www/capacitor/image_quality/image_quality_result.js +0 -10
  71. package/www/capacitor/index.js +0 -48
  72. package/www/capacitor/init/face_sdk_version.js +0 -8
  73. package/www/capacitor/init/init_config.js +0 -19
  74. package/www/capacitor/init/init_exception.js +0 -8
  75. package/www/capacitor/init/license_exception.js +0 -7
  76. package/www/capacitor/internal/bridge.js +1 -20
  77. package/www/capacitor/liveness/liveness_backend_exception.js +0 -7
  78. package/www/capacitor/liveness/liveness_config.js +0 -43
  79. package/www/capacitor/liveness/liveness_exception.js +0 -8
  80. package/www/capacitor/liveness/liveness_notification.js +0 -7
  81. package/www/capacitor/liveness/liveness_response.js +0 -11
  82. package/www/capacitor/match_faces/compared_face.js +0 -9
  83. package/www/capacitor/match_faces/compared_faces_pair.js +0 -10
  84. package/www/capacitor/match_faces/compared_faces_split.js +0 -7
  85. package/www/capacitor/match_faces/match_faces_backend_exception.js +0 -7
  86. package/www/capacitor/match_faces/match_faces_config.js +0 -19
  87. package/www/capacitor/match_faces/match_faces_detection.js +0 -9
  88. package/www/capacitor/match_faces/match_faces_detection_face.js +0 -11
  89. package/www/capacitor/match_faces/match_faces_exception.js +0 -8
  90. package/www/capacitor/match_faces/match_faces_image.js +0 -9
  91. package/www/capacitor/match_faces/match_faces_request.js +0 -27
  92. package/www/capacitor/match_faces/match_faces_response.js +0 -9
  93. package/www/capacitor/person_database/edit_group_persons_request.js +0 -15
  94. package/www/capacitor/person_database/image_upload.js +0 -17
  95. package/www/capacitor/person_database/pageable_item_list.js +0 -8
  96. package/www/capacitor/person_database/person.js +0 -13
  97. package/www/capacitor/person_database/person_group.js +0 -11
  98. package/www/capacitor/person_database/person_image.js +0 -13
  99. package/www/capacitor/person_database/search_person.js +0 -14
  100. package/www/capacitor/person_database/search_person_detection.js +0 -9
  101. package/www/capacitor/person_database/search_person_image.js +0 -15
  102. package/www/capacitor/person_database/search_person_request.js +0 -29
  103. package/www/cordova.js +6 -753
  104. package/www/react-native/customization/customization_fonts.js +1 -1
  105. package/www/react-native/customization/customization_images.js +1 -1
  106. package/www/react-native/customization/font.js +0 -8
  107. package/www/react-native/detect_faces/detect_face_result.js +0 -12
  108. package/www/react-native/detect_faces/detect_faces_attribute_result.js +0 -9
  109. package/www/react-native/detect_faces/detect_faces_backend_exception.js +0 -7
  110. package/www/react-native/detect_faces/detect_faces_config.js +0 -34
  111. package/www/react-native/detect_faces/detect_faces_exception.js +0 -8
  112. package/www/react-native/detect_faces/detect_faces_request.js +0 -22
  113. package/www/react-native/detect_faces/detect_faces_response.js +0 -9
  114. package/www/react-native/face_capture/face_capture_config.js +0 -37
  115. package/www/react-native/face_capture/face_capture_exception.js +0 -7
  116. package/www/react-native/face_capture/face_capture_image.js +0 -8
  117. package/www/react-native/face_capture/face_capture_response.js +0 -7
  118. package/www/react-native/image_params/output_image_crop.js +0 -23
  119. package/www/react-native/image_params/output_image_params.js +0 -19
  120. package/www/react-native/image_params/point.js +0 -7
  121. package/www/react-native/image_params/rect.js +0 -9
  122. package/www/react-native/image_params/size.js +0 -12
  123. package/www/react-native/image_quality/image_quality_characteristic.js +0 -22
  124. package/www/react-native/image_quality/image_quality_range.js +0 -7
  125. package/www/react-native/image_quality/image_quality_result.js +0 -10
  126. package/www/react-native/index.js +0 -48
  127. package/www/react-native/init/face_sdk_version.js +0 -8
  128. package/www/react-native/init/init_config.js +0 -19
  129. package/www/react-native/init/init_exception.js +0 -8
  130. package/www/react-native/init/license_exception.js +0 -7
  131. package/www/react-native/internal/bridge.js +1 -20
  132. package/www/react-native/liveness/liveness_backend_exception.js +0 -7
  133. package/www/react-native/liveness/liveness_config.js +0 -43
  134. package/www/react-native/liveness/liveness_exception.js +0 -8
  135. package/www/react-native/liveness/liveness_notification.js +0 -7
  136. package/www/react-native/liveness/liveness_response.js +0 -11
  137. package/www/react-native/match_faces/compared_face.js +0 -9
  138. package/www/react-native/match_faces/compared_faces_pair.js +0 -10
  139. package/www/react-native/match_faces/compared_faces_split.js +0 -7
  140. package/www/react-native/match_faces/match_faces_backend_exception.js +0 -7
  141. package/www/react-native/match_faces/match_faces_config.js +0 -19
  142. package/www/react-native/match_faces/match_faces_detection.js +0 -9
  143. package/www/react-native/match_faces/match_faces_detection_face.js +0 -11
  144. package/www/react-native/match_faces/match_faces_exception.js +0 -8
  145. package/www/react-native/match_faces/match_faces_image.js +0 -9
  146. package/www/react-native/match_faces/match_faces_request.js +0 -27
  147. package/www/react-native/match_faces/match_faces_response.js +0 -9
  148. package/www/react-native/person_database/edit_group_persons_request.js +0 -15
  149. package/www/react-native/person_database/image_upload.js +0 -17
  150. package/www/react-native/person_database/pageable_item_list.js +0 -8
  151. package/www/react-native/person_database/person.js +0 -13
  152. package/www/react-native/person_database/person_group.js +0 -11
  153. package/www/react-native/person_database/person_image.js +0 -13
  154. package/www/react-native/person_database/search_person.js +0 -14
  155. package/www/react-native/person_database/search_person_detection.js +0 -9
  156. package/www/react-native/person_database/search_person_image.js +0 -15
  157. package/www/react-native/person_database/search_person_request.js +0 -29
  158. package/www/types/index.d.ts +0 -12
  159. package/www/types/match_faces/match_faces_config.d.ts +0 -2
  160. package/www/types/person_database/search_person_request.d.ts +0 -4
  161. package/examples/capacitor/index.tsx +0 -53
  162. package/examples/ionic/index.tsx +0 -68
  163. package/test/json.tsx +0 -375
  164. package/test/package-lock.json +0 -584
  165. package/test/package.json +0 -9
  166. package/test/test.tsx +0 -61
  167. package/test/utils.tsx +0 -38
  168. /package/examples/{ionic → cordova/www}/images/portrait.png +0 -0
  169. /package/examples/ionic/{assets → src/assets}/.gitkeep +0 -0
  170. /package/examples/ionic/{images → src/images}/icon.png +0 -0
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # Regula Face SDK plugin
2
2
  Face SDK is a framework that is used for face matching, recognition and liveness detection.
3
- This plugin makes possible to use it with react-native, cordova and capacitor applications.
3
+ This plugin makes possible to use it with react-native, cordova and ionic applications.
4
4
 
5
5
  ## Demo applications
6
- In the [examples](examples/) folder you can find 3 demo applications:
6
+ In the [examples](examples/) folder you can find 4 demo applications:
7
7
  * [React-native](examples/react_native)
8
+ * [Cordova](examples/cordova)
8
9
  * [Ionic(ionic app with cordova, angular)](examples/ionic)
9
10
  * [Capacitor(ionic app with capacitor, react)](examples/capacitor)
10
11
 
package/RNFaceSDK.podspec CHANGED
@@ -5,7 +5,7 @@ source = File.join(__dir__, 'ios')
5
5
 
6
6
  Pod::Spec.new do |s|
7
7
  s.name = 'RNFaceSDK'
8
- s.version = '7.2.415-beta'
8
+ s.version = '7.2.421-beta'
9
9
  s.summary = package['description']
10
10
  s.license = package['license']
11
11
 
@@ -16,6 +16,6 @@ Pod::Spec.new do |s|
16
16
  s.ios.deployment_target = '13.0'
17
17
  s.source_files = 'ios/**/*.{h,m}'
18
18
  s.exclude_files = [ 'ios/CVDFaceSDK.h', 'ios/CVDFaceSDK.m' ]
19
- s.dependency 'FaceSDKNightly', '7.1.3008'
19
+ s.dependency 'FaceSDK', '7.1.2940'
20
20
  s.dependency 'React'
21
21
  end
@@ -32,7 +32,7 @@ android {
32
32
  rootProject.allprojects {
33
33
  repositories {
34
34
  maven {
35
- url "https://maven.regulaforensics.com/RegulaDocumentReader/Nightly"
35
+ url "https://maven.regulaforensics.com/RegulaDocumentReader"
36
36
  }
37
37
  }
38
38
  }
@@ -41,7 +41,7 @@ dependencies {
41
41
  //noinspection GradleDynamicVersion
42
42
  implementation 'com.facebook.react:react-native:+'
43
43
  //noinspection GradleDependency
44
- implementation('com.regula.face:api:7.1.3926'){
44
+ implementation('com.regula.face:api:7.1.3897'){
45
45
  transitive = true
46
46
  }
47
47
  }
@@ -6,13 +6,13 @@ android {
6
6
 
7
7
  repositories {
8
8
  maven {
9
- url "https://maven.regulaforensics.com/RegulaDocumentReader/Nightly"
9
+ url "https://maven.regulaforensics.com/RegulaDocumentReader"
10
10
  }
11
11
  }
12
12
 
13
13
  dependencies {
14
14
  //noinspection GradleDependency
15
- implementation('com.regula.face:api:7.1.3926'){
15
+ implementation('com.regula.face:api:7.1.3897'){
16
16
  transitive = true
17
17
  }
18
18
  }
@@ -833,7 +833,6 @@ fun searchPersonRequestFromJSON(it: JSONObject) = object : SearchPersonRequest()
833
833
  groupIdsForSearch = it.getJSONArrayOrNull("groupIdsForSearch").toArray()
834
834
  threshold = it.getDoubleOrNull("threshold")?.toFloat()
835
835
  limit = it.getIntOrNull("limit")
836
- tag = it.getStringOrNull("tag")
837
836
  imageUpload = imageUploadFromJSON(it.getJSONObjectOrNull("imageUpload"))
838
837
  isDetectAll = it.optBoolean("detectAll", false)
839
838
  outputImageParams = outputImageParamsFromJSON(it.getJSONObjectOrNull("outputImageParams"))
@@ -844,7 +843,6 @@ fun generateSearchPersonRequest(it: SearchPersonRequest) = mapOf(
844
843
  "groupIdsForSearch" to it.groupIdsForSearch.toJson(),
845
844
  "threshold" to it.threshold,
846
845
  "limit" to it.limit,
847
- "tag" to it.tag,
848
846
  "imageUpload" to generateImageUpload(it.imageUpload),
849
847
  "detectAll" to it.isDetectAll,
850
848
  "outputImageParams" to generateOutputImageParams(it.outputImageParams)
@@ -30,12 +30,6 @@ fun methodCall(method: String, callback: (Any?) -> Unit): Any = when (method) {
30
30
  "getVersion" -> getVersion(callback)
31
31
  "getServiceUrl" -> getServiceUrl(callback)
32
32
  "setServiceUrl" -> setServiceUrl(argsNullable(0))
33
- "getTenant" -> getTenant(callback)
34
- "setTenant" -> setTenant(argsNullable(0))
35
- "getEnv" -> getEnv(callback)
36
- "setEnv" -> setEnv(argsNullable(0))
37
- "getLocale" -> getLocale(callback)
38
- "setLocale" -> setLocale(argsNullable(0))
39
33
  "setLocalizationDictionary" -> setLocalizationDictionary(args(0))
40
34
  "setRequestHeaders" -> setRequestHeaders(args(0))
41
35
  "setCustomization" -> setCustomization(args(0))
@@ -87,18 +81,6 @@ fun getServiceUrl(callback: Callback) = callback(Instance().serviceUrl)
87
81
 
88
82
  fun setServiceUrl(url: String?) = url.let { Instance().serviceUrl = it }
89
83
 
90
- fun getTenant(callback: Callback) = callback(Instance().tenant)
91
-
92
- fun setTenant(tag: String?) = tag.let { Instance().tenant = it }
93
-
94
- fun getEnv(callback: Callback) = callback(Instance().env)
95
-
96
- fun setEnv(tag: String?) = tag.let { Instance().env = it }
97
-
98
- fun getLocale(callback: Callback) = callback(Instance().locale)
99
-
100
- fun setLocale(locale: String?) = locale.let { Instance().locale = it }
101
-
102
84
  fun setLocalizationDictionary(dictionary: JSONObject) {
103
85
  localizationCallbacks = LocalizationCallbacks { if (dictionary.has(it)) dictionary.getString(it) else null }
104
86
  Instance().setLocalizationCallback(localizationCallbacks!!)
@@ -18,8 +18,8 @@
18
18
  <action android:name="android.intent.action.MAIN" />
19
19
  <category android:name="android.intent.category.LAUNCHER" />
20
20
  </intent-filter>
21
+
21
22
  </activity>
22
23
  </application>
23
-
24
24
  <uses-permission android:name="android.permission.INTERNET" />
25
- </manifest>
25
+ </manifest>
@@ -1,5 +1,10 @@
1
1
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
2
+ <script type="module" src="/src/main.tsx"></script>
3
+
2
4
  <div id="content" style="height: 100%"></div>
3
5
 
4
- <script type="module" src="./index.tsx"></script>
5
- <script type="module" src="/src/main.tsx"></script>
6
+ <script>
7
+ fetch("main.html")
8
+ .then(response => response.text())
9
+ .then(html => document.getElementById("content").innerHTML = html)
10
+ </script>
@@ -16,8 +16,6 @@
16
16
  "@capacitor/ios": "7.0.1",
17
17
  "@capacitor/status-bar": "7.0.0",
18
18
  "@ionic/react": "8.4.3",
19
- "@regulaforensics/face-core-basic": "7.1.178",
20
- "@regulaforensics/face-sdk": "7.1.317",
21
19
  "@types/react-router-dom": "5.3.3",
22
20
  "@vitejs/plugin-react": "4.3.4",
23
21
  "cordova-plugin-camera": "8.0.0",
@@ -1204,18 +1202,6 @@
1204
1202
  "node": ">= 8"
1205
1203
  }
1206
1204
  },
1207
- "node_modules/@regulaforensics/face-core-basic": {
1208
- "version": "7.1.178",
1209
- "resolved": "https://registry.npmjs.org/@regulaforensics/face-core-basic/-/face-core-basic-7.1.178.tgz",
1210
- "integrity": "sha512-KfVME7fPy3vOMKM5g/79Yiz6enWvhxL/nw6B9HKkMpE1uKYgXUa3DWgs4m5EMiqH7jmJ3bmxekkDUFwer6j3pw==",
1211
- "license": "commercial"
1212
- },
1213
- "node_modules/@regulaforensics/face-sdk": {
1214
- "version": "7.1.317",
1215
- "resolved": "https://registry.npmjs.org/@regulaforensics/face-sdk/-/face-sdk-7.1.317.tgz",
1216
- "integrity": "sha512-RtZ4vOlVfcisVcD86rEYbnxPyUjVW2cKwG45oUBGE43UJYAuoYdwdUdfOWoQqwNAsk5Aehp/8EsMwc6e775h3Q==",
1217
- "license": "commercial"
1218
- },
1219
1205
  "node_modules/@rollup/rollup-android-arm-eabi": {
1220
1206
  "version": "4.40.2",
1221
1207
  "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.40.2.tgz",
@@ -1778,9 +1764,9 @@
1778
1764
  }
1779
1765
  },
1780
1766
  "node_modules/brace-expansion": {
1781
- "version": "2.0.2",
1782
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
1783
- "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
1767
+ "version": "2.0.1",
1768
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
1769
+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
1784
1770
  "license": "MIT",
1785
1771
  "dependencies": {
1786
1772
  "balanced-match": "^1.0.0"
@@ -6,19 +6,19 @@
6
6
  "android": "scripts/android.sh"
7
7
  },
8
8
  "dependencies": {
9
- "@regulaforensics/face-sdk": "7.2.415-beta",
10
- "@regulaforensics/face-core-basic": "7.1.240-nightly",
9
+ "@regulaforensics/face-sdk": "7.2.421-beta",
10
+ "@regulaforensics/face-core-basic": "7.1.202",
11
11
  "@awesome-cordova-plugins/file": "6.6.0",
12
12
  "@awesome-cordova-plugins/camera": "6.6.0",
13
13
  "cordova-plugin-file": "8.1.3",
14
14
  "cordova-plugin-camera": "8.0.0",
15
+ "@capacitor/dialog": "7.0.1",
15
16
  "@capacitor/cli": "7.0.1",
16
17
  "@capacitor/core": "7.0.1",
17
18
  "@capacitor/app": "7.0.0",
18
19
  "@capacitor/ios": "7.0.1",
19
20
  "@capacitor/android": "7.0.1",
20
21
  "@capacitor/status-bar": "7.0.0",
21
- "@capacitor/dialog": "7.0.1",
22
22
  "@ionic/react": "8.4.3",
23
23
  "@vitejs/plugin-react": "4.3.4",
24
24
  "vite-plugin-static-copy": "2.3.1",
@@ -2,7 +2,5 @@
2
2
  set -e
3
3
 
4
4
  npm install
5
- ionic cap sync ios || {
6
- cd ios/App
7
- pod update
8
- }
5
+ cd ios/App
6
+ pod install || pod update
@@ -1,19 +1,15 @@
1
1
  html,
2
2
  body {
3
- margin: 0;
4
- width: 100%;
3
+ width: 99%;
5
4
  height: 99vh;
6
5
  display: flex;
7
- overflow: hidden;
8
6
  flex-direction: column;
9
7
  }
10
8
 
11
- /* Prevent text selection */
12
- * {
13
- user-select: none !important;
14
- -webkit-user-select: none !important;
15
- -webkit-user-drag: none !important;
16
- -webkit-touch-callout: none !important;
9
+ .page {
10
+ height: 100%;
11
+ display: flex;
12
+ flex-direction: column;
17
13
  }
18
14
 
19
15
  .column {
@@ -56,14 +52,10 @@ body {
56
52
  margin-top: 13px;
57
53
  }
58
54
 
59
- .scroll {
60
- flex-grow: 1;
61
- overflow-y: auto;
62
- }
63
-
64
55
  .no-scroll {
65
56
  flex-grow: 1;
66
57
  overflow-y: hidden;
58
+ overflow-x: hidden;
67
59
  }
68
60
 
69
61
  .button {
@@ -75,7 +67,6 @@ body {
75
67
  color: white;
76
68
  border: none;
77
69
  padding: 10px 20px;
78
- justify-content: center;
79
70
  font-size: 16px;
80
71
  border-radius: 100px;
81
72
  cursor: pointer;
@@ -89,49 +80,4 @@ body {
89
80
  .button:active {
90
81
  position: relative;
91
82
  top: 1px;
92
- }
93
-
94
- .text-button {
95
- background: none;
96
- border: none;
97
- color: #2196f3;
98
- font-size: 20px;
99
- font-weight: bold;
100
- padding: 5px;
101
- }
102
-
103
- .text-button:active {
104
- position: relative;
105
- top: 1px;
106
- }
107
-
108
- .radio {
109
- align-items: baseline;
110
- padding: 15px;
111
- }
112
-
113
- input[type="checkbox"] {
114
- width: 20px;
115
- height: 20px;
116
- border: 2px solid black;
117
- background-color: white;
118
- display: inline-block;
119
- position: relative;
120
- cursor: pointer;
121
- }
122
-
123
- .progress-bar {
124
- width: 75%;
125
- padding: 3px;
126
- margin-top: 40px;
127
- background-color: #eee;
128
- border-radius: 8px;
129
- box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
130
- }
131
-
132
- #progress {
133
- width: 0%;
134
- height: 20px;
135
- background-color: #4285F4;
136
- border-radius: 5px;
137
83
  }
@@ -1,4 +1,4 @@
1
- <div class="column" style="height: 100%">
1
+ <div class="page">
2
2
  <div class="column header">
3
3
  <span id="status">Loading...</span>
4
4
  <div class="column divider"></div>
@@ -1,21 +1,17 @@
1
+ import '@ionic/react/css/core.css'
2
+ import './main.css'
3
+ import { setupIonicReact } from '@ionic/react'
4
+ import { StatusBar, Style } from '@capacitor/status-bar'
5
+ import { File } from '@awesome-cordova-plugins/file'
6
+ import { Dialog } from '@capacitor/dialog'
7
+ import { Camera, DestinationType, MediaType, PictureSourceType } from '@awesome-cordova-plugins/camera'
1
8
  import { FaceSDK, MatchFacesRequest, MatchFacesImage, InitConfig, LivenessSkipStep, ImageType, LivenessStatus, LivenessConfig } from '@regulaforensics/face-sdk'
2
- import { loadAssetIfExists, chooseOption, pickImage } from '../index'
3
-
4
- var faceSdk = FaceSDK.instance
5
- var image1: MatchFacesImage | null
6
- var image2: MatchFacesImage | null
7
9
 
8
10
  async function init() {
9
11
  if (!await initializeReader()) return
10
12
  setStatus("Ready")
11
13
  }
12
14
 
13
- async function startFaceCapture(position: number) {
14
- var image = (await faceSdk.startFaceCapture()).image
15
- if (image == null) return
16
- setImage("data:image/png;base64," + image.image, image.imageType, position)
17
- }
18
-
19
15
  async function startLiveness() {
20
16
  var response = await faceSdk.startLiveness({
21
17
  config: new LivenessConfig({
@@ -46,29 +42,13 @@ async function matchFaces() {
46
42
  setStatus("Ready")
47
43
  }
48
44
 
49
- async function getImage(position: number) {
50
- var source = await chooseOption()
51
- if (source == null) return
52
- if (source) startFaceCapture(position)
53
- else {
54
- var image = await pickImage()
55
- if (image == null) return
56
- setImage(image, ImageType.PRINTED, position)
57
- }
58
- }
59
-
60
- function setImage(base64: string, type: number, position: number) {
45
+ function clearResults() {
46
+ setStatus("Ready")
61
47
  setSimilarityStatus("null")
62
- var mfImage = new MatchFacesImage(base64, type)
63
- if (position == 1) {
64
- image1 = mfImage
65
- setUiImage1(base64)
66
- setLivenessStatus("null")
67
- }
68
- if (position == 2) {
69
- image2 = mfImage
70
- setUiImage2(base64)
71
- }
48
+ setLivenessStatus("null")
49
+ resetImages()
50
+ image1 = null
51
+ image2 = null
72
52
  }
73
53
 
74
54
  // If 'regula.license' exists, init using license(enables offline match)
@@ -81,36 +61,92 @@ async function initializeReader() {
81
61
  if (license != null) config = new InitConfig(license)
82
62
  var [success, error] = await faceSdk.initialize({ config: config })
83
63
 
84
- if (error != null) {
64
+ if (!success && error != null) {
85
65
  setStatus(error.message)
86
66
  console.log(error.code + ": " + error.message)
87
67
  }
88
68
  return success
89
69
  }
90
70
 
91
- // --------------------------------------------------------------------------------------------------------------------
71
+ function setImage(base64: string, type: number, position: number) {
72
+ setSimilarityStatus("null")
73
+ var mfImage = new MatchFacesImage(base64, type)
74
+ if (position == 1) {
75
+ image1 = mfImage
76
+ setUiImage1(base64)
77
+ setLivenessStatus("null")
78
+ }
79
+ if (position == 2) {
80
+ image2 = mfImage
81
+ setUiImage2(base64)
82
+ }
83
+ }
92
84
 
93
- export function main() {
94
- document.getElementById("first-image")!.onclick = () => getImage(1)
95
- document.getElementById("second-image")!.onclick = () => getImage(2)
96
- document.getElementById("match-faces")!.onclick = () => matchFaces()
97
- document.getElementById("start-liveness")!.onclick = () => startLiveness()
98
- document.getElementById("clear-results")!.onclick = () => clearResults()
85
+ async function useCamera(position: number) {
86
+ var response = await faceSdk.startFaceCapture()
87
+ if (response.image == null) return
88
+ var image = response.image
89
+ setImage("data:image/png;base64," + image.image, image.imageType, position)
90
+ }
99
91
 
100
- init()
92
+ async function useGallery(position: number) {
93
+ var image = await Camera.getPicture({
94
+ destinationType: DestinationType.DATA_URL,
95
+ mediaType: MediaType.PICTURE,
96
+ sourceType: PictureSourceType.PHOTOLIBRARY
97
+ })
98
+ setImage(image, ImageType.PRINTED, position)
99
+ }
100
+
101
+ async function pickImage(position: number) {
102
+ var response = await Dialog.confirm({
103
+ message: "Select option",
104
+ okButtonTitle: "Use camera",
105
+ cancelButtonTitle: "Use gallery"
106
+ })
107
+ if (response.value) useCamera(position)
108
+ else useGallery(position)
101
109
  }
102
110
 
103
- var setStatus = (data: string) => document.getElementById("status")!.innerHTML = data
104
- var setLivenessStatus = (data: string) => document.getElementById("liveness-status")!.innerHTML = data
105
- var setSimilarityStatus = (data: string) => document.getElementById("similarity-status")!.innerHTML = data
111
+ async function loadAssetIfExists(path: string): Promise<string | null> {
112
+ try {
113
+ var dir = await File.resolveDirectoryUrl(File.applicationDirectory + "public/assets")
114
+ var fileEntry = await File.getFile(dir, path, null)
115
+ var result = await new Promise<string | null>((resolve, _) => {
116
+ fileEntry.file(file => {
117
+ var reader = new FileReader()
118
+ reader.onloadend = (_) => resolve(reader.result as string)
119
+ reader.readAsDataURL(file)
120
+ }, _ => resolve(null))
121
+ })
122
+ return result
123
+ } catch (_) {
124
+ return null
125
+ }
126
+ }
127
+
128
+ var faceSdk = FaceSDK.instance
129
+ var image1: MatchFacesImage | null
130
+ var image2: MatchFacesImage | null
131
+
132
+ var setStatus = (data: string) => document.getElementById("status").innerHTML = data
133
+ var setLivenessStatus = (data: string) => document.getElementById("liveness-status").innerHTML = data
134
+ var setSimilarityStatus = (data: string) => document.getElementById("similarity-status").innerHTML = data
106
135
  var setUiImage1 = (data: string) => (document.getElementById("first-image") as HTMLImageElement).src = data
107
136
  var setUiImage2 = (data: string) => (document.getElementById("second-image") as HTMLImageElement).src = data
108
- var clearResults = () => {
109
- setStatus("Ready")
110
- setSimilarityStatus("null")
111
- setLivenessStatus("null")
137
+ var resetImages = () => {
112
138
  setUiImage1("images/portrait.png")
113
139
  setUiImage2("images/portrait.png")
114
- image1 = null
115
- image2 = null
116
140
  }
141
+
142
+ setupIonicReact()
143
+ StatusBar.setStyle({ style: Style.Light })
144
+ document.addEventListener('deviceready', () => {
145
+ document.getElementById("first-image").onclick = () => pickImage(1)
146
+ document.getElementById("second-image").onclick = () => pickImage(2)
147
+ document.getElementById("match-faces").onclick = () => matchFaces()
148
+ document.getElementById("start-liveness").onclick = () => startLiveness()
149
+ document.getElementById("clear-results").onclick = () => clearResults()
150
+
151
+ init()
152
+ })
@@ -0,0 +1,28 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Debug Android on emulator",
9
+ "type": "cordova",
10
+ "request": "launch",
11
+ "platform": "android",
12
+ "target": "emulator",
13
+ "port": 9222,
14
+ "sourceMaps": true,
15
+ "cwd": "${workspaceFolder}"
16
+ },
17
+ {
18
+ "name": "Debug Android on device",
19
+ "type": "cordova",
20
+ "request": "launch",
21
+ "platform": "android",
22
+ "target": "device",
23
+ "port": 9222,
24
+ "sourceMaps": true,
25
+ "cwd": "${workspaceFolder}"
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,25 @@
1
+ # Regula Face SDK Cordova demo application
2
+
3
+ ## How to build demo application
4
+ 1. Download or the clone current repository using the command `git clone https://github.com/regulaforensics/npm-face-sdk.git`.
5
+
6
+ 2. Execute `npm run setup` within this directory.
7
+
8
+ 3. Run the app:
9
+ * IOS: `npm run ios`.
10
+ * Android: `npm run android`.
11
+
12
+ **Note**: this is just one way of running the app. You can also pass `-o` or `--open` argument to the command, and this will open Xcode/Android Studio, then run the app directly from the IDE. Overall, this is a more consistent way, so if you're having troubles running the app from terminal, try running it from the IDE.
13
+
14
+
15
+ ## How to use offline match
16
+ 1. Place a license that supports offline match at `www/regula.license`.
17
+
18
+ 2. Change core with the following commands:
19
+ ```bash
20
+ cordova plugin remove @regulaforensics/face-core-basic
21
+ cordova plugin add @regulaforensics/face-core-match
22
+ npm run setup
23
+ ```
24
+
25
+ 3. Turn off the internet and run the app.
@@ -0,0 +1,26 @@
1
+ <widget android-packageName="com.regula.documentreader.api.androidtest" ios-CFBundleIdentifier="com.regula.documentreader.qa" version="1.0.0"
2
+ xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <name>FaceSDK</name>
4
+ <platform name="android">
5
+ <preference name="orientation" value="portrait" />
6
+ <preference name="GradlePluginKotlinEnabled" value="true" />
7
+ <preference name="android-minSdkVersion" value="24" />
8
+ <preference name="android-targetSdkVersion" value="35" />
9
+ <config-file parent="/*" target="AndroidManifest.xml">
10
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
11
+ </config-file>
12
+ <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
13
+ <application android:usesCleartextTraffic="true" />
14
+ </edit-config>
15
+ </platform>
16
+ <platform name="ios">
17
+ <preference name="orientation" value="portrait" />
18
+ <preference name="DisallowOverscroll" value="true" />
19
+ <config-file target="*-Info.plist" parent="NSCameraUsageDescription">
20
+ <string>To use camera</string>
21
+ </config-file>
22
+ <config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
23
+ <string>To pick images</string>
24
+ </config-file>
25
+ </platform>
26
+ </widget>