Pro.deploy.getConfiguration() giving me wrong info

#1

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-

#2

I have tried uninstalling the plugin and installing it back and now it shows none why is this? Shoulnd’t it change depending on what I set in the package.json and config.xml?

#3

It probably shows what was set when adding/installing it to the platform. You could have also updated the value by running cordova platform rm ios and cordova platform add ios (or android). The configuration in config.xml and package.json (or command line) is not used at runtime, but at project creation time.

#4

I don’t like that :confused: .

Thanks!