ionicpro-deploy v1.1.5
Ionic Pro Deploy
Access the Ionic Pro Deploy API using Promises and/or Observable based methods.
Usage
Installation
Ensure you have the Ionic Pro Plugin installed see their Setup Docs
Install this module by running the following command:
npm i --save ionicpro-deploy
Import
IonicProDeployModule
in the@NgModule
where it is to be used.
import { IonicProDeployModule } from 'ionicpro-deploy';
@NgModule({
...
imports: [
...
IonicProDeployModule.forRoot()
]
})
Optionally, an IonicProConfig object can be passed to use a different app configuration than that provided during installation of the plugin.
imports: [
...
IonicProDeployModule.forRoot({
channel: 'Development'
})
]
- Inject
IonicProDeployService
as a dependency in the constructor of the object in which it will be used.
@Component({
...
})
export class MyAwesomePage {
constructor(private proDeploy: IonicProDeployService) {
...
}
}
Usage
The following methods are available for use from the injected provider.
init(config)
Initialize the deploy plugin
Parameters
config: IonicProConfig
- App configuration
check()
Check for updates from specified channel
Returns: Promise<(boolean|string)>
- Resolves with
boolean
:true
- if updates are available and compatible with the current binary version
false
- if updates are available but incompatible with the current binary version
- or currently unable to check for updates
- Rejects with error message
string
- if update information is not available
download()
Download an available and compatible update
Returns: Observable<number>
- Emits the download percentage
- completes when download complete
update()
Complete a full update cycle (download, extract) with or without redirect
Parameters
autoReload: boolean
- TRUE: Redirect when complete (default)
- FALSE: Complete with no redirect
Returns: Observable<UpdateProgress>
- Emits the download then extract percentage and the step being completed
interface UpdateProgress {
/** Name of the step being completed */
step: string;
/** Percent progress for the current step */
percent: number;
}
extract()
Extract a downloaded archive
Returns: Observable<number>
- Emits the extract percentage
- completes when download complete
redirect()
Redirect to the latest version of the app on this device
info()
Retrieve information about the current installed build
getVersions()
List downloaded versions on this device
deleteVersion(version)
Delete a downloaded version on this device
Parameters
version: string
- UUID of the deploy version downloaded to device