@smile_identity/react-native 11.0.2 → 11.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.
Files changed (42) hide show
  1. package/android/build.gradle +0 -1
  2. package/android/gradle.properties +3 -3
  3. package/android/src/main/AndroidManifest.xml +7 -0
  4. package/android/src/main/java/com/smileidentity/react/Mapper.kt +15 -0
  5. package/android/src/main/java/com/smileidentity/react/SmileIdModule.kt +1 -1
  6. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBiometricKYCViewManager.kt +0 -8
  7. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentCaptureViewManager.kt +4 -0
  8. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentVerificationViewManager.kt +4 -1
  9. package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDEnhancedDocumentVerificationViewManager.kt +4 -9
  10. package/android/src/main/java/com/smileidentity/react/views/SmileIDBiometricKYCView.kt +1 -5
  11. package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentCaptureView.kt +8 -0
  12. package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerificationView.kt +7 -2
  13. package/android/src/main/java/com/smileidentity/react/views/SmileIDEnhancedDocumentVerificationView.kt +9 -9
  14. package/ios/Utils/SmileIDUtils.swift +16 -0
  15. package/ios/View/SmileIDBiometricKYCView.swift +4 -5
  16. package/ios/View/SmileIDDocumentCaptureView.swift +2 -1
  17. package/ios/View/SmileIDDocumentVerificationView.swift +6 -6
  18. package/ios/View/SmileIDEnhancedDocumentVerificationView.swift +6 -6
  19. package/ios/View/SmileIDSmartSelfieAuthEnhancedView.swift +5 -6
  20. package/ios/View/SmileIDSmartSelfieAuthView.swift +3 -4
  21. package/ios/View/SmileIDSmartSelfieCaptureView.swift +3 -4
  22. package/ios/View/SmileIDSmartSelfieEnrollmentEnhancedView.swift +3 -4
  23. package/ios/View/SmileIDSmartSelfieEnrollmentView.swift +3 -4
  24. package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +1 -8
  25. package/ios/ViewManagers/SmileIDDocumentCaptureViewManager.swift +8 -0
  26. package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.swift +7 -1
  27. package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +8 -9
  28. package/ios/ViewModels/SmileIDProductModel.swift +3 -9
  29. package/lib/commonjs/types.js +11 -18
  30. package/lib/commonjs/types.js.map +1 -1
  31. package/lib/module/types.js +10 -15
  32. package/lib/module/types.js.map +1 -1
  33. package/lib/typescript/types.d.ts +14 -15
  34. package/lib/typescript/types.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/react-native-smile-id.podspec +1 -1
  37. package/src/types.ts +14 -26
  38. package/ios/SmileId.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  39. package/ios/SmileId.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  40. package/ios/SmileId.xcodeproj/project.xcworkspace/xcuserdata/jumaallan.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  41. package/ios/SmileId.xcodeproj/xcuserdata/jumaallan.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  42. package/ios/Utils/FileUtils.swift +0 -24
@@ -34,7 +34,6 @@ def kotlinVersion = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("
34
34
 
35
35
  apply plugin: "com.android.library"
36
36
  apply plugin: "kotlin-android"
37
- //apply plugin: 'kotlin-kapt'
38
37
  apply plugin: "org.jlleitschuh.gradle.ktlint"
39
38
  apply plugin: "org.jetbrains.kotlin.plugin.serialization"
40
39
  if (kotlinVersion?.startsWith("2")) {
@@ -1,7 +1,7 @@
1
1
  SmileId_kotlinVersion=2.0.0
2
2
  SmileId_minSdkVersion=21
3
- SmileId_targetSdkVersion=35
4
- SmileId_compileSdkVersion=35
3
+ SmileId_targetSdkVersion=36
4
+ SmileId_compileSdkVersion=36
5
5
  SmileId_ndkversion=21.4.7075529
6
- SmileId_androidVersion=11.0.5
6
+ SmileId_androidVersion=11.1.0
7
7
  SmileId_kotlinCompilerExtensionVersion=1.5.11
@@ -1,3 +1,10 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
1
2
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools"
2
4
  package="com.smileidentity.react">
5
+
6
+ <application
7
+ android:pageSizeCompat="enabled"
8
+ tools:targetApi="36"/>
9
+
3
10
  </manifest>
@@ -3,6 +3,7 @@ package com.smileidentity.react
3
3
  import androidx.compose.animation.core.rememberTransition
4
4
  import com.facebook.react.bridge.ReadableMap
5
5
  import com.smileidentity.models.AuthenticationRequest
6
+ import com.smileidentity.models.AutoCapture
6
7
  import com.smileidentity.models.Config
7
8
  import com.smileidentity.models.ConsentInformation
8
9
  import com.smileidentity.models.ConsentedInformation
@@ -233,3 +234,17 @@ fun ReadableMap.toProductsConfigRequest(): ProductsConfigRequest {
233
234
  }
234
235
  )
235
236
  }
237
+
238
+ fun String.toAutoCapture() : AutoCapture {
239
+ return when (this) {
240
+ "AutoCapture" -> AutoCapture.AutoCapture
241
+ "AutoCaptureOnly" -> AutoCapture.AutoCaptureOnly
242
+ "ManualCaptureOnly" -> AutoCapture.ManualCaptureOnly
243
+ else -> {
244
+ throw IllegalArgumentException(
245
+ "Invalid autoCapture value: $this. " +
246
+ "Expected 'AutoCapture', 'AutoCaptureOnly', or 'ManualCaptureOnly'."
247
+ )
248
+ }
249
+ }
250
+ }
@@ -54,7 +54,7 @@ class SmileIdModule internal constructor(
54
54
  try {
55
55
  // Set wrapper info for React Native SDK
56
56
  try {
57
- val version = com.smileidentity.react.BuildConfig.SMILE_ID_VERSION
57
+ val version = BuildConfig.SMILE_ID_VERSION
58
58
  SmileID.setWrapperInfo(WrapperSdkName.ReactNative, version)
59
59
  } catch (e: Exception) {
60
60
  // Fallback to default version if BuildConfig is not available
@@ -31,14 +31,6 @@ class SmileIDBiometricKYCViewManager(
31
31
  ?: return view.emitFailure(IllegalArgumentException("idInfo is required to run Biometric KYC"))
32
32
  val idInfo = idInfoMap.toIdInfo()
33
33
  view.consentInformation = it.getMapOrDefault("consentInformation")?.toConsentInfo()
34
- ?: ConsentInformation(
35
- consented = ConsentedInformation(
36
- consentGrantedDate = getCurrentIsoTimestamp(),
37
- personalDetails = false,
38
- contactInformation = false,
39
- documentInformation = false
40
- ),
41
- )
42
34
  view.extraPartnerParams = it.getImmutableMapOrDefault("extraPartnerParams")
43
35
  view.userId = it.getStringOrDefault("userId")
44
36
  view.jobId = it.getStringOrDefault("jobId")
@@ -6,7 +6,9 @@ import com.facebook.react.bridge.ReadableMap
6
6
  import com.facebook.react.module.annotations.ReactModule
7
7
  import com.facebook.react.uimanager.SimpleViewManager
8
8
  import com.facebook.react.uimanager.ThemedReactContext
9
+ import com.smileidentity.react.toAutoCapture
9
10
  import com.smileidentity.react.utils.getBoolOrDefault
11
+ import com.smileidentity.react.utils.getIntOrDefault
10
12
  import com.smileidentity.react.utils.getStringOrDefault
11
13
  import com.smileidentity.react.views.SmileIDDocumentCaptureView
12
14
  import com.smileidentity.react.views.SmileIDDocumentVerificationView
@@ -31,6 +33,8 @@ class SmileIDDocumentCaptureViewManager(
31
33
  view.showConfirmation = it.getBoolOrDefault("showConfirmation", true)
32
34
  view.allowGalleryUpload = it.getBoolOrDefault("allowGalleryUpload", false)
33
35
  view.front = it.getBoolOrDefault("isDocumentFrontSide", true)
36
+ view.autoCaptureTimeout = it.getIntOrDefault("autoCaptureTimeout", null)
37
+ view.autoCapture = it.getStringOrDefault("autoCapture", null)?.toAutoCapture()
34
38
  }
35
39
  }
36
40
 
@@ -6,9 +6,11 @@ import com.facebook.react.bridge.ReadableMap
6
6
  import com.facebook.react.module.annotations.ReactModule
7
7
  import com.facebook.react.uimanager.SimpleViewManager
8
8
  import com.facebook.react.uimanager.ThemedReactContext
9
+ import com.smileidentity.react.toAutoCapture
9
10
  import com.smileidentity.react.utils.getBoolOrDefault
10
11
  import com.smileidentity.react.utils.getFloatOrDefault
11
12
  import com.smileidentity.react.utils.getImmutableMapOrDefault
13
+ import com.smileidentity.react.utils.getIntOrDefault
12
14
  import com.smileidentity.react.utils.getStringOrDefault
13
15
  import com.smileidentity.react.views.SmileIDDocumentVerificationView
14
16
  import com.smileidentity.react.views.SmileIDEnhancedDocumentVerificationView
@@ -31,7 +33,8 @@ class SmileIDDocumentVerificationViewManager(
31
33
  view.userId = it.getStringOrDefault("userId")
32
34
  view.jobId = it.getStringOrDefault("jobId")
33
35
  view.countryCode = countryCode
34
- view.enableAutoCapture = it.getBoolOrDefault("enableAutoCapture", true)
36
+ view.autoCaptureTimeout = it.getIntOrDefault("autoCaptureTimeout", null)
37
+ view.autoCapture = it.getStringOrDefault("autoCapture", null)?.toAutoCapture()
35
38
  view.allowAgentMode = it.getBoolOrDefault("allowAgentMode", false)
36
39
  view.showAttribution = it.getBoolOrDefault("showAttribution", true)
37
40
  view.captureBothSides = it.getBoolOrDefault("captureBothSides", false)
@@ -8,12 +8,14 @@ import com.facebook.react.uimanager.SimpleViewManager
8
8
  import com.facebook.react.uimanager.ThemedReactContext
9
9
  import com.smileidentity.models.ConsentInformation
10
10
  import com.smileidentity.models.ConsentedInformation
11
+ import com.smileidentity.react.toAutoCapture
11
12
  import com.smileidentity.react.toConsentInfo
12
13
  import com.smileidentity.react.toIdInfo
13
14
  import com.smileidentity.react.utils.getBoolOrDefault
14
15
  import com.smileidentity.react.utils.getCurrentIsoTimestamp
15
16
  import com.smileidentity.react.utils.getFloatOrDefault
16
17
  import com.smileidentity.react.utils.getImmutableMapOrDefault
18
+ import com.smileidentity.react.utils.getIntOrDefault
17
19
  import com.smileidentity.react.utils.getMapOrDefault
18
20
  import com.smileidentity.react.utils.getStringOrDefault
19
21
  import com.smileidentity.react.views.SmileIDEnhancedDocumentVerificationView
@@ -37,19 +39,12 @@ class SmileIDEnhancedDocumentVerificationViewManager(
37
39
  IllegalArgumentException("countryCode is required to run Enhanced Document Verification")
38
40
  )
39
41
  view.consentInformation = it.getMapOrDefault("consentInformation")?.toConsentInfo()
40
- ?: ConsentInformation(
41
- consented = ConsentedInformation(
42
- consentGrantedDate = getCurrentIsoTimestamp(),
43
- personalDetails = false,
44
- contactInformation = false,
45
- documentInformation = false
46
- ),
47
- )
48
42
  view.extraPartnerParams = it.getImmutableMapOrDefault("extraPartnerParams")
49
43
  view.userId = it.getStringOrDefault("userId")
50
44
  view.jobId = it.getStringOrDefault("jobId")
51
45
  view.countryCode = countryCode
52
- view.enableAutoCapture = it.getBoolOrDefault("enableAutoCapture", true)
46
+ view.autoCaptureTimeout = it.getIntOrDefault("autoCaptureTimeout", null)
47
+ view.autoCapture = it.getStringOrDefault("autoCapture", null)?.toAutoCapture()
53
48
  view.allowAgentMode = it.getBoolOrDefault("allowAgentMode", false)
54
49
  view.showAttribution = it.getBoolOrDefault("showAttribution", true)
55
50
  view.captureBothSides = it.getBoolOrDefault("captureBothSides", false)
@@ -24,10 +24,6 @@ class SmileIDBiometricKYCView(context: ReactApplicationContext) : SmileIDView(co
24
24
  emitFailure(IllegalArgumentException("idInfo is required for BiometricKYC"))
25
25
  return
26
26
  }
27
- consentInformation ?: run {
28
- emitFailure(IllegalArgumentException("consentInformation is required for BiometricKYC"))
29
- return
30
- }
31
27
  composeView.apply {
32
28
  val customViewModelStoreOwner = CustomViewModelStoreOwner()
33
29
  setContent {
@@ -41,7 +37,7 @@ class SmileIDBiometricKYCView(context: ReactApplicationContext) : SmileIDView(co
41
37
  showAttribution = showAttribution,
42
38
  showInstructions = showInstructions,
43
39
  extraPartnerParams = extraPartnerParams,
44
- consentInformation = consentInformation!!,
40
+ consentInformation = consentInformation,
45
41
  useStrictMode = useStrictMode ?: false,
46
42
  ) { res ->
47
43
  when (res) {
@@ -25,11 +25,13 @@ import com.smileidentity.compose.document.DocumentCaptureSide
25
25
  import com.smileidentity.compose.theme.colorScheme
26
26
  import com.smileidentity.compose.theme.typography
27
27
  import com.smileidentity.metadata.LocalMetadataProvider
28
+ import com.smileidentity.models.AutoCapture
28
29
  import com.smileidentity.react.results.DocumentCaptureResult
29
30
  import com.smileidentity.react.utils.DocumentCaptureResultAdapter
30
31
  import com.smileidentity.util.randomJobId
31
32
  import timber.log.Timber
32
33
  import java.io.File
34
+ import kotlin.time.Duration.Companion.seconds
33
35
 
34
36
  class SmileIDDocumentCaptureView(context: ReactApplicationContext) : SmileIDView(context) {
35
37
  var showConfirmation: Boolean = true
@@ -37,6 +39,10 @@ class SmileIDDocumentCaptureView(context: ReactApplicationContext) : SmileIDView
37
39
  var allowGalleryUpload: Boolean = false
38
40
  var idAspectRatio: Float? = null
39
41
 
42
+ var autoCaptureTimeout: Int? = null
43
+
44
+ var autoCapture: AutoCapture? = null
45
+
40
46
  override fun renderContent() {
41
47
  composeView.apply {
42
48
  val customViewModelStoreOwner = CustomViewModelStoreOwner()
@@ -71,6 +77,8 @@ class SmileIDDocumentCaptureView(context: ReactApplicationContext) : SmileIDView
71
77
  showAttribution = showAttribution,
72
78
  allowGallerySelection = allowGalleryUpload,
73
79
  showConfirmation = showConfirmation,
80
+ autoCaptureTimeout = autoCaptureTimeout?.seconds ?: 10.seconds,
81
+ autoCapture = autoCapture ?: AutoCapture.AutoCapture,
74
82
  showSkipButton = false,
75
83
  instructionsHeroImage = hero,
76
84
  instructionsTitleText = stringResource(instructionTitle),
@@ -6,16 +6,20 @@ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
6
6
  import com.facebook.react.bridge.ReactApplicationContext
7
7
  import com.smileidentity.SmileID
8
8
  import com.smileidentity.compose.DocumentVerification
9
+ import com.smileidentity.models.AutoCapture
9
10
  import com.smileidentity.react.results.DocumentCaptureResult
10
11
  import com.smileidentity.react.utils.DocumentCaptureResultAdapter
11
12
  import com.smileidentity.results.SmileIDResult
12
13
  import com.smileidentity.util.randomJobId
13
14
  import com.smileidentity.util.randomUserId
14
15
  import java.io.File
16
+ import kotlin.time.Duration.Companion.seconds
15
17
 
16
18
  class SmileIDDocumentVerificationView(context: ReactApplicationContext) : SmileIDView(context) {
17
19
  var countryCode: String? = null
18
- var enableAutoCapture: Boolean = true
20
+
21
+ var autoCaptureTimeout: Int? = null
22
+ var autoCapture: AutoCapture? = null
19
23
  var allowGalleryUpload: Boolean = false
20
24
  var captureBothSides: Boolean = true
21
25
  var bypassSelfieCaptureWithFilePath: String? = null
@@ -40,7 +44,8 @@ class SmileIDDocumentVerificationView(context: ReactApplicationContext) : SmileI
40
44
  userId = userId ?: rememberSaveable { randomUserId() },
41
45
  jobId = jobId ?: rememberSaveable { randomJobId() },
42
46
  countryCode = countryCode!!,
43
- enableAutoCapture = enableAutoCapture ?: true,
47
+ autoCaptureTimeout = autoCaptureTimeout?.seconds ?: 10.seconds,
48
+ autoCapture = autoCapture ?: AutoCapture.AutoCapture,
44
49
  documentType = documentType,
45
50
  idAspectRatio = idAspectRatio,
46
51
  showAttribution = showAttribution,
@@ -6,17 +6,22 @@ import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
6
6
  import com.facebook.react.bridge.ReactApplicationContext
7
7
  import com.smileidentity.SmileID
8
8
  import com.smileidentity.compose.EnhancedDocumentVerificationScreen
9
+ import com.smileidentity.models.AutoCapture
9
10
  import com.smileidentity.models.ConsentInformation
10
11
  import com.smileidentity.react.results.DocumentCaptureResult
11
12
  import com.smileidentity.react.utils.DocumentCaptureResultAdapter
12
13
  import com.smileidentity.results.SmileIDResult
13
14
  import com.smileidentity.util.randomJobId
14
15
  import com.smileidentity.util.randomUserId
16
+ import kotlin.time.Duration.Companion.seconds
15
17
 
16
18
  class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext) :
17
19
  SmileIDView(context) {
18
20
  var countryCode: String? = null
19
- var enableAutoCapture: Boolean = true
21
+
22
+ var autoCaptureTimeout: Int? = null
23
+
24
+ var autoCapture: AutoCapture? = null
20
25
  var allowGalleryUpload: Boolean = false
21
26
  var captureBothSides: Boolean = true
22
27
  var documentType: String? = null
@@ -29,12 +34,6 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
29
34
  emitFailure(IllegalArgumentException("countryCode is required for DocumentVerification"))
30
35
  return
31
36
  }
32
-
33
- consentInformation ?: run {
34
- emitFailure(IllegalArgumentException("consentInformation is required for DocumentVerification"))
35
- return
36
- }
37
-
38
37
  composeView.apply {
39
38
  val customViewModelStoreOwner = CustomViewModelStoreOwner()
40
39
  setContent {
@@ -43,7 +42,8 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
43
42
  userId = userId ?: rememberSaveable { randomUserId() },
44
43
  jobId = jobId ?: rememberSaveable { randomJobId() },
45
44
  countryCode = countryCode!!,
46
- enableAutoCapture = enableAutoCapture ?: true,
45
+ autoCaptureTimeout = autoCaptureTimeout?.seconds ?: 10.seconds,
46
+ autoCapture = autoCapture ?: AutoCapture.AutoCapture,
47
47
  documentType = documentType,
48
48
  idAspectRatio = idAspectRatio,
49
49
  showAttribution = showAttribution,
@@ -53,7 +53,7 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
53
53
  allowGalleryUpload = allowGalleryUpload,
54
54
  captureBothSides = captureBothSides,
55
55
  extraPartnerParams = extraPartnerParams,
56
- consentInformation = consentInformation!!,
56
+ consentInformation = consentInformation,
57
57
  useStrictMode = useStrictMode ?: false,
58
58
  ) { res ->
59
59
  when (res) {
@@ -1,4 +1,5 @@
1
1
  import Foundation
2
+ import SmileID
2
3
 
3
4
  extension String {
4
5
  func isValidUrl() -> Bool {
@@ -17,3 +18,18 @@ func getCurrentIsoTimestamp() -> String {
17
18
  formatter.timeZone = TimeZone(identifier: "UTC")
18
19
  return formatter.string(from: Date())
19
20
  }
21
+
22
+ extension String {
23
+ func toAutoCapture() -> AutoCapture {
24
+ switch self {
25
+ case "AutoCapture":
26
+ return .autoCapture
27
+ case "AutoCaptureOnly":
28
+ return .autoCaptureOnly
29
+ case "ManualCaptureOnly":
30
+ return .manualCaptureOnly
31
+ default:
32
+ return .autoCapture
33
+ }
34
+ }
35
+ }
@@ -2,8 +2,7 @@ import Foundation
2
2
  import SmileID
3
3
  import SwiftUI
4
4
 
5
- struct SmileIDBiometricKYCView: View, SmileIDFileUtilsProtocol {
6
- var fileManager: FileManager = Foundation.FileManager.default
5
+ struct SmileIDBiometricKYCView: View {
7
6
  @ObservedObject var product: SmileIDProductModel
8
7
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
8
  var body: some View {
@@ -19,7 +18,7 @@ struct SmileIDBiometricKYCView: View, SmileIDFileUtilsProtocol {
19
18
  showInstructions: product.showInstructions,
20
19
  useStrictMode: product.useStrictMode,
21
20
  extraPartnerParams: product.extraPartnerParams as [String: String],
22
- consentInformation: product.consentInformation, // already validated in the SmileIDBiometricKYCViewManager
21
+ consentInformation: product.consentInformation,
23
22
  delegate: self
24
23
  )
25
24
  } else {
@@ -35,9 +34,9 @@ struct SmileIDBiometricKYCView: View, SmileIDFileUtilsProtocol {
35
34
  extension SmileIDBiometricKYCView: BiometricKycResultDelegate {
36
35
  func didSucceed(selfieImage: URL, livenessImages: [URL], didSubmitBiometricJob: Bool) {
37
36
  let params: [String: Any] = [
38
- "selfieFile": getFilePath(fileName: selfieImage.absoluteString),
37
+ "selfieFile": selfieImage.absoluteString,
39
38
  "livenessFiles": livenessImages.map {
40
- getFilePath(fileName: $0.absoluteString)
39
+ $0.absoluteString
41
40
  },
42
41
  "didSubmitBiometricKycJob": didSubmitBiometricJob,
43
42
  ]
@@ -17,7 +17,8 @@ struct SmileIDDocumentCaptureView: View {
17
17
  NavigationView {
18
18
  DocumentCaptureScreen(
19
19
  side: self.product.front ? .front : .back,
20
- enableAutoCapture: self.product.enableAutoCapture,
20
+ autoCaptureTimeout: TimeInterval(self.product.autoCaptureTimeout),
21
+ autoCapture: self.product.autoCapture,
21
22
  showInstructions: self.product.showInstructions,
22
23
  showAttribution: self.product.showAttribution,
23
24
  allowGallerySelection: self.product.allowGalleryUpload,
@@ -2,8 +2,7 @@ import Foundation
2
2
  import SmileID
3
3
  import SwiftUI
4
4
 
5
- struct SmileIDDocumentVerificationView: View, SmileIDFileUtilsProtocol {
6
- var fileManager: FileManager = Foundation.FileManager.default
5
+ struct SmileIDDocumentVerificationView: View {
7
6
  @ObservedObject var product: SmileIDProductModel
8
7
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
8
  var body: some View {
@@ -17,7 +16,8 @@ struct SmileIDDocumentVerificationView: View, SmileIDFileUtilsProtocol {
17
16
  documentType: product.documentType,
18
17
  idAspectRatio: product.idAspectRatio,
19
18
  bypassSelfieCaptureWithFile: product.bypassSelfieCaptureWithFilePath,
20
- enableAutoCapture: product.enableAutoCapture,
19
+ autoCaptureTimeout: TimeInterval(product.autoCaptureTimeout),
20
+ autoCapture: product.autoCapture,
21
21
  captureBothSides: product.captureBothSides,
22
22
  allowAgentMode: product.allowAgentMode,
23
23
  allowGalleryUpload: product.allowGalleryUpload,
@@ -41,13 +41,13 @@ struct SmileIDDocumentVerificationView: View, SmileIDFileUtilsProtocol {
41
41
  extension SmileIDDocumentVerificationView: DocumentVerificationResultDelegate {
42
42
  func didSucceed(selfie: URL, documentFrontImage: URL, documentBackImage: URL?, didSubmitDocumentVerificationJob: Bool) {
43
43
  var params: [String: Any] = [
44
- "selfieFile": getFilePath(fileName: selfie.absoluteString),
45
- "documentFrontFile": getFilePath(fileName: documentFrontImage.absoluteString),
44
+ "selfieFile": selfie.absoluteString,
45
+ "documentFrontFile": documentFrontImage.absoluteString,
46
46
  "didSubmitDocumentVerificationJob": didSubmitDocumentVerificationJob,
47
47
  ]
48
48
 
49
49
  if let documentBackImage = documentBackImage {
50
- params["documentBackFile"] = getFilePath(fileName: documentBackImage.absoluteString)
50
+ params["documentBackFile"] = documentBackImage.absoluteString
51
51
  }
52
52
 
53
53
  guard let jsonData = try? JSONSerialization.data(withJSONObject: params.toJSONCompatibleDictionary(), options: .prettyPrinted) else {
@@ -2,8 +2,7 @@ import Foundation
2
2
  import SmileID
3
3
  import SwiftUI
4
4
 
5
- struct SmileIDEnhancedDocumentVerificationView: View, SmileIDFileUtilsProtocol {
6
- var fileManager: FileManager = Foundation.FileManager.default
5
+ struct SmileIDEnhancedDocumentVerificationView: View {
7
6
  @ObservedObject var product: SmileIDProductModel
8
7
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
8
  var body: some View {
@@ -17,7 +16,8 @@ struct SmileIDEnhancedDocumentVerificationView: View, SmileIDFileUtilsProtocol {
17
16
  documentType: product.documentType,
18
17
  idAspectRatio: product.idAspectRatio,
19
18
  bypassSelfieCaptureWithFile: product.bypassSelfieCaptureWithFilePath,
20
- enableAutoCapture: product.enableAutoCapture,
19
+ autoCaptureTimeout: TimeInterval(product.autoCaptureTimeout),
20
+ autoCapture: product.autoCapture,
21
21
  captureBothSides: product.captureBothSides,
22
22
  allowAgentMode: product.allowAgentMode,
23
23
  allowGalleryUpload: product.allowGalleryUpload,
@@ -42,13 +42,13 @@ struct SmileIDEnhancedDocumentVerificationView: View, SmileIDFileUtilsProtocol {
42
42
  extension SmileIDEnhancedDocumentVerificationView: EnhancedDocumentVerificationResultDelegate {
43
43
  func didSucceed(selfie: URL, documentFrontImage: URL, documentBackImage: URL?, didSubmitEnhancedDocVJob: Bool) {
44
44
  var params: [String: Any] = [
45
- "selfieFile": getFilePath(fileName: selfie.absoluteString),
46
- "documentFrontFile": getFilePath(fileName: documentFrontImage.absoluteString),
45
+ "selfieFile": selfie.absoluteString,
46
+ "documentFrontFile": documentFrontImage.absoluteString,
47
47
  "didSubmitEnhancedDocVJob": didSubmitEnhancedDocVJob,
48
48
  ]
49
49
 
50
50
  if let documentBackImage = documentBackImage {
51
- params["documentBackFile"] = getFilePath(fileName: documentBackImage.absoluteString)
51
+ params["documentBackFile"] = documentBackImage.absoluteString
52
52
  }
53
53
 
54
54
  guard let jsonData = try? JSONSerialization.data(withJSONObject: params.toJSONCompatibleDictionary(), options: .prettyPrinted) else {
@@ -2,8 +2,7 @@ import Foundation
2
2
  import SmileID
3
3
  import SwiftUI
4
4
 
5
- struct SmileIDSmartSelfieAuthEnhancedView: View, SmileIDFileUtilsProtocol {
6
- var fileManager: FileManager = Foundation.FileManager.default
5
+ struct SmileIDSmartSelfieAuthEnhancedView: View {
7
6
  @ObservedObject var product: SmileIDProductModel
8
7
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
8
  var body: some View {
@@ -24,22 +23,22 @@ struct SmileIDSmartSelfieAuthEnhancedView: View, SmileIDFileUtilsProtocol {
24
23
  extension SmileIDSmartSelfieAuthEnhancedView: SmartSelfieResultDelegate {
25
24
  func didSucceed(selfieImage: URL, livenessImages: [URL], apiResponse: SmartSelfieResponse?) {
26
25
  var params: [String: Any] = [
27
- "selfieFile": getFilePath(fileName: selfieImage.absoluteString),
26
+ "selfieFile": selfieImage.absoluteString,
28
27
  "livenessFiles": livenessImages.map {
29
- getFilePath(fileName: $0.absoluteString)
28
+ $0.absoluteString
30
29
  },
31
30
  ]
32
31
  if let apiResponse = apiResponse {
33
32
  params["apiResponse"] = apiResponse
34
33
  }
35
-
34
+
36
35
  guard let jsonData = try? JSONSerialization.data(withJSONObject: params.toJSONCompatibleDictionary(), options: .prettyPrinted) else {
37
36
  smileIDUIViewDelegate.onError(error: SmileIDError.unknown("SmileIDSmartSelfieAuthView encoding error"))
38
37
  return
39
38
  }
40
39
  smileIDUIViewDelegate.onResult(smileResult: String(data: jsonData, encoding: .utf8)!)
41
40
  }
42
-
41
+
43
42
  func didError(error: Error) {
44
43
  smileIDUIViewDelegate.onError(error: error)
45
44
  }
@@ -2,8 +2,7 @@ import Foundation
2
2
  import SmileID
3
3
  import SwiftUI
4
4
 
5
- struct SmileIDSmartSelfieAuthView: View, SmileIDFileUtilsProtocol {
6
- var fileManager: FileManager = Foundation.FileManager.default
5
+ struct SmileIDSmartSelfieAuthView: View {
7
6
  @ObservedObject var product: SmileIDProductModel
8
7
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
8
  var body: some View {
@@ -26,9 +25,9 @@ struct SmileIDSmartSelfieAuthView: View, SmileIDFileUtilsProtocol {
26
25
  extension SmileIDSmartSelfieAuthView: SmartSelfieResultDelegate {
27
26
  func didSucceed(selfieImage: URL, livenessImages: [URL], apiResponse: SmartSelfieResponse?) {
28
27
  var params: [String: Any] = [
29
- "selfieFile": getFilePath(fileName: selfieImage.absoluteString),
28
+ "selfieFile": selfieImage.absoluteString,
30
29
  "livenessFiles": livenessImages.map {
31
- getFilePath(fileName: $0.absoluteString)
30
+ $0.absoluteString
32
31
  },
33
32
  ]
34
33
  if let apiResponse = apiResponse {
@@ -2,8 +2,7 @@ import Foundation
2
2
  import SmileID
3
3
  import SwiftUI
4
4
 
5
- struct SmileIDSmartSelfieCaptureView: View, SmileIDFileUtilsProtocol {
6
- var fileManager: FileManager = Foundation.FileManager.default
5
+ struct SmileIDSmartSelfieCaptureView: View {
7
6
  @ObservedObject var viewModel: SelfieViewModel
8
7
  @ObservedObject var product: SmileIDProductModel
9
8
  @State private var acknowledgedInstructions = false
@@ -74,9 +73,9 @@ struct SmileIDSmartSelfieCaptureView: View, SmileIDFileUtilsProtocol {
74
73
  extension SmileIDSmartSelfieCaptureView: SmartSelfieResultDelegate {
75
74
  func didSucceed(selfieImage: URL, livenessImages: [URL], apiResponse _: SmartSelfieResponse?) {
76
75
  let params: [String: Any] = [
77
- "selfieFile": getFilePath(fileName: selfieImage.absoluteString),
76
+ "selfieFile": selfieImage.absoluteString,
78
77
  "livenessFiles": livenessImages.map {
79
- getFilePath(fileName: $0.absoluteString)
78
+ $0.absoluteString
80
79
  },
81
80
  ]
82
81
 
@@ -2,8 +2,7 @@ import Foundation
2
2
  import SmileID
3
3
  import SwiftUI
4
4
 
5
- struct SmileIDSmartSelfieEnrollmentEnhancedView: View, SmileIDFileUtilsProtocol {
6
- var fileManager: FileManager = Foundation.FileManager.default
5
+ struct SmileIDSmartSelfieEnrollmentEnhancedView: View {
7
6
  @ObservedObject var product: SmileIDProductModel
8
7
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
8
  var body: some View {
@@ -24,9 +23,9 @@ struct SmileIDSmartSelfieEnrollmentEnhancedView: View, SmileIDFileUtilsProtocol
24
23
  extension SmileIDSmartSelfieEnrollmentEnhancedView: SmartSelfieResultDelegate {
25
24
  func didSucceed(selfieImage: URL, livenessImages: [URL], apiResponse: SmartSelfieResponse?) {
26
25
  var params: [String: Any] = [
27
- "selfieFile": getFilePath(fileName: selfieImage.absoluteString),
26
+ "selfieFile": selfieImage.absoluteString,
28
27
  "livenessFiles": livenessImages.map {
29
- getFilePath(fileName: $0.absoluteString)
28
+ $0.absoluteString
30
29
  },
31
30
  ]
32
31
  if let apiResponse = apiResponse {
@@ -2,8 +2,7 @@ import Foundation
2
2
  import SmileID
3
3
  import SwiftUI
4
4
 
5
- struct SmileIDSmartSelfieEnrollmentView: View, SmileIDFileUtilsProtocol {
6
- var fileManager: FileManager = Foundation.FileManager.default
5
+ struct SmileIDSmartSelfieEnrollmentView: View {
7
6
  @ObservedObject var product: SmileIDProductModel
8
7
  var smileIDUIViewDelegate: SmileIDUIViewDelegate
9
8
  var body: some View {
@@ -25,9 +24,9 @@ struct SmileIDSmartSelfieEnrollmentView: View, SmileIDFileUtilsProtocol {
25
24
  extension SmileIDSmartSelfieEnrollmentView: SmartSelfieResultDelegate {
26
25
  func didSucceed(selfieImage: URL, livenessImages: [URL], apiResponse: SmartSelfieResponse?) {
27
26
  var params: [String: Any] = [
28
- "selfieFile": getFilePath(fileName: selfieImage.absoluteString),
27
+ "selfieFile": selfieImage.absoluteString,
29
28
  "livenessFiles": livenessImages.map {
30
- getFilePath(fileName: $0.absoluteString)
29
+ $0.absoluteString
31
30
  },
32
31
  ]
33
32
  if let apiResponse = apiResponse {
@@ -22,14 +22,7 @@ class SmileIDBiometricKYCViewManager: SmileIDBaseViewManager {
22
22
  if let consentInformation = params["consentInformation"] as? NSDictionary{
23
23
  self.product.consentInformation = consentInformation.toConsentInfo()
24
24
  } else {
25
- self.product.consentInformation = ConsentInformation(
26
- consented: ConsentedInformation(
27
- consentGrantedDate: getCurrentIsoTimestamp(),
28
- personalDetails: false,
29
- contactInformation: false,
30
- documentInformation: false
31
- )
32
- )
25
+ self.product.consentInformation = nil
33
26
  }
34
27
  self.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
35
28
  self.product.userId = params["userId"] as? String
@@ -13,6 +13,12 @@ class SmileIDDocumentCaptureViewManager: SmileIDBaseViewManager {
13
13
  */
14
14
  DispatchQueue.main.async {
15
15
  if let component = self.bridge.uiManager.view(forReactTag: node) as? BaseSmileIDView {
16
+
17
+ var autoCapture: String?
18
+ if let autoCaptureValue = params["autoCapture"] as? String {
19
+ autoCapture = autoCaptureValue
20
+ }
21
+
16
22
  self.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
17
23
  self.product.userId = params["userId"] as? String
18
24
  self.product.jobId = params["jobId"] as? String
@@ -22,6 +28,8 @@ class SmileIDDocumentCaptureViewManager: SmileIDBaseViewManager {
22
28
  self.product.showInstructions = params["showInstructions"] as? Bool ?? true
23
29
  self.product.showConfirmation = params["showConfirmation"] as? Bool ?? true
24
30
  self.product.allowGalleryUpload = params["allowGalleryUpload"] as? Bool ?? false
31
+ self.product.autoCaptureTimeout = params["autoCaptureTimeout"] as? Int ?? 10
32
+ self.product.autoCapture = autoCapture?.toAutoCapture() ?? .autoCapture
25
33
  self.product.onResult = params["onResult"] as? RCTBubblingEventBlock
26
34
  }
27
35
  }
@@ -28,12 +28,18 @@ class SmileIDDocumentVerificationViewManager: SmileIDBaseViewManager {
28
28
  }
29
29
  bypassSelfieCaptureWithFilePath = URL(string: filePath)
30
30
  }
31
+
32
+ var autoCapture: String?
33
+ if let autoCaptureValue = params["autoCapture"] as? String {
34
+ autoCapture = autoCaptureValue
35
+ }
31
36
 
32
37
  self.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
33
38
  self.product.userId = params["userId"] as? String
34
39
  self.product.jobId = params["jobId"] as? String
35
40
  self.product.countryCode = countryCode
36
- self.product.enableAutoCapture = params["enableAutoCapture"] as? Bool ?? true
41
+ self.product.autoCaptureTimeout = params["autoCaptureTimeout"] as? Int ?? 10
42
+ self.product.autoCapture = autoCapture?.toAutoCapture() ?? .autoCapture
37
43
  self.product.allowNewEnroll = params["allowNewEnroll"] as? Bool ?? false
38
44
  self.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
39
45
  self.product.showAttribution = params["showAttribution"] as? Bool ?? true