A Module to handle getting and using an evergreen update made with the Blink Buildbots
npm i --save @blinkmobile/evergreen-sdk
- Apache Cordova
- ionic-plugin-deploy
For iOS < 10 and older Android projects dist/bm-evergreen-updater-legacy.js
should be used. This includes the WhatWG fetch pollyfil and is transpiled from ES6 to ES5. ES6 builds using import
will include src/evergreen-updater.js
You must make sure the deviceready
event from cordova has fired before using this plugin
const EvergreenUpdater = require('@blinkmobile/evergreen-sdk')
document.addEventListener('deviceready', function () {
const eu = new EvergreenUpdater({ appId: 'appId', tenantId: 'blinkTenantId' })
eu.check().then((updateAvailable) => {
if (updateAvailable) {
return eu.download().then(() => eu.restart())
}
})
})
options.appId
: Your Cordova app id fromconfig.xml
options.tenantId
: Your Blink Mobile Tenant Idoptions.ionicDeploy
: The Ionic Deploy plugin (optional, will use window.IonicDeploy if not specified)options.platformId
: The cordova platform id (optional, will use cordova.platformId if not specified)
Resolves with true
if an update is available, false
if not
progressCB
: called whenever Ionic Deploy reports progress.stage
will be one of 'download' or 'extract',progress
is the percent complete for that particular stage
Resolves on successful download, rejects if an error occurred
Applies the update and restarts the app