Skip to content

Commit

Permalink
feat(app-update): add cordova-plugin-app-update support (#1105)
Browse files Browse the repository at this point in the history
* add new app-update plugin

* update plugin info
  • Loading branch information
xueron authored and ihadeed committed Mar 2, 2017
1 parent 104532e commit 21d4088
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AdMob } from './plugins/admob';
import { AndroidFingerprintAuth } from './plugins/android-fingerprint-auth';
import { AppAvailability } from './plugins/appavailability';
import { AppRate } from './plugins/apprate';
import { AppUpdate } from './plugins/app-update';
import { AppVersion } from './plugins/appversion';
import { Badge } from './plugins/badge';
import { BackgroundGeolocation } from './plugins/background-geolocation';
Expand Down Expand Up @@ -132,6 +133,7 @@ export * from './plugins/admob';
export * from './plugins/android-fingerprint-auth';
export * from './plugins/appavailability';
export * from './plugins/apprate';
export * from './plugins/app-update';
export * from './plugins/appversion';
export * from './plugins/background-geolocation';
export * from './plugins/backgroundmode';
Expand Down Expand Up @@ -257,6 +259,7 @@ window['IonicNative'] = {
AndroidFingerprintAuth,
AppAvailability,
AppRate,
AppUpdate,
AppVersion,
Badge,
BackgroundGeolocation,
Expand Down
37 changes: 37 additions & 0 deletions src/plugins/app-update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Plugin, Cordova } from './plugin';

/**
* @name AppUpdate
* @description
* This plugin does self-update for android
*
* @usage
* ```
* import { AppUpdate } from 'ionic-native';
*
* let updateUrl = 'http://your-remote-api';
* AppUpdate.checkAppUpdate(updateUrl)
* .then((something: any) => doSomething(something))
* .catch((error: any) => console.log(error));
* ```
*/
@Plugin({
pluginName: 'AppUpdate',
plugin: 'cordova-plugin-app-update',
pluginRef: 'AppUpdate',
repo: 'https://github.com/vaenow/cordova-plugin-app-update',
install: 'ionic plugin add cordova-plugin-app-update --save',
platforms: ['Android']
})
export class AppUpdate {
/**
* Check and update
* @param updateUrl {string} update api url
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova({
callbackOrder: 'reverse'
})
static checkAppUpdate(updateUrl: string): Promise<any> { return; }
}

0 comments on commit 21d4088

Please sign in to comment.