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

Commit

Permalink
Removed preference and popup onboarding the user
Browse files Browse the repository at this point in the history
Default persistent private browsing to off.
  • Loading branch information
Brandon-T committed Aug 3, 2023
1 parent e099feb commit 8c3d685
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -624,22 +624,6 @@ class TabTrayController: LoadingViewController {
tabTrayView.collectionView.reloadData()
navigationController?.setNavigationBarHidden(false, animated: false)
}

if Preferences.Privacy.shouldShowPersistentPrivateBrowsingAlert.value {
Preferences.Privacy.shouldShowPersistentPrivateBrowsingAlert.value = false

let alert = UIAlertController(title: Strings.persistentPrivateBrowsingAlertTitle, message: Strings.persistentPrivateBrowsingAlertMessage, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: Strings.yes, style: .default) { [unowned self] _ in
Preferences.Privacy.persistentPrivateBrowsing.value = true
self.tabManager.saveAllTabs()
})

alert.addAction(UIAlertAction(title: Strings.no, style: .cancel) { _ in
Preferences.Privacy.persistentPrivateBrowsing.value = false
})

self.present(alert, animated: true)
}
} else {
tabTrayView.hidePrivateModeInfo()

Expand Down
4 changes: 1 addition & 3 deletions Sources/Brave/Frontend/ClientPreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ extension Preferences {
/// Forces all private tabs
public static let privateBrowsingOnly = Option<Bool>(key: "privacy.private-only", default: false)
/// Whether or not private browsing tabs can be session restored (persistent private browsing)
public static let persistentPrivateBrowsing = Option<Bool>(key: "privacy.private-browsing-persistence", default: true)
/// Whether or not a persistent private browsing alert was shown to existing users
public static let shouldShowPersistentPrivateBrowsingAlert = Option<Bool>(key: "privacy.private-browsing-persistence-alert", default: false)
public static let persistentPrivateBrowsing = Option<Bool>(key: "privacy.private-browsing-persistence", default: false)
/// Blocks all cookies and access to local storage
static let blockAllCookies = Option<Bool>(key: "privacy.block-all-cookies", default: false)
/// The toggles states for clear private data screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,15 @@ struct OtherPrivacySettingsSectionView: View {
OptionToggleView(title: Strings.persistentPrivateBrowsing,
subtitle: nil,
option: Preferences.Privacy.persistentPrivateBrowsing) { newValue in
if !Preferences.Privacy.shouldShowPersistentPrivateBrowsingAlert.value {
Task { @MainActor in
if newValue {
settings.tabManager.saveAllTabs()
} else {
let tabs = settings.tabManager.allTabs.filter({ $0.isPrivate })
SessionTab.deleteAll(tabIds: tabs.map({ $0.id }))

if !settings.tabManager.privateBrowsingManager.isPrivateBrowsing {
settings.tabManager.willSwitchTabMode(leavingPBM: true)
}
Task { @MainActor in
if newValue {
settings.tabManager.saveAllTabs()
} else {
let tabs = settings.tabManager.allTabs.filter({ $0.isPrivate })
SessionTab.deleteAll(tabIds: tabs.map({ $0.id }))

if !settings.tabManager.privateBrowsingManager.isPrivateBrowsing {
settings.tabManager.willSwitchTabMode(leavingPBM: true)
}
}
}
Expand Down

0 comments on commit 8c3d685

Please sign in to comment.