Skip to content

Commit

Permalink
Fixes the firing of mh pixel (#2503)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414709148257752/1206674614649925/f
Tech Design URL:
CC:

Description:
Fixes the firing of mh pixel

Steps to test this PR:

Launch the app, ensure mh pixel is fired when the the new tab is shown
Create tabs from the tab switcher.  mh should only be fired when the the user ends up on the Home Screen
Check RMF message still displays as expected
  • Loading branch information
brindy authored Feb 26, 2024
1 parent d17c8fa commit 4a55da6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions DuckDuckGo/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,14 @@ class HomeViewController: UIViewController {

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if presentedViewController == nil { // prevents these being called when settings forces this controller to be reattached
showNextDaxDialog()
}

// If there's no tab switcher then this will be true, if there is a tabswitcher then only allow the
// stuff below to happen if it's being dismissed
guard presentedViewController?.isBeingDismissed ?? true else { return }

Pixel.fire(pixel: .homeScreenShown)
showNextDaxDialog()

collectionView.didAppear()

viewHasAppeared = true
Expand Down
6 changes: 5 additions & 1 deletion DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2058,8 +2058,12 @@ extension MainViewController: TabSwitcherDelegate {
func tabSwitcher(_ tabSwitcher: TabSwitcherViewController, didRemoveTab tab: Tab) {
if tabManager.count == 1 {
// Make sure UI updates finish before dimissing the view.
// However, as a result, viewDidAppear on the home controller thinks the tab
// switcher is still presented.
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
tabSwitcher.dismiss()
tabSwitcher.dismiss(animated: true) {
self.homeController?.viewDidAppear(true)
}
}
}
closeTab(tab)
Expand Down

0 comments on commit 4a55da6

Please sign in to comment.