Commit 0f8f2a59 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Dismisses InfobarBanner if RepostForm will be presented.

The RepostFormCoordinator checks if baseViewController is already presenting
another ViewController. If it is it won't present and retry later on.

Because of this, if an InfobarBanner is being presented the RepostForm
won't be presented, even if BVC is willing to dismiss the InfobarBanner.

Since RepostForm has a retry mechanism we think its not safe to simply
remove the presentedViewController check. There might be other reasons why
that was added.

In order to fix this, this CL dismisses any banner before trying to
present the RepostForm.


Bug: 911864
Change-Id: Ieaa6c574c619c1d1d3ada7ab49f953ea4656caba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1623453
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662644}
parent c7fda7a1
......@@ -1871,9 +1871,10 @@ NSString* const kBrowserViewControllerSnackbarCategory =
[self.sideSwipeController resetContentView];
}
// An Infobar message is currently the only presented controller that allows
// interaction with the rest of the App while its being presented. Dismiss it
// in case the user or system has triggered another presentation.
// TODO(crbug.com/965688): An Infobar message is currently the only presented
// controller that allows interaction with the rest of the App while its being
// presented. Dismiss it in case the user or system has triggered another
// presentation.
if (IsInfobarUIRebootEnabled() &&
[self.infobarContainerCoordinator isPresentingInfobarBanner]) {
[self.infobarContainerCoordinator
......@@ -3342,9 +3343,24 @@ NSString* const kBrowserViewControllerSnackbarCategory =
CGPoint dialogLocation = CGPointMake(
CGRectGetMidX(bounds), CGRectGetMinY(bounds) + self.headerHeight);
auto* helper = RepostFormTabHelper::FromWebState(webState);
helper->PresentDialog(dialogLocation, base::BindOnce(^(bool shouldContinue) {
handler(shouldContinue);
}));
ProceduralBlock presentDialog = ^{
helper->PresentDialog(dialogLocation,
base::BindOnce(^(bool shouldContinue) {
handler(shouldContinue);
}));
};
// TODO(crbug.com/965688): An Infobar message is currently the only presented
// controller that allows interaction with the rest of the App while its being
// presented. Dismiss it in case the user or system has triggered repost form.
if (IsInfobarUIRebootEnabled() &&
[self.infobarContainerCoordinator isPresentingInfobarBanner]) {
[self.infobarContainerCoordinator
dismissInfobarBannerAnimated:NO
completion:presentDialog];
} else {
presentDialog();
}
}
- (web::JavaScriptDialogPresenter*)javaScriptDialogPresenterForWebState:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment