Skip to content

Commit ceecc65

Browse files
zhu-xiaoweixiaoweii
andauthored
fix: nwpath thread safety issue (#24)
Co-authored-by: xiaoweii <xiaoweii@amazom.com>
1 parent db64731 commit ceecc65

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Sources/Clickstream/Network/NetworkMonitor.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@ protocol NetworkMonitor: AnyObject {
1616
}
1717

1818
var currentNetWorkType: String = NetWorkType.UnKnow
19+
var currentIsOnline: Bool = true
1920

2021
extension NWPathMonitor: NetworkMonitor {
21-
var isOnline: Bool {
22-
currentPath.status == .satisfied
23-
}
24-
22+
var isOnline: Bool { currentIsOnline }
2523
var netWorkType: String { currentNetWorkType }
2624

2725
func startMonitoring(using queue: DispatchQueue) {
2826
start(queue: queue)
2927
pathUpdateHandler = { path in
28+
currentIsOnline = path.status == .satisfied
3029
if path.usesInterfaceType(.wifi) {
3130
currentNetWorkType = NetWorkType.Wifi
3231
} else if path.usesInterfaceType(.cellular) {

Sources/Clickstream/PackageInfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
enum PackageInfo {
99
/// the clickstream analytics iOS sdk version
1010
/// note: update and align the version with new tag version before committing new tag
11-
static let version = "0.5.1"
11+
static let version = "0.5.2"
1212
}

0 commit comments

Comments
 (0)