feat(network): implement Apple network monitoring#4263
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4263 +/- ##
=============================================
- Coverage 61.47% 61.31% -0.17%
- Complexity 3988 4001 +13
=============================================
Files 2104 2135 +31
Lines 69070 69091 +21
Branches 6842 6854 +12
=============================================
- Hits 42462 42363 -99
- Misses 23862 23975 +113
- Partials 2746 2753 +7 see 67 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR replaces the Apple (iOS/macOS) NetworkStateObserverImpl stub with a real implementation backed by Network.framework (nw_path_monitor), so Kalium can react to connectivity changes on Apple platforms similarly to Android and unblock connectivity-aware features (e.g., calling).
Changes:
- Implement iOS/macOS network monitoring using
nw_path_monitor, mappingnw_path_status_satisfiedtoConnectedWithInternetand other states toNotConnected. - Populate
observeCurrentNetwork()with network type, a derived network id, and internet-access flag. - Add
appleTestunit tests covering status mapping and network-id construction.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| logic/src/appleMain/kotlin/com/wire/kalium/logic/network/NetworkStateObserverImpl.kt | Implements Apple network monitoring via nw_path_monitor, plus mapping/id helpers. |
| logic/src/appleTest/kotlin/com/wire/kalium/logic/network/NetworkStateObserverImplTest.kt | Adds unit tests for status→state mapping and network-id building logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|



Replaces the Apple
NetworkStateObserverImplstub, which always reported “connected”, with a real iOS/macOS implementation using Apple’sNetwork.frameworkandnw_path_monitor.What changed
nw_path_status_satisfiedis mapped toConnectedWithInternet.NotConnected, because the path is not currently usable.observeCurrentNetwork()now reports:WIFI,CELLULAR, orOTHERappleTest.This brings iOS/macOS closer to Android behavior and unblocks connectivity-aware sync and
CallNetworkChangeManager.Known limitation
The network id is based on the interface name and index. This means switching between two networks on the same interface, for example changing Wi-Fi SSID, will not be detected as a network change. @johnxnguyen how does the iOS app deal with this?
Detecting that would require reading the SSID, which needs location permission. We are intentionally not requesting that here.