mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
clamp value per CR
// FREEBIE
This commit is contained in:
parent
59b125c3fb
commit
43dd3abf6c
1 changed files with 4 additions and 4 deletions
|
@ -29,6 +29,7 @@
|
||||||
#import "OWSConversationSettingsViewController.h"
|
#import "OWSConversationSettingsViewController.h"
|
||||||
#import "OWSConversationSettingsViewDelegate.h"
|
#import "OWSConversationSettingsViewDelegate.h"
|
||||||
#import "OWSDisappearingMessagesJob.h"
|
#import "OWSDisappearingMessagesJob.h"
|
||||||
|
#import "OWSMath.h"
|
||||||
#import "OWSMessageCell.h"
|
#import "OWSMessageCell.h"
|
||||||
#import "OWSSystemMessageCell.h"
|
#import "OWSSystemMessageCell.h"
|
||||||
#import "OWSUnreadIndicatorCell.h"
|
#import "OWSUnreadIndicatorCell.h"
|
||||||
|
@ -4051,7 +4052,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
||||||
self.currentShowMessageDetailsPanGesture = gestureRecognizer;
|
self.currentShowMessageDetailsPanGesture = gestureRecognizer;
|
||||||
|
|
||||||
const CGFloat leftTranslation = -1 * [gestureRecognizer translationInView:self.view].x;
|
const CGFloat leftTranslation = -1 * [gestureRecognizer translationInView:self.view].x;
|
||||||
const CGFloat percent = MAX(leftTranslation, 0) / self.view.frame.size.width;
|
const CGFloat ratioComplete = Clamp(leftTranslation / self.view.frame.size.width, 0, 1);
|
||||||
|
|
||||||
switch (gestureRecognizer.state) {
|
switch (gestureRecognizer.state) {
|
||||||
case UIGestureRecognizerStateBegan: {
|
case UIGestureRecognizerStateBegan: {
|
||||||
|
@ -4076,7 +4077,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
||||||
DDLogVerbose(@"%@ transition not set up yet", self.tag);
|
DDLogVerbose(@"%@ transition not set up yet", self.tag);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
[transition updateInteractiveTransition:percent];
|
[transition updateInteractiveTransition:ratioComplete];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UIGestureRecognizerStateEnded: {
|
case UIGestureRecognizerStateEnded: {
|
||||||
|
@ -4090,7 +4091,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
|
||||||
|
|
||||||
// Complete the transition if moved sufficiently far or fast
|
// Complete the transition if moved sufficiently far or fast
|
||||||
// Note this is trickier for incoming, since you are already on the left, and have less space.
|
// Note this is trickier for incoming, since you are already on the left, and have less space.
|
||||||
if (percent > 0.3 || velocity < -800) {
|
if (ratioComplete > 0.3 || velocity < -800) {
|
||||||
[transition finishInteractiveTransition];
|
[transition finishInteractiveTransition];
|
||||||
} else {
|
} else {
|
||||||
[transition cancelInteractiveTransition];
|
[transition cancelInteractiveTransition];
|
||||||
|
@ -4130,7 +4131,6 @@ interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransiti
|
||||||
// animation But we may not want to be the navigation controller delegate permanently.
|
// animation But we may not want to be the navigation controller delegate permanently.
|
||||||
self.navigationController.delegate = nil;
|
self.navigationController.delegate = nil;
|
||||||
|
|
||||||
DDLogInfo(@"%@ >>>> in %s", self.tag, __PRETTY_FUNCTION__);
|
|
||||||
UIPanGestureRecognizer *recognizer = self.currentShowMessageDetailsPanGesture;
|
UIPanGestureRecognizer *recognizer = self.currentShowMessageDetailsPanGesture;
|
||||||
if (recognizer == nil) {
|
if (recognizer == nil) {
|
||||||
OWSFail(@"currentShowMessageDetailsPanGesture was unexpectedly nil");
|
OWSFail(@"currentShowMessageDetailsPanGesture was unexpectedly nil");
|
||||||
|
|
Loading…
Reference in a new issue