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

Commit

Permalink
Fix #8209: Better message when tracking is disabled for the Privacy H…
Browse files Browse the repository at this point in the history
…ub. (#8210)
  • Loading branch information
iccub authored Oct 13, 2023
1 parent 8dca22d commit ca3ed63
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Shared
import BraveShared
import BraveUI
import Data
import Preferences

extension PrivacyReportsView {
struct PrivacyHubLastWeekSection: View {
Expand All @@ -21,10 +22,14 @@ extension PrivacyReportsView {
return mostFrequentTracker == nil && riskiestWebsite == nil
}

private var noDataCalloutView: some View {
private var trackingDisabled: Bool {
!Preferences.PrivacyReports.captureShieldsData.value
}

private func emptyCalloutView(text: String) -> some View {
HStack {
Image(systemName: "info.circle.fill")
Text(Strings.PrivacyHub.noDataCalloutBody)
Text(text)
}
.foregroundColor(Color.white)
.frame(maxWidth: .infinity)
Expand All @@ -36,7 +41,13 @@ extension PrivacyReportsView {
var body: some View {
VStack(alignment: .leading, spacing: 8) {
if noData {
noDataCalloutView
if trackingDisabled {
emptyCalloutView(text:
String.localizedStringWithFormat(Strings.PrivacyHub.trackingDisabledCalloutBody,
Strings.PrivacyHub.settingsEnableShieldsTitle))
} else {
emptyCalloutView(text: Strings.PrivacyHub.noDataCalloutBody)
}
}

Text(Strings.PrivacyHub.lastWeekHeader.uppercased())
Expand Down
12 changes: 0 additions & 12 deletions Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyReportsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@ struct PrivacyReportsView: View {
.foregroundColor(Color(.braveBlurpleTint))
}

private var noDataCalloutView: some View {
HStack {
Image(systemName: "info.circle.fill")
Text(Strings.PrivacyHub.noDataCalloutBody)
}
.foregroundColor(Color.white)
.frame(maxWidth: .infinity)
.padding()
.background(Color(.braveInfoLabel))
.clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous))
}

var body: some View {
NavigationView {
ScrollView(.vertical) {
Expand Down
5 changes: 5 additions & 0 deletions Sources/BraveStrings/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4365,6 +4365,11 @@ extension Strings {
comment: "Text of a callout that tell user they need to browser some websites first in order to see privacy stats data"
)

public static let trackingDisabledCalloutBody = NSLocalizedString("privacyHub.trackingDisabledCalloutBody", tableName: "BraveShared", bundle: .module,
value: "Enable '%@' to see data here",
comment: "Text of a callout that tells the user they shields tracking data is disabled. The %@ placeholder will name the setting that needs to be enabled"
)

public static let lastWeekHeader = NSLocalizedString("privacyHub.lastWeekHeader", tableName: "BraveShared", bundle: .module,
value: "Last week",
comment: "Header text, under it we display blocked items from last week"
Expand Down

0 comments on commit ca3ed63

Please sign in to comment.