Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): remove tab tray content when in private mode when user moves to home switch #27091

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,21 @@ class TabTrayController: AuthenticationController {

shredButton.addTarget(self, action: #selector(shredButtonPressed), for: .touchUpInside)
becomeFirstResponder()

NotificationCenter.default.do {
$0.addObserver(
self,
selector: #selector(sceneWillResignActiveNotification(_:)),
name: UIScene.willDeactivateNotification,
object: nil
)
$0.addObserver(
self,
selector: #selector(sceneDidBecomeActiveNotification(_:)),
name: UIScene.didActivateNotification,
object: nil
)
}
}

override func viewDidAppear(_ animated: Bool) {
Expand Down Expand Up @@ -770,6 +785,27 @@ class TabTrayController: AuthenticationController {
}
}

@objc func sceneWillResignActiveNotification(_ notification: NSNotification) {
guard let scene = notification.object as? UIScene, scene == currentScene else {
return
}

// If we are in the private mode info showing, hide any elements in the tab that we wouldn't want shown
// when the app is in the home switcher
if privateMode {
tabContentView.alpha = 0
}
}

@objc func sceneDidBecomeActiveNotification(_ notification: NSNotification) {
guard let scene = notification.object as? UIScene, scene == currentScene else {
return
}

// Re-show any components that might have been hidden
tabContentView.alpha = 1
}

func toggleModeChanger() {
tabTraySearchController.isActive = false

Expand Down
Loading