Skip to content

Commit

Permalink
Fixed #6730: open apps preview should hide all screens in private bro…
Browse files Browse the repository at this point in the history
…wsing (#6757)

* Fixed #6730: open apps preview should hide all screens in private browsing

* #6730 changed color of backdropContainer and changed it edges to fill whole screen, added it TrayView as well

* Added new color #1D1133 for Ink90
  • Loading branch information
hariszaman committed Jun 24, 2020
1 parent c51aab1 commit 5b1bc17
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
9 changes: 6 additions & 3 deletions Client/Frontend/Browser/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,11 @@ class BrowserViewController: UIViewController {
return
}

view.bringSubviewToFront(webViewContainerBackdrop)
webViewContainerBackdrop.alpha = 1
webViewContainer.alpha = 0
urlBar.locationContainer.alpha = 0
firefoxHomeViewController?.view.alpha = 0
topTabsViewController?.switchForegroundStatus(isInForeground: false)
presentedViewController?.popoverPresentationController?.containerView?.alpha = 0
presentedViewController?.view.alpha = 0
Expand All @@ -356,12 +358,14 @@ class BrowserViewController: UIViewController {
UIView.animate(withDuration: 0.2, delay: 0, options: UIView.AnimationOptions(), animations: {
self.webViewContainer.alpha = 1
self.urlBar.locationContainer.alpha = 1
self.firefoxHomeViewController?.view.alpha = 1
self.topTabsViewController?.switchForegroundStatus(isInForeground: true)
self.presentedViewController?.popoverPresentationController?.containerView?.alpha = 1
self.presentedViewController?.view.alpha = 1
self.view.backgroundColor = UIColor.clear
}, completion: { _ in
self.webViewContainerBackdrop.alpha = 0
self.view.sendSubviewToBack(self.webViewContainerBackdrop)
})

// Re-show toolbar which might have been hidden during scrolling (prior to app moving into the background)
Expand All @@ -376,7 +380,7 @@ class BrowserViewController: UIViewController {
KeyboardHelper.defaultHelper.addDelegate(self)

webViewContainerBackdrop = UIView()
webViewContainerBackdrop.backgroundColor = UIColor.Photon.Grey50
webViewContainerBackdrop.backgroundColor = UIColor.Photon.Ink90
webViewContainerBackdrop.alpha = 0
view.addSubview(webViewContainerBackdrop)

Expand Down Expand Up @@ -483,7 +487,7 @@ class BrowserViewController: UIViewController {
}

webViewContainerBackdrop.snp.makeConstraints { make in
make.edges.equalTo(webViewContainer)
make.edges.equalTo(self.view)
}
}

Expand Down Expand Up @@ -539,7 +543,6 @@ class BrowserViewController: UIViewController {

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

// On iPhone, if we are about to show the On-Boarding, blank out the tab so that it does
// not flash before we present. This change of alpha also participates in the animation when
// the intro view is dismissed.
Expand Down
23 changes: 20 additions & 3 deletions Client/Frontend/Browser/TabTrayControllerV1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class TabTrayControllerV1: UIViewController {
var tabDisplayManager: TabDisplayManager!
var tabCellIdentifer: TabDisplayer.TabCellIdentifer = TabCell.Identifier
var otherBrowsingModeOffset = CGPoint.zero
// Backdrop used for displaying greyed background for private tabs
var webViewContainerBackdrop: UIView!
var collectionView: UICollectionView!

let statusBarBG = UIView()
Expand Down Expand Up @@ -161,6 +163,10 @@ class TabTrayControllerV1: UIViewController {
super.viewDidLoad()
tabManager.addDelegate(self)
view.accessibilityLabel = NSLocalizedString("Tabs Tray", comment: "Accessibility label for the Tabs Tray view.")

webViewContainerBackdrop = UIView()
webViewContainerBackdrop.backgroundColor = UIColor.Photon.Ink90
webViewContainerBackdrop.alpha = 0

collectionView.alwaysBounceVertical = true
collectionView.backgroundColor = UIColor.theme.tabTray.background
Expand All @@ -173,7 +179,7 @@ class TabTrayControllerV1: UIViewController {
searchBarHolder.addSubview(roundedSearchBarHolder)
searchBarHolder.addSubview(searchBar)
searchBarHolder.backgroundColor = UIColor.theme.tabTray.toolbar
[collectionView, toolbar, searchBarHolder, cancelButton].forEach { view.addSubview($0) }
[webViewContainerBackdrop, collectionView, toolbar, searchBarHolder, cancelButton].forEach { view.addSubview($0) }
makeConstraints()

// The statusBar needs a background color
Expand Down Expand Up @@ -222,6 +228,11 @@ class TabTrayControllerV1: UIViewController {
}

fileprivate func makeConstraints() {

webViewContainerBackdrop.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}

collectionView.snp.makeConstraints { make in
make.left.equalTo(view.safeArea.left)
make.right.equalTo(view.safeArea.right)
Expand Down Expand Up @@ -518,20 +529,26 @@ extension TabTrayControllerV1 {
extension TabTrayControllerV1 {
@objc func appWillResignActiveNotification() {
if tabDisplayManager.isPrivate {
webViewContainerBackdrop.alpha = 1
view.bringSubviewToFront(webViewContainerBackdrop)
collectionView.alpha = 0
searchBarHolder.alpha = 0
emptyPrivateTabsView.alpha = 0
}
}

@objc func appDidBecomeActiveNotification() {
// Re-show any components that might have been hidden because they were being displayed
// as part of a private mode tab
UIView.animate(withDuration: 0.2) {
UIView.animate(withDuration: 0.2, animations: {
self.collectionView.alpha = 1

self.emptyPrivateTabsView.alpha = 1
if self.tabDisplayManager.isPrivate, !self.privateTabsAreEmpty() {
self.searchBarHolder.alpha = 1
}
}) { _ in
self.webViewContainerBackdrop.alpha = 0
self.view.sendSubviewToBack(self.webViewContainerBackdrop)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Client/Frontend/photon-colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ extension UIColor {
static let Ink60 = UIColor(rgb: 0x464B76)
static let Ink70 = UIColor(rgb: 0x363959)
static let Ink80 = UIColor(rgb: 0x202340)
static let Ink90 = UIColor(rgb: 0x0f1126)
static let Ink90 = UIColor(rgb: 0x1D1133)

static let White100 = UIColor(rgb: 0xffffff)

Expand Down

1 comment on commit 5b1bc17

@firefoxci-taskcluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh oh! Looks like an error! Details

Entity already exists

Please sign in to comment.