@capacitor-community/facebook-login
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,2 +0,2 @@ | ||
declare module "@capacitor/core" { | ||
declare module '@capacitor/core' { | ||
interface PluginRegistry { | ||
@@ -3,0 +3,0 @@ FacebookLogin: FacebookLoginPlugin; |
@@ -15,3 +15,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
name: 'FacebookLogin', | ||
platforms: ['web'] | ||
platforms: ['web'], | ||
}); | ||
@@ -23,3 +23,3 @@ } | ||
return new Promise((resolve, reject) => { | ||
FB.login((response) => { | ||
FB.login(response => { | ||
console.debug('FB.login', response); | ||
@@ -29,4 +29,4 @@ if (response.status === 'connected') { | ||
accessToken: { | ||
token: response.authResponse.accessToken | ||
} | ||
token: response.authResponse.accessToken, | ||
}, | ||
}); | ||
@@ -37,4 +37,4 @@ } | ||
accessToken: { | ||
token: null | ||
} | ||
token: null, | ||
}, | ||
}); | ||
@@ -48,3 +48,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return new Promise((resolve) => { | ||
return new Promise(resolve => { | ||
FB.logout(() => resolve()); | ||
@@ -57,3 +57,3 @@ }); | ||
return new Promise((resolve, reject) => { | ||
FB.getLoginStatus((response) => { | ||
FB.getLoginStatus(response => { | ||
if (response.status === 'connected') { | ||
@@ -69,4 +69,4 @@ const result = { | ||
token: response.authResponse.accessToken, | ||
userId: response.authResponse.userID | ||
} | ||
userId: response.authResponse.userID, | ||
}, | ||
}; | ||
@@ -78,4 +78,4 @@ resolve(result); | ||
accessToken: { | ||
token: null | ||
} | ||
token: null, | ||
}, | ||
}); | ||
@@ -82,0 +82,0 @@ } |
{ | ||
"name": "@capacitor-community/facebook-login", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A native plugin for Facebook Login", | ||
@@ -12,3 +12,7 @@ "main": "dist/esm/index.js", | ||
"prepublishOnly": "npm run build", | ||
"npm-publish": "np" | ||
"npm-publish": "np", | ||
"lint": "npm run prettier -- --check", | ||
"fmt": "npm run prettier -- --write && npm run swiftlint -- autocorrect", | ||
"prettier": "prettier \"{android,ios,src}/*.{css,html,java,js,ts}\"", | ||
"swiftlint": "swiftlint" | ||
}, | ||
@@ -20,5 +24,9 @@ "author": "Masahiko Sakakibara <sakakibara@rdlabo.jp>", | ||
}, | ||
"prettier": "@ionic/prettier-config", | ||
"swiftlint": "@ionic/swiftlint-config", | ||
"devDependencies": { | ||
"@capacitor/android": "^2.0.0", | ||
"@capacitor/ios": "^2.0.0", | ||
"@ionic/prettier-config": "^1.0.0", | ||
"@ionic/swiftlint-config": "^1.0.2", | ||
"husky": "^4.2.5", | ||
@@ -30,2 +38,3 @@ "np": "^6.2.4", | ||
"rimraf": "^3.0.0", | ||
"swiftlint": "^1.0.1", | ||
"typescript": "^3.2.4" | ||
@@ -35,3 +44,3 @@ }, | ||
"hooks": { | ||
"pre-commit": "pretty-quick --staged" | ||
"pre-commit": "npm run lint" | ||
} | ||
@@ -38,0 +47,0 @@ }, |
168
README.md
@@ -22,3 +22,4 @@ [![npm version](https://badge.fury.io/js/%40capacitor-community%2Ffacebook-login.svg)](https://badge.fury.io/js/%40capacitor-community%2Ffacebook-login) | ||
```bash | ||
$ npm i --save @capacitor-community/facebook-login | ||
% npm i --save @capacitor-community/facebook-login | ||
% npx cap update | ||
``` | ||
@@ -29,3 +30,4 @@ | ||
```bash | ||
yarn add @capacitor-community/facebook-login | ||
% yarn add @capacitor-community/facebook-login | ||
% npx cap update | ||
``` | ||
@@ -35,3 +37,4 @@ | ||
``` | ||
$ npm install --save @rdlabo/capacitor-facebook-login@1.5.0 | ||
% npm install --save @rdlabo/capacitor-facebook-login@1.5.0 | ||
% npx cap update | ||
``` | ||
@@ -43,8 +46,8 @@ | ||
```diff | ||
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{ | ||
[...] | ||
+ add(com.getcapacitor.community.facebooklogin.FacebookLogin.class); | ||
[...] | ||
}}); | ||
```java | ||
this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{ | ||
[...] | ||
add(com.getcapacitor.community.facebooklogin.FacebookLogin.class); | ||
[...] | ||
}}); | ||
``` | ||
@@ -54,21 +57,21 @@ | ||
```diff | ||
+ <meta-data android:name="com.facebook.sdk.ApplicationId" | ||
+ android:value="@string/facebook_app_id"/> | ||
+ | ||
+ <activity | ||
+ android:name="com.facebook.FacebookActivity" | ||
+ android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" | ||
+ android:label="@string/app_name" /> | ||
+ | ||
+ <activity | ||
+ android:name="com.facebook.CustomTabActivity" | ||
+ android:exported="true"> | ||
+ <intent-filter> | ||
+ <action android:name="android.intent.action.VIEW" /> | ||
+ <category android:name="android.intent.category.DEFAULT" /> | ||
+ <category android:name="android.intent.category.BROWSABLE" /> | ||
+ <data android:scheme="@string/fb_login_protocol_scheme" /> | ||
+ </intent-filter> | ||
+ </activity> | ||
```xml | ||
<meta-data android:name="com.facebook.sdk.ApplicationId" | ||
android:value="@string/facebook_app_id"/> | ||
<activity | ||
android:name="com.facebook.FacebookActivity" | ||
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" | ||
android:label="@string/app_name" /> | ||
<activity | ||
android:name="com.facebook.CustomTabActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.VIEW" /> | ||
<category android:name="android.intent.category.DEFAULT" /> | ||
<category android:name="android.intent.category.BROWSABLE" /> | ||
<data android:scheme="@string/fb_login_protocol_scheme" /> | ||
</intent-filter> | ||
</activity> | ||
``` | ||
@@ -78,5 +81,5 @@ | ||
```diff | ||
+ <string name="facebook_app_id">[APP_ID]</string> | ||
+ <string name="fb_login_protocol_scheme">fb[APP_ID]</string> | ||
```xml | ||
<string name="facebook_app_id">[APP_ID]</string> | ||
<string name="fb_login_protocol_scheme">fb[APP_ID]</string> | ||
``` | ||
@@ -88,2 +91,5 @@ | ||
### If you have trouble. | ||
Please restart Android Studio, and do clean build. | ||
## iOS configuration | ||
@@ -93,8 +99,8 @@ | ||
```diff | ||
+ import FacebookCore | ||
+ import FBSDKCoreKit | ||
```swift | ||
import FacebookCore | ||
import FBSDKCoreKit | ||
[...] | ||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
+ FBSDKCoreKit.ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions) | ||
FBSDKCoreKit.ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions) | ||
return true | ||
@@ -105,32 +111,32 @@ } | ||
- return CAPBridge.handleOpenUrl(url, options) | ||
+ if CAPBridge.handleOpenUrl(url, options) { | ||
+ return FBSDKCoreKit.ApplicationDelegate.shared.application(app, open: url, options: options) | ||
+ } | ||
+ else{ | ||
+ return false | ||
+ } | ||
if CAPBridge.handleOpenUrl(url, options) { | ||
return FBSDKCoreKit.ApplicationDelegate.shared.application(app, open: url, options: options) | ||
} | ||
else{ | ||
return false | ||
} | ||
} | ||
``` | ||
Add the following in the `ios/App/App/info.plist` file: | ||
Add the following in the `ios/App/App/info.plist` file inside of the outermost `<dict>`: | ||
```diff | ||
+ <key>CFBundleURLTypes</key> | ||
+ <array> | ||
+ <dict> | ||
+ <key>CFBundleURLSchemes</key> | ||
+ <array> | ||
+ <string>fb[APP_ID]</string> | ||
+ </array> | ||
+ </dict> | ||
+ </array> | ||
+ <key>FacebookAppID</key> | ||
+ <string>[APP_ID]</string> | ||
+ <key>FacebookDisplayName</key> | ||
+ <string>Wimlov</string> | ||
+ <key>LSApplicationQueriesSchemes</key> | ||
+ <array> | ||
+ <string>fbapi</string> | ||
+ <string>fbauth2</string> | ||
+ </array> | ||
```xml | ||
<key>CFBundleURLTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>fb[APP_ID]</string> | ||
</array> | ||
</dict> | ||
</array> | ||
<key>FacebookAppID</key> | ||
<string>[APP_ID]</string> | ||
<key>FacebookDisplayName</key> | ||
<string>Wimlov</string> | ||
<key>LSApplicationQueriesSchemes</key> | ||
<array> | ||
<string>fbapi</string> | ||
<string>fbauth2</string> | ||
</array> | ||
``` | ||
@@ -142,20 +148,20 @@ | ||
```ts | ||
+ window.fbAsyncInit = function() { | ||
+ FB.init({ | ||
+ appId: '[APP_ID]', | ||
+ cookie: true, // enable cookies to allow the server to access the session | ||
+ xfbml: true, // parse social plugins on this page | ||
+ version: 'v5.0' // use graph api current version | ||
+ }); | ||
+ }; | ||
```javascript | ||
window.fbAsyncInit = function() { | ||
FB.init({ | ||
appId: '[APP_ID]', | ||
cookie: true, // enable cookies to allow the server to access the session | ||
xfbml: true, // parse social plugins on this page | ||
version: 'v5.0' // use graph api current version | ||
}); | ||
}; | ||
+ // Load the SDK asynchronously | ||
+ (function(d, s, id) { | ||
+ var js, fjs = d.getElementsByTagName(s)[0]; | ||
+ if (d.getElementById(id)) return; | ||
+ js = d.createElement(s); js.id = id; | ||
+ js.src = "https://connect.facebook.net/en_US/sdk.js"; | ||
+ fjs.parentNode.insertBefore(js, fjs); | ||
+ }(document, 'script', 'facebook-jssdk')); | ||
// Load the SDK asynchronously | ||
(function(d, s, id) { | ||
var js, fjs = d.getElementsByTagName(s)[0]; | ||
if (d.getElementById(id)) return; | ||
js = d.createElement(s); js.id = id; | ||
js.src = "https://connect.facebook.net/en_US/sdk.js"; | ||
fjs.parentNode.insertBefore(js, fjs); | ||
}(document, 'script', 'facebook-jssdk')); | ||
``` | ||
@@ -165,6 +171,6 @@ | ||
// Init Capacitor | ||
+ import { registerWebPlugin } from '@capacitor/core'; | ||
+ import { FacebookLogin } from '@capacitor-community/facebook-login'; | ||
import { registerWebPlugin } from '@capacitor/core'; | ||
import { FacebookLogin } from '@capacitor-community/facebook-login'; | ||
... | ||
+ registerWebPlugin(FacebookLogin); | ||
registerWebPlugin(FacebookLogin); | ||
``` | ||
@@ -171,0 +177,0 @@ |
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
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
276591
224
12