Skip to content

Commit 5439adb

Browse files
authored
Refactor FXIOS-14258 [Performance] Some cleanup around updateToolbarDisplay calls (#31053)
* some cleanup around updateToolbardisplay * add feature flag checks
1 parent 2399fb7 commit 5439adb

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

firefox-ios/Client/Frontend/Browser/BrowserViewController/Views/BrowserViewController.swift

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,10 @@ class BrowserViewController: UIViewController,
795795
appMenuBadgeUpdate()
796796
updateTopTabs(showTopTabs: showTopTabs)
797797

798-
header.setNeedsLayout()
799-
view.layoutSubviews()
798+
if !featureFlags.isFeatureEnabled(.toolbarTranslucencyRefactor, checking: .buildOnly) {
799+
header.setNeedsLayout()
800+
view.layoutSubviews()
801+
}
800802

801803
updateToolbarDisplay()
802804
}
@@ -1927,7 +1929,14 @@ class BrowserViewController: UIViewController,
19271929
browserDelegate?.setHomepageVisibility(isVisible: true)
19281930
}
19291931

1930-
updateToolbarDisplay()
1932+
if featureFlags.isFeatureEnabled(.toolbarTranslucencyRefactor, checking: .buildOnly) {
1933+
// Only update blur views when we are not in zero search mode
1934+
if inline {
1935+
updateToolbarDisplay()
1936+
}
1937+
} else {
1938+
updateToolbarDisplay()
1939+
}
19311940
}
19321941

19331942
func showEmbeddedWebview() {
@@ -4905,7 +4914,15 @@ extension BrowserViewController: KeyboardHelperDelegate {
49054914
self.bottomContentStackView.layoutIfNeeded()
49064915
})
49074916

4908-
updateToolbarDisplay()
4917+
if featureFlags.isFeatureEnabled(.toolbarTranslucencyRefactor, checking: .buildOnly) {
4918+
// When animation duration is zero the keyboard is already showing and we don't need
4919+
// to update the toolbar again. This is the case when we are moving between fields in a form.
4920+
if state.animationDuration > 0 {
4921+
updateToolbarDisplay()
4922+
}
4923+
} else {
4924+
updateToolbarDisplay()
4925+
}
49094926
}
49104927

49114928
func keyboardHelper(_ keyboardHelper: KeyboardHelper, keyboardWillHideWithState state: KeyboardState) {

0 commit comments

Comments
 (0)