Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 170bd520e0de87115f0ba9d4ab9f423853ff745f @ebryn committed Oct 13, 2011
@@ -0,0 +1,4 @@
+tmp
+.DS_Store
+build/*
+*.log
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>TwitterOauth</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.appcelerator.titanium.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.aptana.ide.core.unifiedBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.appcelerator.titanium.mobile.nature</nature>
+ <nature>com.aptana.projects.webnature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,3 @@
+#Sun Oct 09 19:32:12 PDT 2011
+MOBILE_PROJECT_SDK_VERSION=1.7.2
+eclipse.preferences.version=1
@@ -0,0 +1,45 @@
+# twitter-titanium
+
+twitter-titanium is a client-side Twitter library for Titanium Mobile. It simplifies the task of authenticating a user via Twitter. A backend is not required.
+It's designed to emulate the API of the Facebook module included in Titanium Mobile.
+
+It presents a very simple and straightforward API. You provide your OAuth configuration and simply call `authorize()`.
+The user is prompted with a modal WebView to login to Twitter. After the user has logged in, the WebView disappears and a `login` event is fired.
+Requests to Twitter's API endpoints are done with the `request()` function. We intentionally are not wrapping Twitter's API calls, this can
+become a maintainence issue if Twitter updates it's API.
+
+## How to use
+
+- There is an example app included in this repository. See `app.js`
+
+```
+var client = Twitter({
+ consumerKey: "INSERT YOUR KEY HERE",
+ consumerSecret: "INSERT YOUR SECRET HERE"
+});
+
+client.authorize(); // Pops up a modal WebView
+
+client.addEventListener('login', function(e) {
+ // Your app code goes here... you'll likely want to save the access tokens passed in the event.
+
+ // Here's an example API call:
+ client.request("1/statuses/home_timeline.json", {count: 100}, 'GET', function(data) {
+ // `data` is the response text
+ });
+});
+```
+
+
+## Nice features
+
+- Android compatible and tested!
+- On iOS, a back button is displayed if the user does any navigation within the WebView. For example, if the user clicks the forgot password link.
+
+## Thanks
+
+twitter-titanium uses the jsOAuth library by @bytespider
+
+## Contact
+
+twitter-titanium was written by Erik Bryn. You can find him on Twitter at @ebryn.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,38 @@
+(function() {
+ var RUN_TESTS = false;
+
+ if (RUN_TESTS) {
+ Ti.include('tests/tests.js');
+ } else {
+ var Twitter = require('twitter').Twitter;
+
+ var client = Twitter({
+ consumerKey: "INSERT KEY HERE"
+ consumerSecret: "INSERT SECRET HERE",
+ accessTokenKey: Ti.App.Properties.getString('twitterAccessTokenKey'),
+ accessTokenSecret: Ti.App.Properties.getString('twitterAccessTokenSecret')
+ });
+
+ var win = Ti.UI.createWindow({backgroundColor: 'white'}),
+ tableView = Ti.UI.createTableView();
+
+ win.add(tableView);
+ win.open();
+
+ client.addEventListener('login', function(e) {
+ Ti.App.Properties.setString('twitterAccessTokenKey', data.accessTokenKey);
+ Ti.App.Properties.setString('twitterAccessTokenSecret', data.accessTokenSecret);
+
+ client.request("1/statuses/home_timeline.json", {count: 100}, 'GET', function(data) {
+ var json = JSON.parse(data.text),
+ tweets = json.map(function(tweet) {
+ return {title: tweet.text};
+ });
+
+ tableView.setData(tweets);
+ });
+ });
+
+ client.authorize();
+ }
+})(this);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 170bd52

Please sign in to comment.