Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Push web-compat report success
Browse files Browse the repository at this point in the history
  • Loading branch information
cuba committed Oct 10, 2023
1 parent a4ff1bb commit 280aae4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,6 @@ extension BrowserViewController: TopToolbarDelegate {
sheet.largestUndimmedDetentIdentifier = .medium
sheet.prefersEdgeAttachedInCompactHeight = true
sheet.widthFollowsPreferredContentSizeWhenEdgeAttached = true

// Allows the user to reference the sheet
sheet.detents = [.medium(), .large()]
}
navigationController?.present(viewController, animated: true)
Expand Down
51 changes: 19 additions & 32 deletions Sources/Brave/Frontend/Shields/SubmitReportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ struct SubmitReportView: View {

private var scrollContent: some View {
ScrollView {
// When we drop iOS 16, we can use NavigationStack with .navigationDestination
// For now we use a hack available to iOS 16
NavigationLink(isActive: $isSubmitted) {
SubmitReportSuccessView()
.navigationBarHidden(true)
} label: {
EmptyView()
}

VStack(alignment: .leading, spacing: 16) {
Text(Strings.Shields.reportBrokenSiteBody1)
Text(url.absoluteString)
Expand Down Expand Up @@ -52,32 +61,18 @@ struct SubmitReportView: View {
.foregroundStyle(Color(braveSystemName: .textSecondary))
.navigationTitle(Strings.Shields.reportABrokenSite)
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button(Strings.cancelButtonTitle) {
dismiss()
}
.disabled(isSubmittingReport)
.hidden(isHidden: isSubmitted)
}

ToolbarItem(placement: .confirmationAction) {
if isSubmitted {
Button(Strings.close, action: {
dismiss()
})
} else {
Button(Strings.Shields.reportBrokenSubmitButtonTitle, action: {
isSubmittingReport = true
Button(Strings.Shields.reportBrokenSubmitButtonTitle, action: {
isSubmittingReport = true

Task { @MainActor in
await createAndSubmitReport()

Task { @MainActor in
await createAndSubmitReport()
isSubmitted = true

try await Task.sleep(seconds: 4)
dismiss()
}
}).disabled(isSubmittingReport)
}
isSubmitted = true
try await Task.sleep(seconds: 4)
dismiss()
}
}).disabled(isSubmittingReport)
}
}
.overlay {
Expand All @@ -89,14 +84,6 @@ struct SubmitReportView: View {
.transition(.opacity.animation(.default))
}
}
.overlay {
if isSubmitted {
SubmitReportSuccessView()
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(.braveBackground).ignoresSafeArea())
.transition(.opacity.animation(.default))
}
}
}

var body: some View {
Expand Down

0 comments on commit 280aae4

Please sign in to comment.