From a7d0829ee362b06bbf266ee0a47b0a43b217d0fb Mon Sep 17 00:00:00 2001 From: Maxim Belov Date: Tue, 17 Sep 2024 12:59:13 +0300 Subject: [PATCH] feat(network-permission): add plugin --- .../plugins/network-permission/index.ts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/@awesome-cordova-plugins/plugins/network-permission/index.ts diff --git a/src/@awesome-cordova-plugins/plugins/network-permission/index.ts b/src/@awesome-cordova-plugins/plugins/network-permission/index.ts new file mode 100644 index 0000000000..19f3084a86 --- /dev/null +++ b/src/@awesome-cordova-plugins/plugins/network-permission/index.ts @@ -0,0 +1,44 @@ +import { Injectable } from '@angular/core'; +import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-plugins/core'; + +/** + * @name Network Permission + * @description + * Requires Cordova plugin: cordova-plugin-network-permission. For more info, please see the [Network permission plugin docs](https://github.com/j5int/cordova-plugin-network-permission). + * @usage + * ```typescript + * import { NetworkPermission } from '@awesome-cordova-plugins/network-permission/ngx'; + * + * constructor(private networkPermission: NetworkPermission) { } + * + * ... + * + * this.networkPermission.requestLocalNetworkPermission() + * .then(() => { + * console.log('Permission was granted successful'); + * }) + * .catch(() => { + * console.log('Permission declined'); + * }); + * + * ``` + */ +@Plugin({ + pluginName: 'NetworkPermission', + plugin: 'cordova-plugin-network-permission', + pluginRef: 'localNetworkPermission', + repo: 'https://github.com/j5int/cordova-plugin-network-permission', + platforms: ['iOS'], +}) +@Injectable() +export class NetworkPermission extends AwesomeCordovaNativePlugin { + /** + * Request local network permission + * + * @returns {Promise} + */ + @Cordova() + requestLocalNetworkPermission(): Promise { + return; + } +}