Skip to content

Commit

Permalink
fix(android-connectivity): add ethernet connection type (#5670)
Browse files Browse the repository at this point in the history
Add "ethernet" connection type to getConnectionType to correctly return a connection type when the type is "ethernet"
  • Loading branch information
crowebird authored and manoldonev committed Apr 19, 2018
1 parent a616dbb commit 1536d15
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tns-core-modules/connectivity/connectivity.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ export enum connectionType {
none = 0,
wifi = 1,
mobile = 2,
ethernet = 3
}

const wifi = "wifi";
const mobile = "mobile";
const ethernet = "ethernet";

// Get Connection Type
function getConnectivityManager(): android.net.ConnectivityManager {
Expand Down Expand Up @@ -37,6 +39,10 @@ export function getConnectionType(): number {
if (type.indexOf(mobile) !== -1){
return connectionType.mobile;
}

if (type.indexOf(ethernet) !== -1){
return connectionType.ethernet;
}

return connectionType.none;
}
Expand Down
7 changes: 6 additions & 1 deletion tns-core-modules/connectivity/connectivity.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ export enum connectionType {
/**
* Denotes a mobile connection, i.e. cellular network or WAN.
*/
mobile = 2
mobile = 2,

/**
* Denotes an ethernet connection
*/
ethernet = 3
}

/**
Expand Down

0 comments on commit 1536d15

Please sign in to comment.