Working example of #nativescript/firebase-firestore - google-cloud-firestore

I am trying to use the #nativescript/firebase-firestore and #nativescript/firebase-core plugin from Nativescript in my Nativescript angular project.
I ran
npm install #nativescript/firebase-core
npm install #nativescript/firebase-firestore
and put this code to my blank native script angular project.
import { firebase } from '#nativescript/firebase-core'
import '#nativescript/firebase-firestore'
const firestore = firebase().firestore()
I was not able to make this work for IOS due to some compatibility issues.
My questions : Has anybody put this to work and could provide me a working example?
Here is my package.json :
{
"name": "fb3",
"main": "./src/main.ts",
"version": "1.0.0",
"private": true,
"dependencies": {
"#angular/animations": "~15.0.0",
"#angular/common": "~15.0.0",
"#angular/compiler": "~15.0.0",
"#angular/core": "~15.0.0",
"#angular/forms": "~15.0.0",
"#angular/platform-browser": "~15.0.0",
"#angular/platform-browser-dynamic": "~15.0.0",
"#angular/router": "~15.0.0",
"#nativescript/angular": "~15.0.0",
"#nativescript/core": "~8.4.0",
"#nativescript/firebase-core": "^2.5.2",
"#nativescript/firebase-firestore": "^2.5.2",
"#nativescript/theme": "~3.0.2",
"rxjs": "~7.5.0",
"zone.js": "~0.11.5"
},
"devDependencies": {
"#angular-devkit/build-angular": "~15.0.0",
"#angular/compiler-cli": "~15.0.0",
"#nativescript/ios": "8.3.3",
"#nativescript/types": "~8.4.0",
"#nativescript/webpack": "~5.0.12",
"#ngtools/webpack": "~15.0.0",
"typescript": "~4.8.4"
}
}
It seems that there are issues with min required iOS version is 11.0 so I added
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
to my build.xcconfig.

Related

Error: “Unresolved function or method present()” when using LoadingController

ISSUE:
When I use the LoadingController in my project, I see the following error: "Unresolved function or method present()"
Here is the screenshot code that I have in my file:
As we can see from the screenshot, there are 2 pieces of code that show the same error. The code from lines: 51-61 are a direct copy of the code from the ionic documentation that can be seen under Usage
The code from lines: 63-69 are the trimmed down and basic version of the code and for testing purposes await is removed in front of the loading.present();. Yet it throws the same error as the original code above.
GOAL:
What can we do to fix the issue so that Intellij Idea (IDE) stops complaining about the same?
Following is the info from my package.json:
{
"name": "gf",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/common": "~8.1.2",
"#angular/compiler": "~8.1.2",
"#angular/core": "~8.1.2",
"#angular/forms": "~8.1.2",
"#angular/platform-browser": "~8.1.2",
"#angular/platform-browser-dynamic": "~8.1.2",
"#angular/router": "~8.1.2",
"#ionic-native/core": "^5.0.0",
"#ionic-native/splash-screen": "^5.0.0",
"#ionic-native/status-bar": "^5.0.0",
"#ionic/angular": "^4.7.1",
"#ionic/storage": "^2.2.0",
"cordova-sqlite-storage": "^3.2.1",
"core-js": "^2.5.4",
"rxjs": "~6.5.1",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/architect": "~0.801.2",
"#angular-devkit/build-angular": "~0.801.2",
"#angular-devkit/core": "~8.1.2",
"#angular-devkit/schematics": "~8.1.2",
"#angular/cli": "~8.1.2",
"#angular/compiler": "~8.1.2",
"#angular/compiler-cli": "~8.1.2",
"#angular/language-service": "~8.1.2",
"#ionic/angular-toolkit": "~2.0.0",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-sqlite-storage": {}
}
}
}
No sure it is the right way to do it but i managed to Intellij to stop whining
return (<any>loading).present();

RxJS module give error after update. how to solve?

In my angular 5 project. My imports have been producing weird errors that I cant remember having a few days ago. For the import here below it says: "module ...rxjs/observable has no exported member observable".
import { Observable } from 'rxjs/Observable';
I did not have this before.
Funny thing is however, the angular website, including the functionality with the observable, works just fine
Here is my package.json:
"private": true,
"dependencies": {
"#angular-devkit/core": "0.0.29",
"#angular/animations": "^5.2.0",
"#angular/cdk": "^5.2.5",
"#angular/common": "^5.2.0",
"#angular/compiler": "^5.2.0",
"#angular/core": "^5.2.0",
"#angular/forms": "^5.2.0",
"#angular/material": "^5.2.0",
"#angular/material-moment-adapter": "^5.2.5",
"#angular/platform-browser": "^5.2.0",
"#angular/platform-browser-dynamic": "^5.2.0",
"#angular/router": "^5.2.0",
"bootstrap": "^4.0.0",
"core-js": "^2.4.1",
"jsonwebtoken": "^8.2.0",
"moment": "^2.20.1",
"moment-duration-format": "^2.2.2",
"npm": "^5.6.0",
"rxjs": "^5.5.12",
"zone.js": "^0.8.19"
},
Unfortunately, I do not know how to solve the import problem. However, I think it might be worth mentioning that I experienced a similar issue when updating to the latest version for Angular 6, that is to say rxjs 6.3.0. So I downgraded to 6.2.1, which made the import errors go away.

VS Code Typescript intellisense does not read correctly Typings

I have installed in my Ionic 3 project pdfjs-dist from npm and the typings from DT, but I do not get the correct intellisense, look: http://imgur.com/ctIqkE7
VS Code: 1.12.2
Typescript: 2.3.3
In my typings folder I have:
Typings
Globals
pdf
index.d.ts
My tsconfig.json says:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"allowJs": true
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
and my dependencies are:
"dependencies": {
"#angular/common": "4.1.2",
"#angular/compiler": "4.1.2",
"#angular/compiler-cli": "4.1.2",
"#angular/core": "4.1.2",
"#angular/forms": "4.1.2",
"#angular/http": "4.1.2",
"#angular/platform-browser": "4.1.2",
"#angular/platform-browser-dynamic": "4.1.2",
"#ionic-native/core": "3.10.2",
"#ionic-native/splash-screen": "3.10.2",
"#ionic-native/status-bar": "3.10.2",
"#ionic/storage": "2.0.1",
"#types/pdf": "0.0.31",
"cordova-android": "^6.2.3",
"cordova-ios": "^4.4.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.3.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"pdfjs-dist": "^1.8.428",
"rxjs": "5.1.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.7",
"#ionic/cli-plugin-cordova": "1.3.0",
"#ionic/cli-plugin-ionic-angular": "1.3.0",
"typescript": "2.3.3"
},
I have looked other questions here like this or this and did not find an solution.
Edit:
I had added updated my includes with the path to the dt typings "typings/**/*.d.ts" and I had this warning while compiling:
typescript: node_modules/#types/pdf/index.d.ts, line: 51
Duplicate string index signature.
L51: * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what]
L52: **/
That point me out that the types are not been reading from typings/** but from node_modules/#types/. I took a look and saw that both index.d.ts files are exactly the same so I uninstalled the typings outside node.
After a while of looking into it I have two main theories about my problem.
1. I do not know what I am doing (Very possible)
2. The Typings are wrong and/or Outdated.
I have found a PDFJSStatic interface that contains the "unintellisensed" method in my screen capture that is exported in the typings. If I do something like:
import * as PDF_JS from 'pdfjs-dist';
let pdfjsLib : PDFJSStatic = PDF_JS;
I finally get Info about the getDocument() method but a lot of other functions get broken.
If I get the PDFJSStatic as an own variable:
var PDFJSStatic : PDFJSStatic = pdfjsLib.PDF;
The intellisense works but obviously the functions does not exist.

Error While Adding New Provider in ionic

When i try to add a new provider to my existing ionic project it throws
The generate command is only available for projects t
hat use ionic-angular >= 3.0.0
I tried the following command to upgrade but it doesn't worked out
>npm install --save ionic-angular
My Ionic Version is 3.2.0
My Package.json looks
"dependencies": {
"#angular/common": "2.4.8",
"#angular/compiler": "2.4.8",
"#angular/compiler-cli": "2.4.8",
"#angular/core": "2.4.8",
"#angular/forms": "2.4.8",
"#angular/http": "2.4.8",
"#angular/platform-browser": "2.4.8",
"#angular/platform-browser-dynamic": "2.4.8",
"#angular/platform-server": "2.4.8",
"#angular/tsc-wrapped": "~0.5.2",
"#ionic/storage": "2.0.0",
"ionic-angular": "^2.3.0",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"lodash-es": "^4.17.4",
"node-uuid": "^1.4.7",
"rxjs": "5.0.1",
"sw-toolbox": "3.4.0",
"uuid": "^2.0.2",
"zone.js": "0.7.2"
}

Cannot find namespace 'moment'

I am using ionic 2.
I create new project
ionic start Ismart --v2
The project was successfully created.
I tried to run the project using ionic serve
I am getting this err
Cannot find namespace 'moment'
Here is my Package.Json
{
"name": "ionic-hello-world",
"version": "0.0.0",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "4.0.2",
"#angular/compiler": "4.0.2",
"#angular/compiler-cli": "4.0.2",
"#angular/core": "4.0.2",
"#angular/forms": "4.0.2",
"#angular/http": "4.0.2",
"#angular/platform-browser": "4.0.2",
"#angular/platform-browser-dynamic": "4.0.2",
"#ionic-native/core": "3.4.2",
"#ionic-native/splash-screen": "3.4.2",
"#ionic-native/status-bar": "3.4.2",
"#ionic/storage": "2.0.1",
"ionic-angular": "3.1.0",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.5"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.6",
"typescript": "~2.2.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "ISmartpremises: An Ionic project"
}
How can i fix this issue...
Kindly advice me,
Thanks
I cannot see any issue in your package.json file.I think you have forgotten to change the directory.
You can try as shown below.
d:\ionic2 > ionic start Ismart blank --v2
d:\ionic2\Ismart> ionic serve