Browse files

Update the JS to remove alerts etc and login now has to have its succ…

…ess method called
  • Loading branch information...
1 parent e0a7337 commit 0ebb23201bc8364368cb77c5b502a345d3144f0e Dave Johnson committed Jul 11, 2011
Showing with 14 additions and 29 deletions.
  1. +14 −29 www/pg-plugin-fb-connect.js
View
43 www/pg-plugin-fb-connect.js
@@ -1,39 +1,24 @@
PG = ( typeof PG == 'undefined' ? {} : PG );
PG.FB = {
init: function(apiKey) {
- PhoneGap.exec(function(e) {
- console.log("init: " + e);
- }, null, 'com.facebook.phonegap.Connect', 'init', [apiKey]);
+ PhoneGap.exec(null, null, 'com.facebook.phonegap.Connect', 'init', [apiKey]);
},
login: function(a, b) {
- try {
- b = b || { perms: '' };
- PhoneGap.exec(function(e) { // login
- //FB.Auth.setSession(e.session, 'connected'); // never gets called because the plugin spawns Mobile Safari/Facebook app
- if (a) a(e);
- }, null, 'com.facebook.phonegap.Connect', 'login', b.perms.split(',') );
- } catch (e) {
- alert(e);
- }
+ b = b || { perms: '' };
+ PhoneGap.exec(function(e) { // login
+ FB.Auth.setSession(e.session, 'connected');
+ if (a) a(e);
+ }, null, 'com.facebook.phonegap.Connect', 'login', b.perms.split(',') );
},
logout: function(cb) {
- try {
- PhoneGap.exec(function(e) {
- FB.Auth.setSession(null, 'notConnected');
- if (cb) cb(e);
- }, null, 'com.facebook.phonegap.Connect', 'logout', []);
- } catch (e) {
- alert(e);
- }
+ PhoneGap.exec(function(e) {
+ FB.Auth.setSession(null, 'notConnected');
+ if (cb) cb(e);
+ }, null, 'com.facebook.phonegap.Connect', 'logout', []);
},
getLoginStatus: function(cb) {
- try {
- PhoneGap.exec(function(e) {
- if (cb) cb(e);
- console.log("getLoginStatus: " + e);
- }, null, 'com.facebook.phonegap.Connect', 'getLoginStatus', []);
- } catch (e) {
- alert(e);
- }
+ PhoneGap.exec(function(e) {
+ if (cb) cb(e);
+ }, null, 'com.facebook.phonegap.Connect', 'getLoginStatus', []);
}
-};
+};

0 comments on commit 0ebb232

Please sign in to comment.