Skip to content

Conversation

@jleandroperez
Copy link
Contributor

@jleandroperez jleandroperez commented Dec 7, 2017

Description:

In this PR we're:

  • Updating the MediaAttachment's delegate signature (a bit more swifty!)
  • Replacing few if return clauses with guard. Why? Because we reduce the indentation level, it's easier to read, and looks beautiful.
  • The MediaAttachment's draw method has been split into methods. (Note that this was partially complete prior to this PR!)
  • CGRect's methods (min, max) have been wired, and computation here and there has been simplified.
  • No new functionality added. Just moving code arround!

To test:

  1. Verify that the unit tests pass okay
  2. Add a Media Attachment:
    2.1. Verify that the progress bar works properly
    2.2. Verify that during the upload OP, there's an overlay
  3. Press over the attachment
    3.1. Verify that an overlay gets displayed
    3.2. Verify that there's an asset rendered at the center of the image
    3.3. Verify that below the center's asset, there's a text label!

I was in the neighborhood, and needed to change few things. This PR will be followed up by another one, in charge of rendering Figure / Figcaption elements.

cc @diegoreymendez @SergioEstevao

Thanks in advance!

@jleandroperez
Copy link
Contributor Author

@diegoreymendez @SergioEstevao ready for review gentlemen!. The Travis CI issue is related to a breaking UI test, non related to these changes.

PS: It'll probably be easier to check the code by means of Kaleidoscope!

Thanks in advance!

Copy link
Contributor

@diegoreymendez diegoreymendez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out my comments, then merge.


/// The margin apply to the images being displayed. This is to avoid that two images in a row get
/// glued together.
/// The margin apply to the images being displayed. This is to avoid that two images in a row get glued together.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "to" after "margin".

var padding = (textContainer?.lineFragmentPadding ?? 0) * 2
if let storage = textContainer?.layoutManager?.textStorage,
let paragraphStyle = storage.attribute(.paragraphStyle, at: charIndex, effectiveRange: nil) as? NSParagraphStyle
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brace on previous line for consistency.

@jleandroperez
Copy link
Contributor Author

Comments addressed, thanks for the review Diego!!

@jleandroperez jleandroperez merged commit d3037c6 into develop Dec 15, 2017
@jleandroperez jleandroperez deleted the issue/media-drawing-refactor branch December 15, 2017 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants