From c363a06a756fd4edcf9a972c22262754fec516d2 Mon Sep 17 00:00:00 2001 From: Zdravko Branzov Date: Tue, 24 Oct 2017 18:41:00 +0300 Subject: [PATCH 1/5] Update webpack version --- .travis.yml | 4 ++-- README.md | 34 ++++++++++++++++++---------------- demo-angular/package.json | 5 +++-- demo/package.json | 17 +++++++++-------- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 90c7fed..544b7ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,14 +25,14 @@ matrix: 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" 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 + 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 - stage: "Build" env: - BuildAndroid="25" diff --git a/README.md b/README.md index cf980fc..647ddf2 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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. diff --git a/demo-angular/package.json b/demo-angular/package.json index c38e8d9..ce42322 100644 --- a/demo-angular/package.json +++ b/demo-angular/package.json @@ -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", diff --git a/demo/package.json b/demo/package.json index c3ddf30..1a66d1d 100644 --- a/demo/package.json +++ b/demo/package.json @@ -32,7 +32,7 @@ "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", @@ -40,7 +40,8 @@ "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", @@ -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", - "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" + "generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install", + "start-android-bundle": "npm run ns-bundle --android --run-app", + "start-ios-bundle": "npm run ns-bundle --ios --run-app", + "build-android-bundle": "npm run ns-bundle --android --build-app", + "build-ios-bundle": "npm run ns-bundle --ios --build-app" } -} \ No newline at end of file +} From 3934ef1643cef887bcaab232f007225d72dee8b0 Mon Sep 17 00:00:00 2001 From: Zdravko Branzov Date: Tue, 24 Oct 2017 18:46:21 +0300 Subject: [PATCH 2/5] Fix uglify options --- demo/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/demo/package.json b/demo/package.json index 1a66d1d..66bf808 100644 --- a/demo/package.json +++ b/demo/package.json @@ -54,9 +54,9 @@ "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", - "start-ios-bundle": "npm run ns-bundle --ios --run-app", - "build-android-bundle": "npm run ns-bundle --android --build-app", - "build-ios-bundle": "npm run ns-bundle --ios --build-app" + "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" } } From 5f36a9b8796f6821cc2555338d53bee1ec09fb1f Mon Sep 17 00:00:00 2001 From: Zdravko Branzov Date: Wed, 25 Oct 2017 15:14:34 +0300 Subject: [PATCH 3/5] Fix snapshot option. --- demo/.gitignore | 1 + demo/app/vendor-platform.android.ts | 32 ++++++++--------------------- demo/app/vendor.ts | 2 +- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/demo/.gitignore b/demo/.gitignore index 5c1c079..b32f58d 100644 --- a/demo/.gitignore +++ b/demo/.gitignore @@ -2,3 +2,4 @@ node_modules platforms hooks app/**/*.js +report diff --git a/demo/app/vendor-platform.android.ts b/demo/app/vendor-platform.android.ts index ba9742f..1eb10c9 100644 --- a/demo/app/vendor-platform.android.ts +++ b/demo/app/vendor-platform.android.ts @@ -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"); +} \ No newline at end of file diff --git a/demo/app/vendor.ts b/demo/app/vendor.ts index 2e44c7c..beba755 100644 --- a/demo/app/vendor.ts +++ b/demo/app/vendor.ts @@ -1,3 +1,3 @@ require("./vendor-platform"); - require("tns-core-modules/bundle-entry-points"); +require("nativescript-facebook"); From fde091b1c73dac215ed9e190639b0b0ae0c5bab4 Mon Sep 17 00:00:00 2001 From: Zdravko Branzov Date: Wed, 25 Oct 2017 15:45:10 +0300 Subject: [PATCH 4/5] Fix snapshot for angular demo --- demo-angular/.gitignore | 1 + demo-angular/app/vendor-platform.android.ts | 30 +++++---------------- demo-angular/app/vendor.ts | 1 + 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/demo-angular/.gitignore b/demo-angular/.gitignore index 6b1e5df..c7c62da 100644 --- a/demo-angular/.gitignore +++ b/demo-angular/.gitignore @@ -2,3 +2,4 @@ platforms node_modules hooks app/**/*.js +report diff --git a/demo-angular/app/vendor-platform.android.ts b/demo-angular/app/vendor-platform.android.ts index 58f2cee..780782b 100644 --- a/demo-angular/app/vendor-platform.android.ts +++ b/demo-angular/app/vendor-platform.android.ts @@ -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"); } diff --git a/demo-angular/app/vendor.ts b/demo-angular/app/vendor.ts index 0d96965..8fd8c7f 100644 --- a/demo-angular/app/vendor.ts +++ b/demo-angular/app/vendor.ts @@ -11,3 +11,4 @@ require("@angular/router"); require("nativescript-angular/platform-static"); require("nativescript-angular/forms"); require("nativescript-angular/router"); +require("nativescript-facebook"); From 8db6cb98835d30939993306958f17bc2bb75aefe Mon Sep 17 00:00:00 2001 From: Zdravko Branzov Date: Thu, 26 Oct 2017 15:30:23 +0300 Subject: [PATCH 5/5] Update ios and android build version --- .travis.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 544b7ac..19a5c6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,11 +17,11 @@ 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 @@ -29,14 +29,13 @@ matrix: - 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 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 - - stage: "Build" + - language: android env: - - BuildAndroid="25" - language: android + - BuildAndroid="26" os: linux jdk: oraclejdk8 before_install: nvm install 6.10.3 @@ -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 @@ -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: