UNPKG

2.2 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var plugin_1 = require('./plugin');
9/**
10 * @name AppUpdate
11 * @description
12 * This plugin does self-update for android
13 *
14 * @usage
15 *
16 * You should first host an XML file on your server with the following data in it:
17 * ```xml
18 * <update>
19 * <version>302048</version>
20 * <name>APK Name</name>
21 * <url>https://your-remote-api.com/YourApp.apk</url>
22 * </update>
23 * ```
24 *
25 * Then use the following code:
26 *
27 * ```
28 * import { AppUpdate } from 'ionic-native';
29 *
30 * let updateUrl = 'http://your-remote-api.com/update.xml';
31 *
32 * AppUpdate.checkAppUpdate(updateUrl);
33 * ```
34 *
35 * The plugin will compare the app version and update it automatically if the API has a newer version to install.
36 */
37var AppUpdate = (function () {
38 function AppUpdate() {
39 }
40 /**
41 * Check and update
42 * @param updateUrl {string} update api url
43 * @return {Promise<any>} Returns a promise that resolves when something happens
44 */
45 AppUpdate.checkAppUpdate = function (updateUrl) { return; };
46 __decorate([
47 plugin_1.Cordova({
48 callbackOrder: 'reverse'
49 })
50 ], AppUpdate, "checkAppUpdate", null);
51 AppUpdate = __decorate([
52 plugin_1.Plugin({
53 pluginName: 'AppUpdate',
54 plugin: 'cordova-plugin-app-update',
55 pluginRef: 'AppUpdate',
56 repo: 'https://github.com/vaenow/cordova-plugin-app-update',
57 platforms: ['Android']
58 })
59 ], AppUpdate);
60 return AppUpdate;
61}());
62exports.AppUpdate = AppUpdate;
63//# sourceMappingURL=app-update.js.map
\No newline at end of file