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

Fix #8209: Better message when tracking is disabled for the Privacy Hub. #8210

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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