Skip to content

Commit

Permalink
feat(app-update): add app update options
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsogl authored Mar 16, 2018
1 parent f11be24 commit 0f325ed
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/@ionic-native/plugins/app-update/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';

export interface AppUpdateOptions {
authType: string;
username?: string;
password?: string;
}

/**
* @name App Update
Expand All @@ -24,13 +30,15 @@ import { Injectable } from '@angular/core';
*
* constructor(private appUpdate: AppUpdate) {
*
* const updateUrl = 'http://your-remote-api.com/update.xml';
* this.appUpdate.checkAppUpdate(updateUrl);
* const updateUrl = 'https://your-remote-api.com/update.xml';
* this.appUpdate.checkAppUpdate(updateUrl).then(() => { console.log('Update available') });
*
* }
* ```
*
* The plugin will compare the app version and update it automatically if the API has a newer version to install.
* @interfaces
* AppUpdateOptions
*/
@Plugin({
pluginName: 'AppUpdate',
Expand All @@ -49,5 +57,7 @@ export class AppUpdate extends IonicNativePlugin {
@Cordova({
callbackOrder: 'reverse'
})
checkAppUpdate(updateUrl: string): Promise<any> { return; }
checkAppUpdate(updateUrl: string, options?: AppUpdateOptions): Promise<any> {
return;
}
}

0 comments on commit 0f325ed

Please sign in to comment.