diff --git a/src/@ionic-native/plugins/network-interface/index.ts b/src/@ionic-native/plugins/network-interface/index.ts index 7a68fb12a..f1f290455 100644 --- a/src/@ionic-native/plugins/network-interface/index.ts +++ b/src/@ionic-native/plugins/network-interface/index.ts @@ -10,15 +10,21 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; * ```typescript * import { NetworkInterface } from '@ionic-native/network-interface'; * + * constructor( private networkInterface: NetworkInterface ) { * - * constructor(private networkInterface: NetworkInterface) { } - * - * ... - * - * this.networkInterface.getWiFiIPAddress(function (ip) { alert(ip); }); - * this.networkInterface.getCarrierIPAddress(function (ip) { alert(ip); }); + * this.networkInterface.getWiFiIPAddress() + * .then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`)) + * .catch(error => console.error(`Unable to get IP: ${error}`)); * + * this.networkInterface.getCarrierIPAddress() { + * .then(address => console.info(`IP: ${address.ip}, Subnet: ${address.subnet}`)) + * .catch(error => console.error(`Unable to get IP: ${error}`)); * + * const url = 'www.github.com'; + * this.networkInterface.getHttpProxyInformation(url) + * .then(proxy => console.info(`Type: ${proxy.type}, Host: ${proxy.host}, Port: ${proxy.port}`)) + * .catch(error => console.error(`Unable to get proxy info: ${error}`)); + * } * ``` */ @Plugin({ @@ -31,28 +37,32 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; @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 + * @return {Promise} Returns a Promise that resolves with the IP address information. */ @Cordova() - getWiFiIPAddress(): Promise { + getWiFiIPAddress(): Promise { return; } /** * Gets the wireless carrier IP address - * @param success {Function} Callback used when successful - * @param error {Function} Callback used when failure + * @return {Promise} Returns a Promise that resolves with the IP address information. */ @Cordova() - getCarrierIPAddress(): Promise { + getCarrierIPAddress(): Promise { return; } + + /** + * Gets the relevant proxies for the passed URL in order of application + * @param {url} message The message to display. + * @return {Promise} Returns a Promise that resolves with the proxy information. + */ + @Cordova() + getHttpProxyInformation(url: string): Promise { + return; + } + }