Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a delete method to the facebookConnectPlugin.js files. #1176

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -241,4 +270,4 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun

module.exports = facebookConnectPlugin;
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -241,5 +269,4 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun

module.exports = facebookConnectPlugin;
}

});
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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
Expand Down Expand Up @@ -241,4 +269,4 @@ cordova.define("com.phonegap.plugins.facebookconnect.FacebookConnectPlugin", fun

module.exports = facebookConnectPlugin;
}
});
});