Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Missing Navigation Buttons #302

Open
wants to merge 6 commits into
base: sdk-navigation-improvements
Choose a base branch
from

Conversation

tobitech
Copy link
Contributor

@tobitech tobitech commented Mar 6, 2025

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

Summary

  • Improve the BiometricKYC Flow to allow users return to ID Information collection flow.

Known Issues

N/A.

Test Instructions

  • Run a Biometric KYC job.
  • When you land on the Selfie Capture screen you should be able to cancel selfie capture and return to ID information collection. (This is so that users can return if they accidentally proceeded from ID information screen).
  • Partner developers should also be able to implement their own dismiss functionality when a user cancels from selfie capture with the onDismiss closure.

Screenshot

N/A

@tobitech tobitech self-assigned this Mar 6, 2025
Copy link

github-actions bot commented Mar 6, 2025

Warnings
⚠️ The source files were changed, but the tests remain unmodified. Consider updating or adding to the tests to match the source changes.
⚠️

Example/SmileID/BiometricKYC/BiometricKycWithIdInputScreenViewModel.swift#L107 - Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)

⚠️

Sources/SmileID/Classes/BiometricKYC/OrchestratedBiometricKycViewModel.swift#L157 - TODOs should be resolved (- Fix when Michael changes thi...). (todo)

⚠️

Sources/SmileID/Classes/SmileID.swift#L161 - Function should have complexity 10 or less: currently complexity equals 11 (cyclomatic_complexity)

⚠️

Sources/SmileID/Classes/SmileID.swift#L188 - TODOs should be resolved (- Fix when Michael changes thi...). (todo)

Generated by 🚫 Danger Swift against 5c803cd

@tobitech tobitech marked this pull request as ready for review March 10, 2025 08:59
@tobitech tobitech requested a review from a team as a code owner March 10, 2025 08:59
Copy link
Contributor

@robin-smileid robin-smileid left a comment

Choose a reason for hiding this comment

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

Tested a few flows with biometric kyc and cancel sends the user back to the id document capture. Great work @tobitech .

ActivityIndicator(isAnimating: true).padding()
Text(SmileIDResourcesHelper.localizedString(for: messageKey))
.font(SmileID.theme.body)
.foregroundColor(SmileID.theme.onLight)
Copy link
Member

Choose a reason for hiding this comment

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

should we replace this with the .light option or this does not get affected by dark mode on the device

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is from the theme class. Not affected by dark mode on the device.
PS: This is the same as on the main branch. I only wrapped the body of the screen inside a ZStack to prevent glitches.

onCancel()
} label: {
Text(SmileIDResourcesHelper.localizedString(for: "Action.Cancel"))
.foregroundColor(SmileID.theme.accent)
Copy link
Member

Choose a reason for hiding this comment

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

same question about this

@@ -38,7 +33,7 @@ class OrchestratedBiometricKycViewModel: ObservableObject {
if selfieFile != nil {
submitJob()
} else {
updateStep(.selfie)
updateProcessingState(nil)
Copy link
Member

Choose a reason for hiding this comment

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

We should maybe have a state that is not nil

Like use an actual name so it's even easier to go through the code and understand

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The state is used to drive navigation to the ProcessingScreen. nil means the job submission hasn't started, so processing screen isn't showing. That's why it's an optional value.

Copy link
Contributor

Choose a reason for hiding this comment

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

but we could have a default value right which'd make it more consistent or there is a con to that?

@@ -103,7 +98,7 @@ class OrchestratedBiometricKycViewModel: ObservableObject {

guard selfieFile != nil else {
// Set step to .selfieCapture so that the Retry button goes back to this step
updateStep(.selfie)
updateProcessingState(nil)
Copy link
Member

Choose a reason for hiding this comment

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

same here

onCancel()
} label: {
Text(SmileIDResourcesHelper.localizedString(for: "Action.Cancel"))
.foregroundColor(SmileID.theme.accent)
Copy link
Member

Choose a reason for hiding this comment

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

theme question here since this is inside the sdk

public class func biometricKycScreen(
config: BiometricVerificationConfig,
delegate: BiometricKycResultDelegate
delegate: BiometricKycResultDelegate,
onDismiss: (() -> Void)? = nil
Copy link
Member

Choose a reason for hiding this comment

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

we don't expose this on android - not opposed to it, but maybe we need to add something like that on android so that the wrappers are in sync

We also use the delegate to send the user cancelled action since you can use the back buttons on android

Copy link
Contributor Author

@tobitech tobitech Mar 12, 2025

Choose a reason for hiding this comment

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

Yeah, basically this is an orchestrated flow. We discussed that we put a constraint on how we want orchestrated flows to be presented. The goal was for orchestrated flows to only be presented as an interstitials and can be dismissed so that users can return back to the original flow.
This closure is for developers to handle that dismiss if they want to... notice that it's optional.
The other goal here is to separate navigation actions from job submission events (didSucceed or didError).

We can discuss about unifying the SDK methods.

Copy link
Contributor

Choose a reason for hiding this comment

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

How would this be better than a delegate/onResult with user cancelled as we have now?

Copy link
Member

@jumaallan jumaallan left a comment

Choose a reason for hiding this comment

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

Left some comments

@tobitech tobitech requested a review from jumaallan March 14, 2025 15:50
public class func biometricKycScreen(
config: BiometricVerificationConfig,
delegate: BiometricKycResultDelegate
delegate: BiometricKycResultDelegate,
onDismiss: (() -> Void)? = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

How would this be better than a delegate/onResult with user cancelled as we have now?

}
)
.transition(.move(edge: .leading))
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we not have this condition just be determined by state instead of a variable and also state?

@@ -38,7 +33,7 @@ class OrchestratedBiometricKycViewModel: ObservableObject {
if selfieFile != nil {
submitJob()
} else {
updateStep(.selfie)
updateProcessingState(nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

but we could have a default value right which'd make it more consistent or there is a con to that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants