@smile_identity/react-native 10.0.0-beta02 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/smileidentity/react/Mapper.kt +172 -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/CustomViewModelStoreOwner.kt +12 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDBiometricKYCView.kt +30 -22
- package/android/src/main/java/com/smileidentity/react/views/SmileIDConsentView.kt +19 -14
- package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerificationView.kt +34 -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 +28 -22
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt +28 -22
- package/android/src/main/java/com/smileidentity/react/views/SmileIDView.kt +20 -7
- package/android/src/oldarch/SmileIdSpec.kt +23 -1
- package/ios/RNSmileID.mm +10 -0
- package/ios/RNSmileID.swift +137 -0
- package/ios/Utils/SmileIDDictExt.swift +145 -6
- package/ios/View/BaseSmileIDView.swift +26 -9
- package/ios/View/SmileIDBiometricKYCView.swift +6 -4
- package/ios/View/SmileIDConsentView.swift +15 -8
- 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 +14 -4
- package/ios/ViewManagers/SmileIDBiometricKYCViewManager.m +1 -0
- package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +11 -10
- package/ios/ViewManagers/SmileIDConsentViewManager.m +1 -0
- package/ios/ViewManagers/SmileIDConsentViewManager.swift +9 -9
- package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.m +1 -0
- package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.swift +17 -16
- package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.m +1 -0
- package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +16 -15
- package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationViewManager.m +1 -0
- package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationViewManager.swift +10 -9
- package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentViewManager.m +1 -0
- package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentViewManager.swift +10 -9
- package/ios/ViewModels/SmileIDProductModel.swift +2 -1
- package/lib/commonjs/NativeSmileId.js.map +1 -1
- package/lib/commonjs/index.js +144 -4
- 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 +45 -7
- 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 +44 -6
- 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 +97 -7
- package/src/types.ts +985 -90
- package/android/src/main/assets/smile_config.json +0 -9
|
@@ -1,6 +1,8 @@
|
|
|
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.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
7
|
import com.smileidentity.SmileID
|
|
6
8
|
import com.smileidentity.compose.BiometricKYC
|
|
@@ -9,6 +11,7 @@ import com.smileidentity.results.BiometricKycResult
|
|
|
9
11
|
import com.smileidentity.results.SmileIDResult
|
|
10
12
|
import com.smileidentity.util.randomJobId
|
|
11
13
|
import com.smileidentity.util.randomUserId
|
|
14
|
+
import kotlinx.collections.immutable.toImmutableMap
|
|
12
15
|
import timber.log.Timber
|
|
13
16
|
|
|
14
17
|
class SmileIDBiometricKYCView(context: ReactApplicationContext) : SmileIDView(context) {
|
|
@@ -18,32 +21,37 @@ class SmileIDBiometricKYCView(context: ReactApplicationContext) : SmileIDView(co
|
|
|
18
21
|
emitFailure(IllegalArgumentException("idInfo is required for BiometricKYC"))
|
|
19
22
|
return
|
|
20
23
|
}
|
|
21
|
-
|
|
22
24
|
composeView.apply {
|
|
25
|
+
val customViewModelStoreOwner = CustomViewModelStoreOwner()
|
|
23
26
|
setContent {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides customViewModelStoreOwner) {
|
|
28
|
+
SmileID.BiometricKYC(
|
|
29
|
+
idInfo = idInfo!!,
|
|
30
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
31
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
32
|
+
allowAgentMode = allowAgentMode ?: false,
|
|
33
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
34
|
+
showAttribution = showAttribution ?: true,
|
|
35
|
+
showInstructions = showInstructions ?: true,
|
|
36
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
37
|
+
) { result ->
|
|
38
|
+
when (result) {
|
|
39
|
+
is SmileIDResult.Success -> {
|
|
40
|
+
val json = try {
|
|
41
|
+
SmileID.moshi
|
|
42
|
+
.adapter(BiometricKycResult::class.java)
|
|
43
|
+
.toJson(result.data)
|
|
44
|
+
} catch (e: Exception) {
|
|
45
|
+
Timber.w(e)
|
|
46
|
+
"null"
|
|
47
|
+
}
|
|
48
|
+
emitSuccess(json)
|
|
40
49
|
}
|
|
41
|
-
emitSuccess(json)
|
|
42
|
-
}
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
is SmileIDResult.Error -> {
|
|
52
|
+
result.throwable.printStackTrace()
|
|
53
|
+
emitFailure(result.throwable)
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
57
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
package com.smileidentity.react.views
|
|
2
2
|
|
|
3
3
|
import android.webkit.URLUtil
|
|
4
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
4
5
|
import androidx.compose.ui.res.painterResource
|
|
6
|
+
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
5
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
8
|
import com.smileidentity.SmileID
|
|
7
9
|
import com.smileidentity.compose.ConsentScreen
|
|
@@ -39,21 +41,24 @@ class SmileIDConsentView(context: ReactApplicationContext) : SmileIDView(context
|
|
|
39
41
|
(context as? ReactApplicationContext)?.currentActivity?.packageName
|
|
40
42
|
)
|
|
41
43
|
composeView.apply {
|
|
44
|
+
val customViewModelStoreOwner = CustomViewModelStoreOwner()
|
|
42
45
|
setContent {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides customViewModelStoreOwner) {
|
|
47
|
+
SmileID.ConsentScreen(
|
|
48
|
+
partnerIcon = painterResource(
|
|
49
|
+
id = partnerIcon
|
|
50
|
+
),
|
|
51
|
+
partnerName = partnerName!!,
|
|
52
|
+
productName = productName!!,
|
|
53
|
+
partnerPrivacyPolicy = URL(partnerPrivacyPolicy),
|
|
54
|
+
onConsentDenied = {
|
|
55
|
+
emitSuccess("denied")
|
|
56
|
+
},
|
|
57
|
+
onConsentGranted = {
|
|
58
|
+
emitSuccess("accepted")
|
|
59
|
+
},
|
|
60
|
+
)
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
}
|
package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerificationView.kt
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
7
|
import com.smileidentity.SmileID
|
|
6
8
|
import com.smileidentity.compose.DocumentVerification
|
|
@@ -30,36 +32,41 @@ class SmileIDDocumentVerificationView(context: ReactApplicationContext) : SmileI
|
|
|
30
32
|
bypassSelfieCaptureWithFile = File(it)
|
|
31
33
|
}
|
|
32
34
|
composeView.apply {
|
|
35
|
+
val customViewModelStoreOwner = CustomViewModelStoreOwner()
|
|
33
36
|
setContent {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
37
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides customViewModelStoreOwner) {
|
|
38
|
+
SmileID.DocumentVerification(
|
|
39
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
40
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
41
|
+
countryCode = countryCode!!,
|
|
42
|
+
documentType = documentType,
|
|
43
|
+
idAspectRatio = idAspectRatio,
|
|
44
|
+
showAttribution = showAttribution ?: true,
|
|
45
|
+
allowAgentMode = allowAgentMode ?: false,
|
|
46
|
+
showInstructions = showInstructions ?: true,
|
|
47
|
+
allowGalleryUpload = allowGalleryUpload,
|
|
48
|
+
captureBothSides = captureBothSides,
|
|
49
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
50
|
+
bypassSelfieCaptureWithFile = bypassSelfieCaptureWithFile,
|
|
51
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
52
|
+
) { result ->
|
|
53
|
+
when (result) {
|
|
54
|
+
is SmileIDResult.Success -> {
|
|
55
|
+
val json = try {
|
|
56
|
+
SmileID.moshi
|
|
57
|
+
.adapter(DocumentVerificationResult::class.java)
|
|
58
|
+
.toJson(result.data)
|
|
59
|
+
} catch (e: Exception) {
|
|
60
|
+
Timber.w(e)
|
|
61
|
+
"null"
|
|
62
|
+
}
|
|
63
|
+
emitSuccess(json)
|
|
56
64
|
}
|
|
57
|
-
emitSuccess(json)
|
|
58
|
-
}
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
is SmileIDResult.Error -> {
|
|
67
|
+
result.throwable.printStackTrace()
|
|
68
|
+
emitFailure(result.throwable)
|
|
69
|
+
}
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
72
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
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.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
7
|
import com.smileidentity.SmileID
|
|
6
8
|
import com.smileidentity.compose.EnhancedDocumentVerificationScreen
|
|
@@ -24,36 +26,42 @@ class SmileIDEnhancedDocumentVerificationView(context: ReactApplicationContext)
|
|
|
24
26
|
emitFailure(IllegalArgumentException("countryCode is required for DocumentVerification"))
|
|
25
27
|
return;
|
|
26
28
|
}
|
|
29
|
+
|
|
27
30
|
composeView.apply {
|
|
31
|
+
val customViewModelStoreOwner = CustomViewModelStoreOwner()
|
|
28
32
|
setContent {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides customViewModelStoreOwner) {
|
|
34
|
+
SmileID.EnhancedDocumentVerificationScreen(
|
|
35
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
36
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
37
|
+
countryCode = countryCode!!,
|
|
38
|
+
documentType = documentType,
|
|
39
|
+
idAspectRatio = idAspectRatio,
|
|
40
|
+
showAttribution = showAttribution ?: true,
|
|
41
|
+
allowAgentMode = allowAgentMode ?: false,
|
|
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,8 @@
|
|
|
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.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
7
|
import com.smileidentity.SmileID
|
|
6
8
|
import com.smileidentity.compose.SmartSelfieAuthentication
|
|
@@ -16,31 +18,35 @@ class SmileIDSmartSelfieAuthenticationView(context: ReactApplicationContext) :
|
|
|
16
18
|
|
|
17
19
|
override fun renderContent() {
|
|
18
20
|
composeView.apply {
|
|
21
|
+
val customViewModelStoreOwner = CustomViewModelStoreOwner()
|
|
19
22
|
setContent {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides customViewModelStoreOwner) {
|
|
24
|
+
SmileID.SmartSelfieAuthentication(
|
|
25
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
26
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
27
|
+
allowAgentMode = allowAgentMode ?: false,
|
|
28
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
29
|
+
showAttribution = showAttribution ?: true,
|
|
30
|
+
showInstructions = showInstructions ?: true,
|
|
31
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
32
|
+
) { result ->
|
|
33
|
+
when (result) {
|
|
34
|
+
is SmileIDResult.Success -> {
|
|
35
|
+
val json = try {
|
|
36
|
+
SmileID.moshi
|
|
37
|
+
.adapter(SmartSelfieResult::class.java)
|
|
38
|
+
.toJson(result.data)
|
|
39
|
+
} catch (e: Exception) {
|
|
40
|
+
Timber.w(e)
|
|
41
|
+
"null"
|
|
42
|
+
}
|
|
43
|
+
emitSuccess(json)
|
|
37
44
|
}
|
|
38
|
-
emitSuccess(json)
|
|
39
|
-
}
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
is SmileIDResult.Error -> {
|
|
47
|
+
result.throwable.printStackTrace()
|
|
48
|
+
emitFailure(result.throwable)
|
|
49
|
+
}
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
}
|
package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
|
|
4
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
7
|
import com.smileidentity.SmileID
|
|
6
8
|
import com.smileidentity.compose.SmartSelfieEnrollment
|
|
@@ -15,31 +17,35 @@ class SmileIDSmartSelfieEnrollmentView(context: ReactApplicationContext) : Smile
|
|
|
15
17
|
|
|
16
18
|
override fun renderContent() {
|
|
17
19
|
composeView.apply {
|
|
20
|
+
val customViewModelStoreOwner = CustomViewModelStoreOwner()
|
|
18
21
|
setContent {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
CompositionLocalProvider(LocalViewModelStoreOwner provides customViewModelStoreOwner) {
|
|
23
|
+
SmileID.SmartSelfieEnrollment(
|
|
24
|
+
userId = userId ?: rememberSaveable { randomUserId() },
|
|
25
|
+
jobId = jobId ?: rememberSaveable { randomJobId() },
|
|
26
|
+
allowAgentMode = allowAgentMode ?: false,
|
|
27
|
+
allowNewEnroll = allowNewEnroll ?: false,
|
|
28
|
+
showAttribution = showAttribution ?: true,
|
|
29
|
+
showInstructions = showInstructions ?: true,
|
|
30
|
+
extraPartnerParams = (extraPartnerParams ?: mapOf()).toImmutableMap(),
|
|
31
|
+
) { result ->
|
|
32
|
+
when (result) {
|
|
33
|
+
is SmileIDResult.Success -> {
|
|
34
|
+
val json = try {
|
|
35
|
+
SmileID.moshi
|
|
36
|
+
.adapter(SmartSelfieResult::class.java)
|
|
37
|
+
.toJson(result.data)
|
|
38
|
+
} catch (e: Exception) {
|
|
39
|
+
Timber.w(e)
|
|
40
|
+
"null"
|
|
41
|
+
}
|
|
42
|
+
emitSuccess(json)
|
|
36
43
|
}
|
|
37
|
-
emitSuccess(json)
|
|
38
|
-
}
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
is SmileIDResult.Error -> {
|
|
46
|
+
result.throwable.printStackTrace()
|
|
47
|
+
emitFailure(result.throwable)
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
}
|
|
@@ -4,6 +4,7 @@ import android.view.Choreographer
|
|
|
4
4
|
import android.view.ViewGroup
|
|
5
5
|
import android.widget.LinearLayout
|
|
6
6
|
import androidx.compose.ui.platform.ComposeView
|
|
7
|
+
import androidx.core.view.contains
|
|
7
8
|
import com.facebook.react.bridge.Arguments
|
|
8
9
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
10
|
import com.facebook.react.bridge.ReactContext
|
|
@@ -13,11 +14,12 @@ import com.smileidentity.models.JobType
|
|
|
13
14
|
import timber.log.Timber
|
|
14
15
|
|
|
15
16
|
abstract class SmileIDView(context: ReactApplicationContext) : LinearLayout(context) {
|
|
16
|
-
|
|
17
|
+
lateinit var composeView: ComposeView
|
|
17
18
|
var userId: String? = null
|
|
18
19
|
var jobId: String? = null
|
|
19
20
|
private var jobType: JobType? = null
|
|
20
21
|
var allowAgentMode: Boolean? = false
|
|
22
|
+
var allowNewEnroll: Boolean? = false
|
|
21
23
|
var showInstructions: Boolean? = true
|
|
22
24
|
var showAttribution: Boolean? = true
|
|
23
25
|
var extraPartnerParams: Map<String, String>? = null
|
|
@@ -34,19 +36,30 @@ abstract class SmileIDView(context: ReactApplicationContext) : LinearLayout(cont
|
|
|
34
36
|
orientation = VERTICAL
|
|
35
37
|
render()
|
|
36
38
|
|
|
37
|
-
composeView.layoutParams = ViewGroup.LayoutParams(
|
|
38
|
-
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
39
|
-
ViewGroup.LayoutParams.MATCH_PARENT
|
|
40
|
-
)
|
|
41
|
-
addView(composeView)
|
|
42
|
-
|
|
43
39
|
setupLayoutHack()
|
|
44
40
|
manuallyLayoutChildren()
|
|
45
41
|
}
|
|
46
42
|
|
|
43
|
+
private fun setUpViews() {
|
|
44
|
+
if (::composeView.isInitialized && contains(composeView)) {
|
|
45
|
+
removeView(composeView)
|
|
46
|
+
}
|
|
47
|
+
(context as ReactContext).currentActivity?.let {
|
|
48
|
+
it.runOnUiThread {
|
|
49
|
+
composeView = ComposeView(it)
|
|
50
|
+
composeView.layoutParams = ViewGroup.LayoutParams(
|
|
51
|
+
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
52
|
+
ViewGroup.LayoutParams.MATCH_PARENT
|
|
53
|
+
)
|
|
54
|
+
addView(composeView)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
47
59
|
abstract fun renderContent()
|
|
48
60
|
|
|
49
61
|
open fun render() {
|
|
62
|
+
setUpViews()
|
|
50
63
|
renderContent()
|
|
51
64
|
}
|
|
52
65
|
|
|
@@ -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
|
}
|
package/ios/RNSmileID.mm
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
@interface RCT_EXTERN_MODULE(RNSmileID, NSObject)
|
|
4
4
|
RCT_EXTERN_METHOD(initialize:(BOOL)useSandBox withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
5
|
+
RCT_EXTERN_METHOD(authenticate:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
6
|
+
RCT_EXTERN_METHOD(prepUpload:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
7
|
+
RCT_EXTERN_METHOD(upload:(NSString *)url request:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
5
8
|
RCT_EXTERN_METHOD(doEnhancedKyc:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
6
9
|
RCT_EXTERN_METHOD(doEnhancedKycAsync:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
10
|
+
RCT_EXTERN_METHOD(getSmartSelfieJobStatus:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
11
|
+
RCT_EXTERN_METHOD(getDocumentVerificationJobStatus:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
12
|
+
RCT_EXTERN_METHOD(getBiometricKycJobStatus:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
13
|
+
RCT_EXTERN_METHOD(getEnhancedDocumentVerificationJobStatus:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
14
|
+
RCT_EXTERN_METHOD(getProductsConfig:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
15
|
+
RCT_EXTERN_METHOD(getValidDocuments:(NSDictionary *)request withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
16
|
+
RCT_EXTERN_METHOD(getServicesWithResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject)
|
|
7
17
|
@end
|