@smile_identity/react-native 10.0.0-beta02 → 10.0.0-beta03
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 +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/smileidentity/react/Mapper.kt +179 -0
- package/android/src/main/java/com/smileidentity/react/SmileIdModule.kt +64 -87
- package/android/src/main/java/com/smileidentity/react/utils/ReactUtils.kt +4 -39
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBiometricKYCViewManager.kt +11 -8
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDConsentViewManager.kt +16 -10
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentVerificationViewManager.kt +14 -12
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDEnhancedDocumentVerificationViewManager.kt +13 -11
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieAuthenticationViewManager.kt +7 -6
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieEnrollmentViewManager.kt +7 -6
- package/android/src/main/java/com/smileidentity/react/views/SmileIDBiometricKYCView.kt +32 -22
- package/android/src/main/java/com/smileidentity/react/views/SmileIDConsentView.kt +21 -14
- package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerificationView.kt +35 -27
- package/android/src/main/java/com/smileidentity/react/views/SmileIDEnhancedDocumentVerificationView.kt +34 -26
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthenticationView.kt +30 -22
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt +30 -22
- package/android/src/main/java/com/smileidentity/react/views/SmileIDView.kt +1 -0
- package/android/src/oldarch/SmileIdSpec.kt +23 -1
- package/ios/View/BaseSmileIDView.swift +5 -5
- package/ios/View/SmileIDBiometricKYCView.swift +6 -4
- package/ios/View/SmileIDConsentView.swift +5 -4
- package/ios/View/SmileIDDocumentVerificationView.swift +5 -3
- package/ios/View/SmileIDEnhancedDocumentVerificationView.swift +6 -4
- package/ios/View/SmileIDSmartSelfieAuthView.swift +6 -4
- package/ios/View/SmileIDSmartSelfieEnrollmentView.swift +6 -4
- package/ios/ViewManagers/SmileIDBaseViewManager.swift +1 -0
- package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +11 -10
- package/ios/ViewManagers/SmileIDConsentViewManager.swift +8 -8
- package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.swift +17 -16
- package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +16 -15
- package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationViewManager.swift +10 -9
- package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentViewManager.swift +10 -9
- package/ios/ViewModels/SmileIDProductModel.swift +1 -0
- package/lib/commonjs/NativeSmileId.js.map +1 -1
- package/lib/commonjs/index.js +96 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +511 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/NativeSmileId.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +471 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/NativeSmileId.d.ts +13 -9
- package/lib/typescript/NativeSmileId.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +410 -88
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/react-native-smile-id.podspec +1 -1
- package/src/NativeSmileId.ts +58 -11
- package/src/index.tsx +33 -1
- package/src/types.ts +985 -90
- package/android/src/main/assets/smile_config.json +0 -9
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
package com.smileidentity.react.views
|
|
2
2
|
|
|
3
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
3
4
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
5
|
+
import androidx.compose.ui.platform.ViewCompositionStrategy
|
|
6
|
+
import androidx.lifecycle.ViewModelStoreOwner
|
|
7
|
+
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
8
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
9
|
import com.smileidentity.SmileID
|
|
6
10
|
import com.smileidentity.compose.BiometricKYC
|
|
@@ -9,6 +13,7 @@ import com.smileidentity.results.BiometricKycResult
|
|
|
9
13
|
import com.smileidentity.results.SmileIDResult
|
|
10
14
|
import com.smileidentity.util.randomJobId
|
|
11
15
|
import com.smileidentity.util.randomUserId
|
|
16
|
+
import kotlinx.collections.immutable.toImmutableMap
|
|
12
17
|
import timber.log.Timber
|
|
13
18
|
|
|
14
19
|
class SmileIDBiometricKYCView(context: ReactApplicationContext) : SmileIDView(context) {
|
|
@@ -18,32 +23,37 @@ class SmileIDBiometricKYCView(context: ReactApplicationContext) : SmileIDView(co
|
|
|
18
23
|
emitFailure(IllegalArgumentException("idInfo is required for BiometricKYC"))
|
|
19
24
|
return
|
|
20
25
|
}
|
|
21
|
-
|
|
22
26
|
composeView.apply {
|
|
27
|
+
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
|
|
23
28
|
setContent {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
|
|
30
|
+
SmileID.BiometricKYC(
|
|
31
|
+
idInfo = idInfo!!,
|
|
32
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
33
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
34
|
+
allowAgentMode = allowAgentMode ?: false,
|
|
35
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
36
|
+
showAttribution = showAttribution ?: true,
|
|
37
|
+
showInstructions = showInstructions ?: true,
|
|
38
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
39
|
+
) { result ->
|
|
40
|
+
when (result) {
|
|
41
|
+
is SmileIDResult.Success -> {
|
|
42
|
+
val json = try {
|
|
43
|
+
SmileID.moshi
|
|
44
|
+
.adapter(BiometricKycResult::class.java)
|
|
45
|
+
.toJson(result.data)
|
|
46
|
+
} catch (e: Exception) {
|
|
47
|
+
Timber.w(e)
|
|
48
|
+
"null"
|
|
49
|
+
}
|
|
50
|
+
emitSuccess(json)
|
|
40
51
|
}
|
|
41
|
-
emitSuccess(json)
|
|
42
|
-
}
|
|
43
52
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
is SmileIDResult.Error -> {
|
|
54
|
+
result.throwable.printStackTrace()
|
|
55
|
+
emitFailure(result.throwable)
|
|
56
|
+
}
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
package com.smileidentity.react.views
|
|
2
2
|
|
|
3
3
|
import android.webkit.URLUtil
|
|
4
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
|
+
import androidx.compose.ui.platform.ViewCompositionStrategy
|
|
4
6
|
import androidx.compose.ui.res.painterResource
|
|
7
|
+
import androidx.lifecycle.ViewModelStoreOwner
|
|
8
|
+
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
5
9
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
10
|
import com.smileidentity.SmileID
|
|
7
11
|
import com.smileidentity.compose.ConsentScreen
|
|
@@ -39,21 +43,24 @@ class SmileIDConsentView(context: ReactApplicationContext) : SmileIDView(context
|
|
|
39
43
|
(context as? ReactApplicationContext)?.currentActivity?.packageName
|
|
40
44
|
)
|
|
41
45
|
composeView.apply {
|
|
46
|
+
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
|
|
42
47
|
setContent {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
|
|
49
|
+
SmileID.ConsentScreen(
|
|
50
|
+
partnerIcon = painterResource(
|
|
51
|
+
id = partnerIcon
|
|
52
|
+
),
|
|
53
|
+
partnerName = partnerName!!,
|
|
54
|
+
productName = productName!!,
|
|
55
|
+
partnerPrivacyPolicy = URL(partnerPrivacyPolicy),
|
|
56
|
+
onConsentDenied = {
|
|
57
|
+
emitSuccess("denied")
|
|
58
|
+
},
|
|
59
|
+
onConsentGranted = {
|
|
60
|
+
emitSuccess("accepted")
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
}
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
66
|
}
|
package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerificationView.kt
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
package com.smileidentity.react.views
|
|
2
2
|
|
|
3
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
3
4
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
5
|
+
import androidx.compose.ui.platform.ViewCompositionStrategy
|
|
6
|
+
import androidx.lifecycle.ViewModelStoreOwner
|
|
7
|
+
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
8
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
9
|
import com.smileidentity.SmileID
|
|
6
10
|
import com.smileidentity.compose.DocumentVerification
|
|
@@ -30,36 +34,40 @@ class SmileIDDocumentVerificationView(context: ReactApplicationContext) : SmileI
|
|
|
30
34
|
bypassSelfieCaptureWithFile = File(it)
|
|
31
35
|
}
|
|
32
36
|
composeView.apply {
|
|
37
|
+
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
|
|
33
38
|
setContent {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
|
|
40
|
+
SmileID.DocumentVerification(
|
|
41
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
42
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
43
|
+
countryCode = countryCode!!,
|
|
44
|
+
documentType = documentType,
|
|
45
|
+
idAspectRatio = idAspectRatio,
|
|
46
|
+
showAttribution = showAttribution ?: true,
|
|
47
|
+
showInstructions = showInstructions ?: true,
|
|
48
|
+
allowGalleryUpload = allowGalleryUpload,
|
|
49
|
+
captureBothSides = captureBothSides,
|
|
50
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
51
|
+
bypassSelfieCaptureWithFile = bypassSelfieCaptureWithFile,
|
|
52
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
53
|
+
) { result ->
|
|
54
|
+
when (result) {
|
|
55
|
+
is SmileIDResult.Success -> {
|
|
56
|
+
val json = try {
|
|
57
|
+
SmileID.moshi
|
|
58
|
+
.adapter(DocumentVerificationResult::class.java)
|
|
59
|
+
.toJson(result.data)
|
|
60
|
+
} catch (e: Exception) {
|
|
61
|
+
Timber.w(e)
|
|
62
|
+
"null"
|
|
63
|
+
}
|
|
64
|
+
emitSuccess(json)
|
|
56
65
|
}
|
|
57
|
-
emitSuccess(json)
|
|
58
|
-
}
|
|
59
66
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
is SmileIDResult.Error -> {
|
|
68
|
+
result.throwable.printStackTrace()
|
|
69
|
+
emitFailure(result.throwable)
|
|
70
|
+
}
|
|
63
71
|
}
|
|
64
72
|
}
|
|
65
73
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
package com.smileidentity.react.views
|
|
2
2
|
|
|
3
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
3
4
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
5
|
+
import androidx.compose.ui.platform.ViewCompositionStrategy
|
|
6
|
+
import androidx.lifecycle.ViewModelStoreOwner
|
|
7
|
+
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
8
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
9
|
import com.smileidentity.SmileID
|
|
6
10
|
import com.smileidentity.compose.EnhancedDocumentVerificationScreen
|
|
@@ -25,35 +29,39 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
|
|
|
25
29
|
return;
|
|
26
30
|
}
|
|
27
31
|
composeView.apply {
|
|
32
|
+
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
|
|
28
33
|
setContent {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
|
|
35
|
+
SmileID.EnhancedDocumentVerificationScreen(
|
|
36
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
37
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
38
|
+
countryCode = countryCode!!,
|
|
39
|
+
documentType = documentType,
|
|
40
|
+
idAspectRatio = idAspectRatio,
|
|
41
|
+
showAttribution = showAttribution ?: true,
|
|
42
|
+
showInstructions = showInstructions ?: true,
|
|
43
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
44
|
+
allowGalleryUpload = allowGalleryUpload,
|
|
45
|
+
captureBothSides = captureBothSides,
|
|
46
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
47
|
+
) { result ->
|
|
48
|
+
when (result) {
|
|
49
|
+
is SmileIDResult.Success -> {
|
|
50
|
+
val json = try {
|
|
51
|
+
SmileID.moshi
|
|
52
|
+
.adapter(EnhancedDocumentVerificationResult::class.java)
|
|
53
|
+
.toJson(result.data)
|
|
54
|
+
} catch (e: Exception) {
|
|
55
|
+
Timber.w(e)
|
|
56
|
+
"null"
|
|
57
|
+
}
|
|
58
|
+
emitSuccess(json)
|
|
50
59
|
}
|
|
51
|
-
emitSuccess(json)
|
|
52
|
-
}
|
|
53
60
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
is SmileIDResult.Error -> {
|
|
62
|
+
result.throwable.printStackTrace()
|
|
63
|
+
emitFailure(result.throwable)
|
|
64
|
+
}
|
|
57
65
|
}
|
|
58
66
|
}
|
|
59
67
|
}
|
package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthenticationView.kt
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
package com.smileidentity.react.views
|
|
2
2
|
|
|
3
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
3
4
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
5
|
+
import androidx.compose.ui.platform.ViewCompositionStrategy
|
|
6
|
+
import androidx.lifecycle.ViewModelStoreOwner
|
|
7
|
+
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
8
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
9
|
import com.smileidentity.SmileID
|
|
6
10
|
import com.smileidentity.compose.SmartSelfieAuthentication
|
|
@@ -16,31 +20,35 @@ class SmileIDSmartSelfieAuthenticationView(context: ReactApplicationContext) :
|
|
|
16
20
|
|
|
17
21
|
override fun renderContent() {
|
|
18
22
|
composeView.apply {
|
|
23
|
+
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
|
|
19
24
|
setContent {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
|
|
26
|
+
SmileID.SmartSelfieAuthentication(
|
|
27
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
28
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
29
|
+
allowAgentMode = allowAgentMode ?: false,
|
|
30
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
31
|
+
showAttribution = showAttribution ?: true,
|
|
32
|
+
showInstructions = showInstructions ?: true,
|
|
33
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
34
|
+
) { result ->
|
|
35
|
+
when (result) {
|
|
36
|
+
is SmileIDResult.Success -> {
|
|
37
|
+
val json = try {
|
|
38
|
+
SmileID.moshi
|
|
39
|
+
.adapter(SmartSelfieResult::class.java)
|
|
40
|
+
.toJson(result.data)
|
|
41
|
+
} catch (e: Exception) {
|
|
42
|
+
Timber.w(e)
|
|
43
|
+
"null"
|
|
44
|
+
}
|
|
45
|
+
emitSuccess(json)
|
|
37
46
|
}
|
|
38
|
-
emitSuccess(json)
|
|
39
|
-
}
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
is SmileIDResult.Error -> {
|
|
49
|
+
result.throwable.printStackTrace()
|
|
50
|
+
emitFailure(result.throwable)
|
|
51
|
+
}
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
54
|
}
|
package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
package com.smileidentity.react.views
|
|
2
2
|
|
|
3
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
3
4
|
import androidx.compose.runtime.saveable.rememberSaveable
|
|
5
|
+
import androidx.compose.ui.platform.ViewCompositionStrategy
|
|
6
|
+
import androidx.lifecycle.ViewModelStoreOwner
|
|
7
|
+
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
8
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
9
|
import com.smileidentity.SmileID
|
|
6
10
|
import com.smileidentity.compose.SmartSelfieEnrollment
|
|
@@ -15,31 +19,35 @@ class SmileIDSmartSelfieEnrollmentView(context: ReactApplicationContext) : Smile
|
|
|
15
19
|
|
|
16
20
|
override fun renderContent() {
|
|
17
21
|
composeView.apply {
|
|
22
|
+
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
|
|
18
23
|
setContent {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides (context as ViewModelStoreOwner)) {
|
|
25
|
+
SmileID.SmartSelfieEnrollment(
|
|
26
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
27
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
28
|
+
allowAgentMode = allowAgentMode ?: false,
|
|
29
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
30
|
+
showAttribution = showAttribution ?: true,
|
|
31
|
+
showInstructions = showInstructions ?: true,
|
|
32
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
33
|
+
) { result ->
|
|
34
|
+
when (result) {
|
|
35
|
+
is SmileIDResult.Success -> {
|
|
36
|
+
val json = try {
|
|
37
|
+
SmileID.moshi
|
|
38
|
+
.adapter(SmartSelfieResult::class.java)
|
|
39
|
+
.toJson(result.data)
|
|
40
|
+
} catch (e: Exception) {
|
|
41
|
+
Timber.w(e)
|
|
42
|
+
"null"
|
|
43
|
+
}
|
|
44
|
+
emitSuccess(json)
|
|
36
45
|
}
|
|
37
|
-
emitSuccess(json)
|
|
38
|
-
}
|
|
39
46
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
is SmileIDResult.Error -> {
|
|
48
|
+
result.throwable.printStackTrace()
|
|
49
|
+
emitFailure(result.throwable)
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
52
|
}
|
|
45
53
|
}
|
|
@@ -18,6 +18,7 @@ abstract class SmileIDView(context: ReactApplicationContext) : LinearLayout(cont
|
|
|
18
18
|
var jobId: String? = null
|
|
19
19
|
private var jobType: JobType? = null
|
|
20
20
|
var allowAgentMode: Boolean? = false
|
|
21
|
+
var allowNewEnroll: Boolean? = false
|
|
21
22
|
var showInstructions: Boolean? = true
|
|
22
23
|
var showAttribution: Boolean? = true
|
|
23
24
|
var extraPartnerParams: Map<String, String>? = null
|
|
@@ -11,6 +11,28 @@ abstract class SmileIdSpec internal constructor(context: ReactApplicationContext
|
|
|
11
11
|
abstract fun initialize(useSandBox: Boolean ,promise: Promise)
|
|
12
12
|
|
|
13
13
|
abstract fun disableCrashReporting(promise: Promise)
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
abstract fun authenticate(request: ReadableMap, promise: Promise)
|
|
16
|
+
|
|
17
|
+
abstract fun prepUpload(request: ReadableMap, promise: Promise)
|
|
18
|
+
|
|
19
|
+
abstract fun upload(url: String, request: ReadableMap, promise: Promise)
|
|
20
|
+
|
|
15
21
|
abstract fun doEnhancedKyc(request: ReadableMap, promise: Promise)
|
|
22
|
+
|
|
23
|
+
abstract fun doEnhancedKycAsync(request: ReadableMap, promise: Promise)
|
|
24
|
+
|
|
25
|
+
abstract fun getSmartSelfieJobStatus(request: ReadableMap, promise: Promise)
|
|
26
|
+
|
|
27
|
+
abstract fun getDocumentVerificationJobStatus(request: ReadableMap, promise: Promise)
|
|
28
|
+
|
|
29
|
+
abstract fun getBiometricKycJobStatus(request: ReadableMap, promise: Promise)
|
|
30
|
+
|
|
31
|
+
abstract fun getEnhancedDocumentVerificationJobStatus(request: ReadableMap, promise: Promise)
|
|
32
|
+
|
|
33
|
+
abstract fun getProductsConfig(request: ReadableMap, promise: Promise)
|
|
34
|
+
|
|
35
|
+
abstract fun getValidDocuments(request: ReadableMap, promise: Promise)
|
|
36
|
+
|
|
37
|
+
abstract fun getServices(promise: Promise)
|
|
16
38
|
}
|
|
@@ -3,10 +3,10 @@ import SwiftUI
|
|
|
3
3
|
|
|
4
4
|
class BaseSmileIDView: UIView {
|
|
5
5
|
typealias ContentView = AnyView
|
|
6
|
+
var contentView : AnyView?
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
override init(frame: CGRect) {
|
|
8
|
+
init(frame: CGRect,contentView:AnyView) {
|
|
9
|
+
self.contentView = contentView
|
|
10
10
|
super.init(frame: frame)
|
|
11
11
|
commonInit()
|
|
12
12
|
}
|
|
@@ -19,7 +19,7 @@ class BaseSmileIDView: UIView {
|
|
|
19
19
|
private func commonInit() {
|
|
20
20
|
// Perform initialization tasks here
|
|
21
21
|
// For example, setup subviews, add constraints, configure appearance
|
|
22
|
-
let hostingController = UIHostingController(rootView:
|
|
22
|
+
let hostingController = UIHostingController(rootView:contentView)
|
|
23
23
|
let hostingView = hostingController.view!
|
|
24
24
|
hostingView.translatesAutoresizingMaskIntoConstraints = false
|
|
25
25
|
addSubview(hostingView)
|
|
@@ -29,7 +29,7 @@ class BaseSmileIDView: UIView {
|
|
|
29
29
|
hostingView.rightAnchor.constraint(equalTo: rightAnchor).isActive = true
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
func getView() -> AnyView {
|
|
32
|
+
func getView(product:SmileIDProductModel) -> AnyView {
|
|
33
33
|
fatalError("Must be implemented by subclass")
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -3,14 +3,16 @@ import Foundation
|
|
|
3
3
|
import SmileID
|
|
4
4
|
import SwiftUI
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
struct SmileIDBiometricKYCView: View {
|
|
7
|
+
@ObservedObject var product : SmileIDProductModel
|
|
8
|
+
var body: some View{
|
|
9
|
+
NavigationView {
|
|
9
10
|
if let idInfo = product.idInfo {
|
|
10
11
|
SmileID.biometricKycScreen(
|
|
11
12
|
idInfo: idInfo, // already validated in the SmileIDBiometricKYCViewManager
|
|
12
13
|
userId: product.userId ?? generateUserId(),
|
|
13
14
|
jobId: product.jobId ?? generateJobId(),
|
|
15
|
+
allowNewEnroll: product.allowNewEnroll,
|
|
14
16
|
allowAgentMode: product.allowAgentMode,
|
|
15
17
|
showAttribution: product.showAttribution,
|
|
16
18
|
showInstructions: product.showInstructions,
|
|
@@ -23,7 +25,7 @@ class SmileIDBiometricKYCView: BaseSmileIDView {
|
|
|
23
25
|
// return an error if the required data is missing
|
|
24
26
|
Text("An error has occured")
|
|
25
27
|
}
|
|
26
|
-
}.navigationViewStyle(StackNavigationViewStyle())
|
|
28
|
+
}.navigationViewStyle(StackNavigationViewStyle())
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -3,9 +3,10 @@ import Foundation
|
|
|
3
3
|
import SmileID
|
|
4
4
|
import SwiftUI
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
struct SmileIDConsentView: View {
|
|
7
|
+
@ObservedObject var product : SmileIDProductModel
|
|
8
|
+
var body: some View {
|
|
9
|
+
NavigationView {
|
|
9
10
|
if let partnerIcon = product.partnerIcon,
|
|
10
11
|
let partnerName = product.partnerName,
|
|
11
12
|
let productName = product.productName,
|
|
@@ -30,6 +31,6 @@ class SmileIDConsentView: BaseSmileIDView {
|
|
|
30
31
|
// return an error if the required data is missing
|
|
31
32
|
Text("An error has occured")
|
|
32
33
|
}
|
|
33
|
-
}.navigationViewStyle(StackNavigationViewStyle())
|
|
34
|
+
}.navigationViewStyle(StackNavigationViewStyle())
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -3,13 +3,15 @@ import Foundation
|
|
|
3
3
|
import SmileID
|
|
4
4
|
import SwiftUI
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
struct SmileIDDocumentVerificationView: View {
|
|
7
|
+
@ObservedObject var product : SmileIDProductModel
|
|
8
|
+
var body : some View {
|
|
8
9
|
AnyView(NavigationView {
|
|
9
10
|
if let countryCode = product.countryCode {
|
|
10
11
|
SmileID.documentVerificationScreen(
|
|
11
12
|
userId: product.userId ?? generateUserId(),
|
|
12
13
|
jobId: product.jobId ?? generateJobId(),
|
|
14
|
+
allowNewEnroll: product.allowNewEnroll,
|
|
13
15
|
countryCode: countryCode, // already validated in SmileIDDocumentVerificationViewManager
|
|
14
16
|
documentType: product.documentType,
|
|
15
17
|
idAspectRatio: product.idAspectRatio,
|
|
@@ -46,7 +48,7 @@ extension SmileIDDocumentVerificationView: DocumentVerificationResultDelegate {
|
|
|
46
48
|
}
|
|
47
49
|
product.onResult?(["result": String(data: jsonData, encoding: .utf8)!])
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
|
|
50
52
|
func didError(error: Error) {
|
|
51
53
|
product.onResult?(["error": error.localizedDescription])
|
|
52
54
|
}
|
|
@@ -3,13 +3,15 @@ import Foundation
|
|
|
3
3
|
import SmileID
|
|
4
4
|
import SwiftUI
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
struct SmileIDEnhancedDocumentVerificationView: View {
|
|
7
|
+
@ObservedObject var product : SmileIDProductModel
|
|
8
|
+
var body: some View {
|
|
9
|
+
NavigationView {
|
|
9
10
|
if let countryCode = product.countryCode {
|
|
10
11
|
SmileID.enhancedDocumentVerificationScreen(
|
|
11
12
|
userId: product.userId ?? generateUserId(),
|
|
12
13
|
jobId: product.jobId ?? generateJobId(),
|
|
14
|
+
allowNewEnroll: product.allowNewEnroll,
|
|
13
15
|
countryCode: countryCode, // already validated in the view manager
|
|
14
16
|
documentType: product.documentType,
|
|
15
17
|
idAspectRatio: product.idAspectRatio,
|
|
@@ -28,7 +30,7 @@ class SmileIDEnhancedDocumentVerificationView: BaseSmileIDView {
|
|
|
28
30
|
// return an error if the required data is missing
|
|
29
31
|
Text("An error has occured")
|
|
30
32
|
}
|
|
31
|
-
}.navigationViewStyle(StackNavigationViewStyle())
|
|
33
|
+
}.navigationViewStyle(StackNavigationViewStyle())
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -3,19 +3,21 @@ import Foundation
|
|
|
3
3
|
import SmileID
|
|
4
4
|
import SwiftUI
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
struct SmileIDSmartSelfieAuthView: View {
|
|
7
|
+
@ObservedObject var product : SmileIDProductModel
|
|
8
|
+
var body: some View {
|
|
9
|
+
NavigationView {
|
|
9
10
|
SmileID.smartSelfieAuthenticationScreen(
|
|
10
11
|
userId: product.userId ?? generateUserId(),
|
|
11
12
|
jobId: product.jobId ?? generateJobId(),
|
|
13
|
+
allowNewEnroll: product.allowNewEnroll,
|
|
12
14
|
allowAgentMode: product.allowAgentMode,
|
|
13
15
|
showAttribution: product.showAttribution,
|
|
14
16
|
showInstructions: product.showInstructions,
|
|
15
17
|
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
16
18
|
delegate: self
|
|
17
19
|
)
|
|
18
|
-
}.navigationViewStyle(StackNavigationViewStyle())
|
|
20
|
+
}.navigationViewStyle(StackNavigationViewStyle())
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
|