diff --git a/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift b/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift index 00dc9c04984..9564acdfef0 100644 --- a/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift +++ b/Sources/Brave/Frontend/Browser/Tabs/TabTray/TabTrayController.swift @@ -189,7 +189,7 @@ class TabTrayController: AuthenticationController { self.tabManager = tabManager self.braveCore = braveCore - super.init(windowProtection: windowProtection, isCancellable: true) + super.init(windowProtection: windowProtection, isCancellable: true, unlockScreentitle: "Private Browsing is Locked") if !UIAccessibility.isReduceMotionEnabled { transitioningDelegate = self diff --git a/Sources/Brave/Frontend/Passcode/WindowProtection.swift b/Sources/Brave/Frontend/Passcode/WindowProtection.swift index 321b718cb54..19ffcd5764c 100644 --- a/Sources/Brave/Frontend/Passcode/WindowProtection.swift +++ b/Sources/Brave/Frontend/Passcode/WindowProtection.swift @@ -18,6 +18,13 @@ public class WindowProtection { private class LockedViewController: UIViewController { let backgroundView = UIVisualEffectView(effect: UIBlurEffect(style: .systemThickMaterial)) let lockImageView = UIImageView(image: UIImage(named: "browser-lock-icon", in: .module, compatibleWith: nil)!) + let titleLabel = UILabel().then { + $0.font = .preferredFont(for: .title3, weight: .semibold) + $0.adjustsFontForContentSizeCategory = true + $0.textColor = .bravePrimary + $0.numberOfLines = 0 + $0.textAlignment = .center + } let unlockButton = FilledActionButton(type: .system).then { $0.setTitle(Strings.unlockButtonTitle, for: .normal) $0.titleLabel?.font = .preferredFont(forTextStyle: .headline) @@ -25,7 +32,6 @@ public class WindowProtection { $0.backgroundColor = .braveBlurpleTint $0.isHidden = true } - let cancelButton = ActionButton(type: .system).then { $0.setTitle(Strings.cancelButtonTitle, for: .normal) $0.titleLabel?.font = .preferredFont(forTextStyle: .headline) @@ -39,12 +45,19 @@ public class WindowProtection { super.viewDidLoad() view.addSubview(backgroundView) + view.addSubview(titleLabel) view.addSubview(lockImageView) view.addSubview(unlockButton) view.addSubview(cancelButton) backgroundView.snp.makeConstraints { $0.edges.equalTo(view) } + titleLabel.snp.makeConstraints { + $0.leading.greaterThanOrEqualToSuperview().offset(20) + $0.trailing.lessThanOrEqualToSuperview().offset(-20) + $0.centerX.equalToSuperview() + $0.bottom.equalTo(lockImageView.snp.top).offset(-40) + } lockImageView.snp.makeConstraints { $0.center.equalTo(view) } @@ -103,6 +116,13 @@ public class WindowProtection { } } + var unlockScreentitle: String = "" { + didSet { + lockedViewController.titleLabel.isHidden = unlockScreentitle.isEmpty + lockedViewController.titleLabel.text = unlockScreentitle + } + } + private let onCancelPressed = PassthroughSubject() private let didFinalizeAuthentication = PassthroughSubject() diff --git a/Sources/Brave/Frontend/Widgets/LoadingViewController.swift b/Sources/Brave/Frontend/Widgets/LoadingViewController.swift index 6f0147e0281..a49e6a3860c 100644 --- a/Sources/Brave/Frontend/Widgets/LoadingViewController.swift +++ b/Sources/Brave/Frontend/Widgets/LoadingViewController.swift @@ -46,13 +46,15 @@ public class AuthenticationController: LoadingViewController { init(windowProtection: WindowProtection? = nil, requiresAuthentication: Bool = false, - isCancellable: Bool = false) { + isCancellable: Bool = false, + unlockScreentitle: String = "") { self.windowProtection = windowProtection self.requiresAuthentication = requiresAuthentication super.init(nibName: nil, bundle: nil) self.windowProtection?.isCancellable = isCancellable + self.windowProtection?.unlockScreentitle = unlockScreentitle } required init?(coder: NSCoder) {