-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix(reader): makes reader use readable content width #416
Conversation
@@ -93,6 +93,12 @@ class ReadableViewController: UIViewController { | |||
readableViewModel.fetchDetailsIfNeeded() | |||
} | |||
|
|||
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very subtly you can see that images may use more space then they should after a rotation, this attempts to correct that by making the collection view re-layout after a size change.
@@ -284,20 +287,26 @@ extension ReadableViewController { | |||
) | |||
|
|||
let section = NSCollectionLayoutSection(group: group) | |||
section.contentInsets = Constants.metaSectionContentInsets | |||
// Zero out the default leading/trailing contentInsets, but preserve the default top/bottom values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used https://developer.apple.com/forums/thread/679863 as my guide.
var contentInsets = section.contentInsets | ||
contentInsets.leading = 0 | ||
contentInsets.trailing = 0 | ||
contentInsets.top = Constants.contentSectionContentInsets.top | ||
contentInsets.bottom = Constants.metaSectionContentInsets.bottom | ||
section.contentInsets = contentInsets | ||
section.contentInsetsReference = .readableContent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: similar as logic above, should we put this in a private func, so we only have to change in one place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im gonna leave that change out for now given it uses different constants,
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just another note, should we enforce SwiftLint rules instead of having them as warnings? I notice at times we merge them in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyndichin yes we should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for resolving this bug! as discussed with the team in terms of how we review PRs, I didn't pull down, but let me know if you would like me to test
PocketKit: Coverage: 75.2
Generated by 🚫 Danger Swift against 745b537 |
Summary
Makes the reader user-readable content width so that the reader looks better on devices like the iPad.
References
Implementation Details
Was not sure what tests I could use here.
Test Steps
PR Checklist:
Screenshots
Before:
After: