Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1260 Detecting and Cleaning Galleries #8119

Closed

Conversation

autojeff
Copy link

@autojeff autojeff commented Nov 8, 2017

#1260 …detecting and cleaning galleries

Fixes #
Remove deprecated characters.count

To test:
Detection for gallery markup

Needs review: @aerych

@@ -332,12 +332,12 @@ class BlockquoteTagProcessor: HtmlTagProcessor {
if !matched {
return (parsedString, nil)
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@@ -6,7 +6,7 @@ import WordPressShared
/// HTML tags that require special handling before the text is shown in a UITextView.
///
class WPRichTextFormatter {

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@@ -332,12 +332,12 @@ class BlockquoteTagProcessor: HtmlTagProcessor {
if !matched {
return (parsedString, nil)
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@@ -6,7 +6,7 @@ import WordPressShared
/// HTML tags that require special handling before the text is shown in a UITextView.
///
class WPRichTextFormatter {

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@autojeff autojeff changed the title remove deprecated characters.count, create scanner and regex for dete… Feature/1260 Detecting and Cleaning Galleries Nov 8, 2017
let cell : ReaderGalleryCell
let attachment : WPTextAttachment
}

Choose a reason for hiding this comment

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

Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)


struct GalleryMedia {
let cell : ReaderGalleryCell
let attachment : WPTextAttachment

Choose a reason for hiding this comment

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

Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)

}

struct GalleryMedia {
let cell : ReaderGalleryCell

Choose a reason for hiding this comment

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

Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)


}

extension WPRichTextGallery : UICollectionViewDelegateFlowLayout {

Choose a reason for hiding this comment

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

Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)


collectionView.reloadData()
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let rightInset = CGFloat(8.0)
let rightExtraContent = CGFloat(8.0)

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}

extension WPRichTextGallery : UICollectionViewDelegateFlowLayout {

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


return cell
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}



Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

let media = GalleryMedia(cell: cell, attachment: attachment)
mediaArray.append(media)
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@autojeff
Copy link
Author

autojeff commented Nov 12, 2017

Gallery is now in the pull request.

Still to do: zoomed in gallery, pagination for inline gallery, clean up code, support for image subtitle.

…troller to work with gallery, delegate functions, changes to WPRichTextGallery to make it all work
more clean up, fix collectionview sizing a bit (needs better sizing for showing edges of past and previous cards and some attention to iPad)
}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
scrollToPage(scrollView, withVelocity: CGPoint(x:0, y:0))

Choose a reason for hiding this comment

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

Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)

page = max(page, 0)
let newOffset: CGFloat = CGFloat(page) * (cellWidth + cellPadding)

scrollView.setContentOffset(CGPoint(x:newOffset, y:0), animated: true)

Choose a reason for hiding this comment

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

Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)


fileprivate var collectionView: UICollectionView
var captionLabel : UILabel?
var pageLabel : UILabel?

Choose a reason for hiding this comment

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

Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)

}()

fileprivate var collectionView: UICollectionView
var captionLabel : UILabel?

Choose a reason for hiding this comment

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

Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)

var contentURL: URL?
var linkURL: URL?

var cellSize : CGFloat = 10

Choose a reason for hiding this comment

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

Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)


scrollView.setContentOffset(CGPoint(x:newOffset, y:0), animated: true)
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}
page = max(page, 0)
let newOffset: CGFloat = CGFloat(page) * (cellWidth + cellPadding)

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

func scrollToPage(_ scrollView: UIScrollView, withVelocity velocity: CGPoint) {
let cellWidth: CGFloat = cellSize
let cellPadding: CGFloat = 8

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
scrollToPage(scrollView, withVelocity: velocity)
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}

/* In case the user scrolls for a long swipe, the scroll view should animate to the nearest page when the scrollview decelerated. */

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

Copy link
Member

@aerych aerych left a comment

Choose a reason for hiding this comment

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

Howdy @autojeff 👋 You've been busy!
I've taken an early peek through the code so far. I've noted a few things and made a few suggestions.
I also had a couple of questions.
I did take a peek at the UI but I know there are things you're still looking at there so I'm holding my comments. :)
I'm happy to chat about any of the comments I've made or clarify anything that might not be clear. Just let me know.

