nativescript-facebook
Advanced tools
Comparing version 2.2.4 to 2.3.0
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var nativescript_facebook_module_1 = require("./nativescript-facebook-module"); | ||
exports.NativeScriptFacebookModule = nativescript_facebook_module_1.NativeScriptFacebookModule; | ||
__export(require("./nativescript-facebook-module")); |
@@ -7,10 +7,32 @@ "use strict"; | ||
} | ||
FacebookLoginButtonDirective.decorators = [ | ||
{ type: core_1.Directive, args: [{ | ||
selector: "FacebookLoginButton" | ||
},] }, | ||
]; | ||
FacebookLoginButtonDirective = __decorate([ | ||
core_1.Directive({ | ||
selector: "FacebookLoginButton" | ||
}) | ||
], FacebookLoginButtonDirective); | ||
return FacebookLoginButtonDirective; | ||
}()); | ||
exports.FacebookLoginButtonDirective = FacebookLoginButtonDirective; | ||
exports.DIRECTIVES = [FacebookLoginButtonDirective]; | ||
var FacebookShareButtonDirective = (function () { | ||
function FacebookShareButtonDirective() { | ||
} | ||
FacebookShareButtonDirective = __decorate([ | ||
core_1.Directive({ | ||
selector: "FacebookShareButton" | ||
}) | ||
], FacebookShareButtonDirective); | ||
return FacebookShareButtonDirective; | ||
}()); | ||
exports.FacebookShareButtonDirective = FacebookShareButtonDirective; | ||
var FacebookSendButtonDirective = (function () { | ||
function FacebookSendButtonDirective() { | ||
} | ||
FacebookSendButtonDirective = __decorate([ | ||
core_1.Directive({ | ||
selector: "FacebookSendButton" | ||
}) | ||
], FacebookSendButtonDirective); | ||
return FacebookSendButtonDirective; | ||
}()); | ||
exports.FacebookSendButtonDirective = FacebookSendButtonDirective; | ||
exports.DIRECTIVES = [FacebookLoginButtonDirective, FacebookShareButtonDirective, FacebookSendButtonDirective]; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"FacebookLoginButtonDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"FacebookLoginButton"}]}]},"DIRECTIVES":[{"__symbolic":"reference","name":"FacebookLoginButtonDirective"}]}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"FacebookLoginButtonDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"FacebookLoginButton"}]}]},"FacebookShareButtonDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":7,"character":1},"arguments":[{"selector":"FacebookShareButton"}]}]},"FacebookSendButtonDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":12,"character":1},"arguments":[{"selector":"FacebookSendButton"}]}]},"DIRECTIVES":[{"__symbolic":"reference","name":"FacebookLoginButtonDirective"},{"__symbolic":"reference","name":"FacebookShareButtonDirective"},{"__symbolic":"reference","name":"FacebookSendButtonDirective"}]}}] |
@@ -9,8 +9,8 @@ "use strict"; | ||
} | ||
NativeScriptFacebookModule.decorators = [ | ||
{ type: core_1.NgModule, args: [{ | ||
declarations: [nativescript_facebook_directives_1.DIRECTIVES], | ||
exports: [nativescript_facebook_directives_1.DIRECTIVES], | ||
},] }, | ||
]; | ||
NativeScriptFacebookModule = __decorate([ | ||
core_1.NgModule({ | ||
declarations: [nativescript_facebook_directives_1.DIRECTIVES], | ||
exports: [nativescript_facebook_directives_1.DIRECTIVES], | ||
}) | ||
], NativeScriptFacebookModule); | ||
return NativeScriptFacebookModule; | ||
@@ -20,1 +20,3 @@ }()); | ||
element_registry_1.registerElement("FacebookLoginButton", function () { return require("../").LoginButton; }); | ||
element_registry_1.registerElement('FacebookShareButton', function () { return require('../').ShareButton; }); | ||
element_registry_1.registerElement('FacebookSendButton', function () { return require('../').SendButton; }); |
@@ -13,7 +13,1 @@ "use strict"; | ||
exports.FacebookAccessToken = FacebookAccessToken; | ||
function FacebookAccessToken_tsickle_Closure_declarations() { | ||
FacebookAccessToken.prototype.accessToken; | ||
FacebookAccessToken.prototype.userId; | ||
FacebookAccessToken.prototype.refreshDate; | ||
FacebookAccessToken.prototype.expirationDate; | ||
} |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var login_manager_1 = require("./login-manager"); | ||
exports._registerLoginCallback = login_manager_1._registerLoginCallback; | ||
exports._registerLogoutCallback = login_manager_1._registerLogoutCallback; | ||
exports.onLoginCallback = login_manager_1.onLoginCallback; | ||
exports.onLogoutCallback = login_manager_1.onLogoutCallback; | ||
exports.init = login_manager_1.init; | ||
exports.requestPublishPermissions = login_manager_1.requestPublishPermissions; | ||
exports.requestReadPermissions = login_manager_1.requestReadPermissions; | ||
exports.login = login_manager_1.login; | ||
exports.logout = login_manager_1.logout; | ||
exports.getCurrentAccessToken = login_manager_1.getCurrentAccessToken; | ||
var login_button_1 = require("./ui/login-button"); | ||
exports.LoginButton = login_button_1.LoginButton; | ||
var login_behavior_1 = require("./login-behavior"); | ||
exports.LoginBehavior = login_behavior_1.LoginBehavior; | ||
__export(require("./login-manager")); | ||
__export(require("./ui/login-button")); | ||
__export(require("./login-behavior")); | ||
__export(require("./share-manager")); | ||
__export(require("./ui/share-button")); |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./login-manager"},{"from":"./ui/login-button"},{"from":"./login-event-data"},{"from":"./login-behavior"}]}] | ||
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./login-manager"},{"from":"./ui/login-button"},{"from":"./login-event-data"},{"from":"./login-behavior"},{"from":"./share-manager"},{"from":"./ui/share-button"}]}] |
@@ -6,1 +6,3 @@ export * from "./login-manager"; | ||
export * from "./login-behavior"; | ||
export * from './share-manager'; | ||
export * from "./ui/share-button"; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var applicationModule = require("tns-core-modules/application"); | ||
var login_button_1 = require("./ui/login-button"); | ||
exports.LoginButton = login_button_1.LoginButton; | ||
var login_manager_1 = require("./login-manager"); | ||
exports._registerLoginCallback = login_manager_1._registerLoginCallback; | ||
exports._registerLogoutCallback = login_manager_1._registerLogoutCallback; | ||
exports.onLoginCallback = login_manager_1.onLoginCallback; | ||
exports.onLogoutCallback = login_manager_1.onLogoutCallback; | ||
exports.init = login_manager_1.init; | ||
exports.requestPublishPermissions = login_manager_1.requestPublishPermissions; | ||
exports.requestReadPermissions = login_manager_1.requestReadPermissions; | ||
exports.login = login_manager_1.login; | ||
exports.logout = login_manager_1.logout; | ||
exports.getCurrentAccessToken = login_manager_1.getCurrentAccessToken; | ||
var login_behavior_1 = require("./login-behavior"); | ||
exports.LoginBehavior = login_behavior_1.LoginBehavior; | ||
__export(require("./ui/login-button")); | ||
__export(require("./login-manager")); | ||
__export(require("./login-behavior")); | ||
__export(require("./share-manager")); | ||
__export(require("./ui/share-button")); | ||
var BaseDelegate = (function (_super) { | ||
@@ -36,5 +29,2 @@ __extends(BaseDelegate, _super); | ||
}(UIResponder)); | ||
function BaseDelegate_tsickle_Closure_declarations() { | ||
BaseDelegate.ObjCProtocols; | ||
} | ||
applicationModule.ios.delegate = BaseDelegate; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./ui/login-button"},{"from":"./login-manager"},{"from":"./login-event-data"},{"from":"./login-behavior"}]}] | ||
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./ui/login-button"},{"from":"./login-manager"},{"from":"./login-event-data"},{"from":"./login-behavior"},{"from":"./share-manager"},{"from":"./ui/share-button"}]}] |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var LoginBehavior = { | ||
LoginBehaviorNative: 0, | ||
LoginBehaviorBrowser: 1, | ||
LoginBehaviorSystemAccount: 2, | ||
LoginBehaviorWeb: 3, | ||
}; | ||
exports.LoginBehavior = LoginBehavior; | ||
LoginBehavior[LoginBehavior.LoginBehaviorNative] = "LoginBehaviorNative"; | ||
LoginBehavior[LoginBehavior.LoginBehaviorBrowser] = "LoginBehaviorBrowser"; | ||
LoginBehavior[LoginBehavior.LoginBehaviorSystemAccount] = "LoginBehaviorSystemAccount"; | ||
LoginBehavior[LoginBehavior.LoginBehaviorWeb] = "LoginBehaviorWeb"; | ||
var LoginBehavior; | ||
(function (LoginBehavior) { | ||
LoginBehavior[LoginBehavior["LoginBehaviorNative"] = 0] = "LoginBehaviorNative"; | ||
LoginBehavior[LoginBehavior["LoginBehaviorBrowser"] = 1] = "LoginBehaviorBrowser"; | ||
LoginBehavior[LoginBehavior["LoginBehaviorSystemAccount"] = 2] = "LoginBehaviorSystemAccount"; | ||
LoginBehavior[LoginBehavior["LoginBehaviorWeb"] = 3] = "LoginBehaviorWeb"; | ||
})(LoginBehavior = exports.LoginBehavior || (exports.LoginBehavior = {})); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function LoginEventData() { } | ||
exports.LoginEventData = LoginEventData; | ||
function LoginEventData_tsickle_Closure_declarations() { | ||
LoginEventData.prototype.error; | ||
LoginEventData.prototype.loginResponse; | ||
} |
@@ -52,7 +52,7 @@ "use strict"; | ||
var errorMessage = "Error with Facebook"; | ||
if (e.getErrorMessage) { | ||
errorMessage += ": " + e.getErrorMessage(); | ||
if (e['getErrorMessage']) { | ||
errorMessage += ": " + e['getErrorMessage'](); | ||
} | ||
else if (e.getErrorCode) { | ||
errorMessage += ": Code " + e.getErrorCode(); | ||
else if (e['getErrorCode']) { | ||
errorMessage += ": Code " + e['getErrorCode'](); | ||
} | ||
@@ -59,0 +59,0 @@ else { |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"onLogoutCallback":{"__symbolic":"error","message":"Variable not initialized","line":8,"character":11},"_registerLogoutCallback":{"__symbolic":"function"},"init":{"__symbolic":"function"},"_registerLoginCallback":{"__symbolic":"function"},"requestPublishPermissions":{"__symbolic":"function"},"requestReadPermissions":{"__symbolic":"function"},"login":{"__symbolic":"function"},"getCurrentAccessToken":{"__symbolic":"function"},"logout":{"__symbolic":"function"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"onLoginCallback":{"__symbolic":"error","message":"Variable not initialized","line":7,"character":11},"onLogoutCallback":{"__symbolic":"error","message":"Variable not initialized","line":8,"character":11},"_registerLogoutCallback":{"__symbolic":"function"},"init":{"__symbolic":"function"},"_registerLoginCallback":{"__symbolic":"function"},"requestPublishPermissions":{"__symbolic":"function"},"requestReadPermissions":{"__symbolic":"function"},"login":{"__symbolic":"function"},"getCurrentAccessToken":{"__symbolic":"function"},"logout":{"__symbolic":"function"}}}] |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"onLoginCallback":{"__symbolic":"error","message":"Variable not initialized","line":17,"character":11},"onLogoutCallback":{"__symbolic":"error","message":"Variable not initialized","line":18,"character":11},"init":{"__symbolic":"function"},"_registerLogoutCallback":{"__symbolic":"function"},"_registerLoginCallback":{"__symbolic":"function"},"requestPublishPermissions":{"__symbolic":"function"},"requestReadPermissions":{"__symbolic":"function"},"login":{"__symbolic":"function"},"getCurrentAccessToken":{"__symbolic":"function"},"logout":{"__symbolic":"function"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"onLoginCallback":{"__symbolic":"error","message":"Variable not initialized","line":8,"character":11},"onLogoutCallback":{"__symbolic":"error","message":"Variable not initialized","line":9,"character":11},"init":{"__symbolic":"function"},"_registerLogoutCallback":{"__symbolic":"function"},"_registerLoginCallback":{"__symbolic":"function"},"requestPublishPermissions":{"__symbolic":"function"},"requestReadPermissions":{"__symbolic":"function"},"login":{"__symbolic":"function"},"getCurrentAccessToken":{"__symbolic":"function"},"logout":{"__symbolic":"function"}}}] |
@@ -10,4 +10,1 @@ "use strict"; | ||
exports.LoginResponse = LoginResponse; | ||
function LoginResponse_tsickle_Closure_declarations() { | ||
LoginResponse.prototype.token; | ||
} |
{ | ||
"name": "nativescript-facebook", | ||
"version": "2.2.4", | ||
"version": "2.3.0", | ||
"description": "NativeScript plugin, wrapper of native Facebook SDK for Adroid and iOS.", | ||
"nativescript": { | ||
"platforms": { | ||
"android": "3.0.0", | ||
"ios": "3.0.0" | ||
"android": "4.0.0", | ||
"ios": "4.0.0" | ||
} | ||
@@ -16,3 +16,3 @@ }, | ||
"build.iosOnly": "npm i && tsc && npm run ngc", | ||
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'", | ||
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/platforms/**'", | ||
"prepublishOnly": "npm run build", | ||
@@ -23,3 +23,5 @@ "plugin.tscwatch": "tsc -skipLibCheck -w", | ||
"demo.ng.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios --syncAllFiles", | ||
"demo.ng.android": "npm i && npm run tsc && cd ../demo-angular && tns run android --syncAllFiles" | ||
"demo.ng.android": "npm i && npm run tsc && cd ../demo-angular && tns run android --syncAllFiles", | ||
"demo.vue.ios": "npm i && npm run tsc && cd ../demo-vue && tns run ios --bundle --syncAllFiles", | ||
"demo.vue.android": "npm i && npm run tsc && cd ../demo-vue && tns run android --bundle --syncAllFiles" | ||
}, | ||
@@ -46,14 +48,15 @@ "repository": { | ||
"devDependencies": { | ||
"tns-core-modules": "^4.0.0", | ||
"tns-platform-declarations": "^4.0.0", | ||
"typescript": "~2.7.2", | ||
"nativescript-angular": "~6.0.6", | ||
"@angular/core": "~6.0.6", | ||
"@angular/common": "~6.0.6", | ||
"@angular/compiler": "~6.0.6", | ||
"@angular/compiler-cli": "~6.0.6", | ||
"rxjs": "5.4.2", | ||
"zone.js": "~0.8.4", | ||
"tslint": "~5.4.3" | ||
"tns-core-modules": "^5.1.0", | ||
"tns-platform-declarations": "^5.1.0", | ||
"typescript": "~3.1.6", | ||
"nativescript-angular": "~7.1.0", | ||
"nativescript-vue": "~2.0.2", | ||
"@angular/core": "~7.1.0", | ||
"@angular/common": "~7.1.0", | ||
"@angular/compiler": "~7.1.0", | ||
"@angular/compiler-cli": "~7.1.0", | ||
"rxjs": "^6.3.3", | ||
"zone.js": "~0.8.26", | ||
"tslint": "~5.11.0" | ||
} | ||
} |
162
README.md
@@ -27,2 +27,8 @@ NativeScript : Facebook SDK ![apple](https://cdn3.iconfinder.com/data/icons/picons-social/57/16-apple-32.png) ![android](https://cdn4.iconfinder.com/data/icons/logos-3/228/android-32.png) | ||
- [Custom Logout Button](#custom-logout-button) | ||
- [Share](#share) | ||
- [Create Sharing Content](#create-sharing-content) | ||
- [Facebook Share Button](#facebook-share-button) | ||
- [Facebook Send Button](#facebook-send-button) | ||
- [Show Share Dialog Programmatically](#show-dialog-programmatically) | ||
- [Hide Custom Button If Can't share](#hide-custom-button) | ||
- [NativeScript Angular](#nativescript-angular) | ||
@@ -36,2 +42,8 @@ - [Initialization](#initialization-1) | ||
- [Custom Logout Button](#custom-logout-button-1) | ||
- [Share](#share-1) | ||
- [Create Sharing Content](#create-sharing-content-1) | ||
- [Facebook Share Button](#facebook-share-button-1) | ||
- [Facebook Send Button](#facebook-send-button-1) | ||
- [Show Share Dialog Programmatically](#show-dialog-programmatically-1) | ||
- [Hide Custom Button If Can't share](#hide-custom-button-1) | ||
- [Login Response](#login-response) | ||
@@ -49,3 +61,3 @@ - [Get Current Access Token](#get-current-access-token) | ||
- [x] Login & Logout | ||
- [ ] Share | ||
- [x] Share | ||
- [ ] Graph API | ||
@@ -61,5 +73,12 @@ | ||
### Android | ||
No additional configuration required! | ||
Update AndroidManifest.xml (app/App_Resources/Android/AndroidManifest.xml) to put `provider` under `<application>` | ||
`{facebook_app_id}` is your app id | ||
```xml | ||
<provider android:authorities="com.facebook.app.FacebookContentProvider{facebook_app_id}" | ||
android:name="com.facebook.FacebookContentProvider" | ||
android:exported="true"/> | ||
``` | ||
### iOS | ||
Update Info.plist file (app/App_Resources/iOS/Info.plist) to contains `CFBundleURLTypes` like below: | ||
Update Info.plist file (app/App_Resources/iOS/Info.plist) to contains `CFBundleURLTypes` and `LSApplicationQueriesSchemes` like below: | ||
```xml | ||
@@ -81,3 +100,9 @@ <?xml version="1.0" encoding="UTF-8"?> | ||
</array> | ||
<key>LSApplicationQueriesSchemes</key> | ||
<array> | ||
<string>fbapi</string> | ||
<string>fb-messenger-share-api</string> | ||
<string>fbauth2</string> | ||
<string>fbshareextension</string> | ||
</array> | ||
</dict> | ||
@@ -258,3 +283,93 @@ </plist> | ||
### Share | ||
### Create Sharing Content | ||
For sharing, you have to create sharing content first. | ||
Currently the available content types are: | ||
- **createShareLinksContent(link: string, quote?: string, addition?: ShareAdditionContent)** available for every condition | ||
- **createSharePhotosContent(images: ImageSource[] | string[], userGenerated: boolean, addition?: ShareAdditionContent)** available for ShareButton and `showShareDialog` ( only when user have native Facebook installed, version 7.0 or higher ) | ||
- **createShareMessageGenericTemplateContent(contentConfig: MessageGenericTemplateContent)** available for SendButton and `showMessageDialog` | ||
- **createShareMessageMediaTemplateContent(contentConfig: MessageMediaTemplateContent)** available for SendButton and `showMessageDialog` | ||
You can see more information from [https://developers.facebook.com/docs/sharing/overview#content](https://developers.facebook.com/docs/sharing/overview#content) and [https://developers.facebook.com/docs/sharing/messenger#share-types](https://developers.facebook.com/docs/sharing/messenger#share-types) | ||
```TypeScript | ||
import { | ||
LoginEventData, | ||
getCurrentAccessToken, | ||
createShareLinksContent, | ||
createSharePhotosContent, | ||
createShareMessageGenericTemplateContent, | ||
MessageGenericTemplateImageAspectRatio, | ||
showShareDialog, | ||
showMessageDialog, | ||
canShareDialogShow, | ||
canMessageDialogShow | ||
} from 'nativescript-facebook'; | ||
const linkContent = createShareLinksContent('https://www.nativescript.org', | ||
'Create Native iOS and Android Apps With JavaScript', | ||
{ | ||
hashtag: '#Nativescript' | ||
}); | ||
// you can also pass in imageUrls as string[] in here | ||
const logoImage = fromResource('logo'); | ||
const photosContent = createSharePhotosContent([logoImage], false, { | ||
hashtag: '#Nativescript' | ||
}); | ||
const GenericTemplate = createShareMessageGenericTemplateContent({ | ||
element: { | ||
title: 'Nativescript', | ||
subtitle: 'Create Native iOS and Android Apps With JavaScript', | ||
imageUrl: 'https://d2odgkulk9w7if.cloudfront.net/images/default-source/home/how-it-works-min.png', | ||
button: { | ||
title: 'Check Doc', | ||
url: 'https://docs.nativescript.org' | ||
}, | ||
defaultAction: { | ||
title: 'Go HomePage', | ||
url: 'https://www.nativescript.org' | ||
} | ||
}, | ||
// it seems android have to provide a pageId, otherwise the MessageDialog just wont show | ||
pageID: 'testestsett', | ||
imageAspectRatio: MessageGenericTemplateImageAspectRatio.Horizontal | ||
}); | ||
``` | ||
### Facebook Share Button | ||
```xml | ||
<Facebook:ShareButton content="{{ linkContent }}"></Facebook:ShareButton> | ||
``` | ||
### Facebook Send Button | ||
If the Messenger app is not installed, the Send button will be hidden. Be sure that your app layout is appropriate when this button is hidden. | ||
```xml | ||
<Facebook:SendButton content="{{ genericContent }}"></Facebook:SendButton> | ||
``` | ||
### Show Share Dialog Programmatically | ||
**Note** The share dialog will try fallback to browse page sharing if user doesn't have Facebook installed (only for linkContent) | ||
```TypeScript | ||
showShareDialog(this.linkContent); | ||
showMessageDialog(this.linkContent); | ||
``` | ||
### Hide Custom Button If Can't share | ||
You can use this method to check if the content can be shared and hide the custom button if can't | ||
```TypeScript | ||
public canShowPhotosShareDialog = canShareDialogShow(this.photosContent); | ||
public canShowGenericMessageDialog = canMessageDialogShow(this.genericContent); | ||
``` | ||
```xml | ||
<Button tap="{{ onShareDialogPhotos }}" text="Open Share dialog (photos)" visibility="{{ canShowPhotosShareDialog ? 'visible' : 'collapsed' }}"></Button> | ||
<Button tap="{{ onSendGenericDialog }}" text="Share Message Generic Template" visibility="{{ canShowGenericMessageDialog ? 'visible' : 'collapsed' }}"></Button> | ||
``` | ||
## NativeScript Angular | ||
@@ -426,2 +541,41 @@ ### Initialization | ||
### Share | ||
### Create Sharing Content | ||
Read Nativescript [chapter](#create-sharing-content) for this | ||
### Facebook Share Button | ||
```html | ||
<FacebookShareButton [content] = "linkContent"></FacebookShareButton> | ||
``` | ||
### Facebook Send Button | ||
If the Messenger app is not installed, the Send button will be hidden. Be sure that your app layout is appropriate when this button is hidden. | ||
```html | ||
<FacebookSendButton [content] = "genericContent"></FacebookSendButton> | ||
``` | ||
### Show Share Dialog Programmatically | ||
**Note** The share dialog will try fallback to browse page sharing if user doesn't have Facebook installed (only for linkContent) | ||
```TypeScript | ||
showShareDialog(this.linkContent); | ||
showMessageDialog(this.linkContent); | ||
``` | ||
### Hide Custom Button If Can't share | ||
You can use this method to check if the content can be shared and hide the custom button if can't | ||
```TypeScript | ||
public canShowPhotosShareDialog = canShareDialogShow(this.photosContent); | ||
public canShowGenericMessageDialog = canMessageDialogShow(this.genericContent); | ||
``` | ||
```html | ||
<Button (tap) = "onShareDialogPhotos()" text = "Open Share dialog (photos)" *ngIf = "canShowPhotosShareDialog"></Button> | ||
<Button (tap) = "onSendGenericDialog()" text = "Share Message Generic Template" *ngIf = "canShowGenericMessageDialog"></Button> | ||
``` | ||
## Login Response | ||
@@ -428,0 +582,0 @@ The callback that have to be provided to Facebook.login method receives 2 arguments: error and login response object. Login response object has the following structure: |
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" /> | ||
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" /> | ||
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" /> | ||
/// <reference path="./platforms/ios/typings/objc!FBSDKCoreKit.d.ts" /> | ||
/// <reference path="./platforms/ios/typings/objc!FBSDKLoginKit.d.ts" /> | ||
/// <reference path="./platforms/ios/typings/objc!FBSDKShareKit.d.ts" /> | ||
/// <reference path="./platforms/android/typings/facebookSdk.d.ts" /> |
@@ -12,3 +12,4 @@ { | ||
"pretty": true, | ||
"noEmitHelpers": true | ||
"noEmitHelpers": true, | ||
"skipLibCheck": true | ||
}, | ||
@@ -22,3 +23,2 @@ "exclude": [ | ||
"angularCompilerOptions": { | ||
"annotateForClosureCompiler": true, | ||
"strictMetadataEmit": true, | ||
@@ -25,0 +25,0 @@ "skipTemplateCodegen": true, |
@@ -13,6 +13,6 @@ "use strict"; | ||
loginManager._registerLoginCallback(function (error, loginResponse) { | ||
_this.notify(({ eventName: LoginButtonBase.loginEvent, object: _this, error: error, loginResponse: loginResponse })); | ||
_this.notify({ eventName: LoginButtonBase.loginEvent, object: _this, error: error, loginResponse: loginResponse }); | ||
}); | ||
loginManager._registerLogoutCallback(function () { | ||
_this.notify(({ eventName: LoginButtonBase.logoutEvent, object: _this })); | ||
_this.notify({ eventName: LoginButtonBase.logoutEvent, object: _this }); | ||
}); | ||
@@ -25,5 +25,1 @@ }; | ||
exports.LoginButtonBase = LoginButtonBase; | ||
function LoginButtonBase_tsickle_Closure_declarations() { | ||
LoginButtonBase.loginEvent; | ||
LoginButtonBase.logoutEvent; | ||
} |
@@ -24,6 +24,2 @@ "use strict"; | ||
exports.LoginButton = LoginButton; | ||
function LoginButton_tsickle_Closure_declarations() { | ||
LoginButton.prototype.nativeView; | ||
LoginButton.prototype._localDelegate; | ||
} | ||
var LoginButtonDelegate = (function (_super) { | ||
@@ -50,4 +46,1 @@ __extends(LoginButtonDelegate, _super); | ||
}(NSObject)); | ||
function LoginButtonDelegate_tsickle_Closure_declarations() { | ||
LoginButtonDelegate.ObjCProtocols; | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
224369
70
3133
635
12
1