Skip to content

Commit 4b382e3

Browse files
authored
Merge release/23.3 into trunk (#16203)
2 parents 8c116c4 + b537f59 commit 4b382e3

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

WooCommerce/Classes/Tools/BackgroundTasks/BackgroundTaskRefreshDispatcher.swift

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,33 @@ private struct BackgroundTaskSystemInfo {
173173
}
174174

175175
private static func getNetworkInfo() async -> NetworkInfo {
176-
return await withCheckedContinuation { continuation in
177-
let monitor = NWPathMonitor()
176+
let monitor = NWPathMonitor()
177+
let queue = DispatchQueue(label: "network.monitor.queue")
178178

179-
monitor.pathUpdateHandler = { path in
180-
monitor.cancel()
181-
continuation.resume(returning: NetworkInfo(path: path))
182-
}
179+
let (stream, continuation) = AsyncStream.makeStream(of: NWPath.self)
180+
181+
monitor.pathUpdateHandler = { path in
182+
continuation.yield(path)
183+
}
183184

184-
let queue = DispatchQueue(label: "network.monitor.queue")
185-
monitor.start(queue: queue)
185+
monitor.start(queue: queue)
186+
187+
defer {
188+
continuation.finish()
189+
monitor.cancel()
190+
}
191+
192+
let timeoutTask = Task {
193+
try await Task.sleep(nanoseconds: 1 * NSEC_PER_SEC)
194+
continuation.finish()
195+
}
196+
197+
if let path = await stream.first(where: { _ in true }) {
198+
timeoutTask.cancel()
199+
return NetworkInfo(path: path)
200+
} else {
201+
// Fallback in case no path is received.
202+
return NetworkInfo(type: "unknown", isExpensive: false, isLowDataMode: false)
186203
}
187204
}
188205
}

config/Version.Public.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
CURRENT_PROJECT_VERSION = $VERSION_LONG
22
MARKETING_VERSION = $VERSION_SHORT
3-
VERSION_LONG = 23.3.0.1
3+
VERSION_LONG = 23.3.0.2
44
VERSION_SHORT = 23.3

0 commit comments

Comments
 (0)