Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In an MSStickerBrowserViewController on iOS 10, how can I tell which sticker a user selected?

I have a subclass of MSStickerBrowserViewController that contains a MSStickerBrowserView with a couple dozen MSStickers. For analytics, we're trying to track which stickers are the most popular in the sticker app. Is there any way to tell which MSSticker was selected by the user?

like image 625
David M Avatar asked Sep 20 '16 20:09

David M


1 Answers

There are no delegate methods to tell us that information, unfortunately. I got around this by making my own UICollectionView of MSStickerViews, then adding tap and long press gesture recognizers to the sticker views.

Make sure the gesture's shouldRecognizeSimultaneouslyWith delegate method returns true so they don't get in the way.

To track whether a sticker is actually sent vs. selected takes a bit more work. Tapping and sending a sticker is pretty straightforward to track - the MSMessagesAppViewController methods didStartSending and didCancelSending can tell you if a message was sent or discarded from the input view.

Tracking the peeled and applied sticker analytics is trickier. Applying a sticker to a previous message in the conversation doesn't trigger any of those methods. Best I've come up with so far is to track where the long press ended and make an educated guess as to whether or not the sticker had been sent or cancelled.

like image 175
JAB Avatar answered Sep 27 '22 22:09

JAB