nativescript-firebase ios initialisation ReferenceError: FIROptions is not defined - javascript

I have an issue with the firebase initialisation on my nativescript app (nativescript-vue).
I am using the nativescript-firebase plugin from https://github.com/EddyVerbruggen/nativescript-plugin-firebase
Here is my initialisation:
import { messaging } from "#nativescript/firebase/messaging";
import { firebase } from "#nativescript/firebase"
firebase.init({
onMessageReceivedCallback: function(message) {
//do stuff
}
}).then(function () {
//do stuff
},function (error) {
console.log("firebase.init error: " + error);
});
This works fine on android, but on ios, I get the error from my console.log
ReferenceError: FIROptions is not defined
My firebase.nativescript.json file is the following:
{
"using_ios": true,
"using_android": true,
"analytics": true,
"firestore": false,
"realtimedb": false,
"authentication": false,
"remote_config": false,
"performance_monitoring": false,
"external_push_client_only": false,
"messaging": true,
"in_app_messaging": false,
"crashlytics": false,
"storage": false,
"functions": false,
"facebook_auth": false,
"google_auth": false,
"admob": false,
"dynamic_links": false,
"ml_kit": false
}
I have tried removing and adding the plugin and running ns clean on my project but it didn't change anything.
Another issue I have is that I do not get prompted the questions (the ones that fill up the json file) when I add the plugin. On android I had to go to node_modules/#nativescrpt/firebase and run npm run config to get the questions. However, this command does nothing on ios. I have no error, in my terminal, but nothing happens.

I got it to work, the two issues were indeed linked. I had to run npm run config for the plugin to work correctly.
It turns out I was using an old version of npm. Updating npm and running npm run config again fixed my issue

Related

VSCode Settings.json and key groupings

I am trying to understand the structure of the Visual Studio Code settings.json file. As I can see, there are multiple settings that appear to be JSON objects but are set separately. Take the following for example:
"javascript.autoClosingTags": true,
"javascript.suggest.autoImports": true,
"javascript.updateImportsOnFileMove.enabled": "always",
Now I am wondering if it is possible to turn this into something like the following:
"javascript": {
"autoClosingTags": true,
"suggest": {
"autoImports": true,
}
"updateImportsOnFileMove": {
"enabled": "always"
}
}
I have tried it with one or two settings but did not see an immediate difference which leads me to believe that this is indeed possible. On the other hand, I did get a few other seemingly unrelated errors, including failure of settings sync for me which has left me unconvinced.
Now I know this is possible for per-language settings like the following:
"[python]": {
"editor.defaultFormatter": "ms-python.python",
"editor.formatOnPaste": false
},
But can we do that for editor key for example:
"editor.fontLigatures": true,
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
"editor.formatOnSaveMode": "file",
"editor.formatOnType": false,

How to add a screenshot on a test failure using Appium and WebdriverIO

I currently have multiple wdio.config files due to the multiple apps in my end to end suite
it looks like this and all these files have the allure reporting command in it and my reports are working fine:
every file has an allure reporting command like this:
reporters: [['allure', {
outputDir: 'allure-results',
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: true,
}]],
and also the desired capabilities like this:
capabilities: {
App: {
port: 4723,
capabilities: {
platformName: 'iOS',
'appium:platformVersion': '13.6',
'appium:orientation': 'PORTRAIT',
'appium:noReset': true,
'appium:newCommandTimeout': 240,
"appium:platformName": "iOS",
"appium:deviceName": "iPhone 8",
"appium:bundleId": "com.app",
}
},
},
and i also have a separate general wdio file which a general file and have not added much in it.
afterStep: function (test, context, { error, result, duration, passed, retries }) {
if (error) {
browser.takeScreenshot();
}
}
I have tried adding the after hook in the custom wdio config file as well but i am not able to have the screenshot on failure. i have also used App.takeScreenshot(); command as well instead of using browser.takeScreenshot(); but no luck.
Not sure about appium part but below code as you also have used in wdio.conf.js (or may be custom wdio file) works in webdriverio. I have used it in my framework.
afterTest: function(test, context, { error, result, duration, passed, retries }) {
if (!passed) {
browser.takeScreenshot();
}
},
This should work:
afterTest: async function (test) {
browser.saveScreenshot("browserfull.png")
// OR
driver.saveScreenshot("driverfull.png")
}

How to lint Angular *.html files from command line?

