Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-facebook-connect

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-facebook-connect - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

18

CHANGELOG.md

@@ -0,1 +1,19 @@

<a name="1.2.0"></a>
# [1.2.0](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/releases/tag/v1.2.0) (2021-02-05)
## Features
* Added the `FACEBOOK_IOS_SDK_VERSION` preference to override the default iOS SDK version
* Added the `FACEBOOK_ADVERTISER_ID_COLLECTION` preference and a new `setAdvertiserIDCollectionEnabled` method to allow for disabling collection of `advertiser-id` (closes [#22](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/issues/22))
* Updated the `checkHasCorrectPermissions` method so that it is now supported on all platforms (closes [#25](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/issues/25))
## Bug Fixes
* Updated the `activateApp` method to use the callbacks passed to it (closes [#18](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/issues/18))
* Fixed an issue that would cause the `showDialog` method to fail on iOS if the `method` property was set to "apprequests" but the `actionType` property was not defined; `actionType` is now optional on all platforms (closes [#29](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/issues/29))
## Documentation
* Updated README to include `objectID` property in example configuration object for the `checkHasCorrectPermissions` method; `objectID` is required by the Facebook SDK if `actionType` is non-null (and vice versa)
<a name="1.1.1"></a>

@@ -2,0 +20,0 @@ # [1.1.1](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/releases/tag/v1.1.1) (2021-01-27)

2

package.json
{
"name": "cordova-plugin-facebook-connect",
"version": "1.1.1",
"version": "1.2.0",
"description": "Cordova Facebook SDK Plugin",

@@ -5,0 +5,0 @@ "cordova": {

@@ -97,3 +97,3 @@ # cordova-plugin-facebook-connect

### Check permissions (iOS only)
### Check permissions

@@ -157,2 +157,3 @@ `facebookConnectPlugin.checkHasCorrectPermissions(Array strings of permissions, Function success, Function failure)`

actionType: 'askfor',
objectID: 'YOUR_OBJECT_ID',
filters: 'app_non_users'

@@ -351,8 +352,26 @@ }

facebookConnectPlugin.setAutoLogAppEventsEnabled(true, function() {
console.log('setAutoLogAppEventsEnabled set successfully');
console.log('setAutoLogAppEventsEnabled success');
}, function() {
console.error('setAutoLogAppEventsEnabled failed');
console.error('setAutoLogAppEventsEnabled failure');
});
```
## Collection of Advertiser IDs
To disable collection of `advertiser-id`, please set the *FACEBOOK_ADVERTISER_ID_COLLECTION* variable to "false" (default is true).
```bash
$ cordova plugin add cordova-plugin-facebook-connect --save --variable APP_ID="123456789" --variable APP_NAME="myApplication" --variable FACEBOOK_ADVERTISER_ID_COLLECTION="false"
```
Then, re-enable collection by calling the `setAdvertiserIDCollectionEnabled` method and set it to true.
```js
facebookConnectPlugin.setAdvertiserIDCollectionEnabled(true, function() {
console.log('setAdvertiserIDCollectionEnabled success');
}, function() {
console.error('setAdvertiserIDCollectionEnabled failure');
});
```
## URL Suffixes for Multiple Apps

@@ -359,0 +378,0 @@

@@ -6,3 +6,3 @@ #!/usr/bin/env node

var getPreferenceValue = function(config, name) {
var getPreferenceValueFromConfig = function(config, name) {
var value = config.match(new RegExp('name="' + name + '" value="(.*?)"', "i"))

@@ -16,4 +16,4 @@ if(value && value[1]) {

var getPreferenceValueFromPackageJson = function (config, name) {
var value = config.match(new RegExp('"' + name + '":\\s"(.*?)"', "i"))
var getPreferenceValueFromPackageJson = function (packageJson, name) {
var value = packageJson.match(new RegExp('"' + name + '":\\s"(.*?)"', "i"))
if(value && value[1]) {

@@ -26,2 +26,12 @@ return value[1]

var getPreferenceValue = function (name) {
var config = fs.readFileSync("config.xml").toString()
var preferenceValue = getPreferenceValueFromConfig(config, name)
if(!preferenceValue) {
var packageJson = fs.readFileSync("package.json").toString()
preferenceValue = getPreferenceValueFromPackageJson(packageJson, name)
}
return preferenceValue
}
var APP_ID = ''

@@ -32,8 +42,3 @@

} else {
var config = fs.readFileSync("config.xml").toString()
APP_ID = getPreferenceValue(config, "APP_ID")
if(!APP_ID) {
var packageJson = fs.readFileSync("package.json").toString()
APP_ID = getPreferenceValueFromPackageJson(packageJson, "APP_ID")
}
APP_ID = getPreferenceValue("APP_ID")
}

@@ -46,8 +51,3 @@

} else {
var config = fs.readFileSync("config.xml").toString()
FACEBOOK_BROWSER_SDK_VERSION = getPreferenceValue(config, "FACEBOOK_BROWSER_SDK_VERSION")
if(!FACEBOOK_BROWSER_SDK_VERSION) {
var packageJson = fs.readFileSync("package.json").toString()
FACEBOOK_BROWSER_SDK_VERSION = getPreferenceValueFromPackageJson(packageJson, "FACEBOOK_BROWSER_SDK_VERSION")
}
FACEBOOK_BROWSER_SDK_VERSION = getPreferenceValue("FACEBOOK_BROWSER_SDK_VERSION")
}

@@ -54,0 +54,0 @@

@@ -6,3 +6,3 @@ 'use strict';

module.exports = function (context) {
var getPreferenceValue = function (config, name) {
var getPreferenceValueFromConfig = function (config, name) {
var value = config.match(new RegExp('name="' + name + '" value="(.*?)"', "i"))

@@ -16,4 +16,4 @@ if(value && value[1]) {

var getPreferenceValueFromPackageJson = function (config, name) {
var value = config.match(new RegExp('"' + name + '":\\s"(.*?)"', "i"))
var getPreferenceValueFromPackageJson = function (packageJson, name) {
var value = packageJson.match(new RegExp('"' + name + '":\\s"(.*?)"', "i"))
if(value && value[1]) {

@@ -25,2 +25,12 @@ return value[1]

}
var getPreferenceValue = function (name) {
var config = fs.readFileSync("config.xml").toString()
var preferenceValue = getPreferenceValueFromConfig(config, name)
if(!preferenceValue) {
var packageJson = fs.readFileSync("package.json").toString()
preferenceValue = getPreferenceValueFromPackageJson(packageJson, name)
}
return preferenceValue
}

@@ -32,8 +42,3 @@ var FACEBOOK_URL_SCHEME_SUFFIX = ' '

} else {
var config = fs.readFileSync("config.xml").toString()
FACEBOOK_URL_SCHEME_SUFFIX = getPreferenceValue(config, "FACEBOOK_URL_SCHEME_SUFFIX")
if(!FACEBOOK_URL_SCHEME_SUFFIX) {
var packageJson = fs.readFileSync("package.json").toString()
FACEBOOK_URL_SCHEME_SUFFIX = getPreferenceValueFromPackageJson(packageJson, "FACEBOOK_URL_SCHEME_SUFFIX")
}
FACEBOOK_URL_SCHEME_SUFFIX = getPreferenceValue("FACEBOOK_URL_SCHEME_SUFFIX")
}

@@ -50,8 +55,3 @@

} else {
var config = fs.readFileSync("config.xml").toString()
FACEBOOK_AUTO_LOG_APP_EVENTS = getPreferenceValue(config, "FACEBOOK_AUTO_LOG_APP_EVENTS")
if(!FACEBOOK_AUTO_LOG_APP_EVENTS) {
var packageJson = fs.readFileSync("package.json").toString()
FACEBOOK_AUTO_LOG_APP_EVENTS = getPreferenceValueFromPackageJson(packageJson, "FACEBOOK_AUTO_LOG_APP_EVENTS")
}
FACEBOOK_AUTO_LOG_APP_EVENTS = getPreferenceValue("FACEBOOK_AUTO_LOG_APP_EVENTS")
}

@@ -65,2 +65,16 @@

var FACEBOOK_ADVERTISER_ID_COLLECTION = 'true'
if(process.argv.join("|").indexOf("FACEBOOK_ADVERTISER_ID_COLLECTION=") > -1) {
FACEBOOK_ADVERTISER_ID_COLLECTION = process.argv.join("|").match(/FACEBOOK_ADVERTISER_ID_COLLECTION=(.*?)(\||$)/)[1]
} else {
FACEBOOK_ADVERTISER_ID_COLLECTION = getPreferenceValue("FACEBOOK_ADVERTISER_ID_COLLECTION")
}
if(typeof FACEBOOK_ADVERTISER_ID_COLLECTION == 'string' && FACEBOOK_ADVERTISER_ID_COLLECTION.toLowerCase() == 'false') {
FACEBOOK_ADVERTISER_ID_COLLECTION = 'false'
} else {
FACEBOOK_ADVERTISER_ID_COLLECTION = 'true'
}
var getPlistPath = function () {

@@ -92,2 +106,8 @@ var common = context.requireCordovaModule('cordova-common'),

if(plistContent.indexOf('<key>FacebookAdvertiserIDCollectionEnabled</key>') == -1) {
plistContent = plistContent.replace('<key>FacebookAdvertiserIDCollectionEnabled_PLACEHOLDER</key>', '<key>FacebookAdvertiserIDCollectionEnabled</key>').replace('<string>FACEBOOK_ADVERTISER_ID_COLLECTION_PLACEHOLDER</string>', '<' + FACEBOOK_ADVERTISER_ID_COLLECTION + ' />')
} else {
plistContent = plistContent.replace('<key>FacebookAdvertiserIDCollectionEnabled_PLACEHOLDER</key>', '').replace('<string>FACEBOOK_ADVERTISER_ID_COLLECTION_PLACEHOLDER</string>', '')
}
fs.writeFileSync(plistPath, plistContent, 'utf8')

@@ -94,0 +114,0 @@ })

@@ -14,3 +14,3 @@ /* globals */

FB.getLoginStatus(function (response) {
s(response)
if(s) s(response);
})

@@ -33,9 +33,18 @@ }

options.quote = options.quote || ''
if (options.actionType) {
options.action_type = options.actionType
}
if (options.objectID) {
options.object_id = options.objectID
}
if (options.filters && !Array.isArray(options.filters)) {
options.filters = [options.filters]
}
FB.ui(options, function (response) {
if (response && (response.request || !response.error_code)) {
s(response)
if(s) s(response);
return
}
f(response.message)
if(f) f(response.message);
})

@@ -74,11 +83,11 @@ }

if (response.authResponse) {
s(response)
if(s) s(response);
} else if (response) { // Previously this was just an else statement.
if (response.status) { // When status is undefined this would throw an error, and rejection function would never be invoked.
f(response.status.message)
if(f) f(response.status.message);
} else {
f(response)
if(f) f(response);
}
} else { // In case that no response is available (e.g. popup dismissed)
f('No response')
if(f) f('No response');
}

@@ -88,9 +97,46 @@ }, options)

exports.checkHasCorrectPermissions = function checkHasCorrectPermissions (permissions, s, f) {
if (!__fbSdkReady) {
return __fbCallbacks.push(function() {
checkHasCorrectPermissions(permissions, s, f);
});
}
if (!permissions || permissions.length === 0) {
if(s) s('All permissions have been accepted');
} else {
FB.api('me/permissions', function (response) {
if (response.error || !response.data) {
if(f) f('There was an error getting the list of the user\'s permissions.');
} else {
var userPermissions = response.data,
grantedPermissions = [],
declinedPermissionsFound = false
for (var x = 0; x < userPermissions.length; x++) {
if (userPermissions[x].status == 'granted') {
grantedPermissions.push(userPermissions[x].permission);
}
}
for (var x = 0; x < permissions.length; x++) {
if (grantedPermissions.indexOf(permissions[x]) < 0) {
declinedPermissionsFound = true;
}
}
if (declinedPermissionsFound) {
if(f) f('A permission has been denied');
} else {
if(s) s('All permissions have been accepted');
}
}
})
}
}
exports.getAccessToken = function getAccessToken (s, f) {
var response = FB.getAccessToken()
if (response) {
s(response)
if(s) s(response);
return
}
f('NO_TOKEN')
if(f) f('NO_TOKEN');
}

@@ -135,3 +181,3 @@

FB.logout(function (response) {
s(response)
if(s) s(response);
})

@@ -162,5 +208,5 @@ }

if (response.error) {
f(response)
if(f) f(response);
} else {
s(response)
if(s) s(response);
}

@@ -175,2 +221,14 @@ })

exports.activateApp = function logEvent (s, f) {
if (!__fbSdkReady) {
return __fbCallbacks.push(function() {
activateApp(s, f);
});
}
FB.AppEvents.activateApp();
if(s) s();
}
if (window.location.protocol === "file:") {

@@ -177,0 +235,0 @@ console.warn("Facebook JS SDK is not supported when using file:// protocol");

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc