Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,25 @@ matrix:
os: linux
node_js: "6"
script: cd src && npm run ci.tslint && cd ../demo && npm run ci.tslint && cd ../demo-angular && npm run ci.tslint
- stage: "WebPack"
- stage: "WebPack and Build"
os: osx
env:
- Webpack="iOS"
osx_image: xcode8.3
- WebpackiOS="11"
osx_image: xcode9.1
language: node_js
node_js: "6"
jdk: oraclejdk8
script: cd demo && npm run build.plugin && npm i && npm run build-ios-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-ios-bundle
script: cd demo && npm run build.plugin && npm i && npm run ns-bundle --ios --build-app --uglify && cd ../demo-angular && npm run build.plugin && npm i && npm run ns-bundle --ios --build-app --uglify
- language: android
os: linux
env:
- Webpack="Android"
- WebpackAndroid="26"
jdk: oraclejdk8
before_install: nvm install 6.10.3
script: cd demo && npm run build.plugin && npm i && npm run build-android-bundle && cd ../demo-angular && npm run build.plugin && npm i && npm run build-android-bundle
- stage: "Build"
script: cd demo && npm run build.plugin && npm i && npm run ns-bundle --android --build-app --uglify --snapshot && cd ../demo-angular && npm run build.plugin && npm i && npm run ns-bundle --android --build-app --uglify --snapshot
- language: android
env:
- BuildAndroid="25"
language: android
- BuildAndroid="26"
os: linux
jdk: oraclejdk8
before_install: nvm install 6.10.3
Expand All @@ -45,9 +44,9 @@ matrix:
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE --data-binary @$ANDROID_PACKAGE_FOLDER/$ANDROID_PACKAGE"
- os: osx
env:
- BuildiOS="10.3"
- Xcode="8.3"
osx_image: xcode8.3
- BuildiOS="11"
- Xcode="9.1"
osx_image: xcode9.1
language: node_js
node_js: "6"
jdk: oraclejdk8
Expand Down Expand Up @@ -79,8 +78,9 @@ android:
components:
- tools
- platform-tools
- build-tools-25.0.2
- android-25
- build-tools-26.0.1
- android-26
- android-23
- extra-android-m2repository