@@ -12,4 +12,10 @@ extension Array {
}
}
}

//Safely returns an index from an array.
Copy link
Member

Choose a reason for hiding this comment

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

Is //Safely is missing a / ?

Copy link
Author

Choose a reason for hiding this comment

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

@aerych Do you mean like this? "/// Safely"

Copy link
Member

Choose a reason for hiding this comment

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

Yep! :)

//
// Created by Jeff Jacka on 11/11/17.
// Copyright © 2017 WordPress. All rights reserved.
//
Copy link
Member

Choose a reason for hiding this comment

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

We try to avoid this sort of header comment.


@IBOutlet weak var galleryImageView: UIImageView!

override func awakeFromNib() {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove this overridden method if all it will do is call the super implementation.

//
// Created by Jeff Jacka on 11/12/17.
// Copyright © 2017 WordPress. All rights reserved.
//
Copy link
Member

Choose a reason for hiding this comment

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

Same as before about file header comments.

}

dataSource = self
// Do any additional setup after loading the view.
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice if we could clean up boilerplate comments like this one.


//Replace Div with Gallery tag
content = RegEx.galleryDivStart.stringByReplacingMatches(in: content, options: .reportCompletion, range: NSRange(location: 0, length: content.count), withTemplate: galleryStart)
content = RegEx.galleryDivEnd.stringByReplacingMatches(in: content, options: .reportCompletion, range: NSRange(location: 0, length: content.count), withTemplate: galleryEnd)
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious about the use of regular expressions to handle string replacement rather than have it handled by the Scanner. Was there a particular reason that made regex a better choice?

Copy link
Author

Choose a reason for hiding this comment

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

My thinking behind this was to the keep the logic a bit more simple. This function scanForGalleryBy(galleryType : String, inString : String) only scans and identifies where a gallery should start and end. Then clean it up with the RegEx, rather than using another Scanner. It could be done in one go, but this felt like a safe, reliable option to me.


// Trailing BR Tags
static let trailingBRTags = try! NSRegularExpression(pattern: "(\\s*<br\\s*(/?)\\s*>\\s*)+$", options: .caseInsensitive)



Copy link
Member

Choose a reason for hiding this comment

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

Maybe remove the newly added returns?


