Skip to content

Commit

Permalink
feat(network-interface): match latest plugin release (#2587)
Browse files Browse the repository at this point in the history
  • Loading branch information
lordjabez authored and danielsogl committed Jul 8, 2018
1 parent 713efd7 commit 4f41589
Showing 1 changed file with 25 additions and 15 deletions.
40 changes: 25 additions & 15 deletions src/@ionic-native/plugins/network-interface/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -31,28 +37,32 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
@Injectable()
export class NetworkInterface extends IonicNativePlugin {

/**
* Gets the WiFi IP address
* @return {Promise<any>} Returns a Promise that resolves with the IP address information.
*/
@Cordova()
getIPAddress(): Promise<string> {
getWiFiIPAddress(): Promise<any> {
return;
}

/**
* Gets the WiFi IP address
* @param success {Function} Callback used when successful
* @param error {Function} Callback used when failure
* Gets the wireless carrier IP address
* @return {Promise<any>} Returns a Promise that resolves with the IP address information.
*/
@Cordova()
getWiFiIPAddress(): Promise<string> {
getCarrierIPAddress(): Promise<any> {
return;
}

/**
* Gets the wireless carrier IP address
* @param success {Function} Callback used when successful
* @param error {Function} Callback used when failure
* Gets the relevant proxies for the passed URL in order of application
* @param {url} message The message to display.
* @return {Promise<any>} Returns a Promise that resolves with the proxy information.
*/
@Cordova()
getCarrierIPAddress(): Promise<string> {
getHttpProxyInformation(url: string): Promise<any> {
return;
}

}

0 comments on commit 4f41589

Please sign in to comment.