-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(network-interface): add plugin support (#2063)
* feat(network-interface): add plugin support * Remove unnecessary options * add getIPAddress method
- Loading branch information
Showing
1 changed file
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |