@capacitor-community/facebook-login
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -30,2 +30,5 @@ declare module '@capacitor/core' { | ||
getCurrentAccessToken(): Promise<FacebookCurrentAccessTokenResponse>; | ||
getProfile<T extends object>(options: { | ||
fields: readonly string[]; | ||
}): Promise<T>; | ||
} |
@@ -15,4 +15,7 @@ import { WebPlugin } from '@capacitor/core'; | ||
getCurrentAccessToken(): Promise<FacebookCurrentAccessTokenResponse>; | ||
getProfile<T extends object>(options: { | ||
fields: readonly string[]; | ||
}): Promise<T>; | ||
} | ||
declare const FacebookLogin: FacebookLoginWeb; | ||
export { FacebookLogin }; |
@@ -79,2 +79,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
getProfile(options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const fields = options.fields.join(','); | ||
return new Promise((resolve, reject) => { | ||
FB.api('/me', { fields }, response => { | ||
if (response.error) { | ||
reject(response.error.message); | ||
return; | ||
} | ||
resolve(response); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
@@ -81,0 +95,0 @@ const FacebookLogin = new FacebookLoginWeb(); |
{ | ||
"name": "@capacitor-community/facebook-login", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "A native plugin for Facebook Login", | ||
@@ -5,0 +5,0 @@ "main": "dist/esm/index.js", |
[![npm version](https://badge.fury.io/js/%40capacitor-community%2Ffacebook-login.svg)](https://badge.fury.io/js/%40capacitor-community%2Ffacebook-login) | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-) | ||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
@@ -100,10 +103,9 @@ # capacitor-facebook-login | ||
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { | ||
- return CAPBridge.handleOpenUrl(url, options) | ||
if CAPBridge.handleOpenUrl(url, options) { | ||
return FBSDKCoreKit.ApplicationDelegate.shared.application(app, open: url, options: options) | ||
if CAPBridge.handleOpenUrl(url, options) { | ||
return FBSDKCoreKit.ApplicationDelegate.shared.application(app, open: url, options: options) | ||
} | ||
else{ | ||
return false | ||
} | ||
} | ||
else{ | ||
return false | ||
} | ||
} | ||
``` | ||
@@ -178,2 +180,3 @@ | ||
| getCurrentAccessToken | ✅ | ✅ | ✅ | | ||
| getProfile | ✅ | ✅ | ✅ | | ||
@@ -224,1 +227,36 @@ ## API | ||
``` | ||
### getProfile | ||
```ts | ||
import { Plugins } from '@capacitor/core'; | ||
import { FacebookLoginResponse } from '@capacitor-community/facebook-login'; | ||
const { FacebookLogin } = Plugins; | ||
const result = await FacebookLogin.getProfile<{ | ||
email: string; | ||
}>({ fields: ['email'] }); | ||
console.log(`Facebook user's email is ${result.email}`); | ||
``` | ||
## Contributors ✨ | ||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
<!-- prettier-ignore-start --> | ||
<!-- markdownlint-disable --> | ||
<table> | ||
<tr> | ||
<td align="center"><a href="https://www.mapianist.com"><img src="https://avatars.githubusercontent.com/u/7777929?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Heo</b></sub></a><br /><a href="https://github.com/capacitor-community/facebook-login/commits?author=leo6104" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/vildhjarta8"><img src="https://avatars.githubusercontent.com/u/2393640?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Artur Tiupa</b></sub></a><br /><a href="https://github.com/capacitor-community/facebook-login/commits?author=vildhjarta8" title="Code">💻</a></td> | ||
</tr> | ||
</table> | ||
<!-- markdownlint-restore --> | ||
<!-- prettier-ignore-end --> | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
282611
205
260