func contentRatio() -> CGFloat {


Copy link
Member

Choose a reason for hiding this comment

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

We probably don't need the white space between the method definition and body here and above.


if galleriesFound <= 0 {
//check for gallery
galleryScanner.scanUpTo(galleryType, into: &tempStr)
Copy link
Member

Choose a reason for hiding this comment

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

The if and else blocks share some similarity in the way the start. Maybe there is an opportunity for a small refactor to reuse some code?

@@ -102,8 +109,10 @@ - (void)viewDidLoad
[tgr1 requireGestureRecognizerToFail:tgr2];
[self.scrollView addGestureRecognizer:tgr1];

self.flingableViewHandler = [[FlingableViewHandler alloc] initWithTargetView:self.scrollView];
self.flingableViewHandler.delegate = self;
if (!self.galleryMode) {
Copy link
Member

Choose a reason for hiding this comment

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

Since galleryMode is only flagging whether the FlingableViewHandle should be used, it might be nice to rename it according to how its used. Then if we extend WPImageViewController in the future and add more inits, the flag could be reused in a new context. Make sense?

fileprivate func handleSwipeGesture(_ recognizer: UISwipeGestureRecognizer) {

isActive = false

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


@objc
fileprivate func handleSwipeGesture(_ recognizer: UISwipeGestureRecognizer) {

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

targetView.addGestureRecognizer(panGestureRecognizer)
isActive = true
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

//Allow swipe gestures to pass through first
panGestureRecognizer.require(toFail: leftSwipe)
panGestureRecognizer.require(toFail: rightSwipe)

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture(_:)))

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

let leftSwipe = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipeGesture(_:)))
leftSwipe.direction = .left
targetView.addGestureRecognizer(leftSwipe)

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@@ -43,11 +43,31 @@ class FlingableViewHandler: NSObject {
animator = UIDynamicAnimator(referenceView: targetView.superview!)

super.init()

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

fix gallery padding so they align correctly
}

extension WPRichTextGallery: UICollectionViewDelegateFlowLayout {

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


collectionView.showsHorizontalScrollIndicator = false
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


setupCollectionView()
setupLabels()

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


override open var frame: CGRect {
didSet {

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

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

I've just been reviewing this, but don't quite have time to go through it all right now – so I'll finish up later.

Functionally, this seems to work pretty well! The galleries are parsed out, I can view the images and flick through them, which is great. I've added bunch code comments - a lot of it is style or naming or organization, rather than fundamental issues. Hopefully it's all useful, but let me know if you have any questions!

Two functional issues I did see:

  1. I think it'd be good if we set the background colour behind the gallery to black, otherwise you see it when you scroll to the edge:

simulator screen shot - iphone 8 - 2017-11-16 at 14 47 17

Also the status bar is black-on-black there – again, you can see it when you scroll off. We should probably hide it altogether or make it lightContent style.

  1. I think it's largely down to UIPageViewController, but you can see the images appear / disappear as you scroll, which is a little jarring. It'd be nice if those transitions happen offscreen:

gallery-1

@@ -1076,6 +1076,16 @@ extension ReaderDetailViewController: WPRichContentViewDelegate {

present(controller, animated: true, completion: nil)
}

func richContentView(_ richContentView: WPRichContentView, didReceiveGalleryAction image: [WPTextAttachment], indexTapped index: Int) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The second parameter name here feels slightly confusing, I think. didReceiveGalleryAction doesn't really explain what the parameter contains, and the inner name is image but it looks like it contains an array of images (plural)? How about didReceiveGalleryActionWithImages images: [WPTextAttachment]?

///
/// - Return: A WPGalleryPageViewController instance.
///
open class func controllerWithImages(_ images: [WPTextAttachment], selectedIndex: Int) -> WPGalleryPageViewController {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think in Swift 3 / 4, this might be best named something like controller(with images: [WPTextAttachment], selectedIndex: Int)

In fact, we could probably add a default value for selected index (= 0?) to allow it to be omitted?

override func viewDidLoad() {
super.viewDidLoad()

if let initalVC = imageViewControllerForIndex(index: initialIndex) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: initalVC -> initialVC

dataSource = self
}

func imageViewControllerForIndex(index: Int) -> WPImageViewController? {
Copy link
Contributor

Choose a reason for hiding this comment

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

Swift's API guidelines (as far as I know) recommend against duplicating parameter names like this – something like imageViewController(for index: Int) or imageViewControllerFor(index: Int) would be a better fit, I think.

return nil
}

let urlString = imageAttachment.attributes?["data-large-file"] ?? imageAttachment.src
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be good to pull "data-large-file" out into a constant.

@@ -5,6 +5,7 @@ import WordPressShared

@objc protocol WPRichContentViewDelegate: UITextViewDelegate {
func richContentView(_ richContentView: WPRichContentView, didReceiveImageAction image: WPRichTextImage)
func richContentView(_ richContentView: WPRichContentView, didReceiveGalleryAction image: [WPTextAttachment], indexTapped index: Int)
Copy link
Contributor

Choose a reason for hiding this comment

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

See earlier comment about the name of this method.

@@ -283,6 +286,48 @@ extension WPRichContentView: WPTextAttachmentManagerDelegate {
return img
}

func galleryForAttachment(_ attachment: WPTextAttachment) -> WPRichTextGallery {

let width: CGFloat = attachment.width > 0 ? attachment.width : self.bounds.width
Copy link
Contributor

Choose a reason for hiding this comment

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

You can omit self. here.

let formatter = WPRichTextFormatter()
let (_, attachments) = formatter.processAndExtractTags(content)

gallery.imageAttachments = attachments.filter({ (attachment) -> Bool in
Copy link
Contributor

Choose a reason for hiding this comment

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

You could condense this if you like, to attachments.filter({ $0.tagName == "img" })

let layout: UICollectionViewFlowLayout = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
layout.minimumInteritemSpacing = 8.0
Copy link
Contributor

Choose a reason for hiding this comment

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

We could use a constant for these values – or should this be using cellPadding?

}
}
}
var handleGalleryTapped : ((_ selectedIndex: Int, _ galleryImages: [WPTextAttachment]) -> ())?
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, but there shouldn't be a space before a : here. Also -> Void is preferred over -> ().

Copy link
Contributor

@frosty frosty left a comment

Choose a reason for hiding this comment

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

Okay, I added a few more comments! Let me know if you have any questions 👍

let source = WPTableImageSource(maxSize: self.maxDisplaySize)
source?.delegate = self
source?.forceLargerSizeWhenFetching = false
source?.photonQuality = 65
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have a constant for this – looks like WPRichContentView has one in its Constants struct.

///

fileprivate let galleryCellIdentifier = "ReaderGalleryCell"
fileprivate let contentUrlKey = "contentUrl"
Copy link
Contributor

Choose a reason for hiding this comment

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

These identifiers could be grouped together in a struct or enum.

setupCollectionView()
setupLabels()

collectionView.isPrefetchingEnabled = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this just go in setupCollectionView?

aCoder.encode(footerStack, forKey: UIStackView.classNameWithoutNamespaces())

if let url = contentURL {
aCoder.encode(url, forKey: "contentURL")
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the constant keys defined at the top of the file here - contentUrlKey, etc.

extension WPRichTextGallery: UICollectionViewDelegateFlowLayout {

func setOffsetIfNeeded() {
//TODO: Still Needs Fixing
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still valid? What's the issue exactly?

Copy link
Author

Choose a reason for hiding this comment

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

Yes it is, you made a nice gif of the issue I'm having with the gallery UICollectionView so a few things need to be changed in this area. The problem I am having is that when my gallery gets it frame from the UIRichContentView/TextView it is respecting the contentInset from that textView, however this causes issues with the UICollectionView because from the design I have attempted to build it should probably be the full width of the app to prevent that disappearing issue you showed here (https://user-images.githubusercontent.com/4780/32897805-738be56a-cade-11e7-80b3-3d1aa4b5845a.gif). So I think I have a two options, change the design or stretch the frame to be the width of the screen, use contentInsets to handle some of the padding, this should make the disappearing issue go away. Would love some feedback/opinions on what the best options here might be from both a design and development standpoint.

///

func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
scrollToPage(scrollView, withVelocity: velocity)
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, rather than calling setContentOffset from this method, you should set targetContentOffset to the offset that you calculate – this will result in a smoother deceleration, instead of stopping in the wrong place and then animating to the correct one.

}

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
scrollToPage(scrollView, withVelocity: CGPoint(x: 0, y: 0))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary if scrollViewWillEndDragging is implemented and sets an adjusted offset?

///
/// - Returns: The formatted string.
///
public class func normalizeGallery(_ string : String) -> String {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, no space before :

var tempStr: NSString? = ""

var divCounter = 0
var galleriesFound : Int = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick, no space before :

return content
}

private class func scanForGalleryBy(galleryType : String, inString : String) -> String {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we able to break this method down at all, to make it a little easier to follow? Can we add some tests?


setupCollectionView()
setupLabels()

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}

aCoder.encode(viewHeight, forKey: viewHeightKey)

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

if let url = linkURL {
aCoder.encode(url, forKey: linkUrlKey)
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

if let url = contentURL {
aCoder.encode(url, forKey: contentUrlKey)
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)


aCoder.encode(collectionView, forKey: UICollectionView.classNameWithoutNamespaces())
aCoder.encode(footerStack, forKey: UIStackView.classNameWithoutNamespaces())

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

extension WPGalleryPageViewController : UIPageViewControllerDelegate {

func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) {

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

}

extension WPGalleryPageViewController : UIPageViewControllerDelegate {

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

guard let index = imageViewControllers[imageVC] else {
return nil
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

guard let imageVC = viewController as? WPImageViewController else {
return nil
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

guard let imageVC = viewController as? WPImageViewController else {
return nil
}

Choose a reason for hiding this comment

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

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@aerych
Copy link
Member

aerych commented Nov 27, 2017

Closing.

@aerych aerych closed this Nov 27, 2017
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.

4 participants