mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
chore(facebook): update facebook docs
This commit is contained in:
parent
c8069b96e5
commit
7b6395817e
6
dist/plugins/calendar.d.ts
vendored
6
dist/plugins/calendar.d.ts
vendored
@ -58,9 +58,7 @@ export declare class Calendar {
|
||||
/**
|
||||
* Returns the default calendar options.
|
||||
*
|
||||
* @return Returns an object with the default calendar options
|
||||
* ```
|
||||
* {
|
||||
* @return Returns an object with the default calendar options:
|
||||
* firstReminderMinutes: 60,
|
||||
* secondReminderMinutes: null,
|
||||
* recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly'
|
||||
@ -69,8 +67,6 @@ export declare class Calendar {
|
||||
* calendarName: null,
|
||||
* calendarId: null,
|
||||
* url: null
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
static getCalendarOptions(): CalendarOptions;
|
||||
/**
|
||||
|
6
dist/plugins/calendar.js
vendored
6
dist/plugins/calendar.js
vendored
@ -64,9 +64,7 @@ var Calendar = (function () {
|
||||
/**
|
||||
* Returns the default calendar options.
|
||||
*
|
||||
* @return Returns an object with the default calendar options
|
||||
* ```
|
||||
* {
|
||||
* @return Returns an object with the default calendar options:
|
||||
* firstReminderMinutes: 60,
|
||||
* secondReminderMinutes: null,
|
||||
* recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly'
|
||||
@ -75,8 +73,6 @@ var Calendar = (function () {
|
||||
* calendarName: null,
|
||||
* calendarId: null,
|
||||
* url: null
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
Calendar.getCalendarOptions = function () {
|
||||
return {
|
||||
|
2
dist/plugins/calendar.js.map
vendored
2
dist/plugins/calendar.js.map
vendored
File diff suppressed because one or more lines are too long
10
dist/plugins/contacts.js
vendored
10
dist/plugins/contacts.js
vendored
@ -53,6 +53,11 @@ var Contacts = (function () {
|
||||
* @return Returns a Promise that resolves with the search results (an array of Contact objects)
|
||||
*/
|
||||
Contacts.find = function (fields, options) {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
;
|
||||
@ -61,6 +66,11 @@ var Contacts = (function () {
|
||||
* @return Returns a Promise that resolves with the selected Contact
|
||||
*/
|
||||
Contacts.pickContact = function () {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
;
|
||||
|
2
dist/plugins/contacts.js.map
vendored
2
dist/plugins/contacts.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/plugins/contacts.ts"],"names":["Contacts","Contacts.constructor","Contacts.create","Contacts.find","Contacts.pickContact"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AA6LzC;;;;;;;;;;;;;;;;GAgBG;AACH;IAAAA;IAqDAC,CAACA;IA9CCD;;;;;OAKGA;IAIIA,eAAMA,GAHbA,UAGcA,OAA0BA;QACtCE,MAAMA,CAACA,IAAIA,OAAOA,EAAEA,CAACA;IACvBA,CAACA;;IAEDF;;;;;;;;;;;;;;;;OAgBGA;IAKIA,aAAIA,GAJXA,UAIYA,MAAgBA,EAAEA,OAAaA;QACzCG,MAAMA,CAACA,IAAIA,OAAOA,CAAYA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAClDA,CAACA;;IAEDH;;;OAGGA;IAEIA,oBAAWA,GADlBA;QAEEI,MAAMA,CAACA,IAAIA,OAAOA,CAAUA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAChDA,CAACA;;IAvCDJ;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,kBAAMA,QAEZA;IAmBDA;QAACA,gBAAOA,CAACA;YACPA,YAAYA,EAAEA,CAACA;YACfA,UAAUA,EAAEA,CAACA;SACdA,CAACA;OACKA,gBAAIA,QAEVA;IAMDA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAEjBA;IApDHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,oBAAoBA;YAC/BA,IAAIA,EAAEA,mDAAmDA;SAC1DA,CAACA;iBAgDDA;IAADA,eAACA;AAADA,CAACA,AArDD,IAqDC;AA/CY,gBAAQ,WA+CpB,CAAA"}
|
||||
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../src/plugins/contacts.ts"],"names":["Contacts","Contacts.constructor","Contacts.create","Contacts.find","Contacts.pickContact"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AA6LzC;;;;;;;;;;;;;;;;GAgBG;AACH;IAAAA;IA+DAC,CAACA;IAxDCD;;;;;OAKGA;IAIIA,eAAMA,GAHbA,UAGcA,OAA0BA;QACtCE,MAAMA,CAACA,IAAIA,OAAOA,EAAEA,CAACA;IACvBA,CAACA;;IAEDF;;;;;;;;;;;;;;;;OAgBGA;IAKIA,aAAIA,GAJXA,UAIYA,MAAgBA,EAAEA,OAAaA;QACzCG,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAYA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAClDA,CAACA;;IAEDH;;;OAGGA;IAEIA,oBAAWA,GADlBA;QAEEI,yEAAyEA;QACzEA,oEAAoEA;QACpEA,wEAAwEA;QACxEA,mDAAmDA;QACnDA,0DAA0DA;QAC1DA,MAAMA,CAACA,IAAIA,OAAOA,CAAUA,UAACA,GAAGA,EAAEA,GAAGA,IAAMA,CAACA,CAACA,CAACA;IAChDA,CAACA;;IAjDDJ;QAACA,gBAAOA,CAACA;YACPA,IAAIA,EAAEA,IAAIA;SACXA,CAACA;OACKA,kBAAMA,QAEZA;IAmBDA;QAACA,gBAAOA,CAACA;YACPA,YAAYA,EAAEA,CAACA;YACfA,UAAUA,EAAEA,CAACA;SACdA,CAACA;OACKA,gBAAIA,QAOVA;IAMDA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAOjBA;IA9DHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,oBAAoBA;YAC/BA,IAAIA,EAAEA,mDAAmDA;SAC1DA,CAACA;iBA0DDA;IAADA,eAACA;AAADA,CAACA,AA/DD,IA+DC;AAzDY,gBAAQ,WAyDpB,CAAA"}
|
2
dist/plugins/device.js.map
vendored
2
dist/plugins/device.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/plugins/device.ts"],"names":["Device","Device.constructor","Device.getDevice"],"mappings":";;;;;;AAAA,uBAAqC,UAAU,CAAC,CAAA;AAKhD;;;;;;;;GAQG;AAEH;IAAAA;IAgBAC,CAACA;IATDD;;;;OAIGA;IAEMA,gBAASA,GADhBA;QAEEE,MAAMA,CAACA,MAAMA,CAACA,MAAMA,CAACA;IACvBA,CAACA;IAHDF;QAACA,uBAAcA;OACRA,mBAASA,QAEfA;IAfHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,QAAQA;YACdA,MAAMA,EAAEA,uBAAuBA;YAC/BA,SAASA,EAAEA,QAAQA;SACpBA,CAACA;eAYDA;IAADA,aAACA;AAADA,CAACA,AAhBD,IAgBC;AAXY,cAAM,SAWlB,CAAA"}
|
||||
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/plugins/device.ts"],"names":["Device","Device.constructor","Device.getDevice"],"mappings":";;;;;;AAAA,uBAAqC,UAAU,CAAC,CAAA;AAKhD;;;;;;;;GAQG;AACH;IAAAA;IAgBAC,CAACA;IATDD;;;;OAIGA;IAEMA,gBAASA,GADhBA;QAEEE,MAAMA,CAACA,MAAMA,CAACA,MAAMA,CAACA;IACvBA,CAACA;IAHDF;QAACA,uBAAcA;OACRA,mBAASA,QAEfA;IAfHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,QAAQA;YACdA,MAAMA,EAAEA,uBAAuBA;YAC/BA,SAASA,EAAEA,QAAQA;SACpBA,CAACA;eAYDA;IAADA,aAACA;AAADA,CAACA,AAhBD,IAgBC;AAXY,cAAM,SAWlB,CAAA"}
|
205
dist/plugins/facebook.d.ts
vendored
205
dist/plugins/facebook.d.ts
vendored
@ -1,11 +1,198 @@
|
||||
/**
|
||||
* Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-facebook4`. For more info, please see the [Facebook Connect](https://github.com/jeduan/cordova-plugin-facebook4).
|
||||
*
|
||||
* #### Installation
|
||||
*
|
||||
* To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at [https://developers.facebook.com/apps](https://developers.facebook.com/apps).
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Retrieve the `App ID` and `App Name`.
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
|
||||
*
|
||||
* ```bash
|
||||
* cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
|
||||
* ```
|
||||
*
|
||||
* After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Click `'Add Platform'`.
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* At this point you'll need to open your project's [`config.xml`](https://cordova.apache.org/docs/en/latest/config_ref/index.html) file, found in the root directory of your project.
|
||||
*
|
||||
* Take note of the `id` for the next step:
|
||||
* ```
|
||||
* <widget id="com.mycompany.testapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
* ```
|
||||
*
|
||||
* You can also edit the `id` to whatever you'd like it to be.
|
||||
*
|
||||
* #### iOS Install
|
||||
* Under 'Bundle ID', add the `id` from your `config.xml` file:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
*
|
||||
* #### Android Install
|
||||
* Under 'Google Play Package Name', add the `id` from your `config.xml` file:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
*
|
||||
* And that's it! You can now make calls to Facebook using the plugin.
|
||||
*
|
||||
* ## Events
|
||||
*
|
||||
* App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.
|
||||
*
|
||||
* - [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events)
|
||||
* - [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events)
|
||||
* - [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success
|
||||
*
|
||||
* Activation events are automatically tracked for you in the plugin.
|
||||
*
|
||||
* Events are listed on the [insights page](https://www.facebook.com/insights/).
|
||||
*
|
||||
* For tracking events, see `logEvent` and `logPurchase`.
|
||||
*
|
||||
*/
|
||||
export declare class Facebook {
|
||||
static login(permissions: string[]): void;
|
||||
static logout(): void;
|
||||
static getLoginStatus(): void;
|
||||
static getAccessToken(): void;
|
||||
static showDialog(options: any): void;
|
||||
static api(requestPath: string, permissions: string[]): void;
|
||||
static logEvent(name: string, params: any, valueToSum: number): void;
|
||||
static logPurchase(value: number, currency: string): void;
|
||||
static appInvite(options: any): void;
|
||||
/**
|
||||
* Login to Facebook to authenticate this app.
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* status: "connected",
|
||||
* authResponse: {
|
||||
* session_key: true,
|
||||
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
|
||||
* expiresIn: 5183979,
|
||||
* sig: "...",
|
||||
* secret: "...",
|
||||
* userID: "634565435"
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
|
||||
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||
*/
|
||||
static login(permissions: string[]): Promise<any>;
|
||||
/**
|
||||
* Logout of Facebook.
|
||||
*
|
||||
* For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout)
|
||||
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
|
||||
*/
|
||||
static logout(): Promise<any>;
|
||||
/**
|
||||
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
|
||||
*
|
||||
* 1) the user is logged into Facebook and has authenticated your application (connected)
|
||||
* 2) the user is logged into Facebook but has not authenticated your application (not_authorized)
|
||||
* 3) the user is either not logged into Facebook or explicitly logged out of your application so it doesn't attempt to connect to Facebook and thus, we don't know if they've authenticated your application or not (unknown)
|
||||
*
|
||||
* Resolves with a response like:
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* authResponse: {
|
||||
* userID: "12345678912345",
|
||||
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
|
||||
* session_Key: true,
|
||||
* expiresIn: "5183738",
|
||||
* sig: "..."
|
||||
* },
|
||||
* status: "connected"
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus)
|
||||
*
|
||||
* @return Returns a Promise that resolves with a status, or rejects with an error
|
||||
*/
|
||||
static getLoginStatus(): Promise<any>;
|
||||
/**
|
||||
* Get a Facebook access token for using Facebook services.
|
||||
*
|
||||
* @return Returns a Promise that resolves with an access token, or rejects with an error
|
||||
*/
|
||||
static getAccessToken(): Promise<string>;
|
||||
/**
|
||||
* Show one of various Facebook dialogs. Example of options for a Share dialog:
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* method: "share",
|
||||
* href: "http://example.com",
|
||||
* caption: "Such caption, very feed.",
|
||||
* description: "Much description",
|
||||
* picture: 'http://example.com/image.png'
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* For more options see the [Cordova plugin docs](https://github.com/jeduan/cordova-plugin-facebook4#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui)
|
||||
* @options {Object} options The dialog options
|
||||
* @return Returns a Promise that resolves with success data, or rejects with an error
|
||||
*/
|
||||
static showDialog(options: any): Promise<any>;
|
||||
/**
|
||||
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
|
||||
*
|
||||
* For more information see:
|
||||
*
|
||||
* Calling the Graph API - https://developers.facebook.com/docs/javascript/reference/FB.api
|
||||
* Graph Explorer - https://developers.facebook.com/tools/explorer
|
||||
* Graph API - https://developers.facebook.com/docs/graph-api
|
||||
*
|
||||
* @param {string} requestPath Graph API endpoint you want to call
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request.
|
||||
* @return Returns a Promise that resolves with the result of the request, or rejects with an error
|
||||
*/
|
||||
static api(requestPath: string, permissions: string[]): Promise<any>;
|
||||
/**
|
||||
* Log an event. For more information see the Events section above.
|
||||
*
|
||||
* @param {string} name Name of the event
|
||||
* @param {Object} [params] An object containing extra data to log with the event
|
||||
* @param {number} [valueToSum] any value to be added to added to a sum on each event
|
||||
* @return
|
||||
*/
|
||||
static logEvent(name: string, params?: Object, valueToSum?: number): Promise<any>;
|
||||
/**
|
||||
* Log a purchase. For more information see the Events section above.
|
||||
*
|
||||
* @param {number} value Value of the purchase.
|
||||
* @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
static logPurchase(value: number, currency: string): Promise<any>;
|
||||
/**
|
||||
* Open App Invite dialog. Does not require login.
|
||||
*
|
||||
* For more information see:
|
||||
*
|
||||
* the App Invites Overview - https://developers.facebook.com/docs/app-invites/overview
|
||||
* the App Links docs - https://developers.facebook.com/docs/applinks
|
||||
*
|
||||
*
|
||||
* @param {Object} options An object containing an [App Link](https://developers.facebook.com/docs/applinks) URL to your app and an optional image URL.
|
||||
* url: [App Link](https://developers.facebook.com/docs/applinks) to your app
|
||||
* picture: image to be displayed in the App Invite dialog
|
||||
*
|
||||
* @return Returns a Promise that resolves with the result data, or rejects with an error
|
||||
*/
|
||||
static appInvite(options: {
|
||||
url: string;
|
||||
picture: string;
|
||||
}): Promise<any>;
|
||||
}
|
||||
|
269
dist/plugins/facebook.js
vendored
269
dist/plugins/facebook.js
vendored
@ -5,18 +5,269 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var plugin_1 = require('./plugin');
|
||||
/**
|
||||
* Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-facebook4`. For more info, please see the [Facebook Connect](https://github.com/jeduan/cordova-plugin-facebook4).
|
||||
*
|
||||
* #### Installation
|
||||
*
|
||||
* To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at [https://developers.facebook.com/apps](https://developers.facebook.com/apps).
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Retrieve the `App ID` and `App Name`.
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
|
||||
*
|
||||
* ```bash
|
||||
* cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
|
||||
* ```
|
||||
*
|
||||
* After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Click `'Add Platform'`.
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* At this point you'll need to open your project's [`config.xml`](https://cordova.apache.org/docs/en/latest/config_ref/index.html) file, found in the root directory of your project.
|
||||
*
|
||||
* Take note of the `id` for the next step:
|
||||
* ```
|
||||
* <widget id="com.mycompany.testapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
* ```
|
||||
*
|
||||
* You can also edit the `id` to whatever you'd like it to be.
|
||||
*
|
||||
* #### iOS Install
|
||||
* Under 'Bundle ID', add the `id` from your `config.xml` file:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
*
|
||||
* #### Android Install
|
||||
* Under 'Google Play Package Name', add the `id` from your `config.xml` file:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
*
|
||||
* And that's it! You can now make calls to Facebook using the plugin.
|
||||
*
|
||||
* ## Events
|
||||
*
|
||||
* App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.
|
||||
*
|
||||
* - [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events)
|
||||
* - [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events)
|
||||
* - [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success
|
||||
*
|
||||
* Activation events are automatically tracked for you in the plugin.
|
||||
*
|
||||
* Events are listed on the [insights page](https://www.facebook.com/insights/).
|
||||
*
|
||||
* For tracking events, see `logEvent` and `logPurchase`.
|
||||
*
|
||||
*/
|
||||
var Facebook = (function () {
|
||||
function Facebook() {
|
||||
}
|
||||
Facebook.login = function (permissions) { };
|
||||
Facebook.logout = function () { };
|
||||
Facebook.getLoginStatus = function () { };
|
||||
Facebook.getAccessToken = function () { };
|
||||
Facebook.showDialog = function (options) { };
|
||||
Facebook.api = function (requestPath, permissions) { };
|
||||
Facebook.logEvent = function (name, params, valueToSum) { };
|
||||
Facebook.logPurchase = function (value, currency) { };
|
||||
Facebook.appInvite = function (options) { };
|
||||
// @Cordova()
|
||||
// static browserInit(appId: number){
|
||||
// return new Promise<any>((res, rej) => {});
|
||||
// }
|
||||
/**
|
||||
* Login to Facebook to authenticate this app.
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* status: "connected",
|
||||
* authResponse: {
|
||||
* session_key: true,
|
||||
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
|
||||
* expiresIn: 5183979,
|
||||
* sig: "...",
|
||||
* secret: "...",
|
||||
* userID: "634565435"
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
|
||||
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||
*/
|
||||
Facebook.login = function (permissions) {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
/**
|
||||
* Logout of Facebook.
|
||||
*
|
||||
* For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout)
|
||||
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
|
||||
*/
|
||||
Facebook.logout = function () {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
/**
|
||||
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
|
||||
*
|
||||
* 1) the user is logged into Facebook and has authenticated your application (connected)
|
||||
* 2) the user is logged into Facebook but has not authenticated your application (not_authorized)
|
||||
* 3) the user is either not logged into Facebook or explicitly logged out of your application so it doesn't attempt to connect to Facebook and thus, we don't know if they've authenticated your application or not (unknown)
|
||||
*
|
||||
* Resolves with a response like:
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* authResponse: {
|
||||
* userID: "12345678912345",
|
||||
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
|
||||
* session_Key: true,
|
||||
* expiresIn: "5183738",
|
||||
* sig: "..."
|
||||
* },
|
||||
* status: "connected"
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus)
|
||||
*
|
||||
* @return Returns a Promise that resolves with a status, or rejects with an error
|
||||
*/
|
||||
Facebook.getLoginStatus = function () {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
/**
|
||||
* Get a Facebook access token for using Facebook services.
|
||||
*
|
||||
* @return Returns a Promise that resolves with an access token, or rejects with an error
|
||||
*/
|
||||
Facebook.getAccessToken = function () {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
/**
|
||||
* Show one of various Facebook dialogs. Example of options for a Share dialog:
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* method: "share",
|
||||
* href: "http://example.com",
|
||||
* caption: "Such caption, very feed.",
|
||||
* description: "Much description",
|
||||
* picture: 'http://example.com/image.png'
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* For more options see the [Cordova plugin docs](https://github.com/jeduan/cordova-plugin-facebook4#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui)
|
||||
* @options {Object} options The dialog options
|
||||
* @return Returns a Promise that resolves with success data, or rejects with an error
|
||||
*/
|
||||
Facebook.showDialog = function (options) {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
/**
|
||||
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
|
||||
*
|
||||
* For more information see:
|
||||
*
|
||||
* Calling the Graph API - https://developers.facebook.com/docs/javascript/reference/FB.api
|
||||
* Graph Explorer - https://developers.facebook.com/tools/explorer
|
||||
* Graph API - https://developers.facebook.com/docs/graph-api
|
||||
*
|
||||
* @param {string} requestPath Graph API endpoint you want to call
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request.
|
||||
* @return Returns a Promise that resolves with the result of the request, or rejects with an error
|
||||
*/
|
||||
Facebook.api = function (requestPath, permissions) {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
/**
|
||||
* Log an event. For more information see the Events section above.
|
||||
*
|
||||
* @param {string} name Name of the event
|
||||
* @param {Object} [params] An object containing extra data to log with the event
|
||||
* @param {number} [valueToSum] any value to be added to added to a sum on each event
|
||||
* @return
|
||||
*/
|
||||
Facebook.logEvent = function (name, params, valueToSum) {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
/**
|
||||
* Log a purchase. For more information see the Events section above.
|
||||
*
|
||||
* @param {number} value Value of the purchase.
|
||||
* @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
Facebook.logPurchase = function (value, currency) {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
/**
|
||||
* Open App Invite dialog. Does not require login.
|
||||
*
|
||||
* For more information see:
|
||||
*
|
||||
* the App Invites Overview - https://developers.facebook.com/docs/app-invites/overview
|
||||
* the App Links docs - https://developers.facebook.com/docs/applinks
|
||||
*
|
||||
*
|
||||
* @param {Object} options An object containing an [App Link](https://developers.facebook.com/docs/applinks) URL to your app and an optional image URL.
|
||||
* url: [App Link](https://developers.facebook.com/docs/applinks) to your app
|
||||
* picture: image to be displayed in the App Invite dialog
|
||||
*
|
||||
* @return Returns a Promise that resolves with the result data, or rejects with an error
|
||||
*/
|
||||
Facebook.appInvite = function (options) {
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise(function (res, rej) { });
|
||||
};
|
||||
__decorate([
|
||||
plugin_1.Cordova()
|
||||
], Facebook, "login", null);
|
||||
|
2
dist/plugins/facebook.js.map
vendored
2
dist/plugins/facebook.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../src/plugins/facebook.ts"],"names":["Facebook","Facebook.constructor","Facebook.login","Facebook.logout","Facebook.getLoginStatus","Facebook.getAccessToken","Facebook.showDialog","Facebook.api","Facebook.logEvent","Facebook.logPurchase","Facebook.appInvite"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAgCAC,CAACA;IAzBQD,cAAKA,GADZA,UACaA,WAAoBA,IAAEE,CAACA;IAG7BF,eAAMA,GADbA,cACgBG,CAACA;IAGVH,uBAAcA,GADrBA,cACwBI,CAACA;IAGlBJ,uBAAcA,GADrBA,cACwBK,CAACA;IAGlBL,mBAAUA,GADjBA,UACkBA,OAAWA,IAAEM,CAACA;IAGzBN,YAAGA,GADVA,UACWA,WAAkBA,EAAEA,WAAoBA,IAAEO,CAACA;IAG/CP,iBAAQA,GADfA,UACgBA,IAAWA,EAAEA,MAAUA,EAAEA,UAAiBA,IAAEQ,CAACA;IAGtDR,oBAAWA,GADlBA,UACmBA,KAAYA,EAAEA,QAAeA,IAAES,CAACA;IAG5CT,kBAASA,GADhBA,UACiBA,OAAWA,IAAEU,CAACA;IAzB/BV;QAACA,gBAAOA,EAAEA;OACHA,iBAAKA,QAAwBA;IAEpCA;QAACA,gBAAOA,EAAEA;OACHA,kBAAMA,QAAIA;IAEjBA;QAACA,gBAAOA,EAAEA;OACHA,0BAAcA,QAAIA;IAEzBA;QAACA,gBAAOA,EAAEA;OACHA,0BAAcA,QAAIA;IAEzBA;QAACA,gBAAOA,EAAEA;OACHA,sBAAUA,QAAeA;IAEhCA;QAACA,gBAAOA,EAAEA;OACHA,eAAGA,QAA4CA;IAEtDA;QAACA,gBAAOA,EAAEA;OACHA,oBAAQA,QAA8CA;IAE7DA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAAiCA;IAEnDA;QAACA,gBAAOA,EAAEA;OACHA,qBAASA,QAAeA;IA/BjCA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,0BAA0BA;YAClCA,SAASA,EAAEA,uBAAuBA;SACnCA,CAACA;iBA4BDA;IAADA,eAACA;AAADA,CAACA,AAhCD,IAgCC;AA3BY,gBAAQ,WA2BpB,CAAA"}
|
||||
{"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../src/plugins/facebook.ts"],"names":["Facebook","Facebook.constructor","Facebook.login","Facebook.logout","Facebook.getLoginStatus","Facebook.getAccessToken","Facebook.showDialog","Facebook.api","Facebook.logEvent","Facebook.logPurchase","Facebook.appInvite"],"mappings":"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"}
|
@ -246,6 +246,11 @@ export class Contacts {
|
||||
errorIndex: 2
|
||||
})
|
||||
static find(fields: string[], options?: any){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<Contact[]>((res, rej) => {});
|
||||
};
|
||||
|
||||
@ -255,6 +260,11 @@ export class Contacts {
|
||||
*/
|
||||
@Cordova()
|
||||
static pickContact(){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<Contact>((res, rej) => {});
|
||||
};
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ declare var window;
|
||||
* // Device sits below
|
||||
* ```
|
||||
*/
|
||||
|
||||
@Plugin({
|
||||
name: 'Device',
|
||||
plugin: 'cordova-plugin-device',
|
||||
|
@ -1,35 +1,291 @@
|
||||
import {Plugin, Cordova} from './plugin';
|
||||
|
||||
/**
|
||||
* Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android.
|
||||
*
|
||||
* Requires Cordova plugin: `cordova-plugin-facebook4`. For more info, please see the [Facebook Connect](https://github.com/jeduan/cordova-plugin-facebook4).
|
||||
*
|
||||
* #### Installation
|
||||
*
|
||||
* To use the FB plugin, you first have to create a new Facebook App inside of the Facebook developer portal at [https://developers.facebook.com/apps](https://developers.facebook.com/apps).
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Retrieve the `App ID` and `App Name`.
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
|
||||
*
|
||||
* ```bash
|
||||
* cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
|
||||
* ```
|
||||
*
|
||||
* After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* Click `'Add Platform'`.
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
* At this point you'll need to open your project's [`config.xml`](https://cordova.apache.org/docs/en/latest/config_ref/index.html) file, found in the root directory of your project.
|
||||
*
|
||||
* Take note of the `id` for the next step:
|
||||
* ```
|
||||
* <widget id="com.mycompany.testapp" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
* ```
|
||||
*
|
||||
* You can also edit the `id` to whatever you'd like it to be.
|
||||
*
|
||||
* #### iOS Install
|
||||
* Under 'Bundle ID', add the `id` from your `config.xml` file:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
*
|
||||
* #### Android Install
|
||||
* Under 'Google Play Package Name', add the `id` from your `config.xml` file:
|
||||
*
|
||||
* [](https://developers.facebook.com/apps/)
|
||||
*
|
||||
*
|
||||
* And that's it! You can now make calls to Facebook using the plugin.
|
||||
*
|
||||
* ## Events
|
||||
*
|
||||
* App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.
|
||||
*
|
||||
* - [iOS] [https://developers.facebook.com/docs/ios/app-events](https://developers.facebook.com/docs/ios/app-events)
|
||||
* - [Android] [https://developers.facebook.com/docs/android/app-events](https://developers.facebook.com/docs/android/app-events)
|
||||
* - [JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success
|
||||
*
|
||||
* Activation events are automatically tracked for you in the plugin.
|
||||
*
|
||||
* Events are listed on the [insights page](https://www.facebook.com/insights/).
|
||||
*
|
||||
* For tracking events, see `logEvent` and `logPurchase`.
|
||||
*
|
||||
*/
|
||||
@Plugin({
|
||||
name: 'Facebook',
|
||||
plugin: 'cordova-plugin-facebook4',
|
||||
pluginRef: 'facebookConnectPlugin'
|
||||
})
|
||||
export class Facebook {
|
||||
@Cordova()
|
||||
static login(permissions:string[]){}
|
||||
|
||||
@Cordova()
|
||||
static logout(){}
|
||||
// @Cordova()
|
||||
// static browserInit(appId: number){
|
||||
// return new Promise<any>((res, rej) => {});
|
||||
// }
|
||||
|
||||
/**
|
||||
* Login to Facebook to authenticate this app.
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* status: "connected",
|
||||
* authResponse: {
|
||||
* session_key: true,
|
||||
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
|
||||
* expiresIn: 5183979,
|
||||
* sig: "...",
|
||||
* secret: "...",
|
||||
* userID: "634565435"
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) this app has upon logging in.
|
||||
* @return Returns a Promise that resolves with a status object if login succeeds, and rejects if login fails.
|
||||
*/
|
||||
@Cordova()
|
||||
static getLoginStatus(){}
|
||||
static login(permissions: string[]){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<any>((res, rej) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout of Facebook.
|
||||
*
|
||||
* For more info see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.logout)
|
||||
* @return Returns a Promise that resolves on a successful logout, and rejects if logout fails.
|
||||
*/
|
||||
@Cordova()
|
||||
static getAccessToken(){}
|
||||
static logout(){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<any>((res, rej) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a user is logged in to Facebook and has authenticated your app. There are three possible states for a user:
|
||||
*
|
||||
* 1) the user is logged into Facebook and has authenticated your application (connected)
|
||||
* 2) the user is logged into Facebook but has not authenticated your application (not_authorized)
|
||||
* 3) the user is either not logged into Facebook or explicitly logged out of your application so it doesn't attempt to connect to Facebook and thus, we don't know if they've authenticated your application or not (unknown)
|
||||
*
|
||||
* Resolves with a response like:
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* authResponse: {
|
||||
* userID: "12345678912345",
|
||||
* accessToken: "kgkh3g42kh4g23kh4g2kh34g2kg4k2h4gkh3g4k2h4gk23h4gk2h34gk234gk2h34AndSoOn",
|
||||
* session_Key: true,
|
||||
* expiresIn: "5183738",
|
||||
* sig: "..."
|
||||
* },
|
||||
* status: "connected"
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* For more information see the [Facebook docs](https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus)
|
||||
*
|
||||
* @return Returns a Promise that resolves with a status, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static showDialog(options:any){}
|
||||
static getLoginStatus(){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<any>((res, rej) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Facebook access token for using Facebook services.
|
||||
*
|
||||
* @return Returns a Promise that resolves with an access token, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static api(requestPath:string, permissions:string[]){}
|
||||
static getAccessToken(){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<string>((res, rej) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show one of various Facebook dialogs. Example of options for a Share dialog:
|
||||
*
|
||||
* ```
|
||||
* {
|
||||
* method: "share",
|
||||
* href: "http://example.com",
|
||||
* caption: "Such caption, very feed.",
|
||||
* description: "Much description",
|
||||
* picture: 'http://example.com/image.png'
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* For more options see the [Cordova plugin docs](https://github.com/jeduan/cordova-plugin-facebook4#show-a-dialog) and the [Facebook docs](https://developers.facebook.com/docs/javascript/reference/FB.ui)
|
||||
* @options {Object} options The dialog options
|
||||
* @return Returns a Promise that resolves with success data, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static logEvent(name:string, params:any, valueToSum:number){}
|
||||
static showDialog(options: any){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<any>((res, rej) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a call to Facebook Graph API. Can take additional permissions beyond those granted on login.
|
||||
*
|
||||
* For more information see:
|
||||
*
|
||||
* Calling the Graph API - https://developers.facebook.com/docs/javascript/reference/FB.api
|
||||
* Graph Explorer - https://developers.facebook.com/tools/explorer
|
||||
* Graph API - https://developers.facebook.com/docs/graph-api
|
||||
*
|
||||
* @param {string} requestPath Graph API endpoint you want to call
|
||||
* @param {string[]} permissions List of [permissions](https://developers.facebook.com/docs/facebook-login/permissions) for this request.
|
||||
* @return Returns a Promise that resolves with the result of the request, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static logPurchase(value:number, currency:string){}
|
||||
static api(requestPath: string, permissions: string[]){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<any>((res, rej) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an event. For more information see the Events section above.
|
||||
*
|
||||
* @param {string} name Name of the event
|
||||
* @param {Object} [params] An object containing extra data to log with the event
|
||||
* @param {number} [valueToSum] any value to be added to added to a sum on each event
|
||||
* @return
|
||||
*/
|
||||
@Cordova()
|
||||
static appInvite(options:any){}
|
||||
static logEvent(name: string, params?: Object, valueToSum?: number){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<any>((res, rej) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a purchase. For more information see the Events section above.
|
||||
*
|
||||
* @param {number} value Value of the purchase.
|
||||
* @param {string} currency The currency, as an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)
|
||||
* @return Returns a Promise
|
||||
*/
|
||||
@Cordova()
|
||||
static logPurchase(value: number, currency: string){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<any>((res, rej) => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open App Invite dialog. Does not require login.
|
||||
*
|
||||
* For more information see:
|
||||
*
|
||||
* the App Invites Overview - https://developers.facebook.com/docs/app-invites/overview
|
||||
* the App Links docs - https://developers.facebook.com/docs/applinks
|
||||
*
|
||||
*
|
||||
* @param {Object} options An object containing an [App Link](https://developers.facebook.com/docs/applinks) URL to your app and an optional image URL.
|
||||
* url: [App Link](https://developers.facebook.com/docs/applinks) to your app
|
||||
* picture: image to be displayed in the App Invite dialog
|
||||
*
|
||||
* @return Returns a Promise that resolves with the result data, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
static appInvite(options: {
|
||||
url: string,
|
||||
picture: string
|
||||
}){
|
||||
// This Promise is replaced by one from the @Cordova decorator that wraps
|
||||
// the plugin's callbacks. We provide a dummy one here so TypeScript
|
||||
// knows that the correct return type is Promise, because there's no way
|
||||
// for it to know the return type from a decorator.
|
||||
// See https://github.com/Microsoft/TypeScript/issues/4881
|
||||
return new Promise<any>((res, rej) => {});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user