From 86b2a2ca73d91d73277b02133631a772d22f65cf Mon Sep 17 00:00:00 2001 From: Samer Albahra Date: Fri, 1 Dec 2017 22:09:08 -0600 Subject: [PATCH] feat(network-interface): add plugin support (#2063) * feat(network-interface): add plugin support * Remove unnecessary options * add getIPAddress method --- .../plugins/network-interface/index.ts | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/@ionic-native/plugins/network-interface/index.ts diff --git a/src/@ionic-native/plugins/network-interface/index.ts b/src/@ionic-native/plugins/network-interface/index.ts new file mode 100644 index 0000000000..bddfe3a2e5 --- /dev/null +++ b/src/@ionic-native/plugins/network-interface/index.ts @@ -0,0 +1,60 @@ +/** + * Network Interface Plugin + * + */ +import { Injectable } from '@angular/core'; +import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; + +/** + * @name Network Interface + * @description + * Network interface information plugin for Cordova/PhoneGap that supports Android, Blackberry 10, Browser, iOS, and Windows Phone 8. + * + * @usage + * ```typescript + * import { NetworkInterface } from '@ionic-native/network-interface'; + * + * + * constructor(private networkInterface: NetworkInterface) { } + * + * ... + * + * this.networkInterface.getWiFiIPAddress(function (ip) { alert(ip); }); + * this.networkInterface.getCarrierIPAddress(function (ip) { alert(ip); }); + * + * + * ``` + */ +@Plugin({ + pluginName: 'NetworkInterface', + plugin: 'cordova-plugin-networkinterface', + pluginRef: 'networkinterface', + repo: 'https://github.com/salbahra/cordova-plugin-networkinterface', + platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'Windows', 'Windows Phone'], +}) +@Injectable() +export class NetworkInterface extends IonicNativePlugin { + + @Cordova() + getIPAddress(): Promise { return; } + + /** + * Gets the WiFi IP address + * @param success {Function} Callback used when successful + * @param error {Function} Callback used when failure + */ + @Cordova() + getWiFiIPAddress(): Promise { + return; + } + + /** + * Gets the wireless carrier IP address + * @param success {Function} Callback used when successful + * @param error {Function} Callback used when failure + */ + @Cordova() + getCarrierIPAddress(): Promise { + return; + } +}