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

Commit

Permalink
Fix #636: UI freezing when leaving private mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
danishjafri88 authored and jhreis committed Apr 24, 2019
1 parent 2da509e commit 44e6f7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions Client/Frontend/Browser/BrowserTrayAnimators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ class TrayToBrowserAnimator: NSObject, UIViewControllerAnimatedTransitioning {
private extension TrayToBrowserAnimator {
func transitionFromTray(_ tabTray: TabTrayController, toBrowser bvc: BrowserViewController, usingContext transitionContext: UIViewControllerContextTransitioning) {
let container = transitionContext.containerView
guard let selectedTab = bvc.tabManager.selectedTab else { return }

let tabManager = bvc.tabManager
let displayedTabs = tabManager.tabsForCurrentMode
guard let expandFromIndex = displayedTabs.index(of: selectedTab) else { return }
guard displayedTabs.index(of: selectedTab) != nil else {
transitionContext.completeTransition(false)
return

guard let selectedTab = bvc.tabManager.selectedTab, let expandFromIndex = displayedTabs.index(of: selectedTab) else {
fatalError("No tab selected for transition.")
}
bvc.view.frame = transitionContext.finalFrame(for: bvc)

Expand Down Expand Up @@ -117,13 +115,10 @@ private extension BrowserToTrayAnimator {
func transitionFromBrowser(_ bvc: BrowserViewController, toTabTray tabTray: TabTrayController, usingContext transitionContext: UIViewControllerContextTransitioning) {

let container = transitionContext.containerView
guard let selectedTab = bvc.tabManager.selectedTab else { return }

let tabManager = bvc.tabManager
let displayedTabs = tabManager.tabsForCurrentMode
guard let scrollToIndex = displayedTabs.index(of: selectedTab) else {
transitionContext.completeTransition(false)
return
guard let selectedTab = bvc.tabManager.selectedTab, let scrollToIndex = displayedTabs.index(of: selectedTab) else {
fatalError("No tab selected for transition.")
}

tabTray.view.frame = transitionContext.finalFrame(for: tabTray)
Expand Down
2 changes: 1 addition & 1 deletion Client/Frontend/Browser/TabTrayController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ class TabTrayController: UIViewController, Themeable {
if tabDataSource.tabs.isEmpty {
openNewTab()
} else {
if TabType.of(tabManager.selectedTab).isPrivate != privateMode {
if tabManager.selectedTab == nil || TabType.of(tabManager.selectedTab).isPrivate != privateMode {
tabManager.selectTab(tabDataSource.tabs.first!)
}
self.navigationController?.popViewController(animated: true)
Expand Down

0 comments on commit 44e6f7c

Please sign in to comment.