ojo / ios

:iphone:
0 stars 0 forks source link

Regression: When Mixpanel is initialized, LNPopupController's content view cannot be dragged down to dismiss #45

Closed btc closed 7 years ago

btc commented 7 years ago

Found the line that breaks it. Bug occurs when I import Mixpanel in my AppDelegate:

        let mp = Mixpanel.initialize(token: "94b5a087efd368348e9765150a465858")

I created an example project to demonstrate the issue. It's an empty project with a single view that uses an LNPopupController and initializes Mixpanel in the AppDelegate. The popup controller's content view cannot be dismissed when Mixpanel is initialized!

https://github.com/btc/MixpanelLNPopupController

@LeoNatan does this bug/incompatibility interest you?

LeoNatan commented 7 years ago

Not really, as it doesn't look like a framework issue. What is Mixpanel?

btc commented 7 years ago

Okay.

Mixpanel is an analytics product. In your AppDelegate, you add Mixanel.initialize(token: "token").

Then, in your code, you can track events like, Mixpanel.default.track("App Opened") and record user activity in your app and analyze in the browser at Mixpanel.com.

It's super strange because Mixpanel doesn't have a UI component. There shouldn't be any conflict between the two libraries, but there is.

LeoNatan commented 7 years ago

My guess is they are swizzling various methods to track touches. I suggest you open a ticket with their support.

btc commented 7 years ago

@LeoNatan

I did that and here's what they said:

Hi Brian, Thanks for sending that over, I can definitely reproduce the issue here. The problem seems to be that the gesture recognizer in the LNPopUpController and the gesture recognizer in the Mixpanel SDK (for connecting to our A/B Test and codeless tracking editors) are interfering with one another.

When Mixpanel is initialized you CAN drag to dismiss the popup, but... you either need to initially touch with 2 fingers and the lift one before dragging OR touch with 4 fingers and drag.

Is this another case of the four finger drag issue?

https://github.com/LeoNatan/LNPopupController/issues/127

The bad news here is that there is no API for modifying or disabling our gesture recognizer.

My best guess is that the problem is caused by the LNPopupControllerLongPressGestureDelegate overriding the default return value of NO with YES for gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: https://github.com/LeoNatan/LNPopupController/blob/master/LNPopupController/LNPopupController/Private/LNPopupControllerLongPressGestureDelegate.m#L25

You might try forking LNPopupController and changing that line to return NO and see if the problem goes away.

Sorry I don't have a better solution at the moment, but please let me know if you have any further questions. Thanks, Jared

LeoNatan commented 7 years ago

It is like that for a reason, otherwise it won't work. Their gesture recognizer should return NO in a parallel method. It's a MixPanel bug.

btc commented 7 years ago

Okay. Mixpanel responded but they won't take action. My next move is to drop them as an analytics provider. I'd much rather keep LNPopupController.

LeoNatan commented 7 years ago

Why are they installing a gesture recognizer anyway? Do they monitor user gestures? Thanks for the support!

btc commented 7 years ago

They have features called A/B testing and codeless tracking where they try to understand what's happening in your app without additional user configuration. Apparently people want these things. Not me. I'd much rather track things explicitly myself. I don't want any magic...