cheeaun / hackerweb

A simply readable Hacker News web app
http://hackerwebapp.com/
1.23k stars 133 forks source link

Pull to refresh #1

Open jcaudle opened 12 years ago

jcaudle commented 12 years ago

I don't know anything about the library used on this project, but it would be nice to get the pull to refresh idiom going on this web app. I know it's possible in the Mobile Safari browser (Gmail has a nice implementation for it). If its possible with these libraries, I'll happily get going on putting it in place if there's interest in the feature.

cheeaun commented 12 years ago

Yeah, that's in the plans :smile:

jcaudle commented 12 years ago

Just forked the repo. I'll take a look into it soon!

jcaudle commented 12 years ago

Do you think this is something that might be better in tappable?

cheeaun commented 12 years ago

I think it's better be a separate piece of code. The rough idea I had in mind is a touchmove event to grab the scrollTop values and animate the rotation of arrow, and touchend to detect if scrollTop reaches a certain threshold then begin refreshing.

jcaudle commented 12 years ago

So, still thinking of doing this? I didn't realize there was a patent on this when I suggested it... Now, according to the IPA, Twitter won't do anything, but I'm just wondering if you were still hoping to implement this...

cheeaun commented 12 years ago

Yeah, I think it's okay for now on the patent stuff. Before I try to implement this, I did some research and read this on Quora: http://www.quora.com/What-are-some-reasons-to-not-implement-Pull-to-refresh-UIs-and-actions-into-an-iPhone-app

Among the reasons, one that doesn't work for hnmobile is that the list of stories is not a timeline. Frontpage stories are sorted not by time but by upvotes + time + magic, so when doing pull-to-refresh, new items are not prepended to the list, the whole list just change. The feature may be cool, but not intuitive in this context, so I'm holding off till there's a better solution or a new paradigm appears. Also keeping this issue open as a reminder for myself :smile:

If you're curious if pull-to-refresh may work at all in a -webkit-overflow-scrolling: touch container, here's another project that manage to implement it, which is worth reading the code: https://github.com/Harrison/Messenger

jcaudle commented 12 years ago

I think you are right on about the UX here. Perhaps shake to refresh would be better, but a browser based app might make that un-workable... and there's this: https://speakerdeck.com/u/mccasal/p/the-ux-of-shake-to-refresh-on-iphone-dark-side-of-ux :smile:

Thanks for the tip to the Messenger app.

cheeaun commented 12 years ago

Hah! It is possible with shake.js https://github.com/alexgibson/shake.js/ :smiley:

jcaudle commented 12 years ago

Well, it might make more sense with the whole idiom of HN shaking things up with a refresh, but I don't know if that's necessarily the best idea to go with... :wink: