diff options
| -rw-r--r-- | Resources/friendship/config/config.js | 5 | ||||
| -rw-r--r-- | Resources/friendship/friendship.js | 1 | ||||
| -rw-r--r-- | Resources/friendship/ui/LoginWindow.js | 21 | ||||
| -rw-r--r-- | Resources/friendship/ui/ui.js | 3 | ||||
| -rw-r--r-- | tiapp.xml | 1 |
5 files changed, 30 insertions, 1 deletions
diff --git a/Resources/friendship/config/config.js b/Resources/friendship/config/config.js new file mode 100644 index 0000000..dc86a0e --- /dev/null +++ b/Resources/friendship/config/config.js @@ -0,0 +1,5 @@ +(function() { + // Facebook + Titanium.Facebook.appid = '258369447595838'; + Titanium.Facebook.permissions = ['publish_stream']; +})(); diff --git a/Resources/friendship/friendship.js b/Resources/friendship/friendship.js index fa00b10..8d3f437 100644 --- a/Resources/friendship/friendship.js +++ b/Resources/friendship/friendship.js @@ -5,5 +5,6 @@ var fs = {}; })(); Ti.include( + '/friendship/config/config.js', '/friendship/ui/ui.js' ); diff --git a/Resources/friendship/ui/LoginWindow.js b/Resources/friendship/ui/LoginWindow.js new file mode 100644 index 0000000..cbb803b --- /dev/null +++ b/Resources/friendship/ui/LoginWindow.js @@ -0,0 +1,21 @@ +(function() { + function createFBLoginButton () { + // Don't forget to set your appid and requested permissions, else the login button + // won't be effective. + + Titanium.Facebook.addEventListener('login', function(e) { + if (e.success) { + alert('Logged in'); + } + }); + Titanium.Facebook.addEventListener('logout', function(e) { + alert('Logged out'); + }); + + // add the button. Note that it doesn't need a click event or anything. + return Titanium.Facebook.createLoginButton({ + top: 50, + style: 'wide' + }); + }; +})(); diff --git a/Resources/friendship/ui/ui.js b/Resources/friendship/ui/ui.js index b86383a..f548cfd 100644 --- a/Resources/friendship/ui/ui.js +++ b/Resources/friendship/ui/ui.js @@ -4,5 +4,6 @@ Ti.include( '/friendship/ui/ApplicationWindow.js', - '/friendship/ui/LikeList.js' + '/friendship/ui/LikeList.js', + '/friendship/ui/LoginWindow.js' ) @@ -23,6 +23,7 @@ <fullscreen>false</fullscreen> <navbar-hidden>false</navbar-hidden> <analytics>true</analytics> + <property name="ti.facebook.appid">258369447595838</property> <guid>ccd110bb-8710-4380-ad4a-94d93e18d62a</guid> <iphone> <orientations device="iphone"> |
