diff --git a/FuelBoard/StationDetailView.swift b/FuelBoard/StationDetailView.swift index cd788e7..cf1943f 100644 --- a/FuelBoard/StationDetailView.swift +++ b/FuelBoard/StationDetailView.swift @@ -11,6 +11,9 @@ struct StationDetailView: View { let location: Coordinate? let distanceUnit: DistanceUnit @Environment(\.dismiss) private var dismiss + @State private var showingReportIssueConfirmation = false + + private let reportIssueURL = URL(string: "https://www.gov.uk/guidance/report-an-error-in-fuel-prices-or-forecourt-details")! private var stationCoordinate: CLLocationCoordinate2D { CLLocationCoordinate2D(latitude: station.lat, longitude: station.lng) @@ -51,10 +54,23 @@ struct StationDetailView: View { } label: { Label("Directions", systemImage: "arrow.triangle.turn.up.right.diamond.fill") } + Button(role: .destructive) { + showingReportIssueConfirmation = true + } label: { + Label("Report issue", systemImage: "exclamationmark.bubble.fill") + } } } .navigationTitle(station.name) .navigationBarTitleDisplayMode(.inline) + .alert("Report an error?", isPresented: $showingReportIssueConfirmation) { + Button("Cancel", role: .cancel) { } + Button("Open GOV.UK") { + UIApplication.shared.open(reportIssueURL) + } + } message: { + Text("Are you sure you want to report an error in fuel prices or forecourt details? This will open in your chosen browser.") + } .toolbar { ToolbarItem(placement: .cancellationAction) { Button("Done") { dismiss() } diff --git a/FuelBoard/en.lproj/Localizable.strings b/FuelBoard/en.lproj/Localizable.strings index 17cd4d2..ac754c2 100644 --- a/FuelBoard/en.lproj/Localizable.strings +++ b/FuelBoard/en.lproj/Localizable.strings @@ -147,6 +147,11 @@ "You" = "You"; "Done" = "Done"; "Directions" = "Directions"; +"Report issue" = "Report issue"; +"Report an error?" = "Report an error?"; +"Cancel" = "Cancel"; +"Open GOV.UK" = "Open GOV.UK"; +"Are you sure you want to report an error in fuel prices or forecourt details? This will open in your chosen browser." = "Are you sure you want to report an error in fuel prices or forecourt details? This will open in your chosen browser."; /* Station row */ "best" = "best";