This PR adds support to network monitoring on iOS to check if a network is metered or unmetered (this already is implemented on the android side).
The check is based on the informations from this article Swift check network connection(thanks Anders Jensen) and the Apple Documentation
A constrained interface is one the user marks as constrained by selecting “Low Data Mode” in the Settings app.
Demo: (running on iPhone 13 with iOS 17.5.1)
In the demo, I demonstrate a WiFi network as unmetered. Afterward, I change to a cellular network and a WiFi network as metered (with the Low Data toggle enabled).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1217
**Author:** [@mfcar](https://github.com/mfcar)
**Created:** 5/27/2024
**Status:** ✅ Merged
**Merged:** 6/8/2024
**Merged by:** [@advplyr](https://github.com/advplyr)
**Base:** `master` ← **Head:** `mf/networkStatusSwift`
---
### 📝 Commits (1)
- [`4f939ce`](https://github.com/advplyr/audiobookshelf-app/commit/4f939ce6fc0646925a909d03d6f20c4499dde1ea) Implement network monitoring on iOS
### 📊 Changes
**1 file changed** (+61 additions, -34 deletions)
<details>
<summary>View changed files</summary>
📝 `ios/App/App/plugins/AbsAudioPlayer.swift` (+61 -34)
</details>
### 📄 Description
This PR adds support to network monitoring on iOS to check if a network is metered or unmetered (this already is implemented on the android side).
The check is based on the informations from this article [Swift check network connection](https://medium.com/@danishandersjensen/swift-check-network-connection-9b10129089c9)(thanks Anders Jensen) and the [Apple Documentation](https://developer.apple.com/documentation/foundation/urlsessiontasktransactionmetrics)
---
### Documentation:
- [isExpensive](https://developer.apple.com/documentation/foundation/urlsessiontasktransactionmetrics/3240635-isexpensive) (iOS 13.0+)
> The system considers an interface expensive if it’s more costly or consumes more power, such as 3G or LTE as compared to ethernet or Wi-Fi.
---
- [isConstrained](https://developer.apple.com/documentation/foundation/urlsessiontasktransactionmetrics/3240628-isconstrained) (iOS 13.0+)
> A constrained interface is one the user marks as constrained by selecting “Low Data Mode” in the Settings app.
---
### Demo: _(running on iPhone 13 with iOS 17.5.1)_
In the demo, I demonstrate a WiFi network as unmetered. Afterward, I change to a cellular network and a WiFi network as metered (with the Low Data toggle enabled).
https://github.com/advplyr/audiobookshelf-app/assets/814828/796c6c70-b198-47ac-87c8-e31f2feac5c7
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1217
Author: @mfcar
Created: 5/27/2024
Status: ✅ Merged
Merged: 6/8/2024
Merged by: @advplyr
Base:
master← Head:mf/networkStatusSwift📝 Commits (1)
4f939ceImplement network monitoring on iOS📊 Changes
1 file changed (+61 additions, -34 deletions)
View changed files
📝
ios/App/App/plugins/AbsAudioPlayer.swift(+61 -34)📄 Description
This PR adds support to network monitoring on iOS to check if a network is metered or unmetered (this already is implemented on the android side).
The check is based on the informations from this article Swift check network connection(thanks Anders Jensen) and the Apple Documentation
Documentation:
Demo: (running on iPhone 13 with iOS 17.5.1)
In the demo, I demonstrate a WiFi network as unmetered. Afterward, I change to a cellular network and a WiFi network as metered (with the Low Data toggle enabled).
https://github.com/advplyr/audiobookshelf-app/assets/814828/796c6c70-b198-47ac-87c8-e31f2feac5c7
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.