diff --git a/.github/main.workflow b/.github/main.workflow new file mode 100644 index 00000000..e0d7a514 --- /dev/null +++ b/.github/main.workflow @@ -0,0 +1,9 @@ +workflow "Automatic Rebase" { + on = "issue_comment" + resolves = "Rebase" +} + +action "Rebase" { + uses = "docker://cirrusactions/rebase:latest" + secrets = ["GITHUB_TOKEN"] +} \ No newline at end of file diff --git a/.github/weekly-digest.yml b/.github/weekly-digest.yml new file mode 100644 index 00000000..6d4ba7e8 --- /dev/null +++ b/.github/weekly-digest.yml @@ -0,0 +1,7 @@ +# Configuration for weekly-digest - https://github.com/apps/weekly-digest +publishDay: sun +canPublishIssues: true +canPublishPullRequests: true +canPublishContributors: true +canPublishStargazers: true +canPublishCommits: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 17210c46..bb22f326 100644 --- a/.gitignore +++ b/.gitignore @@ -5,30 +5,40 @@ package-lock.json *.js !src/*-hooks.js build/ +*.tgz *.log.* src/**/*.d.ts +src/**/*.map src/platforms/ios_lib/TNSMLKitCamera/TNSMLKitCamera.xcodeproj/project.xcworkspace src/platforms/ios_lib/TNSMLKitCamera/TNSMLKitCamera.xcodeproj/xcuserdata src/platforms/ios/Podfile -src/platforms/ios/build.xcconfig src/platforms/android/include.gradle +src/platforms/android/mlkithelpersrc/**/*.class !src/firebase.d.ts !src/index.d.ts !src/references.d.ts !src/analytics/analytics.d.ts +!src/crashlytics/crashlytics.d.ts +!src/performance/performance.d.ts +!src/inappmessaging/inappmessaging.d.ts !src/storage/storage.d.ts +!src/admob/admob.d.ts !src/messaging/messaging.d.ts !src/mlkit/*/index.d.ts !src/mlkit/mlkit-cameraview.d.ts !src/platforms/web/typings/firebase-webapi.d.ts !src/platforms/ios/typings/*.d.ts !src/platforms/android/typings/**/*.d.ts -!src/scripts/*.js +!src/functions/functions.d.ts +!src/scripts/entitlements*.js !demo/karma.conf.js demo/*.d.ts +demo/firebasefunctions/functions/lib !demo-push/karma.conf.js demo-push/*.d.ts demo-ng/*.d.ts +!demo-ng/webpack.config.js +!demo-vue/app/main.js !demo/references.d.ts !demo-push/references.d.ts !demo-ng/references.d.ts diff --git a/.travis.yml b/.travis.yml index df06c7db..7f25d10b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,80 +1,60 @@ -android: - components: - - tools - - platform-tools - - build-tools-26.0.2 - - android-23 - - android-26 - - extra-android-m2repository - - sys-img-armeabi-v7a-android-21 - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - -cache: - directories: - - .nvm - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - -install: - - echo no | npm install -g nativescript - - tns usage-reporting disable - - tns error-reporting disable - - cd src - - npm i --ignore-scripts - - npm run tsc - - cd ../demo - - npm i - -script: - - matrix: include: - stage: "Lint" language: node_js os: linux - node_js: "6" + node_js: "10" script: "npm run ci.tslint" - stage: "WebPack" - os: osx - env: - - Webpack="iOS" - osx_image: xcode9.2 - language: node_js - node_js: "6" - jdk: oraclejdk8 - before_install: - - gem install cocoapods - - pod repo update - script: travis_wait travis_retry tns build ios --bundle - - language: android + language: android os: linux env: - - Webpack="Android" + - WebPack="Android" jdk: oraclejdk8 - before_install: nvm install 6.10.3 + before_install: nvm install 10 script: travis_wait travis_retry tns build android --bundle - stage: "Build" env: - - BuildAndroid="26" + - BuildAndroid="28" language: android os: linux + dist: trusty jdk: oraclejdk8 - before_install: nvm install 6.10.3 + before_install: nvm install 10 script: - travis_wait travis_retry tns build android - os: osx env: - - BuildiOS="11" - - Xcode="9.2" - osx_image: xcode9.2 + - BuildiOS="12.0" + - Type="TypeScript" + osx_image: xcode11.2 language: node_js - node_js: "6" + node_js: "10" jdk: oraclejdk8 - before_install: - - gem install cocoapods - - pod repo update + before_script: pod repo update script: - travis_wait travis_retry tns build ios + +android: + components: + - tools + - platform-tools + - build-tools-28.0.3 + - android-28 + - extra-android-m2repository + - sys-img-armeabi-v7a-android-21 + +before_install: + - sudo pip install --upgrade pip + - sudo pip install six + +install: + - echo no | npm install -g nativescript + - tns usage-reporting disable + - tns error-reporting disable + - cd src + - npm i --ignore-scripts + - npm run tsc + - npm run package + - cd ../demo + - npm i diff --git a/CHANGELOG.md b/CHANGELOG.md index 042b74aa..b7f7385a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,236 @@ Firebase -[Firebase iOS SDK Changelog](https://firebase.google.com/support/release-notes/ios) -[Firebase Android SDK Changelog](https://firebase.google.com/support/release-notes/android) +- [Firebase iOS SDK Changelog](https://firebase.google.com/support/release-notes/ios) +- [Firebase Android SDK Changelog](https://firebase.google.com/support/release-notes/android) + +## 10.4.0 (2020, Feb 10) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/122?closed=1) + +> Make sure to run a `pod repo update` on your dev machine, because this version includes the latest Firebase iOS (and Android) SDKs. + +## 10.3.3 (2019, Dec 24) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/121?closed=1) + + +## 10.3.2 (2019, Dec 11) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/120?closed=1) + + +## 10.3.1 (2019, Dec 6) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/119?closed=1) + + +## 10.3.0 (2019, Dec 2) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/118?closed=1) + + +## 10.2.1 (2019, Nov 26) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/117?closed=1) + + +## 10.2.0 (2019, Nov 18) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/116?closed=1) + + +## 10.1.1 (2019, Oct 29) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/114?closed=1) + + +## 10.1.0 (2019, Oct 18) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/113?closed=1) + + +## 10.0.2 (2019, Oct 16) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/112?closed=1) + + +## 10.0.1 (2019, Sep 30) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/111?closed=1) + + +## 10.0.0 (2019, Sep 17) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/109?closed=1) + +> Make sure to run a `pod repo update` on your dev machine, because this version includes the latest Firebase iOS (and Android) SDKs. + +> This version requires a minimum version of NativeScript 5.2. For MLKit features on iOS it's recommended to use a minimum `tns-ios` version of 6.1.0, otherwise you may run into build issues. + + +## 9.1.1 (2019, Aug 27) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/110?closed=1) + + +## 9.1.0 (2019, Aug 19) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/104?closed=1) + +> Make sure to run a `pod repo update` on your dev machine, because this version includes the latest Firebase iOS (and Android) SDKs. + + +## 9.0.4 (2019, July 22) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/108?closed=1) + + +## 9.0.3 (2019, July 10) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/107?closed=1) + + +## 9.0.2 (2019, July 9) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/106?closed=1) + + +## 9.0.1 (2019, June 18) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/105?closed=1) + + +## 9.0.0 (2019, June 18) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/103?closed=1) + +#### BREAKING CHANGES + +> `fetchProvidersForEmail` has been removed - use `fetchSignInMethodsForEmail` instead. + +> Firebase Invites has been removed - use Dynamic Links instead! Also see https://firebase.google.com/docs/invites/deprecation and https://firebase.google.com/docs/dynamic-links/use-cases/user-to-user + +> Firebase crash reporting has been removed from the SDKs. Use Crashlytics instead. This also means `firebase.sendCrashLog` is gone. Use `firebase.crashlytics.sendCrashLog()` instead. + +> If you're on NativeScript < 5.2 and target iOS, then it's recommended to stick with a plugin version < 9.0.0 because you _may_ run into incompatibilities with certain features. + +> Also, make sure to run a `pod repo update` on your dev machine, because this version includes the latest Firebase iOS SDKs. + +## 8.3.2 (2019, May 14) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/101?closed=1) + + +## 8.3.1 (2019, May 7) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/102?closed=1) + + +## 8.3.0 (2019, May 2) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/100?closed=1) + + +## 8.2.1 (2019, April 17) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/99?closed=1) + + +## 8.2.0 (2019, April 10) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/98?closed=1) + +> Note: The Firebase iOS SDK now requires Xcode 10.1 or later. + +> Also note that there's a little breaking change that's easy to fix: the `name` and `profileImageURL` properties of the login result object have new names: `displayName` and `photoURL` respectively. + +## 8.1.1 (2019, March 24) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/97?closed=1) + + +## 8.1.0 (2019, March 24) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/96?closed=1) + + +## 8.0.1 (2019, March 16) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/95?closed=1) + + +## 8.0.0 (2019, February 26) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/94?closed=1) + +### BREAKING CHANGES +- `getAuthToken` no longer returns a token (`string`), but an `GetAuthTokenResult` object which contains more data. See #1008. +- For better alignment with the Web API, `changePassword` is now `updatePassword`, `resetPassword` is now `sendPasswordResetEmail`. See #1080. + + +## 7.7.0 (2019, January 20) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/92?closed=1) + + +## 7.6.1 (2019, January 8) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/91?closed=1) + + +## 7.6.0 (2018, December 21) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/90?closed=1) + + +## 7.5.1 (2018, December 15) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/89?closed=1) + + +## 7.5.0 (2018, December 15) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/88?closed=1) + + +## 7.4.6 (2018, December 10) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/87?closed=1) + + +## 7.4.5 (2018, December 10) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/86?closed=1) + + +## 7.4.4 (2018, December 8) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/85?closed=1) + + +## 7.4.3 (2018, December 3) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/84?closed=1) + + +## 7.4.2 (2018, November 16) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/83?closed=1) + + +## 7.4.1 (2018, November 10) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/82?closed=1) + + +## 7.4.0 (2018, November 9) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/81?closed=1) + + +## 7.3.0 (2018, October 24) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/80?closed=1) + + +## 7.2.0 (2018, October 19) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/79?closed=1) + + +## 7.1.6 (2018, October 12) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/78?closed=1) + + +## 7.1.5 (2018, October 10) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/77?closed=1) + + +## 7.1.4 (2018, October 9) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/76?closed=1) + + +## 7.1.3 (2018, October 8) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/75?closed=1) + + +## 7.1.2 (2018, October 2) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/74?closed=1) + + +## 7.1.1 (2018, September 30) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/73?closed=1) + + +## 7.1.0 (2018, September 26) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/72?closed=1) + + +## 7.0.1 (2018, September 21) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/71?closed=1) + + +## 7.0.0 (2018, September 19) +[Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/70?closed=1) + ## 6.8.1 (2018, September 14) [Fixes & Enhancements](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/milestone/69?closed=1) diff --git a/README.md b/README.md index a898bb6f..1d41d78f 100755 --- a/README.md +++ b/README.md @@ -1,31 +1,33 @@ # NativeScript Firebase plugin +Firebase
+ [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] -[![Twitter Follow][twitter-image]][twitter-url] +[![TotalDownloads][total-downloads-image]][npm-url] -[build-status]:https://travis-ci.org/EddyVerbruggen/nativescript-plugin-firebase.svg?branch=master -[build-url]:https://travis-ci.org/EddyVerbruggen/nativescript-plugin-firebase -[npm-image]:http://img.shields.io/npm/v/nativescript-plugin-firebase.svg -[npm-url]:https://npmjs.org/package/nativescript-plugin-firebase -[downloads-image]:http://img.shields.io/npm/dm/nativescript-plugin-firebase.svg -[twitter-image]:https://img.shields.io/twitter/follow/eddyverbruggen.svg?style=social&label=Follow%20me -[twitter-url]:https://twitter.com/eddyverbruggen +[npm-image]:https://img.shields.io/npm/v/@nativescript/firebase.svg +[npm-url]:https://npmjs.org/package/@nativescript/firebase +[downloads-image]:https://img.shields.io/npm/dm/@nativescript/firebase.svg +[total-downloads-image]:https://img.shields.io/npm/dt/@nativescript/firebase.svg?label=total%20downloads -Firebase
+> 🚨🚨🚨 I'M NO LONGER ABLE TO MAINTAIN THIS PROJECT - I'm archiving the project for now, but if you want to take over, please don't open an issue, but hit me up on Twitter @eddyverbruggen. Alternatively, please check out this excellent plugin: https://github.com/NativeScript/firebase ## Features -* [Realtime Database](docs/DATABASE.md) -* [Firestore](docs/FIRESTORE.md) +* [AdMob](docs/ADMOB.md) +* [Analytics](docs/ANALYTICS.md) * [Authentication](docs/AUTHENTICATION.md) +* [Cloud Firestore](docs/FIRESTORE.md) +* [Cloud Functions](docs/FUNCTIONS.md) +* [Cloud Messaging](docs/MESSAGING.md) / [Non-Firebase Push Messaging](docs/NON_FIREBASE_MESSAGING.md) +* [Crashlytics](docs/CRASHLYTICS.md) +* [In-App Messaging](docs/IN_APP_MESSAGING.md) +* [Dynamic Links](docs/DYNAMIC_LINKS.md) +* [ML Kit](docs/ML_KIT.md) +* [Performance Monitoring](docs/PERFORMANCE_MONITORING.md) +* [Realtime Database](docs/DATABASE.md) * [Remote Config](docs/REMOTECONFIG.md) -* [Cloud Messaging](docs/MESSAGING.md) * [Storage](docs/STORAGE.md) -* [Crash Reporting / Crashlytics](docs/CRASHREPORTING.md) -* [Analytics](docs/ANALYTICS.md) -* [Invites and Dynamic Links](docs/INVITES_DYNAMICLINKS.md) -* [AdMob](docs/ADMOB.md) -* [ML Kit](docs/ML_KIT.md) ## Prerequisites Head on over to [https://console.firebase.google.com/](https://console.firebase.google.com/) and sign up for a free account. @@ -44,7 +46,13 @@ If you rather watch a (slightly outdated) video explaining the steps then check add iOS and Android support to the Firebase console and how to integrate anonymous authentication: [![YouTube demo](docs/images/yt-thumb-setup.png)](https://youtu.be/IextEpoIzwE "YouTube demo") -From the command prompt go to your app's root folder and execute: +From the command prompt go to your app's root folder and execute this for NativeScript 7+: + +```bash +tns plugin add @nativescript/firebase +``` + +or for NativeScript 6: ```bash tns plugin add nativescript-plugin-firebase @@ -53,6 +61,8 @@ tns plugin add nativescript-plugin-firebase This will launch an install script which will guide you through installing additional components. Check the doc links above to see what's what. You can always change your choices later. +> Want to use this plugin with an *external push notification provider* and **not** use any Firebase feature? Just answer 'y' to the first question to skip most of them, and️ [hop on over to the Push Notification](docs/NON_FIREBASE_MESSAGING.md). Do not run the plugin's `.init` function in this case! + > Using [NativeScript SideKick](https://www.nativescript.org/nativescript-sidekick)? Then the aforementioned install script will not (be able to) run. In that case, running the app for Android will result in [this issue](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/829#issuecomment-409870671). To fix that, see [this comment](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/829#issuecomment-409855611). @@ -65,10 +75,14 @@ You can reconfigure the plugin by going to the `node_modules/nativescript-plugin You can also change the configuration by deleting the `firebase.nativescript.json` and reinstalling the plugin. +> Be advised. Enabling some features (such as [Admob](docs/ADMOB.md)) in the `firebase.nativescript.json` may require additional configuration. If you are experiencing crashes or bugs after installing this plugin please consult the [documentation](docs) for each of the features you've enabled to ensure that no additioal configuration is required. + #### Using Vue? -If you're using this template: [vue-cli-template](https://github.com/nativescript-vue/vue-cli-template), then copy `firebase.nativescript.json` to the `template` folder. You could also symlink it: `firebase.nativescript.json -> template/firebase.nativescript.json`. +Please update your [NativeScript-Vue](https://github.com/nativescript-vue/vue-cli-template) template to 2.0 because it +aligns perfectly with this plugin (because that template is now much more similar to a regular NativeScript project). -And also, `require` the plugin before Vue.start runs (probably in `main.js`), but run `firebase.init()` afterwards (although it may work before). You could wrap it in a timeout to make sure. +If you want a demo using Vue and Firestore, then [check out this project](https://github.com/EddyVerbruggen/footplr), +if you want one with Realtime DB, [check out this one](https://github.com/jlooper/mixology-mobile). ### iOS (Cocoapods) The Firebase iOS SDK is installed via Cocoapods, so run `pod repo update` from the command prompt (in any folder) to ensure you have the latest spec. @@ -96,13 +110,17 @@ We need to do some wiring when your app starts, so open `app.js` and add this be ##### JavaScript ```js +// NativeScript 7+ +var firebase = require("@nativescript/firebase").firebase; + +// NativeScript 6- var firebase = require("nativescript-plugin-firebase"); firebase.init({ // Optionally pass in properties for database, authentication and cloud messaging, // see their respective docs. }).then( - function (instance) { + function () { console.log("firebase.init done"); }, function (error) { @@ -113,13 +131,17 @@ firebase.init({ #### TypeScript ```js +// NativeScript 7+ +import { firebase } from "@nativescript/firebase"; + +// NativeScript 6- const firebase = require("nativescript-plugin-firebase"); firebase.init({ // Optionally pass in properties for database, authentication and cloud messaging, // see their respective docs. }).then( - instance => { + () => { console.log("firebase.init done"); }, error => { @@ -131,6 +153,10 @@ firebase.init({ #### Angular Because of the specifics of the angular bootstrap it is best to initalize firebase once the angular application is running. For example your main compoment's `ngOnInit` method: ```js +// NativeScript 7+ +import { firebase } from "@nativescript/firebase"; + +// NativeScript 6- const firebase = require("nativescript-plugin-firebase"); @Component({ @@ -142,7 +168,7 @@ export class AppComponent implements OnInit { // Optionally pass in properties for database, authentication and cloud messaging, // see their respective docs. }).then( - instance => { + () => { console.log("firebase.init done"); }, error => { @@ -294,7 +320,9 @@ Note: if you currently have the `storageBucket` property in the `firebase.init() ### Build The build hooks of this plugin will now choose either the `dev` or the `prod` version of your google services `plist` and `json` files depending on how you run your build: -* `prod` will be selected if you run with either the `--release`, `--env.prod` or `--env.production` flags -* `dev` will be selected if you do not run with any of the above flags +* `dev` will be selected if you run with either `--env.dev`, `--env.development` or `--env.staging` flags. +* `prod` will be selected if you run with either `--env.prod` or `--env.production`. + +Note: Using the `--release` flag without any of the above flags will set the default environment to production. If you need to create a release with dev environment you'll need to set it explicitly. Note: if you do not have both `dev` and `prod` files in place, the regular `GoogleService-Info.plist` and `google-services.json` files will be used. diff --git a/demo-ng/app/App_Resources/Android/AndroidManifest.xml b/demo-ng/app/App_Resources/Android/src/main/AndroidManifest.xml similarity index 94% rename from demo-ng/app/App_Resources/Android/AndroidManifest.xml rename to demo-ng/app/App_Resources/Android/src/main/AndroidManifest.xml index 1964d795..ef328945 100644 --- a/demo-ng/app/App_Resources/Android/AndroidManifest.xml +++ b/demo-ng/app/App_Resources/Android/src/main/AndroidManifest.xml @@ -30,9 +30,9 @@ android:label="@string/app_name" android:theme="@style/AppTheme"> - + 1.0 LSRequiresIPhoneOS + + UIUserInterfaceStyle + Light UILaunchStoryboardName LaunchScreen UIRequiresFullScreen @@ -100,7 +103,5 @@ NSAllowsArbitraryLoadsInWebContent - NSContactsUsageDescription - Required for Firebase Invites diff --git a/demo-ng/app/App_Resources/iOS/Podfile b/demo-ng/app/App_Resources/iOS/Podfile new file mode 100644 index 00000000..8aa86312 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/Podfile @@ -0,0 +1,7 @@ +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' + end + end +end diff --git a/demo-ng/app/App_Resources/iOS/build.xcconfig b/demo-ng/app/App_Resources/iOS/build.xcconfig index c2335639..8b46bc69 100644 --- a/demo-ng/app/App_Resources/iOS/build.xcconfig +++ b/demo-ng/app/App_Resources/iOS/build.xcconfig @@ -4,3 +4,8 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_ENTITLEMENTS = demong/demong.entitlements + +IPHONEOS_DEPLOYMENT_TARGET = 12.0 + +// Don't check this in because of CI +// DEVELOPMENT_TEAM = 8Q5F6M3TNS diff --git a/demo-ng/app/App_Resources/iOS/leftright/dict.txt b/demo-ng/app/App_Resources/iOS/leftright/dict.txt new file mode 100644 index 00000000..9f636db2 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/leftright/dict.txt @@ -0,0 +1,2 @@ +Left +Right diff --git a/demo-ng/app/App_Resources/iOS/leftright/manifest.json b/demo-ng/app/App_Resources/iOS/leftright/manifest.json new file mode 100644 index 00000000..7c75e804 --- /dev/null +++ b/demo-ng/app/App_Resources/iOS/leftright/manifest.json @@ -0,0 +1,5 @@ +{ + "modelFile": "model.tflite", + "labelsFile": "dict.txt", + "modelType": "IMAGE_LABELING" +} \ No newline at end of file diff --git a/demo-ng/app/App_Resources/iOS/leftright/model.tflite b/demo-ng/app/App_Resources/iOS/leftright/model.tflite new file mode 100644 index 00000000..18ab7c72 Binary files /dev/null and b/demo-ng/app/App_Resources/iOS/leftright/model.tflite differ diff --git a/demo-ng/app/app.component.ts b/demo-ng/app/app.component.ts index 704b9fd3..91456877 100644 --- a/demo-ng/app/app.component.ts +++ b/demo-ng/app/app.component.ts @@ -8,12 +8,15 @@ const firebase = require("nativescript-plugin-firebase"); }) export class AppComponent implements OnInit { - ngOnInit(): void { - firebase.init( - { - persist: false - }) - .then(() => console.log(">>>>> Firebase initialized")) - .catch(err => console.log(">>>>> Firebase init error: " + err)); + // using async-await just for show + async ngOnInit(): Promise { + try { + await firebase.init({ + persist: false + }); + console.log(">>>>> Firebase initialized"); + } catch (err) { + console.log(">>>>> Firebase init error: " + err); + } } } diff --git a/demo-ng/app/app.css b/demo-ng/app/app.css index 80d77fa3..0126a04b 100644 --- a/demo-ng/app/app.css +++ b/demo-ng/app/app.css @@ -71,14 +71,11 @@ button { background-color: #d52c1e; } -.button-invites { - background-color: #1832d5; -} - Label.mlkit-result { margin: 5; text-align: left; color: white; + font-size: 17; } .mask { diff --git a/demo-ng/app/automl/leftright/dict.txt b/demo-ng/app/automl/leftright/dict.txt new file mode 100644 index 00000000..9f636db2 --- /dev/null +++ b/demo-ng/app/automl/leftright/dict.txt @@ -0,0 +1,2 @@ +Left +Right diff --git a/demo-ng/app/automl/leftright/manifest.json b/demo-ng/app/automl/leftright/manifest.json new file mode 100644 index 00000000..7c75e804 --- /dev/null +++ b/demo-ng/app/automl/leftright/manifest.json @@ -0,0 +1,5 @@ +{ + "modelFile": "model.tflite", + "labelsFile": "dict.txt", + "modelType": "IMAGE_LABELING" +} \ No newline at end of file diff --git a/demo-ng/app/automl/leftright/model.tflite b/demo-ng/app/automl/leftright/model.tflite new file mode 100644 index 00000000..18ab7c72 Binary files /dev/null and b/demo-ng/app/automl/leftright/model.tflite differ diff --git a/demo-ng/app/custommodel/inception/inception_labels.txt b/demo-ng/app/custommodel/inception/inception_labels.txt new file mode 100644 index 00000000..b52daf9a --- /dev/null +++ b/demo-ng/app/custommodel/inception/inception_labels.txt @@ -0,0 +1,1001 @@ +background +tench +goldfish +great white shark +tiger shark +hammerhead +electric ray +stingray +cock +hen +ostrich +brambling +goldfinch +house finch +junco +indigo bunting +robin +bulbul +jay +magpie +chickadee +water ouzel +kite +bald eagle +vulture +great grey owl +European fire salamander +common newt +eft +spotted salamander +axolotl +bullfrog +tree frog +tailed frog +loggerhead +leatherback turtle +mud turtle +terrapin +box turtle +banded gecko +common iguana +American chameleon +whiptail +agama +frilled lizard +alligator lizard +Gila monster +green lizard +African chameleon +Komodo dragon +African crocodile +American alligator +triceratops +thunder snake +ringneck snake +hognose snake +green snake +king snake +garter snake +water snake +vine snake +night snake +boa constrictor +rock python +Indian cobra +green mamba +sea snake +horned viper +diamondback +sidewinder +trilobite +harvestman +scorpion +black and gold garden spider +barn spider +garden spider +black widow +tarantula +wolf spider +tick +centipede +black grouse +ptarmigan +ruffed grouse +prairie chicken +peacock +quail +partridge +African grey +macaw +sulphur-crested cockatoo +lorikeet +coucal +bee eater +hornbill +hummingbird +jacamar +toucan +drake +red-breasted merganser +goose +black swan +tusker +echidna +platypus +wallaby +koala +wombat +jellyfish +sea anemone +brain coral +flatworm +nematode +conch +snail +slug +sea slug +chiton +chambered nautilus +Dungeness crab +rock crab +fiddler crab +king crab +American lobster +spiny lobster +crayfish +hermit crab +isopod +white stork +black stork +spoonbill +flamingo +little blue heron +American egret +bittern +crane +limpkin +European gallinule +American coot +bustard +ruddy turnstone +red-backed sandpiper +redshank +dowitcher +oystercatcher +pelican +king penguin +albatross +grey whale +killer whale +dugong +sea lion +Chihuahua +Japanese spaniel +Maltese dog +Pekinese +Shih-Tzu +Blenheim spaniel +papillon +toy terrier +Rhodesian ridgeback +Afghan hound +basset +beagle +bloodhound +bluetick +black-and-tan coonhound +Walker hound +English foxhound +redbone +borzoi +Irish wolfhound +Italian greyhound +whippet +Ibizan hound +Norwegian elkhound +otterhound +Saluki +Scottish deerhound +Weimaraner +Staffordshire bullterrier +American Staffordshire terrier +Bedlington terrier +Border terrier +Kerry blue terrier +Irish terrier +Norfolk terrier +Norwich terrier +Yorkshire terrier +wire-haired fox terrier +Lakeland terrier +Sealyham terrier +Airedale +cairn +Australian terrier +Dandie Dinmont +Boston bull +miniature schnauzer +giant schnauzer +standard schnauzer +Scotch terrier +Tibetan terrier +silky terrier +soft-coated wheaten terrier +West Highland white terrier +Lhasa +flat-coated retriever +curly-coated retriever +golden retriever +Labrador retriever +Chesapeake Bay retriever +German short-haired pointer +vizsla +English setter +Irish setter +Gordon setter +Brittany spaniel +clumber +English springer +Welsh springer spaniel +cocker spaniel +Sussex spaniel +Irish water spaniel +kuvasz +schipperke +groenendael +malinois +briard +kelpie +komondor +Old English sheepdog +Shetland sheepdog +collie +Border collie +Bouvier des Flandres +Rottweiler +German shepherd +Doberman +miniature pinscher +Greater Swiss Mountain dog +Bernese mountain dog +Appenzeller +EntleBucher +boxer +bull mastiff +Tibetan mastiff +French bulldog +Great Dane +Saint Bernard +Eskimo dog +malamute +Siberian husky +dalmatian +affenpinscher +basenji +pug +Leonberg +Newfoundland +Great Pyrenees +Samoyed +Pomeranian +chow +keeshond +Brabancon griffon +Pembroke +Cardigan +toy poodle +miniature poodle +standard poodle +Mexican hairless +timber wolf +white wolf +red wolf +coyote +dingo +dhole +African hunting dog +hyena +red fox +kit fox +Arctic fox +grey fox +tabby +tiger cat +Persian cat +Siamese cat +Egyptian cat +cougar +lynx +leopard +snow leopard +jaguar +lion +tiger +cheetah +brown bear +American black bear +ice bear +sloth bear +mongoose +meerkat +tiger beetle +ladybug +ground beetle +long-horned beetle +leaf beetle +dung beetle +rhinoceros beetle +weevil +fly +bee +ant +grasshopper +cricket +walking stick +cockroach +mantis +cicada +leafhopper +lacewing +dragonfly +damselfly +admiral +ringlet +monarch +cabbage butterfly +sulphur butterfly +lycaenid +starfish +sea urchin +sea cucumber +wood rabbit +hare +Angora +hamster +porcupine +fox squirrel +marmot +beaver +guinea pig +sorrel +zebra +hog +wild boar +warthog +hippopotamus +ox +water buffalo +bison +ram +bighorn +ibex +hartebeest +impala +gazelle +Arabian camel +llama +weasel +mink +polecat +black-footed ferret +otter +skunk +badger +armadillo +three-toed sloth +orangutan +gorilla +chimpanzee +gibbon +siamang +guenon +patas +baboon +macaque +langur +colobus +proboscis monkey +marmoset +capuchin +howler monkey +titi +spider monkey +squirrel monkey +Madagascar cat +indri +Indian elephant +African elephant +lesser panda +giant panda +barracouta +eel +coho +rock beauty +anemone fish +sturgeon +gar +lionfish +puffer +abacus +abaya +academic gown +accordion +acoustic guitar +aircraft carrier +airliner +airship +altar +ambulance +amphibian +analog clock +apiary +apron +ashcan +assault rifle +backpack +bakery +balance beam +balloon +ballpoint +Band Aid +banjo +bannister +barbell +barber chair +barbershop +barn +barometer +barrel +barrow +baseball +basketball +bassinet +bassoon +bathing cap +bath towel +bathtub +beach wagon +beacon +beaker +bearskin +beer bottle +beer glass +bell cote +bib +bicycle-built-for-two +bikini +binder +binoculars +birdhouse +boathouse +bobsled +bolo tie +bonnet +bookcase +bookshop +bottlecap +bow +bow tie +brass +brassiere +breakwater +breastplate +broom +bucket +buckle +bulletproof vest +bullet train +butcher shop +cab +caldron +candle +cannon +canoe +can opener +cardigan +car mirror +carousel +carpenter's kit +carton +car wheel +cash machine +cassette +cassette player +castle +catamaran +CD player +cello +cellular telephone +chain +chainlink fence +chain mail +chain saw +chest +chiffonier +chime +china cabinet +Christmas stocking +church +cinema +cleaver +cliff dwelling +cloak +clog +cocktail shaker +coffee mug +coffeepot +coil +combination lock +computer keyboard +confectionery +container ship +convertible +corkscrew +cornet +cowboy boot +cowboy hat +cradle +crane +crash helmet +crate +crib +Crock Pot +croquet ball +crutch +cuirass +dam +desk +desktop computer +dial telephone +diaper +digital clock +digital watch +dining table +dishrag +dishwasher +disk brake +dock +dogsled +dome +doormat +drilling platform +drum +drumstick +dumbbell +Dutch oven +electric fan +electric guitar +electric locomotive +entertainment center +envelope +espresso maker +face powder +feather boa +file +fireboat +fire engine +fire screen +flagpole +flute +folding chair +football helmet +forklift +fountain +fountain pen +four-poster +freight car +French horn +frying pan +fur coat +garbage truck +gasmask +gas pump +goblet +go-kart +golf ball +golfcart +gondola +gong +gown +grand piano +greenhouse +grille +grocery store +guillotine +hair slide +hair spray +half track +hammer +hamper +hand blower +hand-held computer +handkerchief +hard disc +harmonica +harp +harvester +hatchet +holster +home theater +honeycomb +hook +hoopskirt +horizontal bar +horse cart +hourglass +iPod +iron +jack-o'-lantern +jean +jeep +jersey +jigsaw puzzle +jinrikisha +joystick +kimono +knee pad +knot +lab coat +ladle +lampshade +laptop +lawn mower +lens cap +letter opener +library +lifeboat +lighter +limousine +liner +lipstick +Loafer +lotion +loudspeaker +loupe +lumbermill +magnetic compass +mailbag +mailbox +maillot +maillot +manhole cover +maraca +marimba +mask +matchstick +maypole +maze +measuring cup +medicine chest +megalith +microphone +microwave +military uniform +milk can +minibus +miniskirt +minivan +missile +mitten +mixing bowl +mobile home +Model T +modem +monastery +monitor +moped +mortar +mortarboard +mosque +mosquito net +motor scooter +mountain bike +mountain tent +mouse +mousetrap +moving van +muzzle +nail +neck brace +necklace +nipple +notebook +obelisk +oboe +ocarina +odometer +oil filter +organ +oscilloscope +overskirt +oxcart +oxygen mask +packet +paddle +paddlewheel +padlock +paintbrush +pajama +palace +panpipe +paper towel +parachute +parallel bars +park bench +parking meter +passenger car +patio +pay-phone +pedestal +pencil box +pencil sharpener +perfume +Petri dish +photocopier +pick +pickelhaube +picket fence +pickup +pier +piggy bank +pill bottle +pillow +ping-pong ball +pinwheel +pirate +pitcher +plane +planetarium +plastic bag +plate rack +plow +plunger +Polaroid camera +pole +police van +poncho +pool table +pop bottle +pot +potter's wheel +power drill +prayer rug +printer +prison +projectile +projector +puck +punching bag +purse +quill +quilt +racer +racket +radiator +radio +radio telescope +rain barrel +recreational vehicle +reel +reflex camera +refrigerator +remote control +restaurant +revolver +rifle +rocking chair +rotisserie +rubber eraser +rugby ball +rule +running shoe +safe +safety pin +saltshaker +sandal +sarong +sax +scabbard +scale +school bus +schooner +scoreboard +screen +screw +screwdriver +seat belt +sewing machine +shield +shoe shop +shoji +shopping basket +shopping cart +shovel +shower cap +shower curtain +ski +ski mask +sleeping bag +slide rule +sliding door +slot +snorkel +snowmobile +snowplow +soap dispenser +soccer ball +sock +solar dish +sombrero +soup bowl +space bar +space heater +space shuttle +spatula +speedboat +spider web +spindle +sports car +spotlight +stage +steam locomotive +steel arch bridge +steel drum +stethoscope +stole +stone wall +stopwatch +stove +strainer +streetcar +stretcher +studio couch +stupa +submarine +suit +sundial +sunglass +sunglasses +sunscreen +suspension bridge +swab +sweatshirt +swimming trunks +swing +switch +syringe +table lamp +tank +tape player +teapot +teddy +television +tennis ball +thatch +theater curtain +thimble +thresher +throne +tile roof +toaster +tobacco shop +toilet seat +torch +totem pole +tow truck +toyshop +tractor +trailer truck +tray +trench coat +tricycle +trimaran +tripod +triumphal arch +trolleybus +trombone +tub +turnstile +typewriter keyboard +umbrella +unicycle +upright +vacuum +vase +vault +velvet +vending machine +vestment +viaduct +violin +volleyball +waffle iron +wall clock +wallet +wardrobe +warplane +washbasin +washer +water bottle +water jug +water tower +whiskey jug +whistle +wig +window screen +window shade +Windsor tie +wine bottle +wing +wok +wooden spoon +wool +worm fence +wreck +yawl +yurt +web site +comic book +crossword puzzle +street sign +traffic light +book jacket +menu +plate +guacamole +consomme +hot pot +trifle +ice cream +ice lolly +French loaf +bagel +pretzel +cheeseburger +hotdog +mashed potato +head cabbage +broccoli +cauliflower +zucchini +spaghetti squash +acorn squash +butternut squash +cucumber +artichoke +bell pepper +cardoon +mushroom +Granny Smith +strawberry +orange +lemon +fig +pineapple +banana +jackfruit +custard apple +pomegranate +hay +carbonara +chocolate sauce +dough +meat loaf +pizza +potpie +burrito +red wine +espresso +cup +eggnog +alp +bubble +cliff +coral reef +geyser +lakeside +promontory +sandbar +seashore +valley +volcano +ballplayer +groom +scuba diver +rapeseed +daisy +yellow lady's slipper +corn +acorn +hip +buckeye +coral fungus +agaric +gyromitra +stinkhorn +earthstar +hen-of-the-woods +bolete +ear +toilet tissue \ No newline at end of file diff --git a/demo-ng/app/custommodel/inception/inception_v3_quant.tflite b/demo-ng/app/custommodel/inception/inception_v3_quant.tflite new file mode 100644 index 00000000..1bbf979d Binary files /dev/null and b/demo-ng/app/custommodel/inception/inception_v3_quant.tflite differ diff --git a/demo-ng/app/custommodel/mobilenet/mobilenet_labels.txt b/demo-ng/app/custommodel/mobilenet/mobilenet_labels.txt new file mode 100644 index 00000000..b52daf9a --- /dev/null +++ b/demo-ng/app/custommodel/mobilenet/mobilenet_labels.txt @@ -0,0 +1,1001 @@ +background +tench +goldfish +great white shark +tiger shark +hammerhead +electric ray +stingray +cock +hen +ostrich +brambling +goldfinch +house finch +junco +indigo bunting +robin +bulbul +jay +magpie +chickadee +water ouzel +kite +bald eagle +vulture +great grey owl +European fire salamander +common newt +eft +spotted salamander +axolotl +bullfrog +tree frog +tailed frog +loggerhead +leatherback turtle +mud turtle +terrapin +box turtle +banded gecko +common iguana +American chameleon +whiptail +agama +frilled lizard +alligator lizard +Gila monster +green lizard +African chameleon +Komodo dragon +African crocodile +American alligator +triceratops +thunder snake +ringneck snake +hognose snake +green snake +king snake +garter snake +water snake +vine snake +night snake +boa constrictor +rock python +Indian cobra +green mamba +sea snake +horned viper +diamondback +sidewinder +trilobite +harvestman +scorpion +black and gold garden spider +barn spider +garden spider +black widow +tarantula +wolf spider +tick +centipede +black grouse +ptarmigan +ruffed grouse +prairie chicken +peacock +quail +partridge +African grey +macaw +sulphur-crested cockatoo +lorikeet +coucal +bee eater +hornbill +hummingbird +jacamar +toucan +drake +red-breasted merganser +goose +black swan +tusker +echidna +platypus +wallaby +koala +wombat +jellyfish +sea anemone +brain coral +flatworm +nematode +conch +snail +slug +sea slug +chiton +chambered nautilus +Dungeness crab +rock crab +fiddler crab +king crab +American lobster +spiny lobster +crayfish +hermit crab +isopod +white stork +black stork +spoonbill +flamingo +little blue heron +American egret +bittern +crane +limpkin +European gallinule +American coot +bustard +ruddy turnstone +red-backed sandpiper +redshank +dowitcher +oystercatcher +pelican +king penguin +albatross +grey whale +killer whale +dugong +sea lion +Chihuahua +Japanese spaniel +Maltese dog +Pekinese +Shih-Tzu +Blenheim spaniel +papillon +toy terrier +Rhodesian ridgeback +Afghan hound +basset +beagle +bloodhound +bluetick +black-and-tan coonhound +Walker hound +English foxhound +redbone +borzoi +Irish wolfhound +Italian greyhound +whippet +Ibizan hound +Norwegian elkhound +otterhound +Saluki +Scottish deerhound +Weimaraner +Staffordshire bullterrier +American Staffordshire terrier +Bedlington terrier +Border terrier +Kerry blue terrier +Irish terrier +Norfolk terrier +Norwich terrier +Yorkshire terrier +wire-haired fox terrier +Lakeland terrier +Sealyham terrier +Airedale +cairn +Australian terrier +Dandie Dinmont +Boston bull +miniature schnauzer +giant schnauzer +standard schnauzer +Scotch terrier +Tibetan terrier +silky terrier +soft-coated wheaten terrier +West Highland white terrier +Lhasa +flat-coated retriever +curly-coated retriever +golden retriever +Labrador retriever +Chesapeake Bay retriever +German short-haired pointer +vizsla +English setter +Irish setter +Gordon setter +Brittany spaniel +clumber +English springer +Welsh springer spaniel +cocker spaniel +Sussex spaniel +Irish water spaniel +kuvasz +schipperke +groenendael +malinois +briard +kelpie +komondor +Old English sheepdog +Shetland sheepdog +collie +Border collie +Bouvier des Flandres +Rottweiler +German shepherd +Doberman +miniature pinscher +Greater Swiss Mountain dog +Bernese mountain dog +Appenzeller +EntleBucher +boxer +bull mastiff +Tibetan mastiff +French bulldog +Great Dane +Saint Bernard +Eskimo dog +malamute +Siberian husky +dalmatian +affenpinscher +basenji +pug +Leonberg +Newfoundland +Great Pyrenees +Samoyed +Pomeranian +chow +keeshond +Brabancon griffon +Pembroke +Cardigan +toy poodle +miniature poodle +standard poodle +Mexican hairless +timber wolf +white wolf +red wolf +coyote +dingo +dhole +African hunting dog +hyena +red fox +kit fox +Arctic fox +grey fox +tabby +tiger cat +Persian cat +Siamese cat +Egyptian cat +cougar +lynx +leopard +snow leopard +jaguar +lion +tiger +cheetah +brown bear +American black bear +ice bear +sloth bear +mongoose +meerkat +tiger beetle +ladybug +ground beetle +long-horned beetle +leaf beetle +dung beetle +rhinoceros beetle +weevil +fly +bee +ant +grasshopper +cricket +walking stick +cockroach +mantis +cicada +leafhopper +lacewing +dragonfly +damselfly +admiral +ringlet +monarch +cabbage butterfly +sulphur butterfly +lycaenid +starfish +sea urchin +sea cucumber +wood rabbit +hare +Angora +hamster +porcupine +fox squirrel +marmot +beaver +guinea pig +sorrel +zebra +hog +wild boar +warthog +hippopotamus +ox +water buffalo +bison +ram +bighorn +ibex +hartebeest +impala +gazelle +Arabian camel +llama +weasel +mink +polecat +black-footed ferret +otter +skunk +badger +armadillo +three-toed sloth +orangutan +gorilla +chimpanzee +gibbon +siamang +guenon +patas +baboon +macaque +langur +colobus +proboscis monkey +marmoset +capuchin +howler monkey +titi +spider monkey +squirrel monkey +Madagascar cat +indri +Indian elephant +African elephant +lesser panda +giant panda +barracouta +eel +coho +rock beauty +anemone fish +sturgeon +gar +lionfish +puffer +abacus +abaya +academic gown +accordion +acoustic guitar +aircraft carrier +airliner +airship +altar +ambulance +amphibian +analog clock +apiary +apron +ashcan +assault rifle +backpack +bakery +balance beam +balloon +ballpoint +Band Aid +banjo +bannister +barbell +barber chair +barbershop +barn +barometer +barrel +barrow +baseball +basketball +bassinet +bassoon +bathing cap +bath towel +bathtub +beach wagon +beacon +beaker +bearskin +beer bottle +beer glass +bell cote +bib +bicycle-built-for-two +bikini +binder +binoculars +birdhouse +boathouse +bobsled +bolo tie +bonnet +bookcase +bookshop +bottlecap +bow +bow tie +brass +brassiere +breakwater +breastplate +broom +bucket +buckle +bulletproof vest +bullet train +butcher shop +cab +caldron +candle +cannon +canoe +can opener +cardigan +car mirror +carousel +carpenter's kit +carton +car wheel +cash machine +cassette +cassette player +castle +catamaran +CD player +cello +cellular telephone +chain +chainlink fence +chain mail +chain saw +chest +chiffonier +chime +china cabinet +Christmas stocking +church +cinema +cleaver +cliff dwelling +cloak +clog +cocktail shaker +coffee mug +coffeepot +coil +combination lock +computer keyboard +confectionery +container ship +convertible +corkscrew +cornet +cowboy boot +cowboy hat +cradle +crane +crash helmet +crate +crib +Crock Pot +croquet ball +crutch +cuirass +dam +desk +desktop computer +dial telephone +diaper +digital clock +digital watch +dining table +dishrag +dishwasher +disk brake +dock +dogsled +dome +doormat +drilling platform +drum +drumstick +dumbbell +Dutch oven +electric fan +electric guitar +electric locomotive +entertainment center +envelope +espresso maker +face powder +feather boa +file +fireboat +fire engine +fire screen +flagpole +flute +folding chair +football helmet +forklift +fountain +fountain pen +four-poster +freight car +French horn +frying pan +fur coat +garbage truck +gasmask +gas pump +goblet +go-kart +golf ball +golfcart +gondola +gong +gown +grand piano +greenhouse +grille +grocery store +guillotine +hair slide +hair spray +half track +hammer +hamper +hand blower +hand-held computer +handkerchief +hard disc +harmonica +harp +harvester +hatchet +holster +home theater +honeycomb +hook +hoopskirt +horizontal bar +horse cart +hourglass +iPod +iron +jack-o'-lantern +jean +jeep +jersey +jigsaw puzzle +jinrikisha +joystick +kimono +knee pad +knot +lab coat +ladle +lampshade +laptop +lawn mower +lens cap +letter opener +library +lifeboat +lighter +limousine +liner +lipstick +Loafer +lotion +loudspeaker +loupe +lumbermill +magnetic compass +mailbag +mailbox +maillot +maillot +manhole cover +maraca +marimba +mask +matchstick +maypole +maze +measuring cup +medicine chest +megalith +microphone +microwave +military uniform +milk can +minibus +miniskirt +minivan +missile +mitten +mixing bowl +mobile home +Model T +modem +monastery +monitor +moped +mortar +mortarboard +mosque +mosquito net +motor scooter +mountain bike +mountain tent +mouse +mousetrap +moving van +muzzle +nail +neck brace +necklace +nipple +notebook +obelisk +oboe +ocarina +odometer +oil filter +organ +oscilloscope +overskirt +oxcart +oxygen mask +packet +paddle +paddlewheel +padlock +paintbrush +pajama +palace +panpipe +paper towel +parachute +parallel bars +park bench +parking meter +passenger car +patio +pay-phone +pedestal +pencil box +pencil sharpener +perfume +Petri dish +photocopier +pick +pickelhaube +picket fence +pickup +pier +piggy bank +pill bottle +pillow +ping-pong ball +pinwheel +pirate +pitcher +plane +planetarium +plastic bag +plate rack +plow +plunger +Polaroid camera +pole +police van +poncho +pool table +pop bottle +pot +potter's wheel +power drill +prayer rug +printer +prison +projectile +projector +puck +punching bag +purse +quill +quilt +racer +racket +radiator +radio +radio telescope +rain barrel +recreational vehicle +reel +reflex camera +refrigerator +remote control +restaurant +revolver +rifle +rocking chair +rotisserie +rubber eraser +rugby ball +rule +running shoe +safe +safety pin +saltshaker +sandal +sarong +sax +scabbard +scale +school bus +schooner +scoreboard +screen +screw +screwdriver +seat belt +sewing machine +shield +shoe shop +shoji +shopping basket +shopping cart +shovel +shower cap +shower curtain +ski +ski mask +sleeping bag +slide rule +sliding door +slot +snorkel +snowmobile +snowplow +soap dispenser +soccer ball +sock +solar dish +sombrero +soup bowl +space bar +space heater +space shuttle +spatula +speedboat +spider web +spindle +sports car +spotlight +stage +steam locomotive +steel arch bridge +steel drum +stethoscope +stole +stone wall +stopwatch +stove +strainer +streetcar +stretcher +studio couch +stupa +submarine +suit +sundial +sunglass +sunglasses +sunscreen +suspension bridge +swab +sweatshirt +swimming trunks +swing +switch +syringe +table lamp +tank +tape player +teapot +teddy +television +tennis ball +thatch +theater curtain +thimble +thresher +throne +tile roof +toaster +tobacco shop +toilet seat +torch +totem pole +tow truck +toyshop +tractor +trailer truck +tray +trench coat +tricycle +trimaran +tripod +triumphal arch +trolleybus +trombone +tub +turnstile +typewriter keyboard +umbrella +unicycle +upright +vacuum +vase +vault +velvet +vending machine +vestment +viaduct +violin +volleyball +waffle iron +wall clock +wallet +wardrobe +warplane +washbasin +washer +water bottle +water jug +water tower +whiskey jug +whistle +wig +window screen +window shade +Windsor tie +wine bottle +wing +wok +wooden spoon +wool +worm fence +wreck +yawl +yurt +web site +comic book +crossword puzzle +street sign +traffic light +book jacket +menu +plate +guacamole +consomme +hot pot +trifle +ice cream +ice lolly +French loaf +bagel +pretzel +cheeseburger +hotdog +mashed potato +head cabbage +broccoli +cauliflower +zucchini +spaghetti squash +acorn squash +butternut squash +cucumber +artichoke +bell pepper +cardoon +mushroom +Granny Smith +strawberry +orange +lemon +fig +pineapple +banana +jackfruit +custard apple +pomegranate +hay +carbonara +chocolate sauce +dough +meat loaf +pizza +potpie +burrito +red wine +espresso +cup +eggnog +alp +bubble +cliff +coral reef +geyser +lakeside +promontory +sandbar +seashore +valley +volcano +ballplayer +groom +scuba diver +rapeseed +daisy +yellow lady's slipper +corn +acorn +hip +buckeye +coral fungus +agaric +gyromitra +stinkhorn +earthstar +hen-of-the-woods +bolete +ear +toilet tissue \ No newline at end of file diff --git a/demo-ng/app/custommodel/mobilenet/mobilenet_quant_v2_1.0_299.tflite b/demo-ng/app/custommodel/mobilenet/mobilenet_quant_v2_1.0_299.tflite new file mode 100644 index 00000000..c573d326 Binary files /dev/null and b/demo-ng/app/custommodel/mobilenet/mobilenet_quant_v2_1.0_299.tflite differ diff --git a/demo-ng/app/custommodel/nutella/nutella_labels.txt b/demo-ng/app/custommodel/nutella/nutella_labels.txt new file mode 100644 index 00000000..d4d41485 --- /dev/null +++ b/demo-ng/app/custommodel/nutella/nutella_labels.txt @@ -0,0 +1,3 @@ +nutella +juice +cereals \ No newline at end of file diff --git a/demo-ng/app/custommodel/nutella/nutella_quantize.tflite b/demo-ng/app/custommodel/nutella/nutella_quantize.tflite new file mode 100644 index 00000000..278953e2 Binary files /dev/null and b/demo-ng/app/custommodel/nutella/nutella_quantize.tflite differ diff --git a/demo-ng/app/custommodel/nutella/nutella_test.jpg b/demo-ng/app/custommodel/nutella/nutella_test.jpg new file mode 100644 index 00000000..88986d22 Binary files /dev/null and b/demo-ng/app/custommodel/nutella/nutella_test.jpg differ diff --git a/demo-ng/app/main.ts b/demo-ng/app/main.ts index e5b87d7d..65f9408a 100644 --- a/demo-ng/app/main.ts +++ b/demo-ng/app/main.ts @@ -1,12 +1,7 @@ -// this import should be first in order to load some required settings (like globals and reflect-metadata) import { platformNativeScriptDynamic } from "nativescript-angular/platform"; import { AppModule } from "./app.module"; require("nativescript-plugin-firebase"); -// A traditional NativeScript application starts by initializing global objects, setting up global CSS rules, creating, and navigating to the main page. -// Angular applications need to take care of their own initialization: modules, components, directives, routes, DI providers. -// A NativeScript Angular app needs to make both paradigms work together, so we provide a wrapper platform object, platformNativeScriptDynamic, -// that sets up a NativeScript application and can bootstrap the Angular framework. platformNativeScriptDynamic().bootstrapModule(AppModule); diff --git a/demo-ng/app/package.json b/demo-ng/app/package.json index 22c3f8c2..e406cf49 100644 --- a/demo-ng/app/package.json +++ b/demo-ng/app/package.json @@ -1,8 +1,9 @@ { "android": { "v8Flags": "--expose_gc", - "discardUncaughtJsExceptions": true + "markingMode": "none" }, + "discardUncaughtJsExceptions": false, "main": "main.js", "name": "tns-template-hello-world-ng", "version": "3.3.0" diff --git a/demo-ng/app/tabs/firestore/firestore.component.html b/demo-ng/app/tabs/firestore/firestore.component.html index 804296ba..e700e582 100644 --- a/demo-ng/app/tabs/firestore/firestore.component.html +++ b/demo-ng/app/tabs/firestore/firestore.component.html @@ -10,6 +10,9 @@ + + + @@ -24,10 +27,11 @@ - + + diff --git a/demo-ng/app/tabs/firestore/firestore.component.ts b/demo-ng/app/tabs/firestore/firestore.component.ts index 8b20b78d..57811611 100644 --- a/demo-ng/app/tabs/firestore/firestore.component.ts +++ b/demo-ng/app/tabs/firestore/firestore.component.ts @@ -16,8 +16,8 @@ export class FirestoreComponent { private listenerUnsubscribe: () => void; - public myCity$: Observable; - public myCities$: Observable>; + myCity$: Observable; + myCities$: Observable>; private city: City; private cities: Array = []; @@ -26,7 +26,7 @@ export class FirestoreComponent { // AngularFireModule.initializeApp({}); } - public issue854(): void { + issue854(): void { const helloRef: firestore.DocumentReference = firebase.firestore() .collection("users") @@ -34,10 +34,12 @@ export class FirestoreComponent { .collection("availability") .doc("hello"); - helloRef.get().then(snapshot => console.log(snapshot.data())) + helloRef.get({ source: "cache"}) + .then(snapshot => console.log(snapshot.data())) + .catch(err => console.log("issue854 err: " + err)); } - public loginAnonymously(): void { + loginAnonymously(): void { firebase.auth().signInAnonymously() .then(() => { const user = firebase.auth().currentUser; @@ -46,7 +48,7 @@ export class FirestoreComponent { .catch(err => console.log("Login error: " + JSON.stringify(err))); } - public firestoreAdd(): void { + firestoreAdd(): void { firebase.firestore().collection("dogs").add({name: "Fido"}) .then((docRef: firestore.DocumentReference) => { console.log("Fido added, ref: " + docRef.id); @@ -54,11 +56,13 @@ export class FirestoreComponent { .catch(err => console.log("Adding Fido failed, error: " + err)); } - public firestoreSet(): void { + firestoreSet(): void { firebase.firestore().collection("dogs").doc("fave") .set({ name: "Woofie", last: "lastofwoofie", + lastKnownLocation: firebase.firestore().GeoPoint(5.34, 6.67), + lastKnownLocation2: firestore.GeoPoint(5.34, 6.67) // note that this only works on iOS (there's a limitation in the Firestore Android SDK) // updateTsSet: firebase.firestore().FieldValue().serverTimestamp() }, @@ -125,14 +129,14 @@ export class FirestoreComponent { }); } - public firestoreSetByAutoID(): void { + firestoreSetByAutoID(): void { firebase.firestore().collection("dogs").doc() .set({name: "Woofie", last: "lastofwoofie", date: new Date()}) .then(() => console.log("Woofie set")) .catch(err => console.log("Setting Woofie failed, error: " + err)); } - public firestoreUpdate(): void { + firestoreUpdate(): void { // get a document reference so we can add a city reference to our favourite dog const sfDocRef: firestore.DocumentReference = firebase.firestore().collection("cities").doc("SF"); @@ -140,41 +144,56 @@ export class FirestoreComponent { .update({ name: "Woofieupdate", last: "updatedwoofie!", + nested: { + nestedFoo: "bar", + nestedUpdateTs: firestore.FieldValue.serverTimestamp(), + nestedLastKnownLocation: firebase.firestore().GeoPoint(4.34, 5.67), + nestedLastKnownLocation2: firestore.GeoPoint(4.34, 5.67) + }, city: sfDocRef, updateTs: firestore.FieldValue.serverTimestamp(), updateTsAlt: firebase.firestore().FieldValue().serverTimestamp(), - lastKnownLocation: firebase.firestore().GeoPoint(4.34, 5.67) + lastKnownLocation: firebase.firestore().GeoPoint(4.34, 5.67), + lastKnownLocation2: firestore.GeoPoint(4.34, 5.67) }) .then(() => console.log("Woofie updated")) .catch(err => console.log("Updating Woofie failed, error: " + JSON.stringify(err))); } - public firestoreGet(): void { + firestoreGet(): void { const collectionRef: firestore.CollectionReference = firebase.firestore().collection("dogs"); - collectionRef.get() + console.log(">> collectionRef.parent: " + collectionRef.parent); // should be null (has no parent) + collectionRef.get({ source: "server"}) .then((querySnapshot: firestore.QuerySnapshot) => { querySnapshot.forEach(doc => console.log(`${doc.id} => ${JSON.stringify(doc.data())}`)); }) .catch(err => console.log("Get failed, error: " + err)); + // testing 'parent' + const bjDistrictsRef: firestore.CollectionReference = firebase.firestore().collection("cities").doc("BJ").collection("districts"); + console.log(">> bjDistrictsRef.parent.id: " + bjDistrictsRef.parent.id); + // examples from https://firebase.google.com/docs/firestore/query-data/get-data const docRef: firestore.DocumentReference = firebase.firestore().collection("cities").doc("BJ"); - - docRef.get().then((doc: firestore.DocumentSnapshot) => { - if (doc.exists) { - console.log("Document data:", JSON.stringify(doc.data())); - // since there's a reference stored here, we can use that to retrieve its data - const docRef: firestore.DocumentReference = doc.data().referenceToCitiesDC; - docRef.get().then(res => console.log("docref.get: " + JSON.stringify(res.data()))); - } else { - console.log("No such document!"); - } - }).catch(function (error) { - console.log("Error getting document:", error); - }); + console.log(">> docRef.parent.id: " + docRef.parent.id); + + docRef.get() + .then((doc: firestore.DocumentSnapshot) => { + if (doc.exists) { + console.log("Document data:", JSON.stringify(doc.data())); + // since there's a reference stored here, we can use that to retrieve its data + const docRef: firestore.DocumentReference = doc.data().referenceToCitiesDC; + console.log(">> docRef2.parent.id: " + docRef.parent.id); + docRef.get() + .then(res => console.log("docref.get: " + JSON.stringify(res.data()))) + .catch(err => console.log("docref.get error: " + err)); + } else { + console.log("No such document!"); + } + }).catch(error => console.log("Error getting document:", error)); } - public firestoreGetNested(): void { + firestoreGetNested(): void { const mainStreetInSFDocRef: firestore.DocumentReference = firebase.firestore() .collection("cities") @@ -183,43 +202,120 @@ export class FirestoreComponent { .doc("QZNrg22tkN8W71YC3qCb"); // id of 'main st.' // .doc("doesntexist"); - mainStreetInSFDocRef.get().then((doc: firestore.DocumentSnapshot) => { - if (doc.exists) { - console.log("Document data:", JSON.stringify(doc.data())); - } else { - console.log("No such document!"); - } - }).catch(function (error) { - console.log("Error getting document:", error); - }); + mainStreetInSFDocRef.get() + .then((doc: firestore.DocumentSnapshot) => { + if (doc.exists) { + console.log("Document data:", JSON.stringify(doc.data())); + } else { + console.log("No such document!"); + } + }) + .catch(error => console.log("Error getting document:", error)); + } + + deleteFields(): void { + const faveDog = firebase.firestore().collection("dogs").doc("fave"); + + // let's first add the fields + faveDog.update( + { + field1ToDelete: "foo", + field2ToDelete: "bar", + updateTs: firebase.firestore().FieldValue().serverTimestamp() + }) + .then(() => { + // and now remove them (added a timeout of 2s, so we can check the change in the Firebase console) + setTimeout(() => { + faveDog.update( + { + last: "Updated From 'delete'", + field1ToDelete: firestore.FieldValue.delete(), + field2ToDelete: firestore.FieldValue.delete(), + updateTs: firebase.firestore().FieldValue().serverTimestamp() + }) + .then(() => console.log("Woofie updated from 'delete'")) + .catch(err => console.log("Updating Woofie from 'delete' failed, error: " + JSON.stringify(err))); + }, 2000); + }) + .catch(err => console.log("deleteFields error: " + err)); + } + + arrayUnion(): void { + firestore.collection("dogs").doc("fave") + .update({ + last: "Updated From 'arrayUnion'", + fieldToDelete: firestore.FieldValue.delete(), + updateTs: firebase.firestore().FieldValue().serverTimestamp(), + // just fyi - both of these work: + colors: firestore.FieldValue.arrayUnion("red", "blue"), + ageInt: firebase.firestore().FieldValue().increment(2), + messages: firebase.firestore().FieldValue().arrayUnion({ + message: "Test 1", + source: "central", + time: Date.now() + }) + }) + .then(() => console.log("Woofie updated from 'arrayUnion'")) + .catch(err => console.log("Updating Woofie from 'arrayUnion' failed, error: " + JSON.stringify(err))); + } + + arrayRemove(): void { + firebase.firestore().collection("dogs").doc("fave") + .update({ + last: "Updated From 'arrayRemove'", + updateTs: firebase.firestore().FieldValue().serverTimestamp(), + colors: firestore.FieldValue.arrayUnion("red"), + ageDouble: firebase.firestore().FieldValue().increment(1.1), + messages: firebase.firestore().FieldValue().arrayRemove({ + message: "Test 1", + source: "central", + time: Date.now() + }) + }) + .then(() => console.log("Woofie updated from 'arrayRemove'")) + .catch(err => console.log("Updating Woofie from 'arrayRemove' failed, error: " + JSON.stringify(err))); } firestoreDocumentObservable(): void { - this.myCity$ = Observable.create(subscriber => { + this.myCity$ = new Observable(subscriber => { const docRef: firestore.DocumentReference = firebase.firestore().collection("cities").doc("SF"); - docRef.onSnapshot((doc: firestore.DocumentSnapshot) => { - this.zone.run(() => { - this.city = doc.data(); - subscriber.next(this.city); - }); - }); + docRef.onSnapshot( + {includeMetadataChanges: true}, + (doc: firestore.DocumentSnapshot) => { + + const source = doc.metadata.fromCache ? "local cache" : "server"; + console.log("Data came from " + source); + console.log("Has pending writes? " + doc.metadata.hasPendingWrites); + + this.zone.run(() => { + this.city = doc.data(); + console.log("City name: " + this.city.name); + subscriber.next(this.city); + }); + }); }); } firestoreCollectionObservable(): void { - this.myCities$ = Observable.create(subscriber => { + this.myCities$ = new Observable(subscriber => { const colRef: firestore.CollectionReference = firebase.firestore().collection("cities"); - colRef.onSnapshot((snapshot: firestore.QuerySnapshot) => { - this.zone.run(() => { - this.cities = []; - snapshot.forEach(docSnap => this.cities.push(docSnap.data())); - subscriber.next(this.cities); - }); - }); + colRef.onSnapshot( + {includeMetadataChanges: true}, + (snapshot: firestore.QuerySnapshot) => { + const source = snapshot.metadata.fromCache ? "local cache" : "server"; + console.log("Data came from " + source); + console.log("Has pending writes? " + snapshot.metadata.hasPendingWrites); + + this.zone.run(() => { + this.cities = []; + snapshot.forEach(docSnap => this.cities.push(docSnap.data())); + subscriber.next(this.cities); + }); + }); }); } - public firestoreListen(): void { + firestoreListen(): void { if (this.listenerUnsubscribe !== undefined) { console.log("Already listening ;)"); return; @@ -236,7 +332,7 @@ export class FirestoreComponent { }); } - public firestoreStopListening(): void { + firestoreStopListening(): void { if (this.listenerUnsubscribe === undefined) { console.log("Please start listening first ;)"); return; @@ -246,7 +342,7 @@ export class FirestoreComponent { this.listenerUnsubscribe = undefined; } - public firestoreWhere(): void { + firestoreWhere(): void { const cityDocRef = firebase.firestore().collection("cities").doc("SF"); firebase.firestore().collection("dogs") @@ -260,26 +356,27 @@ export class FirestoreComponent { .catch(err => console.log("Where-get failed, error: " + err)); } - public firestoreWhereOrderLimit(): void { + firestoreWhereOrderLimit(): void { const query: firestore.Query = firebase.firestore().collection("cities") - .where("state", "==", "CA") + // .where("state", "==", "CA") + .where("state", "in", ["CA", "WA"]) .where("population", "<", 99999999) .orderBy("population", "desc") - .limit(2); + .limit(4); query .get() .then((querySnapshot: firestore.QuerySnapshot) => { querySnapshot.forEach(doc => { - console.log(`Large Californian city: ${doc.id} => ${JSON.stringify(doc.data())}`); + console.log(`Large CA/WA city: ${doc.id} => ${JSON.stringify(doc.data())}`); }); }) .catch(err => console.log("firestoreWhereOrderLimit failed, error: " + err)); } - public firestoreWhereCityHasALake(): void { + firestoreWhereCityHasALakeAndOrMountain(): void { const query: firestore.Query = firebase.firestore().collection("cities") - .where("landmarks", "array-contains", "lake"); + .where("landmarks", "array-contains-any", ["mountain", "lake"]); query .get() @@ -291,7 +388,7 @@ export class FirestoreComponent { .catch(err => console.log("firestoreWhereCityHasALake failed, error: " + err)); } - public firestoreDelete(): void { + firestoreDelete(): void { firebase.firestore().collection("dogs").doc("fave") .delete() .then(() => { @@ -300,7 +397,18 @@ export class FirestoreComponent { .catch(err => console.log("Delete failed, error: " + err)); } - public doWebGetValueForCompanies(): void { + firestoreCollectionGroupQuery(): void { + firebase.firestore().collectionGroup("cities").where("population", ">=", 1_000_000) + .get() + .then(querySnapshot => { + querySnapshot.forEach(doc => { + console.log(`City with >= 1M population: ${doc.id} => ${JSON.stringify(doc.data())}`); + }); + }) + .catch(err => console.log("Querying collection group failed, error: " + err)); + } + + doWebGetValueForCompanies(): void { const path = "/companies"; firebase.database().ref(path) .once("value") @@ -308,7 +416,7 @@ export class FirestoreComponent { .catch(error => console.log("doWebGetValueForCompanies error: " + error)); } - public writeBatch(): void { + writeBatch(): void { // one batch can update multiple docs const sfDocRef: firestore.DocumentReference = firebase.firestore().collection("cities").doc("SF"); const sacDocRef: firestore.DocumentReference = firebase.firestore().collection("cities").doc("SAC"); @@ -323,7 +431,7 @@ export class FirestoreComponent { .catch(error => console.log("Batch error: " + error)); } - public transactionalUpdate(): void { + transactionalUpdate(): void { const sfDocRef: firestore.DocumentReference = firebase.firestore().collection("cities").doc("SF"); firebase.firestore().runTransaction(transaction => { @@ -345,29 +453,29 @@ export class FirestoreComponent { .catch(error => console.log("doTransaction error: " + error)); } - public firestoreStartAt(): void { + firestoreStartAt(): void { firebase.firestore().collection('cities') - .doc('LA') - .get() - .then(doc => { - firebase.firestore().collection('cities') - .orderBy('name', 'asc') - .startAt(doc) - .get() - .then(snap => snap.forEach(doc => console.log(doc.id, doc.data()))); - }); + .doc('LA') + .get() + .then(doc => { + firebase.firestore().collection('cities') + .orderBy('name', 'asc') + .startAt(doc) + .get() + .then(snap => snap.forEach(doc => console.log(doc.id, doc.data()))); + }); } - public firestoreStartAfter(): void { + firestoreStartAfter(): void { firebase.firestore().collection('cities') - .doc('LA') - .get() - .then(doc => { - firebase.firestore().collection('cities') - .orderBy('name', 'asc') - .startAfter(doc) - .get() - .then(snap => snap.forEach(doc => console.log(doc.id, doc.data()))); - }); + .doc('LA') + .get() + .then(doc => { + firebase.firestore().collection('cities') + .orderBy('name', 'asc') + .startAfter(doc) + .get() + .then(snap => snap.forEach(doc => console.log(doc.id, doc.data()))); + }); } } diff --git a/demo-ng/app/tabs/mlkit/automl/automl.component.html b/demo-ng/app/tabs/mlkit/automl/automl.component.html new file mode 100644 index 00000000..13b8b340 --- /dev/null +++ b/demo-ng/app/tabs/mlkit/automl/automl.component.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + diff --git a/demo-ng/app/tabs/mlkit/automl/automl.component.ts b/demo-ng/app/tabs/mlkit/automl/automl.component.ts new file mode 100644 index 00000000..0aa79874 --- /dev/null +++ b/demo-ng/app/tabs/mlkit/automl/automl.component.ts @@ -0,0 +1,29 @@ +import { Component } from "@angular/core"; +import { MLKitAutoMLResult } from "nativescript-plugin-firebase/mlkit/automl"; +import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.component"; + +@Component({ + selector: "mlkit-automl", + moduleId: module.id, + templateUrl: "./automl.component.html", +}) +export class AutoMLComponent extends AbstractMLKitViewComponent { + leftOrRight = ""; + + onAutoMLResult(scanResult: any): void { + const value: MLKitAutoMLResult = scanResult.value; + + if (value.labels.length === 0) { + this.leftOrRight = ""; + } else { + value.labels.forEach(label => { + console.log(`${label.text}: ${label.confidence}`); + if (label.text === "Left" && label.confidence >= 0.51) { + this.leftOrRight = label.text; + } else if (label.text === "Right" && label.confidence >= 0.55) { + this.leftOrRight = label.text; + } + }); + } + } +} diff --git a/demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.html b/demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.html index d7ddb5dd..84202716 100644 --- a/demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.html +++ b/demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.html @@ -6,10 +6,12 @@ @@ -36,12 +38,12 @@ - + - + diff --git a/demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.ts b/demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.ts index 8b2de2dd..fd984178 100644 --- a/demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.ts +++ b/demo-ng/app/tabs/mlkit/barcodescanning/barcodescanning.component.ts @@ -1,5 +1,8 @@ import { Component } from "@angular/core"; -import { MLKitScanBarcodesOnDeviceResult } from "nativescript-plugin-firebase/mlkit/barcodescanning"; +import { + MLKitScanBarcodesOnDeviceResult, + MLKitScanBarcodesResultBarcode +} from "nativescript-plugin-firebase/mlkit/barcodescanning"; import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.component"; @Component({ @@ -8,14 +11,19 @@ import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.comp templateUrl: "./barcodescanning.component.html", }) export class BarcodeScanningComponent extends AbstractMLKitViewComponent { - barcodes: Array<{ - value: string; - format: string; - }>; + + barcodes: Array; + + pause: boolean = false; onBarcodeScanResult(event: any): void { const result: MLKitScanBarcodesOnDeviceResult = event.value; this.barcodes = result.barcodes; - console.log("this.barcodes: " + JSON.stringify(this.barcodes)); + + if (this.barcodes.length > 0) { + console.log("this.barcodes: " + JSON.stringify(this.barcodes)); + // this.pause = true; + // setTimeout(() => this.pause = false, 500) + } } } diff --git a/demo-ng/app/tabs/mlkit/custommodel/custommodel.component.html b/demo-ng/app/tabs/mlkit/custommodel/custommodel.component.html new file mode 100644 index 00000000..141262ca --- /dev/null +++ b/demo-ng/app/tabs/mlkit/custommodel/custommodel.component.html @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-ng/app/tabs/mlkit/custommodel/custommodel.component.ts b/demo-ng/app/tabs/mlkit/custommodel/custommodel.component.ts new file mode 100644 index 00000000..31488508 --- /dev/null +++ b/demo-ng/app/tabs/mlkit/custommodel/custommodel.component.ts @@ -0,0 +1,20 @@ +import { Component } from "@angular/core"; +import { MLKitCustomModelResult } from "nativescript-plugin-firebase/mlkit/custommodel"; +import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.component"; + +@Component({ + selector: "mlkit-custommodel", + moduleId: module.id, + templateUrl: "./custommodel.component.html", +}) +export class CustomModelComponent extends AbstractMLKitViewComponent { + labels: Array<{ + text: string; + confidence: number; + }>; + + onCustomModelResult(scanResult: any): void { + const value: MLKitCustomModelResult = scanResult.value; + this.labels = value.result; + } +} diff --git a/demo-ng/app/tabs/mlkit/facedetection/facedetection.component.html b/demo-ng/app/tabs/mlkit/facedetection/facedetection.component.html index d2237902..ac6a128d 100644 --- a/demo-ng/app/tabs/mlkit/facedetection/facedetection.component.html +++ b/demo-ng/app/tabs/mlkit/facedetection/facedetection.component.html @@ -10,8 +10,8 @@ processEveryNthFrame="30" enableFaceTracking="true" minimumFaceSize="0.2" + preferFrontCamera="true" modeType="accurate" - [torchOn]="torchOn" (scanResult)="onFaceDetectionResult($event)"> @@ -40,7 +40,7 @@ - + @@ -50,6 +50,7 @@ + @@ -61,9 +62,10 @@ - - - - + + + + + diff --git a/demo-ng/app/tabs/mlkit/facedetection/facedetection.component.ts b/demo-ng/app/tabs/mlkit/facedetection/facedetection.component.ts index 38e0774a..19ee31ce 100644 --- a/demo-ng/app/tabs/mlkit/facedetection/facedetection.component.ts +++ b/demo-ng/app/tabs/mlkit/facedetection/facedetection.component.ts @@ -11,18 +11,20 @@ export class FaceDetectionComponent extends AbstractMLKitViewComponent { faces: Array; mlKitAllOK: string; + allSmilingAndEyesOpen: boolean = false; onFaceDetectionResult(scanResult: any): any { const value: MLKitDetectFacesOnDeviceResult = scanResult.value; if (value.faces.length > 0) { this.faces = value.faces; + console.log("this.faces: " + JSON.stringify(this.faces)); - let allSmilingAndEyesOpen = true; + this.allSmilingAndEyesOpen = true; value.faces.forEach(face => { - allSmilingAndEyesOpen = allSmilingAndEyesOpen && face.smilingProbability && face.leftEyeOpenProbability && face.rightEyeOpenProbability && + this.allSmilingAndEyesOpen = this.allSmilingAndEyesOpen && face.smilingProbability && face.leftEyeOpenProbability && face.rightEyeOpenProbability && face.smilingProbability > 0.7 && face.leftEyeOpenProbability > 0.7 && face.rightEyeOpenProbability > 0.7; }); - this.mlKitAllOK = `All smiling and eyes open? ${allSmilingAndEyesOpen ? 'Yes!' : 'Nope'}`; + this.mlKitAllOK = `All smiling and eyes open? ${this.allSmilingAndEyesOpen ? 'Yes!' : 'Nope'}`; } } } diff --git a/demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.html b/demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.html index d6c3f72f..3ccfa1d4 100644 --- a/demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.html +++ b/demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.html @@ -7,6 +7,7 @@ width="100%" height="100%" confidenceThreshold="0.6" + [torchOn]="torchOn" (scanResult)="onImageLabelingResult($event)"> diff --git a/demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.ts b/demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.ts index a166d469..ae6fd0fa 100644 --- a/demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.ts +++ b/demo-ng/app/tabs/mlkit/imagelabeling/imagelabeling.component.ts @@ -13,12 +13,6 @@ export class ImageLabelingComponent extends AbstractMLKitViewComponent { confidence: number; }>; - constructor() { - super(); - // let's start with the torch on, just for show - this.torchOn = true; - } - onImageLabelingResult(scanResult: any): void { const value: MLKitImageLabelingOnDeviceResult = scanResult.value; this.labels = value.labels; diff --git a/demo-ng/app/tabs/mlkit/languageidentification/languageidentification.component.html b/demo-ng/app/tabs/mlkit/languageidentification/languageidentification.component.html new file mode 100644 index 00000000..fbb30e9d --- /dev/null +++ b/demo-ng/app/tabs/mlkit/languageidentification/languageidentification.component.html @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-ng/app/tabs/mlkit/languageidentification/languageidentification.component.ts b/demo-ng/app/tabs/mlkit/languageidentification/languageidentification.component.ts new file mode 100644 index 00000000..385c723e --- /dev/null +++ b/demo-ng/app/tabs/mlkit/languageidentification/languageidentification.component.ts @@ -0,0 +1,33 @@ +import { Component } from "@angular/core"; +import { + indentifyPossibleLanguages, + MLKitNaturalLanguageIdentificationLanguage +} from "nativescript-plugin-firebase/mlkit/naturallanguageidentification"; +import { MLKitRecognizeTextResult } from "nativescript-plugin-firebase/mlkit/textrecognition"; +import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.component"; + +@Component({ + selector: "mlkit-languageidentification", + moduleId: module.id, + templateUrl: "./languageidentification.component.html", +}) +export class LanguageIdentificationComponent extends AbstractMLKitViewComponent { + possibleLanguages: Array; + + onTextRecognitionResult(scanResult: any): void { + const result: MLKitRecognizeTextResult = scanResult.value; + if (!result.text) { + return; + } + + indentifyPossibleLanguages({ + text: result.text, + confidenceThreshold: 0.05 + }).then( + (languageIdResults: Array) => { + console.log(">> results: " + JSON.stringify(languageIdResults)); + this.possibleLanguages = languageIdResults + }) + .catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + } +} diff --git a/demo-ng/app/tabs/mlkit/mlkit.component.html b/demo-ng/app/tabs/mlkit/mlkit.component.html index b6fdc418..bc46ced7 100644 --- a/demo-ng/app/tabs/mlkit/mlkit.component.html +++ b/demo-ng/app/tabs/mlkit/mlkit.component.html @@ -4,7 +4,7 @@ - + diff --git a/demo-ng/app/tabs/mlkit/mlkit.component.ts b/demo-ng/app/tabs/mlkit/mlkit.component.ts index 9d6f8c18..400ca341 100644 --- a/demo-ng/app/tabs/mlkit/mlkit.component.ts +++ b/demo-ng/app/tabs/mlkit/mlkit.component.ts @@ -1,20 +1,22 @@ import { Component, NgZone } from "@angular/core"; import { RouterExtensions } from "nativescript-angular"; -import { fromFile, ImageSource } from "tns-core-modules/image-source"; -import * as fileSystemModule from "tns-core-modules/file-system"; -import { action } from "tns-core-modules/ui/dialogs"; -import { ImageAsset } from "tns-core-modules/image-asset"; -import { isIOS } from "tns-core-modules/platform"; -import * as ImagePicker from "nativescript-imagepicker"; import * as Camera from "nativescript-camera"; +import * as ImagePicker from "nativescript-imagepicker"; import { BarcodeFormat, MLKitScanBarcodesOnDeviceResult } from "nativescript-plugin-firebase/mlkit/barcodescanning"; -import { MLKitLandmarkRecognitionCloudResult } from "nativescript-plugin-firebase/mlkit/landmarkrecognition"; +import { MLKitCustomModelResult } from "nativescript-plugin-firebase/mlkit/custommodel"; import { MLKitDetectFacesOnDeviceResult } from "nativescript-plugin-firebase/mlkit/facedetection"; +import { MLKitImageLabelingCloudResult, MLKitImageLabelingOnDeviceResult } from "nativescript-plugin-firebase/mlkit/imagelabeling"; +import { MLKitLandmarkRecognitionCloudResult } from "nativescript-plugin-firebase/mlkit/landmarkrecognition"; +import { MLKitNaturalLanguageIdentificationResult } from "nativescript-plugin-firebase/mlkit/naturallanguageidentification"; +import { MLKitAutoMLResult } from "nativescript-plugin-firebase/mlkit/automl"; +import { MLKitObjectDetectionResult } from "nativescript-plugin-firebase/mlkit/objectdetection"; +import { MLKitSmartReplyConversationMessage } from "nativescript-plugin-firebase/mlkit/smartreply"; import { MLKitRecognizeTextResult } from "nativescript-plugin-firebase/mlkit/textrecognition"; -import { - MLKitImageLabelingCloudResult, - MLKitImageLabelingOnDeviceResult -} from "nativescript-plugin-firebase/mlkit/imagelabeling"; +import * as fileSystemModule from "tns-core-modules/file-system"; +import { ImageAsset } from "tns-core-modules/image-asset"; +import { fromFile, ImageSource } from "tns-core-modules/image-source"; +import { isIOS } from "tns-core-modules/platform"; +import { action } from "tns-core-modules/ui/dialogs"; const firebase = require("nativescript-plugin-firebase"); @@ -32,16 +34,26 @@ export class MLKitComponent { "Text recognition (cloud)", "Barcode scanning (on device)", "Face detection (on device)", + "Detect Objects (on device)", "Image labeling (on device)", "Image labeling (cloud)", - "Landmark recognition (cloud)" + "Custom model", + "AutoML", + "Landmark recognition (cloud)", + "Language identification", + "Text translation (to EN)", + "Smart reply" ]; private mlkitOnDeviceFeatures: Array = [ "Text recognition", "Barcode scanning", "Face detection", - "Image labeling" + "Object detection", + "Image labeling", + "Custom model", + "AutoML", + "Language identification" ]; constructor(private routerExtensions: RouterExtensions, @@ -61,8 +73,16 @@ export class MLKitComponent { to = "/tabs/mlkit/barcodescanning"; } else if (pickedItem === "Face detection") { to = "/tabs/mlkit/facedetection"; + } else if (pickedItem === "Object detection") { + to = "/tabs/mlkit/objectdetection"; } else if (pickedItem === "Image labeling") { to = "/tabs/mlkit/imagelabeling"; + } else if (pickedItem === "Custom model") { + to = "/tabs/mlkit/custommodel"; + } else if (pickedItem === "AutoML") { + to = "/tabs/mlkit/automl"; + } else if (pickedItem === "Language identification") { + to = "/tabs/mlkit/languageidentification"; } if (to !== undefined) { @@ -82,9 +102,10 @@ export class MLKitComponent { fromAppFolder(): void { const folder = fileSystemModule.knownFolders.currentApp(); const path = fileSystemModule.path.join(folder.path, "/images/puppy.jpg"); - const exists = fileSystemModule.File.exists(path); - console.log(`Does it exist: ${exists}`); - + if (!fileSystemModule.File.exists(path)) { + console.log(`File doesn't exist at path: ${path}`); + return; + } const imageSource = fromFile(path); this.pickedImage = imageSource; // give the user some time to to see the picture @@ -96,8 +117,8 @@ export class MLKitComponent { Camera.requestPermissions(); } Camera.takePicture({ - width: 800, - height: 800, + width: 600, + height: 600, keepAspectRatio: true, saveToGallery: true, cameraFacing: "rear" @@ -105,12 +126,12 @@ export class MLKitComponent { new ImageSource().fromAsset(imageAsset).then(imageSource => { this.pickedImage = imageSource; // give the user some time to to see the picture - setTimeout(() => this.selectMLKitFeature(imageSource), 500); + setTimeout(() => this.selectMLKitFeature(imageSource), 700); }); }); } - fromCameraroll(): void { + fromCameraRoll(): void { const imagePicker = ImagePicker.create({ mode: "single" }); @@ -122,8 +143,8 @@ export class MLKitComponent { if (selection.length === 0) return; const selected = selection[0]; - selected.options.height = 800; - selected.options.width = 800; + selected.options.height = 600; + selected.options.width = 600; selected.options.keepAspectRatio = true; selected.getImageAsync((image: any, error: any) => { if (error) { @@ -177,10 +198,20 @@ export class MLKitComponent { this.labelImageOnDevice(imageSource); } else if (pickedItem === "Image labeling (cloud)") { this.labelImageCloud(imageSource); + } else if (pickedItem === "Detect Objects (on device)") { + this.detectObjects(imageSource); } else if (pickedItem === "Landmark recognition (cloud)") { this.recognizeLandmarkCloud(imageSource); - // } else if (pickedItem === "Custom model (on device)") { - // this.customModelOnDevice(imageSource); + } else if (pickedItem === "Custom model") { + this.customModel(imageSource); + } else if (pickedItem === "AutoML") { + this.autoML(imageSource); + } else if (pickedItem === "Language identification") { + this.languageIdentification(imageSource); + } else if (pickedItem === "Text translation (to EN)") { + this.textTranslation(imageSource); + } else if (pickedItem === "Smart reply") { + this.smartReply(imageSource); } }); } @@ -230,8 +261,155 @@ export class MLKitComponent { .catch(errorMessage => console.log("ML Kit error: " + errorMessage)); } + private languageIdentification(imageSource: ImageSource): void { + // First recognize text, then get its language + firebase.mlkit.textrecognition.recognizeTextOnDevice({ + image: imageSource + }).then((result: MLKitRecognizeTextResult) => { + firebase.mlkit.naturallanguageidentification.identifyNaturalLanguage({ + text: result.text + }).then((languageIdResult: MLKitNaturalLanguageIdentificationResult) => { + alert({ + title: `Result`, + message: `Language code: ${languageIdResult ? languageIdResult.languageCode : "Unknown"}`, + okButtonText: "OK" + }); + }).catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + }).catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + } + + private textTranslation(imageSource: ImageSource): void { + // First recognize text, then get its language, then translate the text + firebase.mlkit.textrecognition.recognizeTextOnDevice({ + image: imageSource + }).then((result: MLKitRecognizeTextResult) => { + if (!result || !result.text) { + alert({ + title: `No text found`, + message: `MLKit text recognition could not find any text in your image - please try a different one`, + okButtonText: "Damn! OK.." + }); + return; + } + + firebase.mlkit.naturallanguageidentification.identifyNaturalLanguage({ + text: result.text + }).then((languageIdResult: MLKitNaturalLanguageIdentificationResult) => { + + if (!languageIdResult || !languageIdResult.languageCode) { + alert({ + title: `Unknown language`, + message: `Could not determine language, please try again`, + okButtonText: "Damn! OK.." + }); + + } else if (languageIdResult.languageCode.toLowerCase() === "en") { + alert({ + title: `Dude..`, + message: `Language already English.. no need to translate 😉`, + okButtonText: "Lol, fine.." + }); + + } else { + // translate to EN + console.log(`Translating '${languageIdResult.languageCode}' to 'en'`); + + firebase.mlkit.translation.ensureTranslationModelDownloaded({ + from: languageIdResult.languageCode, + to: "en" + }).then(() => { + firebase.mlkit.translation.translateText({ + from: languageIdResult.languageCode, + to: "en", + text: result.text + }).then(result => { + alert({ + title: "Translated to English:", + message: result, + okButtonText: "Awesome!" + }); + }).catch(console.error) + }).catch(console.error); + } + }).catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + }).catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + } + + // it would be easier to hardcode the conversation, but this fits better with the other image-based examples + private smartReply(imageSource: ImageSource): void { + firebase.mlkit.textrecognition.recognizeTextOnDevice({ + image: imageSource + }).then((result: MLKitRecognizeTextResult) => { + const conversation: Array = []; + let personId = 0; + + // just faking a conversation based on the text blocks we got from the image :) + result.blocks.forEach(block => conversation.push({ + text: block.text, + userId: "person" + (++personId % 2 === 0 ? 1 : 2), + localUser: (personId % 2 === 0), + timestamp: new Date().getTime() - 500000 + (personId * 5000) + })); + + console.log(JSON.stringify(conversation)); + + firebase.mlkit.smartreply.suggestReplies({ + conversation + }).then((result: Array) => { + console.log("result1: " + JSON.stringify(result)); + alert({ + title: `Suggestions`, + message: JSON.stringify(result), + okButtonText: "OK" + }); + }).catch(errorMessage => { + console.log("ML Kit error: " + errorMessage); + alert({ + title: `Error getting suggestions`, + message: errorMessage, + okButtonText: "Pity.." + }); + }); + }).catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + } + + private customModel(imageSource: ImageSource): void { + firebase.mlkit.custommodel.useCustomModel({ + image: imageSource, + + // note that only local quant models work currently (so not 'float' models, and not loaded from the cloud) + + // cloudModelName: "~/mobilenet_quant_v2_1_0_299", + // cloudModelName: "~/inception_v3_quant", + + // note that there's an issue with this model (making the app crash): "ValueError: Model provided has model identifier 'Mobi', should be 'TFL3'" (reported by https://github.com/EddyVerbruggen/ns-mlkit-tflite-curated/blob/master/scripts/get_model_details.py) + // localModelFile: "~/custommodel/nutella/nutella_quantize.tflite", + // labelsFile: "~/custommodel/nutella/nutella_labels.txt", + + // localModelFile: "~/custommodel/mobilenet/mobilenet_quant_v2_1.0_299.tflite", + // labelsFile: "~/custommodel/mobilenet/mobilenet_labels.txt", + + localModelFile: "~/custommodel/inception/inception_v3_quant.tflite", + labelsFile: "~/custommodel/inception/inception_labels.txt", + + maxResults: 5, + modelInput: [{ + // shape: [1, 224, 224, 3], // flowers / nutella + shape: [1, 299, 299, 3], // others + type: "QUANT" // the only currently supported type of model + }], + }).then( + (result: MLKitCustomModelResult) => { + alert({ + title: `Result`, + message: JSON.stringify(result.result), + okButtonText: "OK" + }); + }) + .catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + } + private scanBarcodeOnDevice(imageSource: ImageSource): void { - console.log(">>> imageSource.rotationAngle: " + imageSource.rotationAngle); firebase.mlkit.barcodescanning.scanBarcodesOnDevice({ image: imageSource, formats: [BarcodeFormat.QR_CODE, BarcodeFormat.EAN_13] @@ -278,6 +456,22 @@ export class MLKitComponent { .catch(errorMessage => console.log("ML Kit error: " + errorMessage)); } + private autoML(imageSource: ImageSource): void { + firebase.mlkit.automl.labelImage({ + image: imageSource, + localModelResourceFolder: "leftright", + confidenceThreshold: 0.3 + }).then( + (result: MLKitAutoMLResult) => { + alert({ + title: `Result`, + message: JSON.stringify(result.labels), + okButtonText: "OK" + }); + }) + .catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + } + /* private customModelOnDevice(imageSource: ImageSource): void { console.log("customModelOnDevice"); @@ -311,7 +505,19 @@ export class MLKitComponent { .catch(errorMessage => console.log("ML Kit error: " + errorMessage)); } - // onScanResultImage(event): void { - // this.scannedImage = event.value; - // } + private detectObjects(imageSource: ImageSource): void { + firebase.mlkit.objectdetection.detectObjects({ + image: imageSource, + classify: true, + multiple: true + }).then( + (result: MLKitObjectDetectionResult) => { + alert({ + title: `Result`, + message: JSON.stringify(result.objects), + okButtonText: "OK" + }); + }) + .catch(errorMessage => console.log("ML Kit error: " + errorMessage)); + } } diff --git a/demo-ng/app/tabs/mlkit/objectdetection/objectdetection.component.html b/demo-ng/app/tabs/mlkit/objectdetection/objectdetection.component.html new file mode 100644 index 00000000..c5e5577f --- /dev/null +++ b/demo-ng/app/tabs/mlkit/objectdetection/objectdetection.component.html @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-ng/app/tabs/mlkit/objectdetection/objectdetection.component.ts b/demo-ng/app/tabs/mlkit/objectdetection/objectdetection.component.ts new file mode 100644 index 00000000..ac54743f --- /dev/null +++ b/demo-ng/app/tabs/mlkit/objectdetection/objectdetection.component.ts @@ -0,0 +1,18 @@ +import { Component } from "@angular/core"; +import { MLKitObjectDetectionResult, MLKitObjectDetectionResultItem } from "nativescript-plugin-firebase/mlkit/objectdetection"; +import { AbstractMLKitViewComponent } from "~/tabs/mlkit/abstract.mlkitview.component"; + +@Component({ + selector: "mlkit-objectdetection", + moduleId: module.id, + templateUrl: "./objectdetection.component.html", +}) +export class ObjectDetectionComponent extends AbstractMLKitViewComponent { + objs: Array; + + onObjectDetectionResult(scanResult: any): void { + const value: MLKitObjectDetectionResult = scanResult.value; + this.objs = value.objects; + value.objects.forEach(o => console.log(">> id: " + o.id + ", category: " + o.category + ", bounds: " + JSON.stringify(o.bounds))); + } +} diff --git a/demo-ng/app/tabs/tabs-routing.module.ts b/demo-ng/app/tabs/tabs-routing.module.ts index a882135f..3289283e 100644 --- a/demo-ng/app/tabs/tabs-routing.module.ts +++ b/demo-ng/app/tabs/tabs-routing.module.ts @@ -6,14 +6,22 @@ import { TabsComponent } from "./tabs.component"; import { TextRecognitionComponent } from "~/tabs/mlkit/textrecognition/textrecognition.component"; import { BarcodeScanningComponent } from "~/tabs/mlkit/barcodescanning/barcodescanning.component"; import { FaceDetectionComponent } from "~/tabs/mlkit/facedetection/facedetection.component"; +import { ObjectDetectionComponent } from "~/tabs/mlkit/objectdetection/objectdetection.component"; import { ImageLabelingComponent } from "~/tabs/mlkit/imagelabeling/imagelabeling.component"; +import { CustomModelComponent } from "~/tabs/mlkit/custommodel/custommodel.component"; +import { AutoMLComponent } from "~/tabs/mlkit/automl/automl.component"; +import { LanguageIdentificationComponent } from "~/tabs/mlkit/languageidentification/languageidentification.component"; const routes: Routes = [ { path: "", component: TabsComponent }, { path: "mlkit/textrecognition", component: TextRecognitionComponent }, { path: "mlkit/barcodescanning", component: BarcodeScanningComponent }, { path: "mlkit/facedetection", component: FaceDetectionComponent }, - { path: "mlkit/imagelabeling", component: ImageLabelingComponent } + { path: "mlkit/objectdetection", component: ObjectDetectionComponent }, + { path: "mlkit/imagelabeling", component: ImageLabelingComponent }, + { path: "mlkit/custommodel", component: CustomModelComponent }, + { path: "mlkit/automl", component: AutoMLComponent }, + { path: "mlkit/languageidentification", component: LanguageIdentificationComponent } ]; @NgModule({ diff --git a/demo-ng/app/tabs/tabs.component.ts b/demo-ng/app/tabs/tabs.component.ts index 5c7838a6..b7ec2991 100644 --- a/demo-ng/app/tabs/tabs.component.ts +++ b/demo-ng/app/tabs/tabs.component.ts @@ -1,5 +1,5 @@ -import { Component, OnInit } from "@angular/core"; -import { isAndroid } from "platform"; +import { Component } from "@angular/core"; +import { isAndroid } from "tns-core-modules/platform"; import { SelectedIndexChangedEventData, TabView } from "tns-core-modules/ui/tab-view"; @Component({ @@ -7,17 +7,9 @@ import { SelectedIndexChangedEventData, TabView } from "tns-core-modules/ui/tab- moduleId: module.id, templateUrl: "./tabs.component.html" }) -export class TabsComponent implements OnInit { +export class TabsComponent { private _title: string; - constructor() { - // Use the component constructor to inject providers. - } - - ngOnInit(): void { - // Init your component properties here. - } - get title(): string { return this._title; } diff --git a/demo-ng/app/tabs/tabs.module.ts b/demo-ng/app/tabs/tabs.module.ts index 2752508b..e8782031 100644 --- a/demo-ng/app/tabs/tabs.module.ts +++ b/demo-ng/app/tabs/tabs.module.ts @@ -9,13 +9,20 @@ import { TabsComponent } from "./tabs.component"; import { TextRecognitionComponent } from "~/tabs/mlkit/textrecognition/textrecognition.component"; import { BarcodeScanningComponent } from "~/tabs/mlkit/barcodescanning/barcodescanning.component"; import { FaceDetectionComponent } from "~/tabs/mlkit/facedetection/facedetection.component"; +import { ObjectDetectionComponent } from "~/tabs/mlkit/objectdetection/objectdetection.component"; import { ImageLabelingComponent } from "~/tabs/mlkit/imagelabeling/imagelabeling.component"; +import { CustomModelComponent } from "~/tabs/mlkit/custommodel/custommodel.component"; +import { AutoMLComponent } from "~/tabs/mlkit/automl/automl.component"; +import { LanguageIdentificationComponent } from "~/tabs/mlkit/languageidentification/languageidentification.component"; import { registerElement } from "nativescript-angular/element-registry"; registerElement("MLKitBarcodeScanner", () => require("nativescript-plugin-firebase/mlkit/barcodescanning").MLKitBarcodeScanner); registerElement("MLKitFaceDetection", () => require("nativescript-plugin-firebase/mlkit/facedetection").MLKitFaceDetection); +registerElement("MLKitObjectDetection", () => require("nativescript-plugin-firebase/mlkit/objectdetection").MLKitObjectDetection); registerElement("MLKitTextRecognition", () => require("nativescript-plugin-firebase/mlkit/textrecognition").MLKitTextRecognition); registerElement("MLKitImageLabeling", () => require("nativescript-plugin-firebase/mlkit/imagelabeling").MLKitImageLabeling); +registerElement("MLKitCustomModel", () => require("nativescript-plugin-firebase/mlkit/custommodel").MLKitCustomModel); +registerElement("MLKitAutoML", () => require("nativescript-plugin-firebase/mlkit/automl").MLKitAutoML); @NgModule({ imports: [ @@ -25,11 +32,15 @@ registerElement("MLKitImageLabeling", () => require("nativescript-plugin-firebas declarations: [ BarcodeScanningComponent, FaceDetectionComponent, + ObjectDetectionComponent, FirestoreComponent, ImageLabelingComponent, MLKitComponent, TabsComponent, - TextRecognitionComponent + TextRecognitionComponent, + CustomModelComponent, + AutoMLComponent, + LanguageIdentificationComponent ], schemas: [ NO_ERRORS_SCHEMA diff --git a/demo-ng/firebase.nativescript.json b/demo-ng/firebase.nativescript.json index 9ff919e3..f152b9cf 100644 --- a/demo-ng/firebase.nativescript.json +++ b/demo-ng/firebase.nativescript.json @@ -1,22 +1,31 @@ { + "external_push_client_only": false, "using_ios": true, "using_android": true, - "realtimedb": false, + "analytics": false, "firestore": true, + "realtimedb": false, + "authentication": true, "remote_config": false, + "performance_monitoring": true, "messaging": false, - "crash_reporting": false, - "crashlytics": true, + "in_app_messaging": false, + "crashlytics": false, "storage": false, + "functions": false, "facebook_auth": false, "google_auth": false, "admob": false, - "invites": false, "dynamic_links": false, "ml_kit": true, "ml_kit_text_recognition": true, "ml_kit_barcode_scanning": true, "ml_kit_face_detection": true, "ml_kit_image_labeling": true, - "ml_kit_custom_model": true + "ml_kit_object_detection": true, + "ml_kit_automl": false, + "ml_kit_custom_model": false, + "ml_kit_natural_language_identification": false, + "ml_kit_natural_language_translation": false, + "ml_kit_natural_language_smartreply": false } diff --git a/demo-ng/package.json b/demo-ng/package.json index a14a714f..55bff1fb 100644 --- a/demo-ng/package.json +++ b/demo-ng/package.json @@ -6,41 +6,40 @@ "nativescript": { "id": "org.nativescript.firebasedemo.firestore", "tns-android": { - "version": "4.2.0" + "version": "6.5.3" }, "tns-ios": { - "version": "4.2.0" + "version": "6.5.3" } }, "dependencies": { - "@angular/animations": "~6.1.0", - "@angular/common": "~6.1.0", - "@angular/compiler": "~6.1.0", - "@angular/core": "~6.1.0", - "@angular/forms": "~6.1.0", - "@angular/http": "~6.1.0", - "@angular/platform-browser": "~6.1.0", - "@angular/platform-browser-dynamic": "~6.1.0", - "@angular/router": "~6.1.0", - "nativescript-angular": "^6.1.0", - "nativescript-camera": "^4.0.2", - "nativescript-imagepicker": "^6.0.1", - "nativescript-plugin-firebase": "file:../publish/package/nativescript-plugin-firebase-6.8.0.tgz", - "nativescript-theme-core": "~1.0.4", - "reflect-metadata": "~0.1.10", - "rxjs": "~6.0.0 || >=6.1.0", - "tns-core-modules": "~4.2.0", - "zone.js": "~0.8.26" + "@angular/animations": "~8.1.0", + "@angular/common": "~8.1.0", + "@angular/compiler": "~8.1.0", + "@angular/core": "~8.1.0", + "@angular/forms": "~8.1.0", + "@angular/http": "~8.0.0-beta.10", + "@angular/platform-browser": "~8.1.0", + "@angular/platform-browser-dynamic": "~8.1.0", + "@angular/router": "~8.1.0", + "nativescript-angular": "~8.0.3", + "nativescript-camera": "~4.5.0", + "nativescript-imagepicker": "~6.3.0", + "nativescript-plugin-firebase": "file:../publish/package/nativescript-plugin-firebase-10.6.0.tgz", + "nativescript-theme-core": "~1.0.6", + "reflect-metadata": "~0.1.13", + "rxjs": "~6.5.2", + "tns-core-modules": "~6.5.3", + "zone.js": "~0.10.0" }, "devDependencies": { - "@angular/compiler-cli": "~6.1.0", - "@ngtools/webpack": "~6.1.0", + "@angular/compiler-cli": "~8.1.0", + "@ngtools/webpack": "~8.1.0", "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", "lazy": "1.0.11", - "nativescript-dev-typescript": "~0.7.0", - "nativescript-dev-webpack": "^0.15.1", - "typescript": "~2.7.2" + "nativescript-dev-webpack": "~1.3.0", + "typescript": "3.4.5" } } diff --git a/demo-ng/tsconfig.json b/demo-ng/tsconfig.json index eae291c3..f251eb44 100644 --- a/demo-ng/tsconfig.json +++ b/demo-ng/tsconfig.json @@ -26,4 +26,4 @@ "node_modules", "platforms" ] -} +} \ No newline at end of file diff --git a/demo-ng/tsconfig.tns.json b/demo-ng/tsconfig.tns.json new file mode 100644 index 00000000..95f2ecee --- /dev/null +++ b/demo-ng/tsconfig.tns.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "module": "es2015", + "moduleResolution": "node" + } +} diff --git a/demo-ng/webpack.config.js b/demo-ng/webpack.config.js new file mode 100644 index 00000000..933de292 --- /dev/null +++ b/demo-ng/webpack.config.js @@ -0,0 +1,336 @@ +const { join, relative, resolve, sep, dirname } = require("path"); + +const webpack = require("webpack"); +const nsWebpack = require("nativescript-dev-webpack"); +const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); +const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns-replace-bootstrap"); +const { nsReplaceLazyLoader } = require("nativescript-dev-webpack/transformers/ns-replace-lazy-loader"); +const { nsSupportHmrNg } = require("nativescript-dev-webpack/transformers/ns-support-hmr-ng"); +const { getMainModulePath } = require("nativescript-dev-webpack/utils/ast-utils"); +const { getNoEmitOnErrorFromTSConfig } = require("nativescript-dev-webpack/utils/tsconfig-utils"); +const CleanWebpackPlugin = require("clean-webpack-plugin"); +const CopyWebpackPlugin = require("copy-webpack-plugin"); +const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); +const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); +const TerserPlugin = require("terser-webpack-plugin"); +const { getAngularCompilerPlugin } = require("nativescript-dev-webpack/plugins/NativeScriptAngularCompilerPlugin"); +const hashSalt = Date.now().toString(); + +module.exports = env => { + // Add your custom Activities, Services and other Android app components here. + const appComponents = [ + "tns-core-modules/ui/frame", + "tns-core-modules/ui/frame/activity", + ]; + + const platform = env && (env.android && "android" || env.ios && "ios"); + if (!platform) { + throw new Error("You need to provide a target platform!"); + } + + const AngularCompilerPlugin = getAngularCompilerPlugin(platform); + const projectRoot = __dirname; + + // Default destination inside platforms//... + const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot)); + + const { + // The 'appPath' and 'appResourcesPath' values are fetched from + // the nsconfig.json configuration file. + appPath = "src", + appResourcesPath = "App_Resources", + + // You can provide the following flags when running 'tns run android|ios' + aot, // --env.aot + snapshot, // --env.snapshot, + production, // --env.production + uglify, // --env.uglify + report, // --env.report + sourceMap, // --env.sourceMap + hiddenSourceMap, // --env.hiddenSourceMap + hmr, // --env.hmr, + unitTesting, // --env.unitTesting + verbose, // --env.verbose + snapshotInDocker, // --env.snapshotInDocker + skipSnapshotTools, // --env.skipSnapshotTools + compileSnapshot // --env.compileSnapshot + } = env; + + const useLibs = compileSnapshot; + const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap; + const externals = nsWebpack.getConvertedExternals(env.externals); + const appFullPath = resolve(projectRoot, appPath); + const appResourcesFullPath = resolve(projectRoot, appResourcesPath); + const tsConfigName = "tsconfig.tns.json"; + const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`; + const entryPath = `.${sep}${entryModule}`; + const entries = { bundle: entryPath }; + const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1); + if (platform === "ios" && !areCoreModulesExternal) { + entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules"; + }; + + const ngCompilerTransformers = []; + const additionalLazyModuleResources = []; + if (aot) { + ngCompilerTransformers.push(nsReplaceBootstrap); + } + + if (hmr) { + ngCompilerTransformers.push(nsSupportHmrNg); + } + + // when "@angular/core" is external, it's not included in the bundles. In this way, it will be used + // directly from node_modules and the Angular modules loader won't be able to resolve the lazy routes + // fixes https://github.com/NativeScript/nativescript-cli/issues/4024 + if (env.externals && env.externals.indexOf("@angular/core") > -1) { + const appModuleRelativePath = getMainModulePath(resolve(appFullPath, entryModule), tsConfigName); + if (appModuleRelativePath) { + const appModuleFolderPath = dirname(resolve(appFullPath, appModuleRelativePath)); + // include the lazy loader inside app module + ngCompilerTransformers.push(nsReplaceLazyLoader); + // include the new lazy loader path in the allowed ones + additionalLazyModuleResources.push(appModuleFolderPath); + } + } + + const ngCompilerPlugin = new AngularCompilerPlugin({ + hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]), + platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule), projectRoot)), + mainPath: join(appFullPath, entryModule), + tsConfigPath: join(__dirname, tsConfigName), + skipCodeGeneration: !aot, + sourceMap: !!isAnySourceMapEnabled, + additionalLazyModuleResources: additionalLazyModuleResources + }); + + let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist); + + const itemsToClean = [`${dist}/**/*`]; + if (platform === "android") { + itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "src", "main", "assets", "snapshots")}`); + itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`); + } + + const noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(join(projectRoot, tsConfigName)); + + nsWebpack.processAppComponents(appComponents, platform); + const config = { + mode: production ? "production" : "development", + context: appFullPath, + externals, + watchOptions: { + ignored: [ + appResourcesFullPath, + // Don't watch hidden files + "**/.*", + ] + }, + target: nativescriptTarget, + entry: entries, + output: { + pathinfo: false, + path: dist, + sourceMapFilename, + libraryTarget: "commonjs2", + filename: "[name].js", + globalObject: "global", + hashSalt + }, + resolve: { + extensions: [".ts", ".js", ".scss", ".css"], + // Resolve {N} system modules from tns-core-modules + modules: [ + resolve(__dirname, "node_modules/tns-core-modules"), + resolve(__dirname, "node_modules"), + "node_modules/tns-core-modules", + "node_modules", + ], + alias: { + '~': appFullPath + }, + symlinks: true + }, + resolveLoader: { + symlinks: false + }, + node: { + // Disable node shims that conflict with NativeScript + "http": false, + "timers": false, + "setImmediate": false, + "fs": "empty", + "__dirname": false, + }, + devtool: hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none"), + optimization: { + runtimeChunk: "single", + noEmitOnErrors: noEmitOnErrorFromTSConfig, + splitChunks: { + cacheGroups: { + vendor: { + name: "vendor", + chunks: "all", + test: (module, chunks) => { + const moduleName = module.nameForCondition ? module.nameForCondition() : ''; + return /[\\/]node_modules[\\/]/.test(moduleName) || + appComponents.some(comp => comp === moduleName); + }, + enforce: true, + }, + } + }, + minimize: !!uglify, + minimizer: [ + new TerserPlugin({ + parallel: true, + cache: true, + sourceMap: isAnySourceMapEnabled, + terserOptions: { + output: { + comments: false, + semicolons: !isAnySourceMapEnabled + }, + compress: { + // The Android SBG has problems parsing the output + // when these options are enabled + 'collapse_vars': platform !== "android", + sequences: platform !== "android", + } + } + }) + ], + }, + module: { + rules: [ + { + include: join(appFullPath, entryPath), + use: [ + // Require all Android app components + platform === "android" && { + loader: "nativescript-dev-webpack/android-app-components-loader", + options: { modules: appComponents } + }, + + { + loader: "nativescript-dev-webpack/bundle-config-loader", + options: { + angular: true, + loadCss: !snapshot, // load the application css if in debug mode + unitTesting, + appFullPath, + projectRoot, + ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform) + } + }, + ].filter(loader => !!loader) + }, + + { test: /\.html$|\.xml$/, use: "raw-loader" }, + + { + test: /[\/|\\]app\.css$/, + use: [ + "nativescript-dev-webpack/style-hot-loader", + { + loader: "nativescript-dev-webpack/css2json-loader", + options: { useForImports: true } + } + ] + }, + { + test: /[\/|\\]app\.scss$/, + use: [ + "nativescript-dev-webpack/style-hot-loader", + { + loader: "nativescript-dev-webpack/css2json-loader", + options: { useForImports: true } + }, + "sass-loader" + ] + }, + + // Angular components reference css files and their imports using raw-loader + { test: /\.css$/, exclude: /[\/|\\]app\.css$/, use: "raw-loader" }, + { test: /\.scss$/, exclude: /[\/|\\]app\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] }, + + { + test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/, + use: [ + "nativescript-dev-webpack/moduleid-compat-loader", + "nativescript-dev-webpack/lazy-ngmodule-hot-loader", + "@ngtools/webpack", + ] + }, + + // Mark files inside `@angular/core` as using SystemJS style dynamic imports. + // Removing this will cause deprecation warnings to appear. + { + test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/, + parser: { system: true }, + }, + ], + }, + plugins: [ + // Define useful constants like TNS_WEBPACK + new webpack.DefinePlugin({ + "global.TNS_WEBPACK": "true", + "process": "global.process", + }), + // Remove all files from the out dir. + new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }), + // Copy assets to out dir. Add your own globs as needed. + new CopyWebpackPlugin([ + { from: { glob: "fonts/**" } }, + { from: { glob: "**/*.jpg" } }, + { from: { glob: "**/*.png" } }, + { from: { glob: "**/custommodel/**" } }, + ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }), + new nsWebpack.GenerateNativeScriptEntryPointsPlugin("bundle"), + // For instructions on how to set up workers with webpack + // check out https://github.com/nativescript/worker-loader + new NativeScriptWorkerPlugin(), + ngCompilerPlugin, + // Does IPC communication with the {N} CLI to notify events when running in watch mode. + new nsWebpack.WatchStateLoggerPlugin(), + ], + }; + + if (report) { + // Generate report files for bundles content + config.plugins.push(new BundleAnalyzerPlugin({ + analyzerMode: "static", + openAnalyzer: false, + generateStatsFile: true, + reportFilename: resolve(projectRoot, "report", `report.html`), + statsFilename: resolve(projectRoot, "report", `stats.json`), + })); + } + + if (snapshot) { + config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({ + chunk: "vendor", + angular: true, + requireModules: [ + "reflect-metadata", + "@angular/platform-browser", + "@angular/core", + "@angular/common", + "@angular/router", + "nativescript-angular/platform-static", + "nativescript-angular/router", + ], + projectRoot, + webpackConfig: config, + snapshotInDocker, + skipSnapshotTools, + useLibs + })); + } + + if (hmr) { + config.plugins.push(new webpack.HotModuleReplacementPlugin()); + } + + return config; +}; diff --git a/demo-push/app/app.css b/demo-push/app/app.css index bdc22f54..6b573309 100644 --- a/demo-push/app/app.css +++ b/demo-push/app/app.css @@ -73,10 +73,6 @@ button { background-color: #d52c1e; } -.button-invites { - background-color: #1832d5; -} - .barcodescanner { height: 420; margin-top: 16; diff --git a/demo-push/app/app.ts b/demo-push/app/app.ts index f517e249..a3ba6733 100644 --- a/demo-push/app/app.ts +++ b/demo-push/app/app.ts @@ -1,7 +1,7 @@ import "./bundle-config"; -import * as application from 'tns-core-modules/application'; +import * as application from "tns-core-modules/application"; -// added this here so we can do some wiring +// added this here so we can do some wiring -- without this, you won're receive a push token on iOS require("nativescript-plugin-firebase"); application.run({ moduleName: "main-page" }); diff --git a/demo-push/app/main-page.ts b/demo-push/app/main-page.ts index 48a7dded..5ada47bd 100644 --- a/demo-push/app/main-page.ts +++ b/demo-push/app/main-page.ts @@ -1,6 +1,6 @@ -import * as observable from 'tns-core-modules/data/observable'; -import * as pages from 'tns-core-modules/ui/page'; -import { PushViewModel } from './push-view-model'; +import * as observable from "tns-core-modules/data/observable"; +import * as pages from "tns-core-modules/ui/page"; +import { PushViewModel } from "./push-view-model"; const model = new PushViewModel(); diff --git a/demo-push/app/package.json b/demo-push/app/package.json index 7c8be405..eb552dc7 100644 --- a/demo-push/app/package.json +++ b/demo-push/app/package.json @@ -26,9 +26,9 @@ }, "homepage": "https://github.com/NativeScript/template-hello-world-ts", "android": { - "v8Flags": "--expose_gc", - "discardUncaughtJsExceptions": true + "v8Flags": "--expose_gc" }, + "discardUncaughtJsExceptions": true, "devDependencies": { "nativescript-dev-typescript": "^0.3.0" }, diff --git a/demo-push/app/push-view-model.ts b/demo-push/app/push-view-model.ts index de682454..f1f3a1db 100644 --- a/demo-push/app/push-view-model.ts +++ b/demo-push/app/push-view-model.ts @@ -1,9 +1,9 @@ -import { Observable } from "tns-core-modules/data/observable"; import * as firebase from "nativescript-plugin-firebase"; -import { messaging } from "nativescript-plugin-firebase/messaging"; -import { alert, confirm } from "tns-core-modules/ui/dialogs"; -import * as platform from "tns-core-modules/platform"; +import { Message, messaging } from "nativescript-plugin-firebase/messaging"; import * as applicationSettings from "tns-core-modules/application-settings"; +import { Observable } from "tns-core-modules/data/observable"; +import * as platform from "tns-core-modules/platform"; +import { alert, confirm } from "tns-core-modules/ui/dialogs"; const getCircularReplacer = () => { const seen = new WeakSet; @@ -27,6 +27,7 @@ export class PushViewModel extends Observable { if (applicationSettings.getBoolean(PushViewModel.APP_REGISTERED_FOR_NOTIFICATIONS, false)) { this.doRegisterPushHandlers(); } + // this.setScreenName("push-demo-view"); } public doRequestConsent(): void { @@ -34,19 +35,20 @@ export class PushViewModel extends Observable { title: "We'd like to send notifications", message: "Do you agree? Please do, we won't spam you. Promised.", okButtonText: "Yep!", - cancelButtonText: "Nooo" + cancelButtonText: "Maybe later" }).then(pushAllowed => { if (pushAllowed) { applicationSettings.setBoolean(PushViewModel.APP_REGISTERED_FOR_NOTIFICATIONS, true); - this.doRegisterPushHandlers(); + this.doRegisterForPushNotifications(); } }); } public doGetCurrentPushToken(): void { - firebase.getCurrentPushToken() + messaging.getCurrentPushToken() .then(token => { // may be null/undefined if not known yet + console.log(token); alert({ title: "Current Push Token", message: (!token ? "Not received yet (note that on iOS this does not work on a simulator)" : token + ("\n\nSee the console log if you want to copy-paste it.")), @@ -60,6 +62,7 @@ export class PushViewModel extends Observable { if (!platform.isIOS) { console.log("##### Interactive push messaging is currently iOS-only!"); console.log("##### Also, please make sure you don't include the 'click_action' notification property when pusing to Android."); + return; } const model = new messaging.PushNotificationModel(); @@ -104,7 +107,7 @@ export class PushViewModel extends Observable { identifier: "GENERAL" }]; - model.onNotificationActionTakenCallback = (actionIdentifier: string, message: firebase.Message, inputText?: string) => { + model.onNotificationActionTakenCallback = (actionIdentifier: string, message: Message, inputText?: string) => { console.log(`onNotificationActionTakenCallback fired! \n\r Message: ${JSON.stringify(message)}, \n\r Action taken: ${actionIdentifier}`); alert({ @@ -114,7 +117,7 @@ export class PushViewModel extends Observable { }); }; - firebase.registerForInteractivePush(model); + messaging.registerForInteractivePush(model); console.log("Registered for interactive push"); alert({ @@ -123,11 +126,11 @@ export class PushViewModel extends Observable { }); } - // You would normally add these handlers in 'init', but if you want you can do it seperately as well. + // You could add these handlers in 'init', but if you want you can do it seperately as well. // The benefit being your user will not be confronted with the "Allow notifications" consent popup when 'init' runs. public doRegisterPushHandlers(): void { // note that this will implicitly register for push notifications, so there's no need to call 'registerForPushNotifications' - firebase.addOnPushTokenReceivedCallback( + messaging.addOnPushTokenReceivedCallback( token => { // you can use this token to send to your own backend server, // so you can send notifications to this specific device @@ -136,7 +139,7 @@ export class PushViewModel extends Observable { // pasteboard.setValueForPasteboardType(token, kUTTypePlainText); } ); - firebase.addOnMessageReceivedCallback( + messaging.addOnMessageReceivedCallback( message => { console.log("Push message received in push-view-model: " + JSON.stringify(message, getCircularReplacer())); @@ -156,7 +159,7 @@ export class PushViewModel extends Observable { } public doUnregisterForPushNotifications(): void { - firebase.unregisterForPushNotifications().then( + messaging.unregisterForPushNotifications().then( () => { alert({ title: "Unregistered", @@ -166,19 +169,37 @@ export class PushViewModel extends Observable { }); } - public doRegisterForPushNotificationsAgain(): void { - firebase.registerForPushNotifications().then( - () => { + public doRegisterForPushNotifications(): void { + messaging.registerForPushNotifications({ + onPushTokenReceivedCallback: (token: string): void => { + console.log(">>>> Firebase plugin received a push token: " + token); + }, + + onMessageReceivedCallback: (message: Message) => { + console.log("Push message received in push-view-model: " + JSON.stringify(message, getCircularReplacer())); + + setTimeout(() => { alert({ - title: "Registered again", - message: "You should now use the new push token which was received in 'addOnPushTokenReceivedCallback, or call 'getCurrentPushToken'.", - okButtonText: "Got it." + title: "Push message!", + message: (message !== undefined && message.title !== undefined ? message.title : ""), + okButtonText: "Sw33t" }); - }); + }, 500); + }, + + showNotifications: true, + + // Whether you want this plugin to always handle the notifications when the app is in foreground. + // Currently used on iOS only. Default false. + // When false, you can still force showing it when the app is in the foreground by adding 'showWhenInForeground' to the notification as mentioned in the readme. + showNotificationsWhenInForeground: false + }) + .then(() => console.log(">>>> Registered for push")) + .catch(err => console.log(">>>> Failed to register for push")); } public doSubscribeToTopic(): void { - firebase.subscribeToTopic("demo").then( + messaging.subscribeToTopic("demo").then( () => { alert({ title: "Subscribed", @@ -197,7 +218,7 @@ export class PushViewModel extends Observable { } public doUnsubscribeFromTopic(): void { - firebase.unsubscribeFromTopic("demo").then( + messaging.unsubscribeFromTopic("demo").then( () => { alert({ title: "Unsubscribed", @@ -218,8 +239,17 @@ export class PushViewModel extends Observable { public doGetAreNotificationsEnabled(): void { alert({ title: "AreNotificationsEnabled", - message: "" + firebase.areNotificationsEnabled(), + message: "" + messaging.areNotificationsEnabled(), okButtonText: "Okay, very interesting" }); } + + private setScreenName(screenName): void { + firebase.analytics.setScreenName( + { + screenName + }) + .then(() => console.log("Analytics screen name set to: " + screenName)) + .catch(err => console.log("Analytics error: " + err)); + } } diff --git a/demo-push/app/vendor-platform.android.ts b/demo-push/app/vendor-platform.android.ts deleted file mode 100644 index 16352227..00000000 --- a/demo-push/app/vendor-platform.android.ts +++ /dev/null @@ -1,9 +0,0 @@ -require("application"); -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"); -} diff --git a/demo-push/app/vendor-platform.ios.ts b/demo-push/app/vendor-platform.ios.ts deleted file mode 100644 index 5ce49d81..00000000 --- a/demo-push/app/vendor-platform.ios.ts +++ /dev/null @@ -1,3 +0,0 @@ -// There is a bug in angular: https://github.com/angular/angular-cli/pull/8589/files -// Legendary stuff, its webpack plugin pretty much doesn't work with empty TypeScript files in v1.8.3 -void 0; diff --git a/demo-push/app/vendor.ts b/demo-push/app/vendor.ts deleted file mode 100644 index 8a381374..00000000 --- a/demo-push/app/vendor.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Snapshot the ~/app.css and the theme -const application = require("application"); -require("ui/styling/style-scope"); -const appCssContext = require.context("~/", false, /^\.\/app\.(css|scss|less|sass)$/); -global.registerWebpackModules(appCssContext); -application.loadAppCss(); - -require("./vendor-platform"); - -require("bundle-entry-points"); diff --git a/demo-push/app_resources/Android/app.gradle b/demo-push/app_resources/Android/app.gradle index 69381255..1990bcec 100644 --- a/demo-push/app_resources/Android/app.gradle +++ b/demo-push/app_resources/Android/app.gradle @@ -5,6 +5,10 @@ // compile 'com.android.support:recyclerview-v7:+' //} +//project.ext { +// googlePlayServicesVersion = "15.0.1" +//} + android { defaultConfig { generatedDensities = [] diff --git a/demo-push/app_resources/iOS/Info.plist b/demo-push/app_resources/iOS/Info.plist index 83cd9ebc..1d6bd787 100644 --- a/demo-push/app_resources/iOS/Info.plist +++ b/demo-push/app_resources/iOS/Info.plist @@ -22,6 +22,9 @@ 1.0 LSRequiresIPhoneOS + + UIUserInterfaceStyle + Light UILaunchStoryboardName LaunchScreen UIRequiresFullScreen @@ -47,7 +50,7 @@ remote-notification - UseExternalPushProvider + UseExternalPushProvider diff --git a/demo-push/firebase.nativescript.json b/demo-push/firebase.nativescript.json index d7a7a7f5..c550642e 100644 --- a/demo-push/firebase.nativescript.json +++ b/demo-push/firebase.nativescript.json @@ -1,5 +1,21 @@ { - "external_push_client_only": true, - "using_ios": true, - "using_android": true -} + "using_ios": true, + "using_android": true, + "analytics": false, + "firestore": false, + "realtimedb": false, + "authentication": false, + "remote_config": false, + "performance_monitoring": false, + "external_push_client_only": true, + "messaging": false, + "in_app_messaging": false, + "crashlytics": false, + "storage": false, + "functions": false, + "facebook_auth": false, + "google_auth": false, + "admob": false, + "dynamic_links": false, + "ml_kit": false +} \ No newline at end of file diff --git a/demo-push/nsconfig.json b/demo-push/nsconfig.json index d2b232c9..01dbddfc 100644 --- a/demo-push/nsconfig.json +++ b/demo-push/nsconfig.json @@ -1,4 +1,4 @@ { "appPath": "app", "appResourcesPath": "app_resources" -} +} \ No newline at end of file diff --git a/demo-push/package.json b/demo-push/package.json index 3c4fbc1f..0de76aae 100644 --- a/demo-push/package.json +++ b/demo-push/package.json @@ -2,45 +2,32 @@ "nativescript": { "id": "org.nativescript.firebasedemo", "tns-ios": { - "version": "4.2.0" + "version": "6.3.0" }, "tns-android": { - "version": "4.2.0" + "version": "6.3.1" } }, "dependencies": { - "nativescript-plugin-firebase": "file:../publish/package/nativescript-plugin-firebase-6.8.1.tgz", - "nativescript-theme-core": "^1.0.4", - "nativescript-unit-test-runner": "^0.3.4", - "tns-core-modules": "~4.2.0" + "nativescript-plugin-firebase": "file:../publish/package/nativescript-plugin-firebase-10.5.2.tgz", + "nativescript-theme-core": "~1.0.6", + "nativescript-unit-test-runner": "0.7.0", + "tns-core-modules": "~6.3.2" }, "devDependencies": { - "awesome-typescript-loader": "~3.1.3", "babel-traverse": "6.12.0", "babel-types": "6.11.1", "babylon": "6.8.4", - "copy-webpack-plugin": "~4.0.1", - "css-loader": "~0.28.7", - "extract-text-webpack-plugin": "~3.0.0", "filewalker": "0.1.2", "lazy": "1.0.11", "nativescript-css-loader": "~0.26.0", - "nativescript-dev-typescript": "~0.7.1", - "nativescript-dev-webpack": "~0.10.0", - "nativescript-worker-loader": "~0.8.1", - "raw-loader": "~0.5.1", - "resolve-url-loader": "~2.1.0", - "tns-platform-declarations": "~4.2.0", + "nativescript-dev-webpack": "1.0.1", + "tns-platform-declarations": "~6.3.2", "tslint": "~5.4.3", - "typescript": "~2.8.0", - "webpack": "~3.8.1", - "webpack-bundle-analyzer": "^2.8.2", - "webpack-sources": "~1.0.1", - "uglifyjs-webpack-plugin": "~1.1.6", - "clean-webpack-plugin": "~0.1.19" + "typescript": "3.4.5" }, "scripts": { "build.plugin": "cd ../src && npm run build", "ci.tslint": "npm i && tslint --config '../tslint.json' 'app/**/*.ts' --exclude '**/node_modules/**' --exclude '**/typings/**'" } -} \ No newline at end of file +} diff --git a/demo-push/tsconfig.tns.json b/demo-push/tsconfig.tns.json new file mode 100644 index 00000000..95f2ecee --- /dev/null +++ b/demo-push/tsconfig.tns.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "module": "es2015", + "moduleResolution": "node" + } +} diff --git a/demo-vue/.gitignore b/demo-vue/.gitignore new file mode 100644 index 00000000..b4a60da7 --- /dev/null +++ b/demo-vue/.gitignore @@ -0,0 +1,9 @@ +# JetBrains project files +.idea + +# NPM +node_modules + +# NativeScript application +hooks +platforms diff --git a/demo-vue/README.md b/demo-vue/README.md new file mode 100644 index 00000000..ec55eaf1 --- /dev/null +++ b/demo-vue/README.md @@ -0,0 +1,19 @@ +# Firebase Plugin Vue Demo + +> Vue demo app for the NativeScript Firebase plugin + +## Usage + +``` bash +# Install dependencies +npm install + +# Build for production +tns build --bundle + +# Build, watch for changes and debug the application +tns debug --bundle + +# Build, watch for changes and run the application +tns run --bundle +``` \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/app.gradle b/demo-vue/app/App_Resources/Android/app.gradle new file mode 100644 index 00000000..b0f962f4 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/app.gradle @@ -0,0 +1,11 @@ +// Add your native dependencies here: + +android { + defaultConfig { + generatedDensities = [] + applicationId = "org.nativescript.firebasedemo.firestore" + } + aaptOptions { + additionalParameters "--no-version-vectors" + } +} diff --git a/demo-vue/app/App_Resources/Android/google-services.json b/demo-vue/app/App_Resources/Android/google-services.json new file mode 100644 index 00000000..610a6c36 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/google-services.json @@ -0,0 +1,42 @@ +{ + "project_info": { + "project_number": "176080762547", + "firebase_url": "https://n-plugin-test-firestore.firebaseio.com", + "project_id": "n-plugin-test-firestore", + "storage_bucket": "n-plugin-test-firestore.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:176080762547:android:fbe95ab1f255d884", + "android_client_info": { + "package_name": "org.nativescript.firebasedemo.firestore" + } + }, + "oauth_client": [ + { + "client_id": "176080762547-e030nqu3u61ntnq5d3jilip6ik6au4cq.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCbzMMocv610ByMwPvcv2W0h45btMojqLw" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/src/main/AndroidManifest.xml b/demo-vue/app/App_Resources/Android/src/main/AndroidManifest.xml new file mode 100644 index 00000000..ca537b8c --- /dev/null +++ b/demo-vue/app/App_Resources/Android/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png new file mode 100644 index 00000000..64200327 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png new file mode 100644 index 00000000..117b444a Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png new file mode 100644 index 00000000..711905f3 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png new file mode 100644 index 00000000..03befc22 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png new file mode 100644 index 00000000..bd04848e Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png new file mode 100644 index 00000000..af908e46 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png new file mode 100644 index 00000000..cfe4a7c2 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png new file mode 100644 index 00000000..32aa6176 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png new file mode 100644 index 00000000..c21ae444 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml b/demo-vue/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml new file mode 100644 index 00000000..ada77f92 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png new file mode 100644 index 00000000..b06ae267 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png new file mode 100644 index 00000000..12950046 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png new file mode 100644 index 00000000..4ad5346d Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png new file mode 100644 index 00000000..9bc7f010 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png new file mode 100644 index 00000000..541e7591 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png new file mode 100644 index 00000000..bcc40119 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png new file mode 100644 index 00000000..d93c3d8f Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png new file mode 100644 index 00000000..072b6013 Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png new file mode 100644 index 00000000..96acb1ec Binary files /dev/null and b/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png differ diff --git a/demo-vue/app/App_Resources/Android/src/main/res/values-v21/colors.xml b/demo-vue/app/App_Resources/Android/src/main/res/values-v21/colors.xml new file mode 100644 index 00000000..a64641a9 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/src/main/res/values-v21/colors.xml @@ -0,0 +1,4 @@ + + + #3d5afe + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/src/main/res/values-v21/strings.xml b/demo-vue/app/App_Resources/Android/src/main/res/values-v21/strings.xml new file mode 100644 index 00000000..ef994511 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/src/main/res/values-v21/strings.xml @@ -0,0 +1,5 @@ + + + Firebase Plugin Vue Demo + Firebase Plugin Vue Demo + diff --git a/demo-vue/app/App_Resources/Android/src/main/res/values-v21/styles.xml b/demo-vue/app/App_Resources/Android/src/main/res/values-v21/styles.xml new file mode 100644 index 00000000..acff7c9c --- /dev/null +++ b/demo-vue/app/App_Resources/Android/src/main/res/values-v21/styles.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/Android/src/main/res/values/colors.xml b/demo-vue/app/App_Resources/Android/src/main/res/values/colors.xml new file mode 100644 index 00000000..2d0390d8 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/src/main/res/values/colors.xml @@ -0,0 +1,7 @@ + + + #F5F5F5 + #53ba82 + #33B5E5 + #272734 + diff --git a/demo-vue/app/App_Resources/Android/src/main/res/values/strings.xml b/demo-vue/app/App_Resources/Android/src/main/res/values/strings.xml new file mode 100644 index 00000000..ef994511 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/src/main/res/values/strings.xml @@ -0,0 +1,5 @@ + + + Firebase Plugin Vue Demo + Firebase Plugin Vue Demo + diff --git a/demo-vue/app/App_Resources/Android/src/main/res/values/styles.xml b/demo-vue/app/App_Resources/Android/src/main/res/values/styles.xml new file mode 100644 index 00000000..fae0f4b7 --- /dev/null +++ b/demo-vue/app/App_Resources/Android/src/main/res/values/styles.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..4034b76e --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "icon-40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon-60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "icon-29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "icon-40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "icon-76.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "icon-76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "icon-83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "icon-1024.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png new file mode 100644 index 00000000..fe7c5040 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png new file mode 100644 index 00000000..275ddd11 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png new file mode 100644 index 00000000..906e4b4c Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png new file mode 100644 index 00000000..5b9a78e3 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png new file mode 100644 index 00000000..3e4a7ea5 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png new file mode 100644 index 00000000..f1cf7ae0 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png new file mode 100644 index 00000000..a6b0b6fc Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png new file mode 100644 index 00000000..091c1360 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png new file mode 100644 index 00000000..eb0279cf Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png new file mode 100644 index 00000000..42d84e1c Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png new file mode 100644 index 00000000..50f1e707 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png new file mode 100644 index 00000000..11dc75f5 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 00000000..11bfcf55 --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,176 @@ +{ + "images" : [ + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "2436h", + "filename" : "Default-1125h.png", + "minimum-system-version" : "11.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "orientation" : "landscape", + "idiom" : "iphone", + "extent" : "full-screen", + "filename" : "Default-Landscape-X.png", + "minimum-system-version" : "11.0", + "subtype" : "2436h", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "Default-736h@3x.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "736h", + "filename" : "Default-Landscape@3x.png", + "minimum-system-version" : "8.0", + "orientation" : "landscape", + "scale" : "3x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "667h", + "filename" : "Default-667h@2x.png", + "minimum-system-version" : "8.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default@2x.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "extent" : "full-screen", + "idiom" : "iphone", + "subtype" : "retina4", + "filename" : "Default-568h@2x.png", + "minimum-system-version" : "7.0", + "orientation" : "portrait", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait@2x.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape@2x.png", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default.png", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default@2x.png", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "filename" : "Default-568h@2x.png", + "extent" : "full-screen", + "subtype" : "retina4", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait.png", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape.png", + "extent" : "full-screen", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "filename" : "Default-Portrait@2x.png", + "extent" : "full-screen", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "to-status-bar", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "filename" : "Default-Landscape@2x.png", + "extent" : "full-screen", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png new file mode 100644 index 00000000..2913f85d Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png new file mode 100644 index 00000000..d7f17fcd Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png new file mode 100644 index 00000000..b8841540 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png new file mode 100644 index 00000000..faab4b63 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png new file mode 100644 index 00000000..cd94a3ac Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png new file mode 100644 index 00000000..3365ba3c Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png new file mode 100644 index 00000000..a44945c1 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png new file mode 100644 index 00000000..e6dca626 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png new file mode 100644 index 00000000..1a500796 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png new file mode 100644 index 00000000..73d8b920 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png new file mode 100644 index 00000000..9f1f6ce3 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png new file mode 100644 index 00000000..514fc5cd Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json new file mode 100644 index 00000000..4f4e9c50 --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchScreen-AspectFill.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchScreen-AspectFill@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png new file mode 100644 index 00000000..c293f9c7 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png new file mode 100644 index 00000000..233693a6 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json new file mode 100644 index 00000000..23c0ffd7 --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchScreen-Center.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchScreen-Center@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png new file mode 100644 index 00000000..a5a775a2 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png differ diff --git a/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png new file mode 100644 index 00000000..154c1934 Binary files /dev/null and b/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png differ diff --git a/demo-push/app_resources/iOS/GoogleService-Info.plist b/demo-vue/app/App_Resources/iOS/GoogleService-Info.plist similarity index 61% rename from demo-push/app_resources/iOS/GoogleService-Info.plist rename to demo-vue/app/App_Resources/iOS/GoogleService-Info.plist index e0e0fc65..03e23a4d 100644 --- a/demo-push/app_resources/iOS/GoogleService-Info.plist +++ b/demo-vue/app/App_Resources/iOS/GoogleService-Info.plist @@ -7,21 +7,21 @@ AD_UNIT_ID_FOR_INTERSTITIAL_TEST ca-app-pub-3940256099942544/4411468910 CLIENT_ID - 1052836194035-l81fsjai1u40ocnqjcpnoebnnsltt03b.apps.googleusercontent.com + 176080762547-8g2ls3h76dcgdt5uuingun2hiehl49r7.apps.googleusercontent.com REVERSED_CLIENT_ID - com.googleusercontent.apps.1052836194035-l81fsjai1u40ocnqjcpnoebnnsltt03b + com.googleusercontent.apps.176080762547-8g2ls3h76dcgdt5uuingun2hiehl49r7 API_KEY - AIzaSyDuXPZxKamjttwP_hYpnX7MvDoZWhAVVtk + AIzaSyC6yOZO4Kl0yGyRdyH_Z_Q0DysqvNYt3l0 GCM_SENDER_ID - 1052836194035 + 176080762547 PLIST_VERSION 1 BUNDLE_ID - org.nativescript.firebasedemo + org.nativescript.firebasedemo.firestore PROJECT_ID - n-plugin-test + n-plugin-test-firestore STORAGE_BUCKET - n-plugin-test.appspot.com + n-plugin-test-firestore.appspot.com IS_ADS_ENABLED IS_ANALYTICS_ENABLED @@ -33,8 +33,8 @@ IS_SIGNIN_ENABLED GOOGLE_APP_ID - 1:1052836194035:ios:443e3741d53b6bc3 + 1:176080762547:ios:fbe95ab1f255d884 DATABASE_URL - https://n-plugin-test.firebaseio.com + https://n-plugin-test-firestore.firebaseio.com - + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/iOS/Info.plist b/demo-vue/app/App_Resources/iOS/Info.plist new file mode 100644 index 00000000..e4121d54 --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/Info.plist @@ -0,0 +1,65 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + Firebase Plugin Vue Demo + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0.0 + LSRequiresIPhoneOS + + + UIUserInterfaceStyle + Light + UILaunchStoryboardName + LaunchScreen + UIRequiresFullScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + firebasedemovue.page.link + CFBundleURLSchemes + + org.nativescript.firebasedemo.firestore + + + + + + diff --git a/demo-vue/app/App_Resources/iOS/LaunchScreen.storyboard b/demo-vue/app/App_Resources/iOS/LaunchScreen.storyboard new file mode 100644 index 00000000..2ad9471e --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/LaunchScreen.storyboard @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo-vue/app/App_Resources/iOS/app.entitlements b/demo-vue/app/App_Resources/iOS/app.entitlements new file mode 100644 index 00000000..205ac37d --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/app.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.developer.associated-domains + + applinks:j4ctx.app.goo.gl + + + \ No newline at end of file diff --git a/demo-vue/app/App_Resources/iOS/build.xcconfig b/demo-vue/app/App_Resources/iOS/build.xcconfig new file mode 100644 index 00000000..1432ac5e --- /dev/null +++ b/demo-vue/app/App_Resources/iOS/build.xcconfig @@ -0,0 +1,10 @@ +// You can add custom settings here +// for example you can uncomment the following line to force distribution code signing +// CODE_SIGN_IDENTITY = iPhone Distribution +// To build for device with Xcode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html +// DEVELOPMENT_TEAM = YOUR_TEAM_ID; +ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; +ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + +CODE_SIGN_ENTITLEMENTS = demovue/demovue.entitlements +DEVELOPMENT_TEAM = 8Q5F6M3TNS diff --git a/demo-vue/app/app.scss b/demo-vue/app/app.scss new file mode 100644 index 00000000..59ab05ad --- /dev/null +++ b/demo-vue/app/app.scss @@ -0,0 +1,10 @@ +// NativeScript core theme +// @see https://docs.nativescript.org/ui/theme +@import '~nativescript-theme-core/scss/dark'; + +// Override variables here + +@import '~nativescript-theme-core/scss/index'; + +// Global SCSS styling +// @see https://docs.nativescript.org/ui/styling diff --git a/demo-vue/app/assets/images/NativeScript-Vue.png b/demo-vue/app/assets/images/NativeScript-Vue.png new file mode 100644 index 00000000..2ad8ed20 Binary files /dev/null and b/demo-vue/app/assets/images/NativeScript-Vue.png differ diff --git a/demo-vue/app/components/App.vue b/demo-vue/app/components/App.vue new file mode 100644 index 00000000..173a11e8 --- /dev/null +++ b/demo-vue/app/components/App.vue @@ -0,0 +1,47 @@ + + + + + \ No newline at end of file diff --git a/demo-push/app/vendor-platform.ts b/demo-vue/app/fonts/.gitkeep similarity index 100% rename from demo-push/app/vendor-platform.ts rename to demo-vue/app/fonts/.gitkeep diff --git a/demo-vue/app/main.js b/demo-vue/app/main.js new file mode 100644 index 00000000..39ede95f --- /dev/null +++ b/demo-vue/app/main.js @@ -0,0 +1,24 @@ +import Vue from "nativescript-vue"; +import App from "./components/App"; + +const firebase = require("nativescript-plugin-firebase"); + +// Prints Vue logs when --env.production is *NOT* set while building +Vue.config.silent = (TNS_ENV === "production"); + +firebase.init({ + // can be used to catch in-app-messaging dynamic links, but it's not mandatory + onDynamicLinkCallback: result => { + console.log("Dynamic Link received: " + result); + console.log("Dynamic Link received, url: " + result.url); + if (result.url.indexOf("/shit") > -1) { + // note that you could deeplink/route the user now, but let's just show an alert + } + } +}) + .then(() => console.log("Firebase initialized")) + .catch(error => console.log("Error initializing Firebase: " + error)); + +new Vue({ + render: h => h('frame', [h(App)]) +}).$start(); diff --git a/demo-vue/app/package.json b/demo-vue/app/package.json new file mode 100644 index 00000000..1296b84f --- /dev/null +++ b/demo-vue/app/package.json @@ -0,0 +1,9 @@ +{ + "android": { + "v8Flags": "--expose_gc" + }, + "discardUncaughtJsExceptions": true, + "main": "main", + "name": "demo-vue", + "version": "1.0.0" +} diff --git a/demo-vue/firebase.nativescript.json b/demo-vue/firebase.nativescript.json new file mode 100644 index 00000000..06277437 --- /dev/null +++ b/demo-vue/firebase.nativescript.json @@ -0,0 +1,20 @@ +{ + "external_push_client_only": false, + "using_ios": true, + "using_android": true, + "firestore": false, + "realtimedb": false, + "authentication": true, + "remote_config": false, + "performance_monitoring": false, + "messaging": false, + "in_app_messaging": true, + "crashlytics": false, + "storage": false, + "functions": false, + "facebook_auth": false, + "google_auth": false, + "admob": false, + "dynamic_links": true, + "ml_kit": false +} \ No newline at end of file diff --git a/demo-vue/package.json b/demo-vue/package.json new file mode 100644 index 00000000..aa9f31e5 --- /dev/null +++ b/demo-vue/package.json @@ -0,0 +1,44 @@ +{ + "name": "demo-vue", + "version": "1.0.0", + "description": "Vue demo app for the NativeScript Firebase plugin", + "author": "EddyVerbruggen ", + "license": "MIT", + "nativescript": { + "id": "org.nativescript.firebasedemo.firestore", + "tns-ios": { + "version": "6.3.0" + }, + "tns-android": { + "version": "6.3.1" + } + }, + "dependencies": { + "nativescript-plugin-firebase": "file:../publish/package/nativescript-plugin-firebase-10.5.2.tgz", + "nativescript-theme-core": "~1.0.6", + "nativescript-vue": "~2.4.0", + "tns-core-modules": "~6.3.2" + }, + "devDependencies": { + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "babel-loader": "^8.0.2", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "clean-webpack-plugin": "^0.1.19", + "copy-webpack-plugin": "^4.5.2", + "css-loader": "^1.0.0", + "lazy": "1.0.11", + "nativescript-dev-webpack": "next", + "nativescript-vue-template-compiler": "^2.0.0", + "nativescript-worker-loader": "~0.9.0", + "node-sass": "^4.9.2", + "sass-loader": "^7.1.0", + "terser-webpack-plugin": "^1.1.0", + "vue-loader": "^15.2.6", + "webpack": "^4.16.4", + "webpack-bundle-analyzer": "~2.13.1", + "webpack-cli": "^3.1.0" + } +} diff --git a/demo/app/app.css b/demo/app/app.css index bdc22f54..aee31cc9 100644 --- a/demo/app/app.css +++ b/demo/app/app.css @@ -73,8 +73,8 @@ button { background-color: #d52c1e; } -.button-invites { - background-color: #1832d5; +.button-performance { + background-color: #d57c13; } .barcodescanner { diff --git a/demo/app/app.ts b/demo/app/app.ts index cff81d12..13abbaa5 100644 --- a/demo/app/app.ts +++ b/demo/app/app.ts @@ -1,13 +1,11 @@ -import "./bundle-config"; -import * as application from 'tns-core-modules/application'; -import { UnhandledErrorEventData } from "tns-core-modules/application"; +import { Application, UnhandledErrorEventData } from "@nativescript/core"; // added this here so we can do some wiring -require("nativescript-plugin-firebase"); +require("@nativescript/firebase"); // testing this.. we may be able to hook that up to Crashlytics. Either via docs, or automatically. -application.on(application.uncaughtErrorEvent, (args: UnhandledErrorEventData) => { +Application.on(Application.uncaughtErrorEvent, (args: UnhandledErrorEventData) => { console.log("[app.js]: Uncaught NativeScript Error: " + args.error); }); -application.run({ moduleName: "main-page" }); +Application.run({ moduleName: "main-page" }); diff --git a/demo/app/bundle-config.ts b/demo/app/bundle-config.ts deleted file mode 100644 index 436a04d5..00000000 --- a/demo/app/bundle-config.ts +++ /dev/null @@ -1,9 +0,0 @@ -if (global.TNS_WEBPACK) { - // registers tns-core-modules UI framework modules - require("bundle-entry-points"); - - // register application modules - // This will register each `page` postfixed xml, css, js, ts, scss etc. in the app/ folder - const context = require.context("~/", true, /(page|fragment)\.(xml|css|js|ts|scss|less|sass)$/); - global.registerWebpackModules(context); -} \ No newline at end of file diff --git a/demo/app/main-page.ts b/demo/app/main-page.ts index c4b4abc4..f88ddf6c 100644 --- a/demo/app/main-page.ts +++ b/demo/app/main-page.ts @@ -1,12 +1,11 @@ -import * as observable from 'tns-core-modules/data/observable'; -import * as pages from 'tns-core-modules/ui/page'; -import { HelloWorldModel } from './main-view-model'; +import { EventData, Page } from "@nativescript/core"; +import { HelloWorldModel } from "./main-view-model"; const model = new HelloWorldModel(); // Event handler for Page 'loaded' event attached in main-page.xml -export function pageLoaded(args: observable.EventData) { +export function pageLoaded(args: EventData) { // Get the event sender - let page = args.object; + let page = args.object; page.bindingContext = model; } diff --git a/demo/app/main-page.xml b/demo/app/main-page.xml index c0f04833..cac7c866 100644 --- a/demo/app/main-page.xml +++ b/demo/app/main-page.xml @@ -18,7 +18,7 @@