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

Commit

Permalink
Localization is included.
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Nov 2, 2022
1 parent 90b13e0 commit afadcb4
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 33 deletions.
22 changes: 11 additions & 11 deletions Client/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1112,22 +1112,22 @@ public class BrowserViewController: UIViewController {
}

override public func viewDidAppear(_ animated: Bool) {
// // Passcode Migration has highest priority, it should be presented over everything else
// presentPassCodeMigration()
//
// // Present Onboarding to new users, existing users will not see the onboarding
// presentOnboardingIntro()
//
// // Full Screen Callout Presentation
// // Priority: P3A - VPN - Default Browser - Rewards
// // TODO: Remove the dispatch after with a proper fix and fix calling present functions before super.viewDidAppear
// DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
// Passcode Migration has highest priority, it should be presented over everything else
presentPassCodeMigration()

// Present Onboarding to new users, existing users will not see the onboarding
presentOnboardingIntro()

// Full Screen Callout Presentation
// Priority: P3A - VPN - Default Browser - Rewards
// TODO: Remove the dispatch after with a proper fix and fix calling present functions before super.viewDidAppear
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
self.presentP3AScreenCallout()
self.presentVPNAlertCallout()
self.presentDefaultBrowserScreenCallout()
self.presentBraveRewardsScreenCallout()
self.presentCookieNotificationBlockingCalloutIfNeeded()
// }
}

screenshotHelper.viewIsVisible = true
screenshotHelper.takePendingScreenshots(tabManager.allTabs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ extension BrowserViewController {
}

func presentP3AScreenCallout() {
// if Preferences.DebugFlag.skipNTPCallouts == true || isOnboardingOrFullScreenCalloutPresented { return }
//
// if presentedViewController != nil || !FullScreenCalloutManager.shouldShowDefaultBrowserCallout(calloutType: .p3a) {
// return
// }
if Preferences.DebugFlag.skipNTPCallouts == true || isOnboardingOrFullScreenCalloutPresented { return }

// let onboardingP3ACalloutController = WelcomeViewController(p3aUtilities: braveCore.p3aUtils)
if presentedViewController != nil || !FullScreenCalloutManager.shouldShowDefaultBrowserCallout(calloutType: .p3a) {
return
}

let onboardingP3ACalloutController = Welcome3PAViewController().then {
$0.isModalInPresentation = true
Expand All @@ -46,11 +44,11 @@ extension BrowserViewController {

let state = WelcomeViewCalloutState.p3a(
info: WelcomeViewCalloutState.WelcomeViewDefaultBrowserDetails(
title: "Help make Brave better.",
toggleTitle: "Share anonymous, private product insights.",
details: "This helps us learn what Brave features are used most often. Change this at any time in Brave Settings under ‘Brave Shields and Privacy’.",
linkDescription: "Learn more about our Privacy Preserving Product Analytics (P3A).",
primaryButtonTitle: "Done",
title: Strings.Callout.p3aCalloutTitle,
toggleTitle: Strings.Callout.p3aCalloutToggleTitle,
details: Strings.Callout.p3aCalloutDescription,
linkDescription: Strings.Callout.p3aCalloutLinkTitle,
primaryButtonTitle: Strings.done,
toggleAction: { [weak self] isOn in
self?.braveCore.p3aUtils.isP3AEnabled = isOn
},
Expand Down
38 changes: 32 additions & 6 deletions Sources/BraveShared/BraveStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,30 @@ extension Strings {
tableName: "BraveShared", bundle: .module,
value: "Tab Received",
comment: "Title for 'Tab Received' Callout, This is shown in the message when a Tab information is received from another sync device. ")
public static let p3aCalloutTitle =
NSLocalizedString(
"callout.p3aCalloutTitle",
tableName: "BraveShared", bundle: .module,
value: "Help make Brave better.",
comment: "Title for p3a (Privacy Preserving Analytics) Full Screen Callout")
public static let p3aCalloutDescription =
NSLocalizedString(
"callout.p3aCalloutDescription",
tableName: "BraveShared", bundle: .module,
value: "This helps us learn what Brave features are used most often. Change this at any time in Brave Settings under ‘Brave Shields and Privacy’.",
comment: "Subtitle - Description for p3a (Privacy Preserving Analytics) Full Screen Callout")
public static let p3aCalloutToggleTitle =
NSLocalizedString(
"callout.p3aCalloutToggleTitle",
tableName: "BraveShared", bundle: .module,
value: "Share anonymous, private product insights. ",
comment: "Title for toggle for enabling p3a (Privacy Preserving Analytics) Full Screen Callout")
public static let p3aCalloutLinkTitle =
NSLocalizedString(
"callout.p3aCalloutLinkTitle",
tableName: "BraveShared", bundle: .module,
value: "Learn more about our Privacy Preserving Product Analytics (P3A).",
comment: "Title for the link that vaviagtes information about p3a (Privacy Preserving Analytics)")
}
}

Expand Down Expand Up @@ -4096,13 +4120,15 @@ extension Strings {
// P3A
extension Strings {
public struct P3A {
public static let settingTitle = NSLocalizedString("p3a.settingTitle", tableName: "BraveShared", bundle: .module,
value: "Allow Privacy-Preserving Product Analytics (P3A)",
comment: "The title for the setting that will allow a user to toggle sending privacy preserving analytics to Brave. P3A is the name of a Brave Product")
public static let settingTitle = NSLocalizedString(
"p3a.settingTitle", tableName: "BraveShared", bundle: .module,
value: "Product Analytics",
comment: "The title for the setting that will allow a user to toggle sending privacy preserving analytics to Brave.")

public static let settingSubtitle = NSLocalizedString("p3a.settingSubtitle", tableName: "BraveShared", bundle: .module,
value: "Anonymized P3A info helps Brave estimate overall usage and ensure we're improving popular features",
comment: "A subtitle shown on the setting that toggles analytics on Brave. P3A is the name of a Brave Product")
public static let settingSubtitle = NSLocalizedString(
"p3a.settingSubtitle", tableName: "BraveShared", bundle: .module,
value: "Share anonymous, private product insights. This helps us learn what Brave features are used most often.",
comment: "A subtitle shown on the setting that toggles analytics on Brave.")
}
}

Expand Down
10 changes: 5 additions & 5 deletions Sources/Onboarding/Welcome/WelcomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ public class WelcomeViewController: UIViewController {
let nextController = WelcomeViewController(state: nil, p3aUtilities: self.p3aUtilities)
let state = WelcomeViewCalloutState.p3a(
info: WelcomeViewCalloutState.WelcomeViewDefaultBrowserDetails(
title: "Help make Brave better.",
toggleTitle: "Share anonymous, private product insights.",
details: "This helps us learn what Brave features are used most often. Change this at any time in Brave Settings under ‘Brave Shields and Privacy’.",
linkDescription: "Learn more about our Privacy Preserving Product Analytics (P3A).",
primaryButtonTitle: "Done",
title: Strings.Callout.p3aCalloutTitle,
toggleTitle: Strings.Callout.p3aCalloutToggleTitle,
details: Strings.Callout.p3aCalloutDescription,
linkDescription: Strings.Callout.p3aCalloutLinkTitle,
primaryButtonTitle: Strings.done,
toggleAction: { [weak self] isOn in
self?.p3aUtilities.isP3AEnabled = isOn
},
Expand Down

0 comments on commit afadcb4

Please sign in to comment.