-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(emm-app-config): add plugin (#3181)
* Add Emm App Config plugin Add [emm-app-config](https://github.com/oracle/cordova-plugin-emm-app-config) plugin to retrieve EMM application configuration * Update index.ts
- Loading branch information
1 parent
fc6d1d0
commit 5f16fcd
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; | ||
import { Observable } from 'rxjs'; | ||
|
||
/** | ||
* @name Emm App Config | ||
* @description | ||
* This plugin provides information on EMM application configuration | ||
* | ||
* Requires the Cordova plugin: `cordova-plugin-emm-app-config`. For more info, please see the [Cordova EMM App Config Plugin Docs](https://github.com/oracle/cordova-plugin-emm-app-config). | ||
* | ||
* | ||
* @usage | ||
* ```typescript | ||
* import { EmmAppConfig } from '@ionic-native/emm-app-config/ngx'; | ||
* | ||
* | ||
* constructor(private readonly emmAppConfig: EmmAppConfig) { } | ||
* | ||
* ... | ||
* | ||
* // Get all the values of the emm app configuration | ||
* const values = this.emmAppConfig.getValue(); | ||
* | ||
* // Get specific value of the emm app configuration | ||
* const value = this.emmAppConfig.getValue('serverUrl'); | ||
* | ||
* // Get an event every time the emm app config changes | ||
* this.emmAppConfig.registerChangedListener() | ||
* .subscribe(() => console.log('App config changes')); | ||
* | ||
* ``` | ||
*/ | ||
@Plugin({ | ||
platforms: ['Android', 'iOS'], | ||
plugin: 'cordova-plugin-emm-app-config', | ||
pluginName: 'EmmAppConfig', | ||
pluginRef: 'cordova.plugins.EmmAppConfig', | ||
repo: 'https://github.com/oracle/cordova-plugin-emm-app-config', | ||
}) | ||
@Injectable() | ||
export class EmmAppConfig extends IonicNativePlugin { | ||
|
||
/** | ||
* Get value from the Emm application configuration. | ||
* @param configKey {string} Key of the value to get, or null to get all the values as an object. | ||
* @return {any} Returns configuration on an object | ||
*/ | ||
@Cordova({ sync: true }) getValue(configKey?: string): any { | ||
return; | ||
} | ||
|
||
/** | ||
* Register a listener that will be invoked when the application configuration is changed. | ||
* @return {void} | ||
*/ | ||
@Cordova({ observable: true }) registerChangedListener(): Observable<void> { | ||
return; | ||
} | ||
|
||
} |