From b1d8d367cc40ef3caf5f0cdff8f74a4cabe0a813 Mon Sep 17 00:00:00 2001 From: Robbie Gibson Date: Wed, 8 Mar 2023 21:44:43 +0000 Subject: [PATCH] [iOS] Remove Popup Menu IPH delay to prevent DCHECK My guess as to the root cause is that the situation changed between checking if the presenter can present the bubble initially and then after the delay when presentation actually takes place. I can't remember exactly why I added this delay in the first place and the bubble still presents fine without it, so I don't think it's necessary. This also adds a missing return after checking if the feature engagement tracker is initialized. Bug: 1420460 Change-Id: Ie5e481037d041b115a0c2d8d22f3af7b7b3e1f13 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4306868 Commit-Queue: Robbie Gibson Reviewed-by: Rohit Rao Cr-Commit-Position: refs/heads/main@{#1114786} --- .../popup_menu/popup_menu_help_coordinator.mm | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_help_coordinator.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_help_coordinator.mm index 4e27db005cc514..dc8ad6a4056fe8 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_help_coordinator.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_help_coordinator.mm @@ -29,12 +29,6 @@ #error "This file requires ARC support." #endif -namespace { -// Delay between the time the app launches, and the time the -// menu button tip is shown. -constexpr base::TimeDelta kMenuTipDelay = base::Seconds(1); -} // namespace - @interface PopupMenuHelpCoordinator () // Bubble view controller presenter for popup menu tip. @@ -181,6 +175,7 @@ - (void)showPopupMenuBubbleIfNecessary { } [weakSelf showPopupMenuBubbleIfNecessary]; })); + return; } // Skip if a presentation is already in progress @@ -214,22 +209,12 @@ - (void)showPopupMenuBubbleIfNecessary { // Present the bubble after the delay. self.popupMenuBubblePresenter = bubblePresenter; - __weak __typeof(self) weakSelf = self; - base::SequencedTaskRunner::GetCurrentDefault()->PostDelayedTask( - FROM_HERE, base::BindOnce(^{ - [weakSelf presentPopupMenuBubbleAtAnchorPoint:anchorPoint]; - [weakSelf.UIUpdater updateUIForIPHDisplayed:PopupMenuTypeToolsMenu]; - }), - kMenuTipDelay); -} - -// Actually presents the bubble. -- (void)presentPopupMenuBubbleAtAnchorPoint:(CGPoint)anchorPoint { self.inSessionWithPopupMenuIPH = YES; [self.popupMenuBubblePresenter presentInViewController:self.baseViewController view:self.baseViewController.view anchorPoint:anchorPoint]; + [self.UIUpdater updateUIForIPHDisplayed:PopupMenuTypeToolsMenu]; } #pragma mark - Overflow Menu Bubble methods