Remove missing peers error in UpdateTunnelConfiguration Intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
This commit is contained in:
@@ -20,7 +20,6 @@
|
|||||||
"updateTunnelConfigurationIntentSummary ${tunnelName}" = "Update ${tunnelName} configuration";
|
"updateTunnelConfigurationIntentSummary ${tunnelName}" = "Update ${tunnelName} configuration";
|
||||||
|
|
||||||
"updateTunnelConfigurationIntentPeerOptionsUnavailableError" = "Use the output of \"Build Peer Configuration\" action to update tunnel configuration.";
|
"updateTunnelConfigurationIntentPeerOptionsUnavailableError" = "Use the output of \"Build Peer Configuration\" action to update tunnel configuration.";
|
||||||
"updateTunnelConfigurationIntentMissingPeerParameterError" = "Peer parameter value is missing";
|
|
||||||
"updateTunnelConfigurationIntentMalformedPublicKeyError %@" = "The key \"%1$@\" is not a valid Public Key encoded in Base64 format.";
|
"updateTunnelConfigurationIntentMalformedPublicKeyError %@" = "The key \"%1$@\" is not a valid Public Key encoded in Base64 format.";
|
||||||
|
|
||||||
// Build Peer Configuration
|
// Build Peer Configuration
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ struct UpdateTunnelConfiguration: AppIntent {
|
|||||||
var tunnelsManager: TunnelsManager
|
var tunnelsManager: TunnelsManager
|
||||||
|
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult {
|
||||||
guard let peers else { throw AppIntentConfigurationUpdateError.missingPeerParameter }
|
let peers = peers ?? []
|
||||||
|
|
||||||
guard let tunnelContainer = tunnelsManager.tunnel(named: tunnelName) else {
|
guard let tunnelContainer = tunnelsManager.tunnel(named: tunnelName) else {
|
||||||
throw AppIntentConfigurationUpdateError.wrongTunnel(name: tunnelName)
|
throw AppIntentConfigurationUpdateError.wrongTunnel(name: tunnelName)
|
||||||
@@ -114,7 +114,6 @@ enum AppIntentConfigurationUpdateError: Swift.Error, CustomLocalizedStringResour
|
|||||||
case wrongTunnel(name: String)
|
case wrongTunnel(name: String)
|
||||||
case missingConfiguration
|
case missingConfiguration
|
||||||
case peerOptionsUnavailable
|
case peerOptionsUnavailable
|
||||||
case missingPeerParameter
|
|
||||||
case malformedPublicKey(key: String)
|
case malformedPublicKey(key: String)
|
||||||
|
|
||||||
var localizedStringResource: LocalizedStringResource {
|
var localizedStringResource: LocalizedStringResource {
|
||||||
@@ -125,8 +124,6 @@ enum AppIntentConfigurationUpdateError: Swift.Error, CustomLocalizedStringResour
|
|||||||
return LocalizedStringResource("wireguardAppIntentsMissingConfigurationError", table: "AppIntents")
|
return LocalizedStringResource("wireguardAppIntentsMissingConfigurationError", table: "AppIntents")
|
||||||
case .peerOptionsUnavailable:
|
case .peerOptionsUnavailable:
|
||||||
return LocalizedStringResource("updateTunnelConfigurationIntentPeerOptionsUnavailableError", table: "AppIntents")
|
return LocalizedStringResource("updateTunnelConfigurationIntentPeerOptionsUnavailableError", table: "AppIntents")
|
||||||
case .missingPeerParameter:
|
|
||||||
return LocalizedStringResource("updateTunnelConfigurationIntentMissingPeerParameterError", table: "AppIntents")
|
|
||||||
case .malformedPublicKey(let malformedKey):
|
case .malformedPublicKey(let malformedKey):
|
||||||
return LocalizedStringResource("updateTunnelConfigurationIntentMalformedPublicKeyError \(malformedKey)", table: "AppIntents")
|
return LocalizedStringResource("updateTunnelConfigurationIntentMalformedPublicKeyError \(malformedKey)", table: "AppIntents")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user