Skip to content

Commit f9ead67

Browse files
authored
fix(ConfirmSignUp): Updating the state's deliveryDetails property when a new code is sent (#65)
1 parent 71fb556 commit f9ead67

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Sources/Authenticator/Authenticator.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,12 @@ public struct Authenticator<LoadingContent: View,
245245
}
246246
}
247247
.onReceive(state.$step) {
248+
// Currently, the only Step that can transition to itself is `.confirmSignUp(deliveryDetails)`,
249+
// when new delivery details are populated by requesting a new code.
250+
// We don't want to re-draw the Authenticator on said situations, so ignore it.
251+
guard $0.authenticatorStep != self.currentStep.authenticatorStep else {
252+
return
253+
}
248254
self.previousStep = self.currentStep
249255
self.currentStep = $0
250256
}

Sources/Authenticator/States/ConfirmSignUpState.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public class ConfirmSignUpState: AuthenticatorBaseState {
6565
)
6666

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

0 commit comments

Comments
 (0)