tinode / ios

Tinodios: Tinode Messaging Client for iOS
Apache License 2.0
245 stars 109 forks source link

Basic changes for rendering QQ Drafty elements in Tinodios. #176

Closed aforge closed 3 years ago

aforge commented 3 years ago

This PR deals with the rendering part only since it's already too big. Replies are WIP.

  1. Moved DraftyFormatter's associated type Node out of the enclosing protocol (protocols with an associated type are too hard to work with when using generics).
  2. Refactored the logic which turns Drafty into a tree of Drafty.Spans and traverses it into a separate Drafty.SpanTreeProcessor class. Now Drafty.format() and Drafty.preview() may implement their own processors and apply their own logic in them by subclassing Drafty.SpanTreeProcessor.
  3. Quotes (QQs) are rendered via QuotedAttachments - these are similar to the DraftyButtonAttachment. The quoted Drafty object is rendered in an image object which subsequently is embedded in a NSTextAttachment in the parent Drafty object (unfortunately, Apple's NSAttributedString does not have anything similar to the Android's Spans).
or-else commented 3 years ago

It would be nice to port tests too.

aforge commented 3 years ago

It would be nice to port tests too.

Done.