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

Stability, Layout, and Logging Enhancements; Added Support for Legacy Edge Insets Functionality #202

Merged

Conversation

mamccarthy
Copy link
Contributor

@mamccarthy mamccarthy commented Nov 14, 2017

  • Includes a fix (and unit tests) for the crashes that occur due to changing repeat counts. @rubencagnie has looked at this change and agreed it looks good.

  • Add the flag needsLegacyEdgeInsetFunctionality to BrickCell, which defaults to false, but can be set to true if the legacy handling of edge insets is required.

  • Remove some forced unwraps in BrickFlowLayout to avoid crashes.

  • Fix a crash that could occur due to calculating layouts of deleted sections in BrickFlowLayout.

  • Refactor Height provider to be a closure instead of protocol.

  • Fix a crash due to unchecked bounds of a range creation in BrickLayoutSection

  • Clear prefetch index paths upon invalidation.

  • Add additional verbose logging to refresh/reloading of data.


Squashed Commit of the following:

commit 89ef650
Author: Will Spurgeon [email protected]
Date: Thu Nov 9 10:16:10 2017 -0500

Added additional verbose logging to refresh/reloading of data.

commit cee70e8
Author: Will Spurgeon [email protected]
Date: Thu Nov 2 15:05:39 2017 -0400

Clear prefetch index paths upon invalidation. Written by nlobue

commit c760425
Author: Will Spurgeon [email protected]
Date: Mon Oct 30 16:50:56 2017 -0400

Fix for a crash that can occur if the first index is greater the number of items.

commit a838e8d
Author: Will Spurgeon [email protected]
Date: Mon Oct 23 14:15:58 2017 -0400

Updated height provider code to be a closure (#191). Fix by vlozko.

commit 5e21936
Author: Will Spurgeon [email protected]
Date: Wed Oct 18 14:06:09 2017 -0400

Fix for crash

commit 48846ee
Author: Will Spurgeon [email protected]
Date: Fri Oct 13 10:04:59 2017 -0400

Attempt to fix a crash

commit e6d3c6d
Author: Will Spurgeon [email protected]
Date: Thu Oct 5 17:28:58 2017 -0400

Added a flag that determines which version of the inset updating code is run.

… Edge Insets Functionality

Squashed Commit of the following:

commit 89ef650
Author: Will Spurgeon <[email protected]>
Date:   Thu Nov 9 10:16:10 2017 -0500

    Added additional verbose logging to refresh/reloading of data.

commit cee70e8
Author: Will Spurgeon <[email protected]>
Date:   Thu Nov 2 15:05:39 2017 -0400

    Clear prefetch index paths upon invalidation. Written by nlobue

commit c760425
Author: Will Spurgeon <[email protected]>
Date:   Mon Oct 30 16:50:56 2017 -0400

    Fix for a crash that can occur if the first index is greater the number of items.

commit a838e8d
Author: Will Spurgeon <[email protected]>
Date:   Mon Oct 23 14:15:58 2017 -0400

    Updated height provider code to be a closure (wayfair-archive#191). Fix by vlozko.

commit 5e21936
Author: Will Spurgeon <[email protected]>
Date:   Wed Oct 18 14:06:09 2017 -0400

    Fix for crash

commit 48846ee
Author: Will Spurgeon <[email protected]>
Date:   Fri Oct 13 10:04:59 2017 -0400

    Attempt to fix a crash

commit e6d3c6d
Author: Will Spurgeon <[email protected]>
Date:   Thu Oct 5 17:28:58 2017 -0400

    Added a flag that determines which version of the inset updating code is run.
@codecov-io
Copy link

codecov-io commented Nov 15, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@0b8607f). Click here to learn what that means.
The diff coverage is 70%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #202   +/-   ##
=========================================
  Coverage          ?   92.82%           
=========================================
  Files             ?       40           
  Lines             ?     4513           
  Branches          ?      376           
=========================================
  Hits              ?     4189           
  Misses            ?      323           
  Partials          ?        1
Impacted Files Coverage Δ
Source/Layout/BrickLayoutSection.swift 92.8% <100%> (ø)
Source/Layout/BrickFlowLayout.swift 91.22% <100%> (ø)
Source/Cells/BrickCell.swift 92.4% <42.85%> (ø)
Source/ViewControllers/BrickCollectionView.swift 93.75% <69.69%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b8607f...d0c42ae. Read the comment docs.

super.reloadData()
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Extra space

if !didUpdateEdgeInsets {
guard let brickAttributes = layoutAttributes as? BrickLayoutAttributes, brickAttributes.isEstimateSize else {
return layoutAttributes
if needsLegacyEdgeInsetFunctionality {
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 if statement really necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is also a key part of the legacy edge insets fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

k

private var didUpdateEdgeInsets: Bool = false
@objc open dynamic var edgeInsets: UIEdgeInsets = UIEdgeInsets.zero {
didSet {
if edgeInsets == oldValue {

if edgeInsets == oldValue && needsLegacyEdgeInsetFunctionality {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is needsLegacyEdgeInsetFunctionality really necessary here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's definitely required for the fix/workaround for the edge insets issue. This legacy edge insets support will be removed once the root cause of the issue is identified (there is a ticket for that work).

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

@mamccarthy
Copy link
Contributor Author

I pushed two commits:

  • Line spacing caught in the code review was fixed.
  • A fix (and unit tests) for the crashes that occur due to changing repeat counts. @rubencagnie has looked at this change and agreed it looks good.

@jay18001 jay18001 merged commit daf9dd4 into wayfair-archive:master Nov 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants