Giter Site home page Giter Site logo

bennyguitar / news-yc---iphone Goto Github PK

View Code? Open in Web Editor NEW
822.0 57.0 152.0 12.7 MB

The iPhone version of News/YC, a Hacker News reader and interactive iOS application.

License: Other

Swift 99.01% Objective-C 0.64% Ruby 0.35%
ycombinator hackernews

news-yc---iphone's Introduction

banner

About

News/YC is an iOS app that tries to do one thing, give you Hacker News and get the hell out of the way. If the app isn't doing something you feel it should, or if you think there's an easier way to get an action accomplished - open up an Issue! I want your feedback. This app was made by me, for my usage, so it probably won't line up with everybody's tastes and there is probably a huge group of people with better taste than me. Feel free to be vocal - it's the only way to make this app the best!

This app does not use the new HackerNews API, but instead relies on libHN for the interface to HN content.

App Store

  • 3.0
  • Swift

Table of Contents

General Architecture

This app is built in Swift, but is really a port of an existing app with a little bit clearer design and modularity of components. There are a few architecture decisions I made to make some things easier that may or may not be defacto architecture or MVC considerations. The first of which is...

HNNavigationBrain

This class is literally the arbiter for all navigation related activities. I made this class with the idea that I shouldn't have to constantly defer navigation-related logic up through a chain to meet a UIViewController which then actually does it. That's too much of a chain, and honestly too much of a hassle. I wanted the system to be slightly knowledgable about itself. I wanted to be able to navigate at any time I want.

Enter the Brain.

The navigation brain works by making every navigable View Controller a subclass of HNViewController which handles a lot of boilerplate logic like building the navigation bar and responding to theme changes, etc. The biggest thing this view controller does is listen for navigation notifications, and responding if they are valid. HNNavigationBrain initiates navigation by a bunch of possible methods (navigate to Posts, navigate to comments for Post, etc) and passes a newly instantiated HNViewController instance through the NSNotificationCenter to the top-most view controller in the UINavigationController's stack.

What this effectively means, is that anything can initiate navigation. All views, models, and controllers have this functionality thanks to the brain. This scheme is not without possible problems, however, but we try to minimize these as much as possible. Navigation events are fairly predictable reactions to button presses, so we don't have to worry so much about different classes calling navigation notifications at the same time. But it is beneficial to think about this as you commit and contribute to the project.

It's fairly easy to use the navigation brain as well:

HNNavigationBrain.navigateToComments(somePost)

HNTheme

HNTheme.currentTheme() acts as the main interface for all them and color related functionality of the app. The currentTheme() singleton instance determines how all UI color schemes are assigned, and handles the notifications blasted out when the theme is changed. All HNViewControllers and their subclasses override the resetUI() method to reset after a theme change.

Currently there are four themes in the app, two light (Day and Minima) and two dark (Night and SpaceOne). Since I'm an art guy myself, you can bet your butt there will be more themes and theme packs later.

View Controllers

As mentioned earlier, all navigable view controllers in the app are subclasses of HNViewController - but those don't account for all view controllers in the app.

HNViewController subclassed

  • HNPostsViewController
  • HNCommentsViewController
  • HNWebViewController

UIViewController subclassed

  • HNSubmissionViewController
  • HNNavigationViewController

What's Next?

Apart from library changes here and there whenever YC starts messing with the site site's HTML markup, here's the list of functionality I'd like to add:

  • Nesting Comments
  • Find text in comment strings
  • More themes!

news-yc---iphone's People

Contributors

bennyguitar avatar btmills avatar gshahbazian avatar imavca avatar krohling avatar reygonzales avatar troyharris avatar vexocide avatar xonder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

news-yc---iphone's Issues

New Features

New Features

Leave new features you'd like added to the app!

  • Horizontal viewing
  • iPad Support
  • More share options

Scroll to top

Tapping the iPhone status bar (with time, battery, etc.) should scroll to the top if the list.

Unable to login

After entering my username and password and hitting submit, the username and password fields are cleared without any success/fail login message, and I am still unable to post/up vote.

Btw this happens with the current App Store version.

Horizontal View

The ability to turn the app to landscape view is missing (by design or not) and it would be nice, especially for viewing videos inside articles.

Share Options

Share options for future release:

  • FB
  • Twitter
  • Email
  • Instapaper
  • Pocket
  • Open in Safari/Chrome (if possible)

Comment here about different share options so we can have them in the same place.

Crash on loading comments

Getting the following when trying to view comments. Looking for fix but this one is stumping me:

2013-07-26 15:15:29.491 HackerNews[19160:907] *** Assertion failure in -[NSConcreteMutableAttributedString boundingRectWithSize:options:context:], /SourceCache/UIFoundation/UIFoundation-78/UIFoundation/TextSystem/NSStringDrawing.m:1176

App takes over music player

This is an issue from a review. Here's the full text:

Working again. Thank you guys! Dropped my star rating cause there us an issue where the app takes over music control. Gotta be able to listen to the music app and use this app.

3.3.0 update

Thanks for the awesome app. I wasn't able to run the code when I cloned it. Will this repo be updated to 3.3.0?

Pocket

This really needs pocket integration! I use it all the time in HackerNode. I save the actual HN pages and the links to the submission.

News refresh pull down too much

