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

[VwG] Add verification flow example to DaysUntilBirthday Sample App. #452

Merged
merged 9 commits into from
Jul 16, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class VerificationLoader: ObservableObject {
/// Verifies the user's age based upon the selected account.
brnnmrls marked this conversation as resolved.
Show resolved Hide resolved
/// - note: Successful calls to this method will set the `verificationState` property of the
/// `verifiedAgeViewModel` instance passed to the initializer.
func verifyAccountDetails() {
func verifyUserAge() {
let accountDetails: [GIDVerifiableAccountDetail] = [
GIDVerifiableAccountDetail(accountDetailType: .ageOver18)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,9 @@ final class VerifiedAgeViewModel: ObservableObject {
self.verificationState = .unverified
}

/// Verifies the user.
func verifyAccountDetails() {
switch self.verificationState {
case .unverified:
loader.verifyAccountDetails()
case .verified:
return
}
/// Verifies the user's age over 18.
func verifyUserAge() {
loader.verifyUserAge()
}
}

Expand Down
5 changes: 4 additions & 1 deletion Samples/Swift/DaysUntilBirthday/iOS/UserProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ struct UserProfileView: View {
NavigationLink(NSLocalizedString("Verify My Age", comment: "Verify Age"),
destination: VerificationView(verifiedAgeViewModel: verifiedAgeViewModel)
.onAppear {
verifiedAgeViewModel.verifyAccountDetails()
verifiedAgeViewModel.verifyUserAge()
}
.onDisappear {
verifiedAgeViewModel.verificationState = .unverified
mdmathias marked this conversation as resolved.
Show resolved Hide resolved
})
#endif
Spacer()
Expand Down
Loading