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 { ...@@ -35,8 +35,9 @@ enum class MobileMessagesBannerDismissType {
TimedOut = 0, TimedOut = 0,
// Infobar Banner was dismissed by being swiped up. // Infobar Banner was dismissed by being swiped up.
SwipedUp = 1, SwipedUp = 1,
// Infobar Banner was dismissed by being dragged into an Infobar Modal. // *DEPRECATED* Infobar Banner was dismissed by being dragged into an Infobar
ExpandedToModal = 2, // Modal.
ExpandedToModal_DEPRECATED = 2,
// Infobar Banner was dismissed by being tapped into an Infobar Modal. // Infobar Banner was dismissed by being tapped into an Infobar Modal.
TappedToModal = 3, TappedToModal = 3,
// Highest enumerator. Recommended by Histogram metrics best practices. // Highest enumerator. Recommended by Histogram metrics best practices.
......
...@@ -51,7 +51,6 @@ const CGFloat kContainerStackVerticalPadding = 18.0; ...@@ -51,7 +51,6 @@ const CGFloat kContainerStackVerticalPadding = 18.0;
const CGFloat kIconWidth = 25.0; const CGFloat kIconWidth = 25.0;
// Gesture constants. // Gesture constants.
const CGFloat kChangeInPositionForTransition = 100.0;
const CGFloat kChangeInPositionForDismissal = -15.0; const CGFloat kChangeInPositionForDismissal = -15.0;
const CGFloat kLongPressTimeDurationInSeconds = 0.4; const CGFloat kLongPressTimeDurationInSeconds = 0.4;
} // namespace } // namespace
...@@ -313,27 +312,11 @@ const CGFloat kLongPressTimeDurationInSeconds = 0.4; ...@@ -313,27 +312,11 @@ const CGFloat kLongPressTimeDurationInSeconds = 0.4;
self.startingTouch = touchLocation; self.startingTouch = touchLocation;
[self animateBannerToScaleUpState]; [self animateBannerToScaleUpState];
} else if (gesture.state == UIGestureRecognizerStateChanged) { } else if (gesture.state == UIGestureRecognizerStateChanged) {
self.view.center = // Don't allow the banner to be dragged down past its original position.
CGPointMake(self.view.center.x, self.view.center.y + touchLocation.y - CGFloat newYPosition =
self.startingTouch.y); self.view.center.y + touchLocation.y - self.startingTouch.y;
// If dragged down by more than kChangeInPositionForTransition, present if (newYPosition < self.originalCenter.y) {
// the InfobarModal. self.view.center = CGPointMake(self.view.center.x, newYPosition);
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;
} }
} }
......
...@@ -89,8 +89,8 @@ using ::showcase_utils::Close; ...@@ -89,8 +89,8 @@ using ::showcase_utils::Close;
assertWithMatcher:grey_nil()]; assertWithMatcher:grey_nil()];
} }
// Tests that the InfobarModal is presented when the Banner its swiped down. // Tests that the InfobarModal is not presented when the Banner its swiped down.
- (void)testInfobarBannerSwipeDown { - (void)testInfobarBannerCantSwipeDown {
// Check Banner was presented. // Check Banner was presented.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerViewIdentifier)] kInfobarBannerViewIdentifier)]
...@@ -99,20 +99,17 @@ using ::showcase_utils::Close; ...@@ -99,20 +99,17 @@ using ::showcase_utils::Close;
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerViewIdentifier)] kInfobarBannerViewIdentifier)]
performAction:grey_swipeFastInDirection(kGREYDirectionDown)]; performAction:grey_swipeFastInDirection(kGREYDirectionDown)];
// Check Modal was presented. // Check the Modal is not presented.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerPresentedModalLabel)] kInfobarBannerPresentedModalLabel)]
assertWithMatcher:grey_notNil()]; assertWithMatcher:grey_nil()];
// Dismiss Modal. // Check the banner is still interactable by swiping it up.
[[EarlGrey
selectElementWithMatcher:grey_accessibilityID(kInfobarModalCancelButton)]
performAction:grey_tap()];
// Check neither the Banner nor Modal are presented.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerViewIdentifier)] kInfobarBannerViewIdentifier)]
assertWithMatcher:grey_nil()]; performAction:grey_swipeFastInDirection(kGREYDirectionUp)];
// Check Banner was dismissed.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID( [[EarlGrey selectElementWithMatcher:grey_accessibilityID(
kInfobarBannerPresentedModalLabel)] kInfobarBannerViewIdentifier)]
assertWithMatcher:grey_nil()]; 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