-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
8350d2f
commit cf0fb8f
Showing
12 changed files
with
911 additions
and
13 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
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
"/android", | ||
"!/android/build", | ||
"/ios", | ||
"/windows", | ||
"/src", | ||
"/lib", | ||
"/*.podspec" | ||
|
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,78 @@ | ||
*AppPackages* | ||
*BundleArtifacts* | ||
*ReactAssets* | ||
|
||
# OS junk files | ||
[Tt]humbs.db | ||
*.DS_Store | ||
|
||
# Visual Studio files | ||
*.[Oo]bj | ||
*.user | ||
*.aps | ||
*.pch | ||
*.vspscc | ||
*.vssscc | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.suo | ||
*.tlb | ||
*.tlh | ||
*.bak | ||
*.[Cc]ache | ||
*.ilk | ||
*.log | ||
*.lib | ||
*.sbr | ||
*.sdf | ||
*.opensdf | ||
*.opendb | ||
*.unsuccessfulbuild | ||
ipch/ | ||
[Oo]bj/ | ||
[Bb]in | ||
[Dd]ebug*/ | ||
[Rr]elease*/ | ||
Ankh.NoLoad | ||
|
||
# MonoDevelop | ||
*.pidb | ||
*.userprefs | ||
|
||
# Tooling | ||
_ReSharper*/ | ||
*.resharper | ||
[Tt]est[Rr]esult* | ||
*.sass-cache | ||
|
||
# Project files | ||
[Bb]uild/ | ||
|
||
# Subversion files | ||
.svn | ||
|
||
# Office Temp Files | ||
~$* | ||
|
||
# vim Temp Files | ||
*~ | ||
|
||
# NuGet | ||
packages/ | ||
*.nupkg | ||
|
||
# ncrunch | ||
*ncrunch* | ||
*crunch*.local.xml | ||
|
||
# Visual Studio database projects | ||
*.dbmdl | ||
|
||
# Test files | ||
*.testsettings | ||
|
||
#Other files | ||
*.DotSettings | ||
.vs/ | ||
*project.lock.json |
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,86 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RNCNetInfo", "RNCNetInfo\RNCNetInfo.csproj", "{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}" | ||
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChakraBridge", "..\node_modules\react-native-windows\ReactWindows\ChakraBridge\ChakraBridge.vcxproj", "{4B72C796-16D5-4E3A-81C0-3E36F531E578}" | ||
EndProject | ||
Global | ||
GlobalSection(SharedMSBuildProjectFiles) = preSolution | ||
..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{c7673ad5-e3aa-468c-a5fd-fa38154e205c}*SharedItemsImports = 4 | ||
EndGlobalSection | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|ARM = Debug|ARM | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Development|ARM = Development|ARM | ||
Development|x64 = Development|x64 | ||
Development|x86 = Development|x86 | ||
Release|ARM = Release|ARM | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Debug|ARM.ActiveCfg = Debug|ARM | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Debug|ARM.Build.0 = Debug|ARM | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Debug|x64.ActiveCfg = Debug|x64 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Debug|x64.Build.0 = Debug|x64 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Debug|x86.ActiveCfg = Debug|x86 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Debug|x86.Build.0 = Debug|x86 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Development|ARM.ActiveCfg = Development|ARM | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Development|ARM.Build.0 = Development|ARM | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Development|x64.ActiveCfg = Development|x64 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Development|x64.Build.0 = Development|x64 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Development|x86.ActiveCfg = Development|x86 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Development|x86.Build.0 = Development|x86 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Release|ARM.ActiveCfg = Release|ARM | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Release|ARM.Build.0 = Release|ARM | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Release|x64.ActiveCfg = Release|x64 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Release|x64.Build.0 = Release|x64 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Release|x86.ActiveCfg = Release|x86 | ||
{4ACDD44C-E556-423E-BD74-B4CEF3E67FF0}.Release|x86.Build.0 = Release|x86 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.ActiveCfg = Debug|ARM | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.Build.0 = Debug|ARM | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.ActiveCfg = Debug|x64 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.Build.0 = Debug|x64 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.ActiveCfg = Debug|x86 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.Build.0 = Debug|x86 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.ActiveCfg = Debug|ARM | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.Build.0 = Debug|ARM | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.ActiveCfg = Debug|x64 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.Build.0 = Debug|x64 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.ActiveCfg = Debug|x86 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.Build.0 = Debug|x86 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.ActiveCfg = Release|ARM | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.Build.0 = Release|ARM | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.ActiveCfg = Release|x64 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.Build.0 = Release|x64 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.ActiveCfg = Release|x86 | ||
{C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.Build.0 = Release|x86 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.ActiveCfg = Debug|ARM | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.Build.0 = Debug|ARM | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.ActiveCfg = Debug|x64 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.Build.0 = Debug|x64 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.Build.0 = Debug|Win32 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|ARM.ActiveCfg = Debug|ARM | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|ARM.Build.0 = Debug|ARM | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x64.ActiveCfg = Debug|x64 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x64.Build.0 = Debug|x64 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x86.ActiveCfg = Debug|Win32 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x86.Build.0 = Debug|Win32 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.ActiveCfg = Release|ARM | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.Build.0 = Release|ARM | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.ActiveCfg = Release|x64 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.Build.0 = Release|x64 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.ActiveCfg = Release|Win32 | ||
{4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
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,129 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using Windows.Networking.Connectivity; | ||
|
||
namespace ReactNativeCommunity.NetInfo | ||
{ | ||
class DefaultNetworkInformation : INetworkInformation | ||
{ | ||
public event NetworkStatusChangedEventHandler NetworkStatusChanged; | ||
|
||
public void Start() | ||
{ | ||
NetworkInformation.NetworkStatusChanged += OnNetworkStatusChanged; | ||
} | ||
|
||
public void Stop() | ||
{ | ||
NetworkInformation.NetworkStatusChanged -= OnNetworkStatusChanged; | ||
} | ||
|
||
public IConnectionProfile GetInternetConnectionProfile() | ||
{ | ||
var profile = NetworkInformation.GetInternetConnectionProfile(); | ||
return profile != null | ||
? new ConnectionProfileImpl(profile) | ||
: null; | ||
} | ||
|
||
private void OnNetworkStatusChanged(object sender) | ||
{ | ||
NetworkStatusChanged?.Invoke(sender); | ||
} | ||
|
||
class ConnectionProfileImpl : IConnectionProfile | ||
{ | ||
private readonly ConnectionProfile _profile; | ||
|
||
public ConnectionProfileImpl(ConnectionProfile profile) | ||
{ | ||
_profile = profile; | ||
} | ||
|
||
public NetworkConnectivityLevel ConnectivityLevel | ||
{ | ||
get | ||
{ | ||
return _profile.GetNetworkConnectivityLevel(); | ||
} | ||
} | ||
|
||
public NetworkConnectionType ConnectionType | ||
{ | ||
get | ||
{ | ||
if (_profile.IsWlanConnectionProfile) | ||
{ | ||
return NetworkConnectionType.Wifi; | ||
} | ||
else if (_profile.IsWwanConnectionProfile) | ||
{ | ||
return NetworkConnectionType.Cellular; | ||
} | ||
|
||
var networkAdapter = _profile.NetworkAdapter; | ||
if (networkAdapter == null) | ||
{ | ||
return NetworkConnectionType.Unknown; | ||
} | ||
|
||
// Possible values: https://www.iana.org/assignments/ianaiftype-mib/ianaiftype-mib | ||
if (networkAdapter.IanaInterfaceType == 6u) | ||
{ | ||
return NetworkConnectionType.Ethernet; | ||
} | ||
else | ||
{ | ||
return NetworkConnectionType.Other; | ||
} | ||
} | ||
} | ||
|
||
public CellularGeneration CellularGeneration | ||
{ | ||
get | ||
{ | ||
if (!_profile.IsWwanConnectionProfile) | ||
{ | ||
return CellularGeneration.None; | ||
} | ||
|
||
var dataClass = _profile.WwanConnectionProfileDetails.GetCurrentDataClass(); | ||
|
||
switch (dataClass) { | ||
case WwanDataClass.None: | ||
return CellularGeneration.None; | ||
case WwanDataClass.Edge: | ||
case WwanDataClass.Gprs: | ||
return CellularGeneration.Generation2; | ||
case WwanDataClass.Cdma1xEvdo: | ||
case WwanDataClass.Cdma1xEvdoRevA: | ||
case WwanDataClass.Cdma1xEvdoRevB: | ||
case WwanDataClass.Cdma1xEvdv: | ||
case WwanDataClass.Cdma1xRtt: | ||
case WwanDataClass.Cdma3xRtt: | ||
case WwanDataClass.Hsdpa: | ||
case WwanDataClass.Hsupa: | ||
case WwanDataClass.Umts: | ||
return CellularGeneration.Generation3; | ||
case WwanDataClass.CdmaUmb: | ||
case WwanDataClass.LteAdvanced: | ||
return CellularGeneration.Generation4; | ||
case WwanDataClass.Custom: | ||
default: | ||
return CellularGeneration.Unknown; | ||
} | ||
} | ||
} | ||
|
||
public NetworkCostType ConnectionCost | ||
{ | ||
get | ||
{ | ||
return _profile.GetConnectionCost().NetworkCostType; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.