diff --git a/platforms/android/assets/www/plugins/com.phonegap.plugins.facebookconnect/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js b/platforms/android/assets/www/plugins/com.phonegap.plugins.facebookconnect/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js index 54788a6ab..55bcbc290 100644 --- a/platforms/android/assets/www/plugins/com.phonegap.plugins.facebookconnect/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js +++ b/platforms/android/assets/www/plugins/com.phonegap.plugins.facebookconnect/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js @@ -53,7 +53,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun if (options.link && !options.href) { options.href = options.link; } - + // Try will catch errors when SDK has not been init try { FB.ui(options, @@ -79,7 +79,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun if (permissions && permissions.length > 0) { permissionObj.scope = permissions.toString(); } - + FB.login(function (response) { if (response.authResponse) { s(response); @@ -129,7 +129,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun api: function (graphPath, permissions, s, f) { // JS API does not take additional permissions - + // Try will catch errors when SDK has not been init try { FB.api(graphPath, function (response) { @@ -148,6 +148,35 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun } }, + delete: function (graphPath, params, s, f) { + if(!params) { + params = {}; + } + // JS API does not take additional permissions + + // Try will catch errors when SDK has not been init + try { + FB.api( + graphPath, + 'delete', + params, + function (response) { + if (response.error) { + f(response); + } else { + s(response); + } + } + ); + } catch (error) { + if (!f) { + console.error(error.message); + } else { + f(error.message); + } + } + }, + // Browser wrapper API ONLY browserInit: function (appId, version) { if (!version) { @@ -161,7 +190,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun }); } }; - + // Bake in the JS SDK (function () { // Retrieve the root element to append the script tags to @@ -241,4 +270,4 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun module.exports = facebookConnectPlugin; } -}); \ No newline at end of file +}); diff --git a/platforms/browser/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js b/platforms/browser/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js index 7894af8aa..ad9f236d7 100644 --- a/platforms/browser/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js +++ b/platforms/browser/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js @@ -53,7 +53,6 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun if (options.link && !options.href) { options.href = options.link; } - // Try will catch errors when SDK has not been init try { FB.ui(options, @@ -79,7 +78,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun if (permissions && permissions.length > 0) { permissionObj.scope = permissions.toString(); } - + FB.login(function (response) { if (response.authResponse) { s(response); @@ -127,9 +126,38 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun } }, + delete: function (graphPath, params, s, f) { + if(!params) { + params = {}; + } + // JS API does not take additional permissions + + // Try will catch errors when SDK has not been init + try { + FB.api( + graphPath, + 'delete', + params, + function (response) { + if (response.error) { + f(response); + } else { + s(response); + } + } + ); + } catch (error) { + if (!f) { + console.error(error.message); + } else { + f(error.message); + } + } + }, + api: function (graphPath, permissions, s, f) { // JS API does not take additional permissions - + // Try will catch errors when SDK has not been init try { FB.api(graphPath, function (response) { @@ -161,7 +189,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun }); } }; - + // Bake in the JS SDK (function () { // Retrieve the root element to append the script tags to @@ -241,5 +269,4 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun module.exports = facebookConnectPlugin; } - }); diff --git a/platforms/ios/www/plugins/com.phonegap.plugins.facebookconnect/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js b/platforms/ios/www/plugins/com.phonegap.plugins.facebookconnect/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js index 54788a6ab..ed8a4ba05 100644 --- a/platforms/ios/www/plugins/com.phonegap.plugins.facebookconnect/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js +++ b/platforms/ios/www/plugins/com.phonegap.plugins.facebookconnect/www/phonegap/plugin/facebookConnectPlugin/facebookConnectPlugin.js @@ -53,7 +53,6 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun if (options.link && !options.href) { options.href = options.link; } - // Try will catch errors when SDK has not been init try { FB.ui(options, @@ -79,7 +78,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun if (permissions && permissions.length > 0) { permissionObj.scope = permissions.toString(); } - + FB.login(function (response) { if (response.authResponse) { s(response); @@ -129,7 +128,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun api: function (graphPath, permissions, s, f) { // JS API does not take additional permissions - + // Try will catch errors when SDK has not been init try { FB.api(graphPath, function (response) { @@ -148,6 +147,35 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun } }, + delete: function (graphPath, params, s, f) { + if(!params) { + params = {}; + } + // JS API does not take additional permissions + + // Try will catch errors when SDK has not been init + try { + FB.api( + graphPath, + 'delete', + params, + function (response) { + if (response.error) { + f(response); + } else { + s(response); + } + } + ); + } catch (error) { + if (!f) { + console.error(error.message); + } else { + f(error.message); + } + } + }, + // Browser wrapper API ONLY browserInit: function (appId, version) { if (!version) { @@ -161,7 +189,7 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun }); } }; - + // Bake in the JS SDK (function () { // Retrieve the root element to append the script tags to @@ -241,4 +269,4 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun module.exports = facebookConnectPlugin; } -}); \ No newline at end of file +});