diff --git a/Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyHubLastWeekSection.swift b/Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyHubLastWeekSection.swift index 9a29e4c82c5..eae8df1ab74 100644 --- a/Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyHubLastWeekSection.swift +++ b/Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyHubLastWeekSection.swift @@ -8,6 +8,7 @@ import Shared import BraveShared import BraveUI import Data +import Preferences extension PrivacyReportsView { struct PrivacyHubLastWeekSection: View { @@ -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) @@ -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()) diff --git a/Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyReportsView.swift b/Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyReportsView.swift index 0dade80a4b8..2590c77c9d1 100644 --- a/Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyReportsView.swift +++ b/Sources/Brave/Frontend/Browser/PrivacyHub/PrivacyReportsView.swift @@ -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) { diff --git a/Sources/BraveStrings/BraveStrings.swift b/Sources/BraveStrings/BraveStrings.swift index bf3c843117d..576ab549d37 100644 --- a/Sources/BraveStrings/BraveStrings.swift +++ b/Sources/BraveStrings/BraveStrings.swift @@ -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"