Fix Packet Tunnel options not working
This commit is contained in:
@@ -15,6 +15,7 @@ struct PacketTunnelView: View {
|
|||||||
@State private var excludeCellularServices = false
|
@State private var excludeCellularServices = false
|
||||||
@State private var excludeLocalNetworks = false
|
@State private var excludeLocalNetworks = false
|
||||||
@State private var enforceRoutes = false
|
@State private var enforceRoutes = false
|
||||||
|
@State private var excludeDeviceCommunication = false
|
||||||
|
|
||||||
init() {}
|
init() {}
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -48,22 +49,24 @@ struct PacketTunnelView: View {
|
|||||||
await restartService()
|
await restartService()
|
||||||
}
|
}
|
||||||
|
|
||||||
FormToggle("excludeAPNs", """
|
if #available(iOS 16.4, macOS 13.3, *) {
|
||||||
If this property is true, the system excludes Apple Push Notification services (APNs) traffic, but only when the **includeAllNetworks** property is also true.
|
FormToggle("excludeAPNs", """
|
||||||
|
If this property is true, the system excludes Apple Push Notification services (APNs) traffic, but only when the **includeAllNetworks** property is also true.
|
||||||
|
|
||||||
[Apple Documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocol/4140516-excludeapns)
|
[Apple Documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocol/4140516-excludeapns)
|
||||||
""", $excludeAPNs) { newValue in
|
""", $excludeAPNs) { newValue in
|
||||||
await SharedPreferences.excludeAPNs.set(newValue)
|
await SharedPreferences.excludeAPNs.set(newValue)
|
||||||
await restartService()
|
await restartService()
|
||||||
}
|
}
|
||||||
|
|
||||||
FormToggle("excludeCellularServices", """
|
FormToggle("excludeCellularServices", """
|
||||||
If this property is true, the system excludes cellular services — such as Wi-Fi Calling, MMS, SMS, and Visual Voicemail — but only when the **includeAllNetworks** property is also true. This property doesn't impact services that use the cellular network only — such as VoLTE — which the system automatically excludes.
|
If this property is true, the system excludes cellular services — such as Wi-Fi Calling, MMS, SMS, and Visual Voicemail — but only when the **includeAllNetworks** property is also true. This property doesn't impact services that use the cellular network only — such as VoLTE — which the system automatically excludes.
|
||||||
|
|
||||||
[Apple Documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocol/4140517-excludecellularservices)
|
[Apple Documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocol/4140517-excludecellularservices)
|
||||||
""", $excludeCellularServices) { newValue in
|
""", $excludeCellularServices) { newValue in
|
||||||
await SharedPreferences.excludeCellularServices.set(newValue)
|
await SharedPreferences.excludeCellularServices.set(newValue)
|
||||||
await restartService()
|
await restartService()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FormToggle("excludeLocalNetworks", """
|
FormToggle("excludeLocalNetworks", """
|
||||||
@@ -86,6 +89,17 @@ struct PacketTunnelView: View {
|
|||||||
await restartService()
|
await restartService()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if #available(iOS 17.4, macOS 14.4, *) {
|
||||||
|
FormToggle("excludeDeviceCommunication", """
|
||||||
|
No documentation.
|
||||||
|
|
||||||
|
[Apple Documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocol/excludedevicecommunication)
|
||||||
|
""", $excludeDeviceCommunication) { newValue in
|
||||||
|
await SharedPreferences.excludeDeviceCommunication.set(newValue)
|
||||||
|
await restartService()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FormButton {
|
FormButton {
|
||||||
@@ -126,10 +140,15 @@ struct PacketTunnelView: View {
|
|||||||
#endif
|
#endif
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
includeAllNetworks = await SharedPreferences.includeAllNetworks.get()
|
includeAllNetworks = await SharedPreferences.includeAllNetworks.get()
|
||||||
excludeAPNs = await SharedPreferences.excludeAPNs.get()
|
|
||||||
excludeCellularServices = await SharedPreferences.excludeCellularServices.get()
|
|
||||||
excludeLocalNetworks = await SharedPreferences.excludeLocalNetworks.get()
|
excludeLocalNetworks = await SharedPreferences.excludeLocalNetworks.get()
|
||||||
enforceRoutes = await SharedPreferences.enforceRoutes.get()
|
enforceRoutes = await SharedPreferences.enforceRoutes.get()
|
||||||
|
if #available(iOS 16.4, macOS 13.3, *) {
|
||||||
|
excludeAPNs = await SharedPreferences.excludeAPNs.get()
|
||||||
|
excludeCellularServices = await SharedPreferences.excludeCellularServices.get()
|
||||||
|
}
|
||||||
|
if #available(iOS 17.4, macOS 14.4, *) {
|
||||||
|
excludeDeviceCommunication = await SharedPreferences.excludeDeviceCommunication.get()
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
isLoading = false
|
isLoading = false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ public enum SharedPreferences {
|
|||||||
public static let excludeLocalNetworks = Preference<Bool>("exclude_local_networks", defaultValue: excludeLocalNetworksByDefault)
|
public static let excludeLocalNetworks = Preference<Bool>("exclude_local_networks", defaultValue: excludeLocalNetworksByDefault)
|
||||||
public static let excludeCellularServices = Preference<Bool>("exclude_cellular_services", defaultValue: true)
|
public static let excludeCellularServices = Preference<Bool>("exclude_cellular_services", defaultValue: true)
|
||||||
public static let enforceRoutes = Preference<Bool>("enforce_routes", defaultValue: false)
|
public static let enforceRoutes = Preference<Bool>("enforce_routes", defaultValue: false)
|
||||||
|
public static let excludeDeviceCommunication = Preference<Bool>("exclude_device_communication", defaultValue: true)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ public enum SharedPreferences {
|
|||||||
excludeLocalNetworks.name,
|
excludeLocalNetworks.name,
|
||||||
excludeCellularServices.name,
|
excludeCellularServices.name,
|
||||||
enforceRoutes.name,
|
enforceRoutes.name,
|
||||||
|
excludeDeviceCommunication.name,
|
||||||
]
|
]
|
||||||
#elseif os(tvOS)
|
#elseif os(tvOS)
|
||||||
let names = [ignoreMemoryLimit.name]
|
let names = [ignoreMemoryLimit.name]
|
||||||
@@ -60,6 +62,7 @@ public enum SharedPreferences {
|
|||||||
excludeLocalNetworks.name,
|
excludeLocalNetworks.name,
|
||||||
excludeCellularServices.name,
|
excludeCellularServices.name,
|
||||||
enforceRoutes.name,
|
enforceRoutes.name,
|
||||||
|
excludeDeviceCommunication.name,
|
||||||
]
|
]
|
||||||
#endif
|
#endif
|
||||||
try? await batchDelete(names)
|
try? await batchDelete(names)
|
||||||
|
|||||||
@@ -145,8 +145,14 @@ public class ExtensionProfile: ObservableObject {
|
|||||||
if let protocolConfiguration = manager.protocolConfiguration {
|
if let protocolConfiguration = manager.protocolConfiguration {
|
||||||
let includeAllNetworks = await SharedPreferences.includeAllNetworks.get()
|
let includeAllNetworks = await SharedPreferences.includeAllNetworks.get()
|
||||||
protocolConfiguration.includeAllNetworks = includeAllNetworks
|
protocolConfiguration.includeAllNetworks = includeAllNetworks
|
||||||
|
protocolConfiguration.excludeLocalNetworks = await SharedPreferences.excludeLocalNetworks.get()
|
||||||
|
protocolConfiguration.enforceRoutes = await SharedPreferences.enforceRoutes.get()
|
||||||
if #available(iOS 16.4, macOS 13.3, *) {
|
if #available(iOS 16.4, macOS 13.3, *) {
|
||||||
protocolConfiguration.excludeCellularServices = !includeAllNetworks
|
protocolConfiguration.excludeAPNs = await SharedPreferences.excludeAPNs.get()
|
||||||
|
protocolConfiguration.excludeCellularServices = await SharedPreferences.excludeCellularServices.get()
|
||||||
|
}
|
||||||
|
if #available(iOS 17.4, macOS 14.4, *) {
|
||||||
|
protocolConfiguration.excludeDeviceCommunication = await SharedPreferences.excludeDeviceCommunication.get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3290,6 +3290,9 @@
|
|||||||
},
|
},
|
||||||
"shouldTranslate" : false
|
"shouldTranslate" : false
|
||||||
},
|
},
|
||||||
|
"excludeDeviceCommunication" : {
|
||||||
|
"shouldTranslate" : false
|
||||||
|
},
|
||||||
"excludeLocalNetworks" : {
|
"excludeLocalNetworks" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"fa" : {
|
"fa" : {
|
||||||
@@ -5550,6 +5553,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"No documentation.\n\n[Apple Documentation](https://developer.apple.com/documentation/networkextension/nevpnprotocol/excludedevicecommunication)" : {
|
||||||
|
"shouldTranslate" : false
|
||||||
|
},
|
||||||
"Ok" : {
|
"Ok" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"fa" : {
|
"fa" : {
|
||||||
@@ -8632,4 +8638,4 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version" : "1.0"
|
"version" : "1.0"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user