On-demand not applying to wired connections (#463)

Condition is `#if os(macOS)`, but a Catalyst app is actually `os(iOS)`,
so the code adding the Ethernet rule was being ignored.
This commit is contained in:
Davide De Rosa 2024-01-11 00:15:06 +01:00 committed by GitHub
parent 92d5008d1c
commit 990fde5325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- "Restore purchases" not working. [#459](https://github.com/passepartoutvpn/passepartout-apple/issues/459) - "Restore purchases" not working. [#459](https://github.com/passepartoutvpn/passepartout-apple/issues/459)
- Purchase is not credited if any refund was issued in the past. [#461](https://github.com/passepartoutvpn/passepartout-apple/issues/461) - Purchase is not credited if any refund was issued in the past. [#461](https://github.com/passepartoutvpn/passepartout-apple/issues/461)
- On-demand not applying to wired connections. [#463](https://github.com/passepartoutvpn/passepartout-apple/pull/463)
## 2.3.2 (2024-01-10) ## 2.3.2 (2024-01-10)

View File

@ -63,7 +63,7 @@ private extension Profile.OnDemand {
rules.append(cellularRule()) rules.append(cellularRule())
} }
#endif #endif
#if os(macOS) #if targetEnvironment(macCatalyst) || os(macOS)
if Utils.hasEthernet() && withEthernetNetwork { if Utils.hasEthernet() && withEthernetNetwork {
if let rule = ethernetRule() { if let rule = ethernetRule() {
rules.append(rule) rules.append(rule)
@ -81,6 +81,11 @@ private extension Profile.OnDemand {
// IMPORTANT: append fallback rule last // IMPORTANT: append fallback rule last
rules.append(globalRule()) rules.append(globalRule())
pp_log.debug("On-demand rules:")
rules.forEach {
pp_log.debug("\($0)")
}
return rules return rules
} }
} }
@ -118,7 +123,7 @@ private extension Profile.OnDemand {
} }
#endif #endif
#if os(macOS) #if targetEnvironment(macCatalyst) || os(macOS)
func ethernetRule() -> NEOnDemandRule? { func ethernetRule() -> NEOnDemandRule? {
guard let compatibleEthernet = NEOnDemandRuleInterfaceType.compatibleEthernet else { guard let compatibleEthernet = NEOnDemandRuleInterfaceType.compatibleEthernet else {
return nil return nil