From a04c1072c88704f2c6f6f1c7471abe96c20cb496 Mon Sep 17 00:00:00 2001 From: Davide Date: Sat, 14 Dec 2024 21:59:25 +0100 Subject: [PATCH] Allow Ethernet on-demand on all platforms (#1012) Fixes #1010 --- Library/Package.resolved | 3 +-- Library/Package.swift | 4 ++-- Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift | 3 ++- Library/Sources/CommonUtils/Extensions/Utils+Network.swift | 5 +---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Library/Package.resolved b/Library/Package.resolved index 88cc2b67d..7c42673f6 100644 --- a/Library/Package.resolved +++ b/Library/Package.resolved @@ -41,8 +41,7 @@ "kind" : "remoteSourceControl", "location" : "git@github.com:passepartoutvpn/passepartoutkit-source", "state" : { - "revision" : "234a709bfd18f5b31fdf0b44f0f09c84f9c76581", - "version" : "0.13.0" + "revision" : "a08e04fccde51d92d5bed3fbe1880c4225f18618" } }, { diff --git a/Library/Package.swift b/Library/Package.swift index 916f57ec4..c002b7826 100644 --- a/Library/Package.swift +++ b/Library/Package.swift @@ -64,8 +64,8 @@ let package = Package( ) ], dependencies: [ - .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.13.0"), -// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "406712a60faf8208a15c4ffaf286b1c71df7c6d2"), +// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.13.0"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "a08e04fccde51d92d5bed3fbe1880c4225f18618"), // .package(path: "../../passepartoutkit-source"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "0.13.0"), // .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"), diff --git a/Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift b/Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift index ce436e0a2..eb3743fc9 100644 --- a/Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift +++ b/Library/Sources/AppUIMain/Views/Modules/OnDemandView.swift @@ -124,7 +124,8 @@ private extension OnDemandView { Group { if Utils.hasCellularData() { Toggle(Strings.Modules.OnDemand.mobile, isOn: draft.withMobileNetwork) - } else if Utils.hasEthernet() { + } + if Utils.hasEthernet() { Toggle(Strings.Modules.OnDemand.ethernet, isOn: draft.withEthernetNetwork) } } diff --git a/Library/Sources/CommonUtils/Extensions/Utils+Network.swift b/Library/Sources/CommonUtils/Extensions/Utils+Network.swift index 4a612fbd6..015b9a4e2 100644 --- a/Library/Sources/CommonUtils/Extensions/Utils+Network.swift +++ b/Library/Sources/CommonUtils/Extensions/Utils+Network.swift @@ -36,6 +36,7 @@ extension Utils { true } #else + // TODO: ###, move this check to kit, and try something similar for Ethernet public static func hasCellularData() -> Bool { var addrs: UnsafeMutablePointer? guard getifaddrs(&addrs) == 0 else { @@ -57,11 +58,7 @@ extension Utils { #endif public static func hasEthernet() -> Bool { -#if os(macOS) true -#else - false -#endif } public static func currentWifiSSID() async -> String? {