mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-14 04:05:23 +08:00
68 lines
1.5 KiB
TypeScript
68 lines
1.5 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core';
|
|
|
|
|
|
|
|
/**
|
|
* @name App Version
|
|
* @description
|
|
* Reads the version of your app from the target build settings.
|
|
*
|
|
* Requires Cordova plugin: `cordova-plugin-app-version`. For more info, please see the [Cordova App Version docs](https://github.com/whiteoctober/cordova-plugin-app-version).
|
|
*
|
|
* @usage
|
|
* ```typescript
|
|
* import { AppVersion } from '@ionic-native/app-version';
|
|
*
|
|
* constructor(private appVersion: AppVersion) { }
|
|
*
|
|
* ...
|
|
*
|
|
*
|
|
* this.appVersion.getAppName();
|
|
* this.appVersion.getPackageName();
|
|
* this.appVersion.getVersionCode();
|
|
* this.appVersion.getVersionNumber();
|
|
*
|
|
* ```
|
|
*/
|
|
@Plugin({
|
|
pluginName: 'AppVersion',
|
|
plugin: 'cordova-plugin-app-version',
|
|
pluginRef: 'cordova.getAppVersion',
|
|
repo: 'https://github.com/whiteoctober/cordova-plugin-app-version',
|
|
platforms: ['Android', 'iOS', 'Windows']
|
|
})
|
|
@Injectable()
|
|
export class AppVersion extends IonicNativePlugin {
|
|
|
|
/**
|
|
* Returns the name of the app
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova()
|
|
getAppName(): Promise<any> { return; }
|
|
|
|
/**
|
|
* Returns the package name of the app
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova()
|
|
getPackageName(): Promise<any> { return; }
|
|
|
|
/**
|
|
* Returns the build identifier of the app
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova()
|
|
getVersionCode(): Promise<any> { return; }
|
|
|
|
/**
|
|
* Returns the version of the app
|
|
* @returns {Promise<any>}
|
|
*/
|
|
@Cordova()
|
|
getVersionNumber(): Promise<any> { return; }
|
|
|
|
}
|