From 989886c43495526e8a2d1e968bb36542738768c1 Mon Sep 17 00:00:00 2001 From: Davide Date: Sat, 28 Sep 2024 00:01:01 +0200 Subject: [PATCH] Fix description of parsing errors on import (#623) Fixes #607 --- .../xcshareddata/swiftpm/Package.resolved | 76 +++++++++++++++++++ Passepartout/Library/Package.swift | 2 +- .../AppUI/Business/ProfileImporter.swift | 3 +- .../Sources/AppUI/L10n/AppError+L10n.swift | 2 +- 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved diff --git a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 00000000..02a0753c --- /dev/null +++ b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,76 @@ +{ + "pins" : [ + { + "identity" : "dtfoundation", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Cocoanetics/DTFoundation.git", + "state" : { + "revision" : "76062513434421cb6c8a1ae1d4f8368a7ebc2da3", + "version" : "1.7.18" + } + }, + { + "identity" : "kvitto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Cocoanetics/Kvitto", + "state" : { + "revision" : "88888674d772ddcf19671159ed0022cb0bc37be2", + "version" : "1.0.6" + } + }, + { + "identity" : "openssl-apple", + "kind" : "remoteSourceControl", + "location" : "https://github.com/passepartoutvpn/openssl-apple", + "state" : { + "revision" : "0edc07c7a0e4ec2ca0f448dd68314241ccc925b3", + "version" : "3.2.107" + } + }, + { + "identity" : "passepartoutkit", + "kind" : "remoteSourceControl", + "location" : "git@github.com:passepartoutvpn/passepartoutkit", + "state" : { + "revision" : "ed3f54281b672af0f1127f00033579a36a9afed5" + } + }, + { + "identity" : "passepartoutkit-openvpn-openssl", + "kind" : "remoteSourceControl", + "location" : "git@github.com:passepartoutvpn/passepartoutkit-openvpn-openssl", + "state" : { + "revision" : "a3092a6ee0a63f666aa47ef3f0f50c324a64598d", + "version" : "0.6.0" + } + }, + { + "identity" : "passepartoutkit-wireguard-go", + "kind" : "remoteSourceControl", + "location" : "git@github.com:passepartoutvpn/passepartoutkit-wireguard-go", + "state" : { + "revision" : "2cbd6023300d2dcc3f6f68de4812cf390421ec35", + "version" : "0.6.2" + } + }, + { + "identity" : "wg-go-apple", + "kind" : "remoteSourceControl", + "location" : "https://github.com/passepartoutvpn/wg-go-apple", + "state" : { + "revision" : "860e82efaf261da37483a5f51555be83e5a79ad3", + "version" : "0.0.20240714" + } + }, + { + "identity" : "wireguard-apple", + "kind" : "remoteSourceControl", + "location" : "https://github.com/passepartoutvpn/wireguard-apple", + "state" : { + "revision" : "a896f784bc5ed94f29d97e376be5cfa08d4a5d44", + "version" : "1.1.1" + } + } + ], + "version" : 2 +} diff --git a/Passepartout/Library/Package.swift b/Passepartout/Library/Package.swift index 41800cf8..b1f7d8a8 100644 --- a/Passepartout/Library/Package.swift +++ b/Passepartout/Library/Package.swift @@ -31,7 +31,7 @@ let package = Package( ], dependencies: [ // .package(url: "git@github.com:passepartoutvpn/passepartoutkit", from: "0.7.0"), - .package(url: "git@github.com:passepartoutvpn/passepartoutkit", revision: "2d7e0210d8754664ce45528d50c1a1e6a36ad27c"), + .package(url: "git@github.com:passepartoutvpn/passepartoutkit", revision: "ed3f54281b672af0f1127f00033579a36a9afed5"), // .package(path: "../../../passepartoutkit"), .package(url: "git@github.com:passepartoutvpn/passepartoutkit-openvpn-openssl", from: "0.6.0"), // .package(path: "../../../passepartoutkit-openvpn-openssl"), diff --git a/Passepartout/Library/Sources/AppUI/Business/ProfileImporter.swift b/Passepartout/Library/Sources/AppUI/Business/ProfileImporter.swift index 79ece4c5..211dd9c6 100644 --- a/Passepartout/Library/Sources/AppUI/Business/ProfileImporter.swift +++ b/Passepartout/Library/Sources/AppUI/Business/ProfileImporter.swift @@ -60,7 +60,8 @@ final class ProfileImporter: ObservableObject { ) } catch { if let error = error as? PassepartoutError, - error.code == .OpenVPN.passphraseRequired { + let reason = error.reason as? PassepartoutError, + reason.code == .OpenVPN.passphraseRequired { withPassphrase.append(url) continue } diff --git a/Passepartout/Library/Sources/AppUI/L10n/AppError+L10n.swift b/Passepartout/Library/Sources/AppUI/L10n/AppError+L10n.swift index 4acfa4f5..532ca118 100644 --- a/Passepartout/Library/Sources/AppUI/L10n/AppError+L10n.swift +++ b/Passepartout/Library/Sources/AppUI/L10n/AppError+L10n.swift @@ -71,7 +71,7 @@ extension PassepartoutError: LocalizedError { return Strings.Errors.App.Passepartout.invalidFields(fieldsDescription) case .parsing: - return Strings.Errors.App.Passepartout.parsing + return reason?.localizedDescription ?? Strings.Errors.App.Passepartout.parsing case .unhandled: return reason?.localizedDescription