ionic_twitter_feed icon indicating copy to clipboard operation
ionic_twitter_feed copied to clipboard

How much code has to be changed to properly display a user timeline

Open erjin opened this issue 9 years ago • 6 comments

I got my own API key and API secret and also installed all plugins including whitelist and in-app browser plugins. And built in ios but still could not see any contents. Can you please give me any advice?

erjin avatar Jun 20 '16 21:06 erjin

Have you got it working?

chsxe avatar Jun 22 '16 20:06 chsxe

@chsxe yes, it works well.

erjin avatar Jun 23 '16 00:06 erjin

@drrasic How much code has to be changed to properly display a user timeline. This works great for home timelines, but say I wanted a specific user. I have messed around with the code, I kind of expected changing the url and taking out the # hashtag would work. I have a work around now, but I don't understand the method of getting it properly.

chsxe avatar Jun 23 '16 08:06 chsxe

Some Twitter API endpoints return diferently formated responses, so you have to tweak the controller in some cases, and probably the view in other

For user timeline you would use something like this

var twitterStreamURL = "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=";
var qValue = "twitter";

and in that case you would change in controller from $scope.tweets = tweets.statuses; to $scope.tweets = tweets;

So in summary:

  • find your endpoint on https://dev.twitter.com/rest/public
  • build your custom query
  • print raw response to see how it is formated,
  • corect the controller(maybe view) to match

drrasic avatar Jun 23 '16 10:06 drrasic

I made a demo for this https://github.com/erjin/ionic_twitter_feed

erjin avatar Jun 24 '16 21:06 erjin

Yes this works 100% fine, thank you @drrasic . Previously I had changed one line of code and made a workaround that displayed tweets from a specific user, along with the @ mentions of that user.

chsxe avatar Jun 25 '16 08:06 chsxe