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

fix(ConfirmSignUp): Updating the state's deliveryDetails property when a new code is sent #65

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sources/Authenticator/Authenticator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ public struct Authenticator<LoadingContent: View,
}
}
.onReceive(state.$step) {
// Currently, the only Step that can transition to itself is `.confirmSignUp(deliveryDetails)`,
// when new delivery details are populated by requesting a new code.
// We don't want to re-draw the Authenticator on said situations, so ignore it.
guard $0.authenticatorStep != self.currentStep.authenticatorStep else {
return
}
self.previousStep = self.currentStep
self.currentStep = $0
}
Expand Down
1 change: 1 addition & 0 deletions Sources/Authenticator/States/ConfirmSignUpState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class ConfirmSignUpState: AuthenticatorBaseState {
)

setMessage(.info(message: localizedMessage(for: details)))
authenticatorState.setCurrentStep(.confirmSignUp(deliveryDetails: details))
} catch {
log.error("Unable to resend the Sign Up confirmation code")
let authenticationError = self.error(for: error)
Expand Down