eBay/NMessenger

Jerky Animations in iOS 11 when addMessageToMessenger

Opened this issue · 9 comments

Using a vanilla MessengerViewController to send messages after I add messages to the point where the screen has to scroll to add the messages, the animations become buggy. I tested with and without software keyboard, and both result in same jerky behavior

See attached video, I slowed down the animations to see the whole effect.

To reproduce test on iPhone 8 or iPhone X and see that the animations no longer work. Any guesses at what changed in iOS 11?

Thank you!

jumpy animations

I am also noticing ugly jerkiness when the software keyboard becomes active and the messenger view has to scroll. Also when the keyboard is dismissed.

@klivin , sorry, I have no idea yet but I have some animation related issues as well.

A stupid question, but...

  1. Are you doing any networking?
  2. Have you ensured the main thread is clean?
  3. Are you constructing the cells off main thread? You should insert them to NMessenger on main thread, though.

I've managed to improve things a bit when I moved things off main thread. And used batch insertions when possible (multiple messages at a time)

@objc public override func didEnterDisplayState()

P.S. The AsyncDisplayKit cell logs might also help debugging.
https://www.raywenderlich.com/124311/asyncdisplaykit-2-0-tutorial-getting-started

Thanks for the questions, and I'll look into cell logs to see if I find anything useful.

I have been able to reproduce jumpiness with and without adding cells on networking response. The gif I added shows a networking response appending cells in the same way:

let newMessage = self.createTextMessage(responseText!, isIncomingMessage: true)
self.addMessageToMessenger(newMessage)

All cell construction and insertion is on the main thread. I don't imagine constructing the cell off the main thread would help smooth out the jerky behavior. It seems to be more of a scrolling timing with new content size issue as the whole offset jumps up to previous cell on insertion of a new message cell. Then the table animates down to most of the way below the bottom message, but often times the bottom message is cut off.

Also odd that this behavior is new in iOS 11 as I cannot reproduce the jumpyness in iOS 10 and below.

I tried:

    func add(text: String, incoming: Bool) {
        DispatchQueue.default.async {
            let newMessage = self.createTextMessage(text, isIncomingMessage: incoming)
            DispatchQueue.main.async {
                self.addMessageToMessenger(newMessage)
            }
        }
    }

And that still has jumpy animations. It's interesting that the cell above the new cell to be added jumps as well, while the rest of the table appears to not move until scroll to index animated is issued.

Hi Guys, any idea how to fix this?

Any solution to this yet?

No fix yet?

i tried updating to Texture 2.3.4 and that somewhat improved things, but there is still occasional table jumping. Trying to update to a more recent Texture (there's been a ton of bug fixes since 2.3.4) but seems each new Texture version introduces new breaking changes with this lib.

Note too, no use asking "no fix yet" as the creators of this lib have evidently left the building.