In order to refresh the stories, you have too pull down a little bit too much. Making the pull down refresh activate a little higher would make it easier to update. I've had numerous times when I didn't pull down far enough.

Incorrect parsing of items

hey,

every time I open the app in the last couple of days I always get this view:

img_2207

It's the latest release from the apple app store.

The view of HN Jobs is always the same no matter what topic (New, Top, Ask) I select.

Am I doing something wrong? 8-)

Sharing/Opening

Facebook/Twitter/Email/Open in Safari/Open in Chrome

Extra points for a "favorites" list in the app, which could sync across iPad/iPhone apps (if/when iPad support comes)

Unable to share articles

When selecting to share an article on Twitter or Facebook nothing happens. Am I missing something or is this a real issue? I am on version 7.1 if that matters.

photo

Tried to Build app but got 3 errors, using XCode6

(1) PhaseScriptExecution Check\ Pods\ Manifest.lock /Users/sasaro/Library/Developer/Xcode/DerivedData/HackerNews-gzwqcccowfufmgerdmiuagcbmvti/Build/Intermediates/HackerNews.build/Debug-iphonesimulator/HackerNews.build/Script-7E730C088B0B40D6838FB2CC.sh
cd /Users/sasaro/GitHub/News-YC---iPhone
/bin/sh -c /Users/sasaro/Library/Developer/Xcode/DerivedData/HackerNews-gzwqcccowfufmgerdmiuagcbmvti/Build/Intermediates/HackerNews.build/Debug-iphonesimulator/HackerNews.build/Script-7E730C088B0B40D6838FB2CC.sh

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

(2) PhaseScriptExecution Check\ Pods\ Manifest.lock /Users/sasaro/Library/Developer/Xcode/DerivedData/HackerNews-gzwqcccowfufmgerdmiuagcbmvti/Build/Intermediates/HackerNews.build/Debug-iphonesimulator/HackerNews.build/Script-7E730C088B0B40D6838FB2CC.sh
cd /Users/sasaro/GitHub/News-YC---iPhone
/bin/sh -c /Users/sasaro/Library/Developer/Xcode/DerivedData/HackerNews-gzwqcccowfufmgerdmiuagcbmvti/Build/Intermediates/HackerNews.build/Debug-iphonesimulator/HackerNews.build/Script-7E730C088B0B40D6838FB2CC.sh

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

(3) PhaseScriptExecution Check\ Pods\ Manifest.lock /Users/sasaro/Library/Developer/Xcode/DerivedData/HackerNews-gzwqcccowfufmgerdmiuagcbmvti/Build/Intermediates/HackerNews.build/Debug-iphonesimulator/HackerNews.build/Script-7E730C088B0B40D6838FB2CC.sh
cd /Users/sasaro/GitHub/News-YC---iPhone
/bin/sh -c /Users/sasaro/Library/Developer/Xcode/DerivedData/HackerNews-gzwqcccowfufmgerdmiuagcbmvti/Build/Intermediates/HackerNews.build/Debug-iphonesimulator/HackerNews.build/Script-7E730C088B0B40D6838FB2CC.sh

diff: /../Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

Also, libPods.a is read and was giving me an error before the above.

Colours.h file not found

I cloned the repo and after doing pod install, I still get an error saying "Colours.h" file not found. Can you help?

App icon on iPad

This may be outside the scope of the project (as the project is for iPhone) but the app icon when installing the app on my iPad mini is a blank grid-like icon.

Hopefully low level of effort for this one. This is such a well designed app that I imagine people will use this on the iPad even though there is not a UI design for that resolution yet.

Return to already visited links

Occasionally I click on to an article link, then within that website I click another link. Afterwards, I might press back in order to go back to the top news links. When I click the same link after going back to the top news, I am brought back to the link I clicked within the original article instead of the article itself.

What I have been doing to see the original article is to click on another article from top news, then go back to the original article link I wanted to visit.

Would be nice to have the WebView to refresh each time I visit a link like in the scenario described.

Stories aren't fetched

The app has completely stopped working for me. It no longer displays any stories. Possible that the underlying HTML has changed and broken the app?

Crash on start

The update released in the App Store on 6/17 crashes immediately upon launching the app.
Configurations tested:

  • iPhone 5, iOS 6.1.4
  • iPad 4, iOS 6.1.0

Keep browser loaded

If I go to the comments while I have an article open, I shouldn't lose my clicks (the comments should open on top of the browser and I should be able to switch back).

Comments fail to submit

I just get a "failed to comment" error. No extra info. Happens on different networks, so it is definitely the app.

Comment folding

It would be really cool to have "Fold" as an option on the comment menu to collapse sub threads.

Selecting unloaded article crashes app

Crash bug, discovered after an accidental finger tap on an iPhone 5.

To reproduce

  1. Make sure the app is not running by closing it if it is in the multitasking tray.
  2. Launch the app.
  3. Before articles have loaded, tap on the topmost article spot.

Expected behavior: Nothing
Actual behavior: The topmost article spot highlights (turns blue), after which the app crashes and exits to the Springboard.

Notes

  • This only happens for the topmost article spot. Tapping on any other results in no action, as expected.
  • Opening the menu tray and then selecting the topmost article also crashes the app.
  • As far as I can tell, tapping the topmost article is the only action that causes this crash.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.