TuftEntertainment / hashtag-warrior

Open-source iOS game powered by cocos2d.
MIT License
8 stars 7 forks source link

Get local trending topics. #12

Open verbitan opened 11 years ago

verbitan commented 11 years ago

Before the game layer, we need a layer to chose the trending topic from twitter. This layer must go to twitter, find a list of local trending topics, display them, and allow choosing one.

verbitan commented 11 years ago

Twitter API for trending topics near you - https://dev.twitter.com/docs/api/1.1/get/trends/place

danielgwood commented 11 years ago

I'm thinking from a usability point of view, it would be ideal if we could launch the locally-trending request in the background before this screen is actually requested.

verbitan commented 11 years ago

Agreed. I was thinking that we'd have a Twitter object, probably as a member of the game state singleton, which handles all this. All we'd have to do is request info from it.

danielgwood commented 11 years ago

There is now a TwitterManager object which GameState can use to abstract out the Twitter functionality, but for some unfathomable reason the data never quite returns. On line 66 https://github.com/verbitan/hashtag-warrior/blob/97156622c4ef4cd42e5a5f1f63faa6874306b231/hashtag-warrior/Game/State/TwitterManager.m the json object exists and is populated with data, including a "trends" key, but does it ever make it into the trends property? No.

verbitan commented 11 years ago

I'm taking over this whilst @danielgwood does the restructure.

verbitan commented 11 years ago

I've written all the infrastructure behind this, we just need the GUI part. I tried using the UIRefreshControl but I couldn't get it to play nice with cocos2d.

danielgwood commented 11 years ago

Working on a GUI.

danielgwood commented 11 years ago

Writing stuff for this today, I noticed this in the Twitter docs:

This information is cached for 5 minutes. Requesting more frequently than that will not return
any more data, and will count against your rate limit usage.

So actually, there's no point in us making this screen refreshable, as it's pretty unlikely to change.

verbitan commented 11 years ago

I find that we're rate limited a lot when it comes to the trends API. I think it's best that we cache the trends for a while, ideally between game sessions as well (e.g. serialise the trends and save to disk).

danielgwood commented 11 years ago

Would need to be careful about how we cache them though - perhaps enforce a maximum time of 30 minutes or an hour - otherwise if a trend is cached, but people stop talking about it, if the user selects that trend the search API may not return any results (would need to confirm that - it may just return the old results, but Twitter's search API certainly used to have some "wibbles"). Agreed on the need to cache though.