New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #2052 - Change reachability computation #2060
Issue #2052 - Change reachability computation #2060
Conversation
|
||
private func isNetworkReachable(with flags: SCNetworkReachabilityFlags) -> Bool { | ||
let needsConnection = flags.contains(.connectionRequired) | ||
let canConnectionAutomatically = flags.contains(.connectionOnDemand) || flags.contains(.connectionOnTraffic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this name be canConnectAutomatically ?
if flags.contains(.connectionOnDemand) || flags.contains(.connectionOnTraffic) { | ||
if !flags.contains(.interventionRequired) { networkStatus = .reachable(.ethernetOrWiFi) } | ||
} | ||
let isNetworkReachable = self.isNetworkReachable(with: flags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you combine this with the guard statement above?
into:
guard flags.contains(.reachable), isNetworkReachable(with:flags) else { return .notReachable }
I think CI for watchOS has some issues @jshier |
@jshier can you rerun the tests please? They pass locally so it seems an odd failure. |
No problem, it's a Travis issue (still). |
@jshier is this PR under review? Or Don't you want it merged? |
@MarcoSantarossa We're still reviewing changes for our 4.5 release, we'll likely review and merge soon. |
…WAN] combo. These changes resolve issue #2052 where the reachability calcuation was incorrectly reporting the connection as reachable. When a user has install a simcard, but hasn’t yet selected a carrier, the connection is not reachable.
Thanks for putting this together @MarcoSantarossa...much appreciated! 🍻 I've made a few small tweaks to your PR and have pushed it into Thanks again! |
It fixes the issue #2052. There is a bug with the reachability computation when the user has a sim but s/he didn't select the carrier yet. In this scenario we have both
.connectionRequired
and.isWWAN
.