From ca7ffd6a230af0988f688e3b228f5f23408fb5d1 Mon Sep 17 00:00:00 2001 From: Brandon T Date: Wed, 3 Jan 2024 10:29:48 -0500 Subject: [PATCH] Authenticate when disabling browser lock --- .../Settings/SettingsViewController.swift | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Sources/Brave/Frontend/Settings/SettingsViewController.swift b/Sources/Brave/Frontend/Settings/SettingsViewController.swift index 3b8145f85c7..781fe6e9580 100644 --- a/Sources/Brave/Frontend/Settings/SettingsViewController.swift +++ b/Sources/Brave/Frontend/Settings/SettingsViewController.swift @@ -656,11 +656,24 @@ class SettingsViewController: TableViewController { return Section( header: .title(Strings.security), rows: [ - .boolRow( - title: Strings.Privacy.browserLock, + Row( + text: Strings.Privacy.browserLock, detailText: Strings.Privacy.browserLockDescription, - option: Preferences.Privacy.lockWithPasscode, - image: UIImage(braveSystemNamed: "leo.biometric.login")), + image: UIImage(braveSystemNamed: "leo.biometric.login"), + accessory: .view(SwitchAccessoryView(initialValue: Preferences.Privacy.lockWithPasscode.value, valueChange: { isOn in + if isOn { + Preferences.Privacy.lockWithPasscode.value = isOn + } else { + self.askForLocalAuthentication { [weak self] success, error in + if success { + Preferences.Privacy.lockWithPasscode.value = isOn + } + } + } + })), + cellClass: MultilineSubtitleCell.self, + uuid: Preferences.Privacy.lockWithPasscode.key + ), Row( text: Strings.Login.loginListNavigationTitle, selection: { [unowned self] in