Skip to content

Conversation

@wangerekaharun
Copy link
Member

@wangerekaharun wangerekaharun commented Aug 5, 2025

User description

Story: https://app.shortcut.com/smileid/story/xxx

Summary

A few sentences/bullet points about the changes

Known Issues

Any shortcomings in your work. This may include corner cases not correctly handled or issues related
to but not within the scope of your PR. Design compromises should be discussed here if they were not
already discussed above.

Test Instructions

Concise test instructions on how to verify that your feature works as intended. This should include
changes to the development environment (if applicable) and all commands needed to run your work.

Screenshot

If applicable (e.g. UI changes), add screenshots to help explain your work.


PR Type

Enhancement


Description

• Replace enableAutoCapture with AutoCapture enum for better control
• Add autoCaptureTimeout parameter for configurable capture timing
• Update Android and iOS SDKs to v11.1.0
• Remove default ConsentInformation values, now supports null


Changes walkthrough 📝

Relevant files
Enhancement
18 files
Mapper.kt
Add AutoCapture enum mapping function                                       
+15/-0   
SmileIDBiometricKYCViewManager.kt
Remove default ConsentInformation requirement                       
+0/-8     
SmileIDDocumentCaptureViewManager.kt
Add auto capture timeout and enum support                               
+4/-0     
SmileIDDocumentVerificationViewManager.kt
Replace enableAutoCapture with timeout and enum                   
+4/-1     
SmileIDEnhancedDocumentVerificationViewManager.kt
Update auto capture and consent handling                                 
+4/-9     
SmileIDBiometricKYCView.kt
Make consentInformation optional parameter                             
+1/-5     
SmileIDDocumentCaptureView.kt
Add auto capture timeout and enum properties                         
+8/-0     
SmileIDDocumentVerificationView.kt
Replace boolean with timeout and enum                                       
+7/-2     
SmileIDEnhancedDocumentVerificationView.kt
Update auto capture and consent parameters                             
+9/-9     
HomeScreen.tsx
Add auto capture configuration examples                                   
+8/-1     
types.ts
Add AutoCapture enum and update interfaces                             
+14/-2   
SmileIDUtils.swift
Add AutoCapture enum conversion function                                 
+16/-0   
SmileIDBiometricKYCView.swift
Remove consent information validation requirement               
+1/-1     
SmileIDDocumentCaptureView.swift
Replace enableAutoCapture with timeout and enum                   
+2/-1     
SmileIDDocumentVerificationView.swift
Update auto capture parameters                                                     
+2/-1     
SmileIDEnhancedDocumentVerificationView.swift
Replace boolean with timeout and enum                                       
+2/-1     
SmileIDBiometricKYCViewManager.swift
Remove default ConsentInformation creation                             
+1/-8     
SmileIDDocumentCaptureViewManager.swift
Add auto capture timeout and enum handling                             
+8/-0     
Bug fix
1 files
SmileIdModule.kt
Fix BuildConfig import reference                                                 
+1/-1     
Additional files
8 files
CHANGELOG.md +9/-1     
gradle.properties +1/-1     
PrivacyInfo.xcprivacy +7/-7     
SmileIDDocumentVerificationViewManager.swift +7/-1     
SmileIDEnhancedDocumentVerificationViewManager.swift +8/-9     
SmileIDProductModel.swift +3/-9     
package.json +1/-1     
react-native-smile-id.podspec +1/-1     

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • @prfectionist
    Copy link
    Contributor

    prfectionist bot commented Aug 5, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling

    The toAutoCapture() function throws IllegalArgumentException for invalid values but doesn't handle null input gracefully. Consider adding null safety or documenting the expected behavior.

    fun String.toAutoCapture() : AutoCapture {
      return when (this) {
        "AutoCapture" -> AutoCapture.AutoCapture
        "AutoCaptureOnly" -> AutoCapture.AutoCaptureOnly
        "ManualCaptureOnly" -> AutoCapture.ManualCaptureOnly
        else -> {
          throw IllegalArgumentException(
            "Invalid autoCapture value: $this. " +
              "Expected 'AutoCapture', 'AutoCaptureOnly', or 'ManualCaptureOnly'."
          )
        }
      }
    }
    Default Fallback

    The toAutoCapture() extension returns .autoCapture as default for unrecognized strings, which differs from the Android implementation that throws an exception. This inconsistency could lead to different behaviors across platforms.

    extension String {
        func toAutoCapture()  -> AutoCapture {
            switch self {
            case "AutoCapture":
                return .autoCapture
            case "AutoCaptureOnly":
                return .autoCaptureOnly
            case "ManualCaptureOnly":
                return .manualCaptureOnly
            default:
              return .autoCapture
            }
        }
    }
    Default Values

    The default timeout is hardcoded to 10 seconds in multiple places. Consider extracting this to a constant to ensure consistency and easier maintenance across the codebase.

    autoCaptureTimeout = autoCaptureTimeout?.seconds ?: 10.seconds,
    autoCapture = autoCapture ?: AutoCapture.AutoCapture,

    Comment on lines +238 to +250
    fun String.toAutoCapture() : AutoCapture {
    return when (this) {
    "AutoCapture" -> AutoCapture.AutoCapture
    "AutoCaptureOnly" -> AutoCapture.AutoCaptureOnly
    "ManualCaptureOnly" -> AutoCapture.ManualCaptureOnly
    else -> {
    throw IllegalArgumentException(
    "Invalid autoCapture value: $this. " +
    "Expected 'AutoCapture', 'AutoCaptureOnly', or 'ManualCaptureOnly'."
    )
    }
    }
    }
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Suggestion: The function should handle null input gracefully since it's called with nullable strings. Consider returning a default value or making the parameter nullable to prevent runtime crashes. [possible issue, importance: 7]

    Suggested change
    fun String.toAutoCapture() : AutoCapture {
    return when (this) {
    "AutoCapture" -> AutoCapture.AutoCapture
    "AutoCaptureOnly" -> AutoCapture.AutoCaptureOnly
    "ManualCaptureOnly" -> AutoCapture.ManualCaptureOnly
    else -> {
    throw IllegalArgumentException(
    "Invalid autoCapture value: $this. " +
    "Expected 'AutoCapture', 'AutoCaptureOnly', or 'ManualCaptureOnly'."
    )
    }
    }
    }
    fun String?.toAutoCapture() : AutoCapture {
    return when (this) {
    "AutoCapture" -> AutoCapture.AutoCapture
    "AutoCaptureOnly" -> AutoCapture.AutoCaptureOnly
    "ManualCaptureOnly" -> AutoCapture.ManualCaptureOnly
    null -> AutoCapture.AutoCapture
    else -> {
    throw IllegalArgumentException(
    "Invalid autoCapture value: $this. " +
    "Expected 'AutoCapture', 'AutoCaptureOnly', or 'ManualCaptureOnly'."
    )
    }
    }
    }

    Comment on lines +22 to +35
    extension String {
    func toAutoCapture() -> AutoCapture {
    switch self {
    case "AutoCapture":
    return .autoCapture
    case "AutoCaptureOnly":
    return .autoCaptureOnly
    case "ManualCaptureOnly":
    return .manualCaptureOnly
    default:
    return .autoCapture
    }
    }
    }
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Suggestion: The function silently returns a default value for invalid inputs, which could mask configuration errors. Consider throwing an error for invalid values to maintain consistency with the Android implementation. [general, importance: 5]

    Suggested change
    extension String {
    func toAutoCapture() -> AutoCapture {
    switch self {
    case "AutoCapture":
    return .autoCapture
    case "AutoCaptureOnly":
    return .autoCaptureOnly
    case "ManualCaptureOnly":
    return .manualCaptureOnly
    default:
    return .autoCapture
    }
    }
    }
    extension String {
    func toAutoCapture() throws -> AutoCapture {
    switch self {
    case "AutoCapture":
    return .autoCapture
    case "AutoCaptureOnly":
    return .autoCaptureOnly
    case "ManualCaptureOnly":
    return .manualCaptureOnly
    default:
    throw NSError(domain: "SmileIDError", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid autoCapture value: \(self). Expected 'AutoCapture', 'AutoCaptureOnly', or 'ManualCaptureOnly'."])
    }
    }
    }

    Comment on lines +80 to +81
    autoCaptureTimeout = autoCaptureTimeout?.seconds ?: 10.seconds,
    autoCapture = autoCapture ?: AutoCapture.AutoCapture,
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Suggestion: The timeout conversion could fail if autoCaptureTimeout contains an invalid value. Add validation to ensure the timeout is within reasonable bounds before conversion. [general, importance: 6]

    Suggested change
    autoCaptureTimeout = autoCaptureTimeout?.seconds ?: 10.seconds,
    autoCapture = autoCapture ?: AutoCapture.AutoCapture,
    autoCaptureTimeout = autoCaptureTimeout?.let {
    if (it > 0) it.seconds else 10.seconds
    } ?: 10.seconds,
    autoCapture = autoCapture ?: AutoCapture.AutoCapture,

    Comment on lines +31 to +32
    self.product.autoCaptureTimeout = params["autoCaptureTimeout"] as? Int ?? 10
    self.product.autoCapture = autoCapture?.toAutoCapture() ?? .autoCapture
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Suggestion: The timeout value should be validated to ensure it's positive before assignment. Negative or zero timeouts could cause unexpected behavior in the capture process. [general, importance: 6]

    Suggested change
    self.product.autoCaptureTimeout = params["autoCaptureTimeout"] as? Int ?? 10
    self.product.autoCapture = autoCapture?.toAutoCapture() ?? .autoCapture
    let timeout = params["autoCaptureTimeout"] as? Int ?? 10
    self.product.autoCaptureTimeout = max(1, timeout)
    self.product.autoCapture = autoCapture?.toAutoCapture() ?? .autoCapture

    @jumaallan jumaallan merged commit c50dc9e into main Aug 5, 2025
    11 checks passed
    @jumaallan jumaallan deleted the feat/update-to-v11.1.0 branch August 5, 2025 20:11
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants