Skip to content

Commit

Permalink
Replace deprecated .alert and add check for iOS 15+.
Browse files Browse the repository at this point in the history
  • Loading branch information
brnnmrls committed Jul 23, 2024
1 parent 885fe55 commit f524f15
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions Samples/Swift/DaysUntilBirthday/Shared/Views/VerificationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,50 @@ struct VerificationView: View {
}
.padding(10)
.overlay(
RoundedRectangle(cornerRadius: 30)
.stroke(Color.gray)
RoundedRectangle(cornerRadius: 30)
.stroke(Color.gray)
)
.padding(.bottom)
if #available(iOS 15, *) {
VStack(alignment:.leading) {
Text("List of result object properties:")
.font(.headline)

VStack(alignment:.leading) {
Text("List of result object properties:")
.font(.headline)

HStack(alignment: .top) {
Text("Access Token:")
Text(result.accessToken?.tokenString ?? "Not available")
}
HStack(alignment: .top) {
Text("Refresh Token:")
Text(result.refreshToken?.tokenString ?? "Not available")
}
HStack {
Text("Expiration:")
if let expirationDate = result.accessToken?.expirationDate {
Text(formatDateWithDateFormatter(expirationDate))
} else {
Text("Not available")
HStack(alignment: .top) {
Text("Access Token:")
Text(result.accessToken?.tokenString ?? "Not available")
}
HStack(alignment: .top) {
Text("Refresh Token:")
Text(result.refreshToken?.tokenString ?? "Not available")
}
HStack {
Text("Expiration:")
if let expirationDate = result.accessToken?.expirationDate {
Text(formatDateWithDateFormatter(expirationDate))
} else {
Text("Not available")
}
}
Spacer()
}
Spacer()
}
.navigationTitle("Verified Account!")
.toolbar {
ToolbarItemGroup(placement: .navigationBarTrailing) {
Button(NSLocalizedString("Refresh", comment: "Refresh button"),
action:{refresh(results: result)})
.navigationTitle("Verified Account!")
.toolbar {
ToolbarItemGroup(placement: .navigationBarTrailing) {
Button(NSLocalizedString("Refresh", comment: "Refresh button"),
action:{refresh(results: result)})
}
}
}
.sheet(isPresented: $verifiedAgeViewModel.isShowingAgeVerificationSignal) {
.sheet(isPresented: $verifiedAgeViewModel.isShowingAgeVerificationSignal) {
AgeVerificationResultView(ageVerificationSignal: verifiedAgeViewModel.ageVerificationSignal)
}
.alert("Oh no! User is not verified over 18.",
isPresented: $verifiedAgeViewModel.isShowingAgeVerificationAlert) {
Button("OK", role: .cancel) { }
} message: {
Text("Age Verification Signal: \(verifiedAgeViewModel.ageVerificationSignal)")
}
}
.alert(isPresented: $verifiedAgeViewModel.isShowingAgeVerificationAlert, content: {
Alert(
title: Text("Oh no! User is not verified over 18."),
message: Text("Age Verification Signal: \(verifiedAgeViewModel.ageVerificationSignal)"),
dismissButton: .cancel()
)
})
case .unverified:
ProgressView()
.navigationTitle(NSLocalizedString("Unverified account",
Expand Down

0 comments on commit f524f15

Please sign in to comment.