talklittle / reddit-is-fun

OLD VERSION 1.3 of reddit is fun -- Android app to interact with reddit.com
GNU General Public License v3.0
370 stars 158 forks source link

Intercepting HTTP URIs to www.reddit.com #9

Closed talklittle closed 14 years ago

talklittle commented 14 years ago

It's possible to have an intent-filter for HTTP URIs based on domain. All that is needed would be some pattern matching to direct the parsed URL to the correct Activity. (RedditIsFun for link to subreddit, RedditCommentsListActivity for link to thread, MoreChildrenActivity for link to a comment)

eligrey commented 14 years ago

I second this very strongly. IMO, this should be pretty high priority as then reddit.com links submitted to reddit (such as a specific comment) will be much nicer, as I wouldn't have to scroll in and can use the same UI.

albertb commented 14 years ago

I have a fix here: albertb/reddit-is-fun@42aed8df1101316cc4c8848f392ca9ea2c0e197f

It works with links back to either threads or subreddits as well as individual comments (eg. the bestof reddit).

eligrey commented 14 years ago

You have a bug in your fix: http://github.com/albertb/reddit-is-fun/commit/42aed8df1101316cc4c8848f392ca9ea2c0e197f#commitcomment-64845

eligrey commented 14 years ago

Here are some example URLs that are not matched:

albertb commented 14 years ago

Thanks for the review and sample URLs. I fixed the regular expression to match them all, and fixed the download code for the case where the subreddit is missing from the URL.

I ended up writing some unit tests for the URLs, let me know if you'd like to incorporate them to the repo.

albertb commented 14 years ago

I'm a bit confused by github's compare view and whether it can be used for code reviews, but here's a link to all my changes (they span 4 commits in my repo): http://github.com/albertb/reddit-is-fun/compare/c890b601e9d783205add51614b09b59c962a94a0...master

Let me know what you think!

eligrey commented 14 years ago

It looks good, but it also handles reddit links ending in .rss and .json, which it shouldn't. After that, I think you should ask talklittle about merging in your stuff.

talklittle commented 14 years ago

Thanks a ton, albertb and eligrey. I have been hacking at my school project, sorry for lack of response. I have set aside a few hours (if need be) tomorrow for this and other patches, and hopefully push your updates to Android Market. Hold tight...

talklittle commented 14 years ago

I just checked out the patch and tested a bit. Applied cleanly and works great! I'll put a new version with this patch right now. Thanks!

eligrey commented 14 years ago

Did you add a fix for not handling URLs ending in .json and .rss too?

albertb commented 14 years ago

@eligrey Yes, see http://github.com/albertb/reddit-is-fun/commit/6639460f7386fee9c50c61386e5bfb5603ba832f

@talklittle Awesome!

eligrey commented 14 years ago

Ah, didn't see that. Yeah, this looks great!