ionic-team / ionic-starter-super

The Ionic 2 Super Starter 🎮

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cosmetics - get rid of warnings when in 'serve' mode

adamjakab opened this issue · comments

Hi, just a quick suggestion for all starter projects - if you surround this:

this.statusBar.styleDefault();
this.splashScreen.hide();

like this:

if(!this.platform.is("core")){
        this.statusBar.styleDefault();
        this.splashScreen.hide();
}

you can get rid of the annoying warnings when in 'serve' mode:

Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

Not wrong, but core is defined as:

on a desktop device.

https://ionicframework.com/docs/api/platform/Platform/#is

This means that opening the app as a PWA in a mobile browser still would throw these errors - that's why this would be not a good recommended best practice. Agree?

What would actually be required/useful would be to be able to check if we are in a native (or maybe cordova, because that's essentially what it means) context.

Well this check should be okay for Cordova plugins then....

if(this.platform.is("cordova")){
        this.statusBar.styleDefault();
        this.splashScreen.hide();
}

I close this issue because the super starter template follows our guidelines from the other starter templates (blank, tabs, ...).
You can ignore warnings in the console output.