Access the Ionic Pro Deploy API using Promises and/or Observable based methods.
-
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) {
...
}
}
The following methods are available for use from the injected provider.
Initialize the deploy plugin
Parameters
config: IonicProConfig
- App configuration
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 an available and compatible update
Returns: Observable<number>
- Emits the download percentage
- completes when download complete
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 a downloaded archive
Returns: Observable<number>
- Emits the extract percentage
- completes when download complete
Redirect to the latest version of the app on this device
Retrieve information about the current installed build
List downloaded versions on this device
Delete a downloaded version on this device
Parameters
version: string
- UUID of the deploy version downloaded to device