expo-network 7.0.0 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/android/build.gradle +2 -2
- package/ios/NetworkModule.swift +32 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 7.0.2 — 2024-11-22
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 7.0.1 — 2024-11-22
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug fixes
|
|
20
|
+
|
|
21
|
+
- [iOS] Added fix to getNetworkStateAsync failing on iOS ([#33137](https://github.com/expo/expo/pull/33137) by [@chrfalch](https://github.com/chrfalch))
|
|
22
|
+
|
|
13
23
|
## 7.0.0 — 2024-10-22
|
|
14
24
|
|
|
15
25
|
### 🛠 Breaking changes
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '7.0.
|
|
4
|
+
version = '7.0.2'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,6 +14,6 @@ android {
|
|
|
14
14
|
namespace "expo.modules.network"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 11
|
|
17
|
-
versionName '7.0.
|
|
17
|
+
versionName '7.0.2'
|
|
18
18
|
}
|
|
19
19
|
}
|
package/ios/NetworkModule.swift
CHANGED
|
@@ -87,9 +87,38 @@ public final class NetworkModule: Module {
|
|
|
87
87
|
return address
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
private func getNetworkPathAsync() -> NWPath? {
|
|
91
|
+
// create a temporary monitor to avoid interfering with the module's monitor
|
|
92
|
+
// since we want to wait for the result to be updated once:
|
|
93
|
+
let tempMonitor = NWPathMonitor()
|
|
94
|
+
var tempPath: NWPath?
|
|
95
|
+
|
|
96
|
+
let semaphore = DispatchSemaphore(value: 0)
|
|
97
|
+
|
|
98
|
+
tempMonitor.pathUpdateHandler = { updatedPath in
|
|
99
|
+
tempPath = updatedPath
|
|
100
|
+
semaphore.signal() // Notify that we got the path
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
tempMonitor.start(queue: monitorQueue)
|
|
104
|
+
|
|
105
|
+
// Wait max 5 seconds to avoid any locking issues if the monitor
|
|
106
|
+
// doesn't get an update in time.
|
|
107
|
+
let result = semaphore.wait(timeout: .now() + 5)
|
|
108
|
+
tempMonitor.cancel()
|
|
109
|
+
|
|
110
|
+
if result == .timedOut {
|
|
111
|
+
// Handle the timeout case
|
|
112
|
+
print("Timeout waiting for network path.")
|
|
113
|
+
return nil
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return tempPath
|
|
117
|
+
}
|
|
118
|
+
|
|
90
119
|
private func getNetworkStateAsync(path: NWPath? = nil) -> [String: Any] {
|
|
91
|
-
let currentPath = path ??
|
|
92
|
-
let isConnected = currentPath
|
|
120
|
+
let currentPath = path ?? getNetworkPathAsync()
|
|
121
|
+
let isConnected = currentPath?.status == .satisfied
|
|
93
122
|
|
|
94
123
|
if !isConnected {
|
|
95
124
|
return [
|
|
@@ -102,7 +131,7 @@ public final class NetworkModule: Module {
|
|
|
102
131
|
let connectionType = NWInterface
|
|
103
132
|
.InterfaceType
|
|
104
133
|
.allCases
|
|
105
|
-
.filter { currentPath
|
|
134
|
+
.filter { currentPath?.usesInterfaceType($0) == true }
|
|
106
135
|
.first
|
|
107
136
|
|
|
108
137
|
var currentNetworkType = NetworkType.unknown
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-network",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Provides useful information about the device's network such as its IP address, MAC address, and airplane mode status",
|
|
5
5
|
"main": "build/Network.js",
|
|
6
6
|
"types": "build/Network.d.ts",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"expo": "*",
|
|
38
38
|
"react": "*"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "eb0d9b5b6ba8dd5b64e016e41166e42ced543a69"
|
|
41
41
|
}
|