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

fix(reader): makes reader use readable content width #416

Merged
merged 3 commits into from
Feb 22, 2023
Merged

Conversation

bassrock
Copy link
Member

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

  • Use the reader on a large tablet screen.

PR Checklist:

  • Added Unit / UI tests
  • Self Review (review, clean up, documentation, run tests)
  • Basic Self QA

Screenshots

Before:

Simulator Screen Shot - iPad Mini - 2023-02-21 at 15 45 56

After:
Simulator Screen Shot - iPad Mini - 2023-02-21 at 15 44 43

@bassrock bassrock requested a review from a team as a code owner February 21, 2023 23:47
@@ -93,6 +93,12 @@ class ReadableViewController: UIViewController {
readableViewModel.fetchDetailsIfNeeded()
}

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
Copy link
Member Author

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.
Copy link
Member Author

Choose a reason for hiding this comment

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

Comment on lines +327 to +333
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
Copy link
Contributor

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

Copy link
Member Author

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,

Comment on lines 113 to 114


Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@cyndichin yes we should.

Copy link
Contributor

@cyndichin cyndichin left a 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

@pocket-ci
Copy link
Contributor

Messages
📖 No SwiftLint violations! 🎉
📖 Project coverage: 76.37%
📖 Edited 1 files
📖 Created 0 files

PocketKit: Coverage: 75.2

File Coverage
ReadableViewController.swift 73.9%

Generated by 🚫 Danger Swift against 745b537

@bassrock bassrock merged commit 5fb5c16 into develop Feb 22, 2023
@bassrock bassrock deleted the in-790 branch February 22, 2023 21:03
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