I would like to lint html angular template files via the command line, similar to:
ng lint
I would like to validate the Angular html templates to check they are valid and the variables are correct, so I can run this in a CI pipeline like Travis or AWS Codebuild.
Visual studio code runs Angular Language Services and can do this:
What I want is to capture these errors, so that I don't let invalid Angular html templates get into releases.
How can I achieve this?
What you are seeing here is in fact a Typescript error, not a lint error.
There is an option fullTemplateTypeCheck that allows you to capture such errors during build when AOT is activated:
This option tells the compiler to enable the binding expression validation phase of the template compiler which uses TypeScript to validate binding expressions.
This option is false by default.
Note: It is recommended to set this to true because this option will default to true in the future.
This can in fact slow down your build considerably, so what you can do if you only want to use this in the CI pipeline:
Create a new tsconfig.strict.json next to your tsconfig.app.json like this:
{
"extends": "./tsconfig.app.json",
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
In angular.json add a new configuration "strictProd" under projects>YourProject>architect>build>configurations that looks like this:
"strictProd": {
"tsConfig": "src/tsconfig.app.strict.json",
"aot": true
[...your other prod settings here],
}
Run it with ng build -c strictProd
The best thing I have found is the html hint node package. You can read about it here: https://htmlhint.com/docs/user-guide/getting-started
Here is settings for the .htmlhintrc that work with Angular.
{
"tagname-lowercase": true,
"attr-lowercase": false,
"attr-value-double-quotes": true,
"attr-value-not-empty": false,
"attr-no-duplication": true,
"doctype-first": false,
"tag-pair": true,
"tag-self-close": true,
"empty-tag-not-self-closed": true,
"spec-char-escape": false,
"id-unique": false,
"src-not-empty": true,
"title-require": true,
"alt-require": true,
"doctype-html5": true,
"id-class-value": "true",
"style-disabled": true,
"inline-style-disabled": true,
"inline-script-disabled": true,
"space-tab-mixed-disabled": "true",
"id-class-ad-disabled": true,
"href-abs-or-rel": false,
"attr-unsafe-chars": true,
"head-script-disabled": true
}

TypeError: Cannot read property 'getInitialNotification' of undefined

I am trying to implement react-native-push-notification in my react-native app currently testing on an Android device.
I have implemented the configure function inside componentDidMount as below
componentDidMount() {
PushNotification.configure({
onRegister: token => console.log('Token', token),
onNotification: notification => console.log('NOTIFICATION', notification),
permissions: {
alert: true,
badge: true,
sound: true
},
popInitialNotification: true,
requestPermissions: true,
});
PushNotification.localNotification(AppData.Notifications.localNotification);
}
When I reload the the app, I get error: TypeError: Cannot read property 'getInitialNotification' of undefined
I am pretty new to react-native-push-notification and must be getting something small wrong
I was able to solve problem by editing android/app/build.gradle and adding the necessary dependencies as listed in the documentation.
This had to be done even when react-native link is used.
I cleaned, and rebuilt the project and the notification worked.
You can try for push notification, its pretty much good, easy to implement and works smoothly.
https://github.com/evollu/react-native-fcm

grunt-autoshot 'cannot call method 'createPage' of undefined'

I'd like to get grunt-autoshot working to take screenshots of my project, but there seems to be one small hitch I can't find.
I've reconfigured the grunt.initConfig commands different ways and can't seem to get this to work. this is all locally hosted, the server is loading properly and i can see my sample files ('index.html') when grunt server is turned on . Below is what I'm using now based off the example page
Error: 'Fatal error: Cannot call method 'createPage' of undefined'
autoshot: {
default_options: {
options: {
// necessary config
path: 'screenshots/',
local: {
path: './test',
port: 9000,
files: [{
src: 'index.html',
dest: 'index.jpg'
}]
},
viewport: [
'320x480', '480x320', '384x640', '640x384', '602x963', '963x602', '600x960', '960x600', '800x1280', '1280x800', '768x1024', '1024x768'
]
},
},
},
You need to install PhantomJS.
If you're on a Mac you can do:
brew update && brew install phantomjs
Otherwise visit http://phantomjs.org/download.html
I was working with a friend and we just run into the same problem.
It looks like it's because of the phantomjs' version. I was using 1.9.2 and I was getting the same error, download and install 1.9.0 and it'll work (it did for me) you can download it from here: https://code.google.com/p/phantomjs/downloads/detail?name=phantomjs-1.9.0-macosx.zip&can=1&q=

Categories

Resources