before_cache:
Expand Down
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@ NativeScript : Facebook SDK ![apple](https://cdn3.iconfinder.com/data/icons/pico
- [Configuration](#configuration)
- [Android](#android)
- [iOS](#ios)
- [NativeScript Core](#nativescript-core)
- [Initialization](#initialization)
- [Login](#login)
- [Facebook Login Button](#facebook-login-button)
- [Custom Login Button](#custom-login-button)
- [Log out](#log-out)
- [Facebook Logout Button](#facebook-logout-button)
- [Custom Logout Button](#custom-logout-button)
- [NativeScript Angular](#nativescript-angular)
- [Initialization](#initialization-1)
- [Login](#login-1)
- [Facebook Login Button](#facebook-login-button-1)
- [Custom Login Button](#custom-login-button-1)
- [Logout](#logout)
- [Facebook Logout Button](#facebook-logout-button-1)
- [Custom Logout Button](#custom-logout-button-1)
- [Usage](#usage)
- [NativeScript Core](#nativescript-core)
- [Initialization](#initialization)
- [Login](#login)
- [Facebook Login Button](#facebook-login-button)
- [Custom Login Button](#custom-login-button)
- [Log out](#log-out)
- [Facebook Logout Button](#facebook-logout-button)
- [Custom Logout Button](#custom-logout-button)
- [NativeScript Angular](#nativescript-angular)
- [Initialization](#initialization-1)
- [Login](#login-1)
- [Facebook Login Button](#facebook-login-button-1)
- [Custom Login Button](#custom-login-button-1)
- [Logout](#logout)
- [Facebook Logout Button](#facebook-logout-button-1)
- [Custom Logout Button](#custom-logout-button-1)
- [Login Response](#login-response)
- [Graph API Example](#graph-api-example)
- [Release notes](#release-notes)
Expand Down Expand Up @@ -79,6 +80,7 @@ Update Info.plist file (app/App_Resources/iOS/Info.plist) to contains `CFBundleU
```
>Make sure you replaced {facebook_app_id} with your Facebook App Id. More info regarding how to obtain a Facebook App Id can be found [here](https://developers.facebook.com/docs/apps/register).

# Usage
## NativeScript Core
### Initialization
Call init of nativescript-facebook module on application launch.
Expand Down
1 change: 1 addition & 0 deletions demo-angular/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ platforms
node_modules
hooks
app/**/*.js
report
30 changes: 7 additions & 23 deletions demo-angular/app/vendor-platform.android.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
// Resolve JavaScript classes that extend a Java class, and need to resolve
// their JavaScript module from a bundled script. For example:
// NativeScriptApplication, NativeScriptActivity, etc.
//
// This module gets bundled together with the rest of the app code and the
// `require` calls get resolved to the correct bundling import call.
//
// At runtime the module gets loaded *before* the rest of the app code, so code
// placed here needs to be careful about its dependencies.

require("tns-core-modules/application");
require("tns-core-modules/ui/frame");
require("tns-core-modules/ui/frame/activity");

if (global.TNS_WEBPACK) {
global.__requireOverride = function (name, dir) {
if (name === "./tns_modules/application/application.js") {
return require("application");
} else if (name === "./tns_modules/ui/frame/frame.js") {
return require("ui/frame");
} else if (name === "./tns_modules/ui/frame/activity.js") {
return require("ui/frame/activity");
}
};
if (!global["__snapshot"]) {
/*
In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
*/
require("tns-core-modules/ui/frame");
require("tns-core-modules/ui/frame/activity");
}
1 change: 1 addition & 0 deletions demo-angular/app/vendor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ require("@angular/router");
require("nativescript-angular/platform-static");
require("nativescript-angular/forms");
require("nativescript-angular/router");
require("nativescript-facebook");
5 changes: 3 additions & 2 deletions demo-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@
"lazy": "1.0.11",
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-typescript": "^0.4.0",
"nativescript-dev-webpack": "0.7.3",
"nativescript-dev-webpack": "^0.8.0",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.0.2",
"typescript": "~2.3.4",
"webpack": "~2.6.1",
"webpack-sources": "~1.0.1",
"tslint": "~5.4.3",
"webpack-bundle-analyzer": "^2.8.2"
"webpack-bundle-analyzer": "^2.8.2",
"nativescript-worker-loader": "~0.8.1"
},
"scripts": {
"ns-bundle": "ns-bundle",
Expand Down
1 change: 1 addition & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
platforms
hooks
app/**/*.js
report
32 changes: 8 additions & 24 deletions demo/app/vendor-platform.android.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
// Resolve JavaScript classes that extend a Java class, and need to resolve
// their JavaScript module from a bundled script. For example:
// NativeScriptApplication, NativeScriptActivity, etc.
//
// This module gets bundled together with the rest of the app code and the
// `require` calls get resolved to the correct bundling import call.
//
// At runtime the module gets loaded *before* the rest of the app code, so code
// placed here needs to be careful about its dependencies.

require("application");
require("ui/frame");
require("ui/frame/activity");

if (global.TNS_WEBPACK) {
global.__requireOverride = function (name, dir) {
if (name === "./tns_modules/application/application.js") {
return require("application");
} else if (name === "./tns_modules/ui/frame/frame.js") {
return require("ui/frame");
} else if (name === "./tns_modules/ui/frame/activity.js") {
return require("ui/frame/activity");
}
};
}
if (!global["__snapshot"]) {
/*
In case snapshot generation is enabled these modules will get into the bundle but will not be required/evaluated.
The snapshot webpack plugin will add them to the tns-java-classes.js bundle file. This way, they will be evaluated on app start as early as possible.
*/
require("ui/frame");
require("ui/frame/activity");
}
2 changes: 1 addition & 1 deletion demo/app/vendor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require("./vendor-platform");

require("tns-core-modules/bundle-entry-points");
require("nativescript-facebook");
11 changes: 6 additions & 5 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-appium": "^1.0.0",
"nativescript-dev-typescript": "^0.4.0",
"nativescript-dev-webpack": "0.7.3",
"nativescript-dev-webpack": "^0.8.0",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.0.2",
"typescript": "~2.2.2",
"tslint": "~5.4.3",
"wd": "~1.1.1",
"webpack": "~2.6.1",
"webpack-sources": "~1.0.1",
"webpack-bundle-analyzer": "^2.8.2"
"webpack-bundle-analyzer": "^2.8.2",
"nativescript-worker-loader": "~0.8.1"
},
"scripts": {
"ns-bundle": "ns-bundle",
Expand All @@ -52,10 +53,10 @@
"ci.ios.build": "npm run build.plugin && tns build ios",
"ci.ios.uitest": "npm run appium --runtype=ios-simulator103iPhone6",
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
"start-android-bundle": "npm run ns-bundle --android --run-app --uglify --snapshot",
"start-ios-bundle": "npm run ns-bundle --ios --run-app --uglify",
"build-android-bundle": "npm run ns-bundle --android --build-app --uglify --snapshot",
"build-ios-bundle": "npm run ns-bundle --ios --build-app --uglify",
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install"
"build-ios-bundle": "npm run ns-bundle --ios --build-app --uglify"
}
}
}