Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(network-interface): add plugin support #2063

Merged
merged 3 commits into from
Dec 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions src/@ionic-native/plugins/network-interface/index.ts
Original file line number Diff line number Diff line change
@@ -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<string> { return; }

/**
* Gets the WiFi IP address
* @param success {Function} Callback used when successful
* @param error {Function} Callback used when failure
*/
@Cordova()
getWiFiIPAddress(): Promise<string> {
return;
}

/**
* Gets the wireless carrier IP address
* @param success {Function} Callback used when successful
* @param error {Function} Callback used when failure
*/
@Cordova()
getCarrierIPAddress(): Promise<string> {
return;
}
}