Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70433

Manual Deploy not working for me

$
0
0

@pdemilly wrote:

I have used deploy appflow succesfully for some time but now I would like to implement a beta channel for my app (ionic v3).

My app is currently setup as auto on Production channel. I wwould like to add an option in the app to try the beta channel version. Since many of the doc seems outaded, I am trying my best to understand the steps but it is not working. The first thing I see in my console which is surprising is an info that says: cordova-plugin-ionic has been disabled. Searching on the web, it seems that it could be something to do with fetch not being present even though window.fetch in the console returns me a functton. I even try to import ‘whatwg-fetch’; as suggested by others.

Here are the steps I do. In my app.module.ts I include import { Deploy } from ‘cordova-plugin-ionic/dist/ngx’; and define Deploy in my providers: .

I then create a service which change the channel and try to download if a new version is available.

    let progress = this.loadingCtrl.create({ content: 'Checking for new update' });
    progress.present();

    try {

      await Deploy.configure({ channel: action.channel, debug: true });
      const update = await Deploy.checkForUpdate();
      console.log('check for update : ', update.available);

      if (update.available) {
        progress = this.loadingCtrl.create({ content: 'Downloading new update' });
        progress.present();
        const downloaded = await Deploy.downloadUpdate((p) => console.log(`downloading: ${p}%`));
        if (downloaded) {
          progress.dismiss();
          progress = this.loadingCtrl.create({ content: 'Extracting new update' });
          const extracted = await Deploy.extractUpdate((p) => console.log(`extracting: ${p}%`));
          if (extracted) {
            progress.dismiss();
            progress = this.loadingCtrl.create({ content: 'Restarting now ...' });
            return Deploy.reloadApp();
          } else {
            progress.dismiss();
            const alert = this.alertCtrl.create({ message: 'Extraction failed', buttons: ['RESTART'] });
            alert.present();
            return Deploy.reloadApp();
          }

        } else {
          progress.dismiss();
          const alert = this.alertCtrl.create({ message: 'Download failed', buttons: ['RESTART'] });
          alert.present();
          return Deploy.reloadApp();
        }
      }

      return progress.dismissAll();

    }
    catch (err) {
      console.error(`error updating app: ${err}`);
      progress.dismissAll();
    }
  }

Any help or working code appreciated

Pascal

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70433

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>