Commit d7c5eebc authored by sczs's avatar sczs Committed by Commit Bot

[ios] Removes Infobar banner drag down gesture.

Removes the ability to swipe down the Infobar banner in order to reveal
the modal. Now only tapping on the Banner should display a Modal.

This is part of the change UX are proposing after the experiment.

Bug: 961343
Change-Id: Ia64198b22ff9c7d32c129f7532ba4491ebb063a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1804081
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarChris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696866}
parent 3443fed0
......@@ -35,8 +35,9 @@ enum class MobileMessagesBannerDismissType {
TimedOut = 0,
// Infobar Banner was dismissed by being swiped up.
SwipedUp = 1,
// Infobar Banner was dismissed by being dragged into an Infobar Modal.
ExpandedToModal = 2,
// *DEPRECATED* Infobar Banner was dismissed by being dragged into an Infobar
// Modal.
ExpandedToModal_DEPRECATED = 2,
// Infobar Banner was dismissed by being tapped into an Infobar Modal.
TappedToModal = 3,
// Highest enumerator. Recommended by Histogram metrics best practices.
......
......@@ -51,7 +51,6 @@ const CGFloat kContainerStackVerticalPadding = 18.0;
const CGFloat kIconWidth = 25.0;
// Gesture constants.
const CGFloat kChangeInPositionForTransition = 100.0;
const CGFloat kChangeInPositionForDismissal = -15.0;
const CGFloat kLongPressTimeDurationInSeconds = 0.4;
} // namespace
......@@ -313,27 +312,11 @@ const CGFloat kLongPressTimeDurationInSeconds = 0.4;
self.startingTouch = touchLocation;
[self animateBannerToScaleUpState];
} else if (gesture.state == UIGestureRecognizerStateChanged) {
self.view.center =
CGPointMake(self.view.center.x, self.view.center.y + touchLocation.y -
self.startingTouch.y);
// If dragged down by more than kChangeInPositionForTransition, present
// the InfobarModal.
BOOL dragDownExceededThreshold =
(self.view.center.y - self.originalCenter.y >
kChangeInPositionForTransition);
if (dragDownExceededThreshold) {
base::RecordAction(
base::UserMetricsAction("MobileMessagesBannerDraggedDown"));
[self.metricsRecorder
recordBannerDismissType:MobileMessagesBannerDismissType::
ExpandedToModal];
[self recordBannerOnScreenTime];
[self.delegate presentInfobarModalFromBanner];
// Since the modal has now been presented prevent any external dismissal.
self.shouldDismissAfterTouchesEnded = NO;
// Cancel the gesture since the modal has now been presented.
gesture.state = UIGestureRecognizerStateCancelled;
return;
// Don't allow the banner to be dragged down past its original position.
CGFloat newYPosition =
self.view.center.y + touchLocation.y - self.startingTouch.y;
if (newYPosition < self.originalCenter.y) {
self.view.center = CGPointMake(self.view.center.x, newYPosition);
}
}
......
......@@ -89,8 +89,8 @@ using ::showcase_utils::Close;
assertWithMatcher:grey_nil()];
}
// Tests that the InfobarModal is presented when the Banner its swiped down.
- (void)testInfobarBannerSwipeDown {
// Tests that the InfobarModal is not presented when the Banner its swiped down.
- (void)testInfobarBannerCantSwipeDown {
// Check Banner was presented.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerViewIdentifier)]
......@@ -99,20 +99,17 @@ using ::showcase_utils::Close;
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerViewIdentifier)]
performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
// Check Modal was presented.
// Check the Modal is not presented.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerPresentedModalLabel)]
assertWithMatcher:grey_notNil()];
// Dismiss Modal.
[[EarlGrey
selectElementWithMatcher:grey_accessibilityID(kInfobarModalCancelButton)]
performAction:grey_tap()];
// Check neither the Banner nor Modal are presented.
assertWithMatcher:grey_nil()];
// Check the banner is still interactable by swiping it up.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerViewIdentifier)]
assertWithMatcher:grey_nil()];
performAction:grey_swipeFastInDirection(kGREYDirectionUp)];
// Check Banner was dismissed.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerPresentedModalLabel)]
kInfobarBannerViewIdentifier)]
assertWithMatcher:grey_nil()];
}
......
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