mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-01 02:53:03 +08:00
feat(app-update): add app update options
feat(app-update): add app update options
This commit is contained in:
commit
d1d7404a09
@ -1,5 +1,11 @@
|
|||||||
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|
||||||
import { Injectable } from '@angular/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
|
* @name App Update
|
||||||
@ -24,13 +30,15 @@ import { Injectable } from '@angular/core';
|
|||||||
*
|
*
|
||||||
* constructor(private appUpdate: AppUpdate) {
|
* constructor(private appUpdate: AppUpdate) {
|
||||||
*
|
*
|
||||||
* const updateUrl = 'http://your-remote-api.com/update.xml';
|
* const updateUrl = 'https://your-remote-api.com/update.xml';
|
||||||
* this.appUpdate.checkAppUpdate(updateUrl);
|
* 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.
|
* The plugin will compare the app version and update it automatically if the API has a newer version to install.
|
||||||
|
* @interfaces
|
||||||
|
* AppUpdateOptions
|
||||||
*/
|
*/
|
||||||
@Plugin({
|
@Plugin({
|
||||||
pluginName: 'AppUpdate',
|
pluginName: 'AppUpdate',
|
||||||
@ -49,5 +57,7 @@ export class AppUpdate extends IonicNativePlugin {
|
|||||||
@Cordova({
|
@Cordova({
|
||||||
callbackOrder: 'reverse'
|
callbackOrder: 'reverse'
|
||||||
})
|
})
|
||||||
checkAppUpdate(updateUrl: string): Promise<any> { return; }
|
checkAppUpdate(updateUrl: string, options?: AppUpdateOptions): Promise<any> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user