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

UI improvements [WIP, DO NOT MERGE] #45

Closed
wants to merge 15 commits into from

Conversation

robbiet480
Copy link

@robbiet480 robbiet480 commented Oct 21, 2018

This PR adds a few nice UI tweaks:

  • Two new themes, a pure black theme for OLED devices and a "original" theme which matches news.ycombinator.com in terms of colors and fonts (Verdana).
  • Handoff support for comments and links
  • Allow users to choose a browser to open a link in (SFSafariViewController, SFSafariViewController in reader mode, Safari or Chrome)
  • Long press on a link in NewsViewController to share link
  • When sharing, we give the user the option of either sharing the content link or the comments link
  • Long press on a comment now allows sharing a link to that comment
  • SFSafariViewController is initialized with barCollapsingEnabled = TRUE (Indicates if SFSafariViewController should enable collapsing of the navigation bar and hiding of the bottom toolbar when the user scrolls web content.)
  • Hides tab bar on comments view
  • Tapping a jobs post goes directly to the link instead of comments since job posts don't have comments.
  • Extends comments view to superview so comments are behind home indicator
  • Redid the settings page with Eureka so that it's easier to handle the inline theme picker as well as provide a good foundation for other future settings.
  • Removed the custom share icon and instead used the system default icon.
  • Minor other tweaks

@weiran Can you provide me sources for the icons you are using? I need to generate a new set of icons that look good in the original theme as right now the grey doesn't look great...

@robbiet480
Copy link
Author

@weiran just checking in about those icons again 😄

@robbiet480
Copy link
Author

@weiran Just a heads up it looks like your latest libHN changes broke job posts (they only have a urlString and title now, no ID or time).

}

extension MainTabBarController: Themed {
func applyTheme(_ theme: AppTheme) {
tabBar.barTintColor = theme.barBackgroundColor
tabBar.tintColor = theme.barForegroundColor

let application = UIApplication.shared.delegate as! AppDelegate
Copy link
Owner

Choose a reason for hiding this comment

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

Can use a chain of if lets here to avoid force casting.

@@ -34,6 +36,12 @@ class CommentsViewController : UIViewController {
setupPostTitleView()
view.showAnimatedSkeleton(usingColor: AppThemeProvider.shared.currentTheme.skeletonColor)
loadComments()

let activity = NSUserActivity(activityType: "com.weiranzhang.Hackers.comments")
Copy link
Owner

Choose a reason for hiding this comment

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

Can this be wrapped in a setupHandoff method?

@@ -107,6 +128,16 @@ extension CommentsViewController: PostTitleViewDelegate {

// show link
let safariViewController = ThemedSafariViewController(url: url)
let activity = NSUserActivity(activityType: "com.weiranzhang.Hackers.link")
Copy link
Owner

Choose a reason for hiding this comment

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

There's some duplication with the following block of code in a few places.


extension UIFont {

@objc class func mySystemFont(ofSize size: CGFloat) -> UIFont {
Copy link
Owner

Choose a reason for hiding this comment

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

A better name is themedSystemFont so that it's clear this method returns a font based on the current theme.

skeletonColor: UIColor(rgb: 0xAAAAAA)
skeletonColor: UIColor(rgb: 0xAAAAAA),

regularFontName: UIFont.systemFont(ofSize: 1).fontName,
Copy link
Owner

Choose a reason for hiding this comment

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

Perhaps use some placeholder value for size instead of 1 to avoid confusion.

}
}.cellUpdate { cell, row in
let activeTheme = UserDefaults.standard.enabledTheme
cell.textLabel?.textColor = activeTheme.textColor
Copy link
Owner

Choose a reason for hiding this comment

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

Can this cell conform to the Themed protocol instead of being manually updated?

@weiran
Copy link
Owner

weiran commented Oct 26, 2018

@weiran just checking in about those icons again 😄

I'm afraid I don't have the original sources other than the 1x, 2x, 3x PNG icons.

@weiran Just a heads up it looks like your latest libHN changes broke job posts (they only have a urlString and title now, no ID or time).

Thanks I'll have a look at it.

@weiran
Copy link
Owner

weiran commented Oct 26, 2018

Some great improvements in here, thanks! There's also a lot of changes going on in this single PR which makes it hard to review the code, and also review the changes involved. I like most of them but I'm unsure about long-press gestures (I'm thinking of adding cell swipe actions to reply/share/collapse thread etc).

Smaller PRs will make it easier to review and merge if you're able to split out future features/enhancements.

@weiran
Copy link
Owner

weiran commented Jan 12, 2019

Closing this for now.

@robbiet480 let me know if you'd like to continue, otherwise I'll probably take several of your improvements into the 4.0 milestone myself. Thanks.

@weiran weiran closed this Jan 12, 2019
@robbiet480 robbiet480 mentioned this pull request May 17, 2019
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.

None yet

2 participants