Make swipe-for-details RTL-safe.

This commit is contained in:
Matthew Chen 2017-11-21 11:01:20 -05:00
parent 596206557f
commit 92ef507810
2 changed files with 5 additions and 4 deletions

View File

@ -20,7 +20,7 @@ class SlideOffAnimatedTransition: NSObject, UIViewControllerAnimatedTransitionin
}
let width = containerView.frame.width
let offsetLeft = fromView.frame.offsetBy(dx: -width, dy: 0)
let offsetFrame = fromView.frame.offsetBy(dx: (containerView.isRTL() ? +width : -width), dy: 0)
toView.frame = fromView.frame
fromView.layer.shadowRadius = 15.0
@ -29,7 +29,7 @@ class SlideOffAnimatedTransition: NSObject, UIViewControllerAnimatedTransitionin
containerView.insertSubview(toView, belowSubview: fromView)
UIView.animate(withDuration: transitionDuration(using: transitionContext), delay:0, options: .curveLinear, animations: {
fromView.frame = offsetLeft
fromView.frame = offsetFrame
toView.layer.opacity = 1.0
fromView.layer.shadowOpacity = 0.1

View File

@ -4211,8 +4211,9 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
{
self.currentShowMessageDetailsPanGesture = gestureRecognizer;
const CGFloat leftTranslation = -1 * [gestureRecognizer translationInView:self.view].x;
const CGFloat ratioComplete = Clamp(leftTranslation / self.view.frame.size.width, 0, 1);
const CGFloat swipeTranslation
= ([gestureRecognizer translationInView:self.view].x * (self.view.isRTL ? +1.f : -1.f));
const CGFloat ratioComplete = Clamp(swipeTranslation / self.view.frame.size.width, 0, 1);
switch (gestureRecognizer.state) {
case UIGestureRecognizerStateBegan: {