Hi guys, I am trying to set Ionic Pro but I am facing some problems.
When I run Pro.deploy.getConfiguration()
it gives me wrong information like for example that the UPDATE_METHOD
is background
or that the WARN_BUG
field is set at true.
This is how I have everything up:
Package.json (matching config.xml):
"cordova-plugin-ionic": {
"APP_ID": "...",
"CHANNEL_NAME": "Master",
"UPDATE_METHOD": "none",
"MAX_STORE": "2",
"WARN_DEBUG": "false",
"UPDATE_API": "https://api.ionicjs.com",
"MIN_BACKGROUND_DURATION": "30"
}
App.module.ts:
Pro.init('...', {
appVersion: '0.0.1'
})
@Injectable()
export class MyErrorHandler implements ErrorHandler {
ionicErrorHandler: IonicErrorHandler;
constructor(injector: Injector) {
try {
this.ionicErrorHandler = injector.get(IonicErrorHandler);
} catch(e) {
}
}
handleError(err: any): void {
Pro.monitoring.handleNewError(err);
this.ionicErrorHandler && this.ionicErrorHandler.handleError(err);
}
}
App.component.ts, where I call my custom method to perform the update:
constructor(private platform: Platform,
private statusBar: StatusBar,
private splashScreen: SplashScreen,
private pro: ProUpdateProvider
) {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
if(this.platform.is('mobileweb') || this.platform.is('core')) {
this.setRootPage();
} else {
this.pro.update();
}
});
}
And pro-update.ts, where I hava the this.pro.update()
method:
public async update(): Promise<any> {
let nav = this.app.getActiveNav();
const update = await Pro.deploy.checkForUpdate();
if(update.available) {
nav.insert(0, PAGES.UPDATE);
this.message = "Actualizando aplicación";
await Pro.deploy.downloadUpdate((progress) => {
this.progress = progress;
});
this.progress = 0;
this.message = "Aplicando actualización";
await Pro.deploy.extractUpdate((progress) => {
this.progress = progress;
})
this.progress = 0;
this.message = "Actualizando..."
await Pro.deploy.reloadApp();
} else {
nav.insert(0, PAGES.HOME);
}
console.log(await Pro.deploy.getConfiguration())
}
This is what console.log(await Pro.deploy.getConfiguration())
from the last file gives me:
appId:"..."
channel:"Master"
currentVersionId:"...
debug:"true"
host:"https://api.ionicjs.com"
maxVersions:2
minBackgroundDuration:30
updateMethod:"background"
Why is this? I had it set to background
before but now I want to do some thing while updating and I want to uses none
as update method for so.
The weird thing is that it works as I have it, it shows one page or other depending wether it updates or not and it actually updates.
But I wanna know how to fix this since sometimes I want to use none
and sometimes background
depending on a variable I’ll send on a silent notification.
How can I solve this?
Thanks-