diff --git a/CHANGELOG.md b/CHANGELOG.md index d85db8266..74ab2cef8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [53.6.2] +- [iOS] Fixed so Touch.Command will not be executed when long press is recognized. + ## [53.6.1] - [AlertView][Android] Fixed bug where buttons would not be visible if text size was increased and the Alert was not large. - [AlertView][iOS] Fixed bug where `AlertView` would not show the custom truncation text if its visibility were set to false at the start. diff --git a/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectTapGestureRecognizer.cs b/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectTapGestureRecognizer.cs index d31311002..cf63ec145 100644 --- a/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectTapGestureRecognizer.cs +++ b/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchEffectTapGestureRecognizer.cs @@ -9,6 +9,7 @@ public class TouchEffectTapGestureRecognizer : UIGestureRecognizer { private UIView? m_uiView; private readonly Action m_onTap; + private bool m_longPressDetected; internal UIGestureRecognizerState m_currentState = UIGestureRecognizerState.Possible; @@ -37,6 +38,7 @@ public override void TouchesBegan(NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); + m_longPressDetected = false; m_isCancelled = false; TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Began, ref m_currentState, m_uiView); @@ -46,10 +48,11 @@ public override void TouchesEnded(NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); - if(m_currentState is not UIGestureRecognizerState.Cancelled) + if(!m_longPressDetected && m_currentState is not UIGestureRecognizerState.Cancelled) m_onTap.Invoke(); TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Ended, ref m_currentState, m_uiView); + m_longPressDetected = false; } public override void TouchesCancelled(NSSet touches, UIEvent evt) @@ -57,6 +60,7 @@ public override void TouchesCancelled(NSSet touches, UIEvent evt) base.TouchesCancelled(touches, evt); TouchPlatformEffect.HandleTouch(UIGestureRecognizerState.Cancelled, ref m_currentState, m_uiView); + m_longPressDetected = false; } public override void TouchesMoved(NSSet touches, UIEvent evt) @@ -79,6 +83,11 @@ public override void TouchesMoved(NSSet touches, UIEvent evt) private CGPoint? GetTouchPoint(NSSet touches) => (touches.AnyObject as UITouch)?.LocationInView(m_uiView); + + public void NotifyLongPress() + { + m_longPressDetected = true; + } protected override void Dispose(bool disposing) { diff --git a/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchPlatformEffect.cs b/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchPlatformEffect.cs index a39eb9f04..a463e64ca 100644 --- a/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchPlatformEffect.cs +++ b/src/library/DIPS.Mobile.UI/Effects/Touch/iOS/TouchPlatformEffect.cs @@ -41,6 +41,8 @@ private void OnLongPress(UILongPressGestureRecognizer e) if (e.State != UIGestureRecognizerState.Began) return; + m_tapGestureRecognizer?.NotifyLongPress(); + if (Touch.GetLongPressCommand(Element)?.CanExecute(Touch.GetLongPressCommandParameter(Element)) ?? false) Touch.GetLongPressCommand(Element)?.Execute(Touch.GetLongPressCommandParameter(Element)); }