Do some code clean up

- Use guard in validators

- Rename URL.openURL() to URL.open()

- Sort imports (SwiftLint)

- Drop unused VPNProtocolType.allTypes

- Drop unused imports
This commit is contained in:
Davide De Rosa 2023-04-04 09:50:45 +02:00
parent 1051a8dc52
commit b4ad8dea0d
163 changed files with 195 additions and 241 deletions

View File

@ -5,6 +5,8 @@ included:
analyzer_rules: analyzer_rules:
- unused_declaration - unused_declaration
- unused_import - unused_import
opt_in_rules:
- sorted_imports
disabled_rules: disabled_rules:
- cyclomatic_complexity - cyclomatic_complexity
- file_length - file_length

View File

@ -24,8 +24,8 @@
// //
import Foundation import Foundation
import UIKit
import PassepartoutLibrary import PassepartoutLibrary
import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate, ObservableObject { class AppDelegate: UIResponder, UIApplicationDelegate, ObservableObject {
private let mac = MacBundle.shared private let mac = MacBundle.shared

View File

@ -24,8 +24,8 @@
// //
import Foundation import Foundation
import UniformTypeIdentifiers
import SwiftyBeaver import SwiftyBeaver
import UniformTypeIdentifiers
extension Constants { extension Constants {
enum App { enum App {

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary
import LocalAuthentication import LocalAuthentication
import PassepartoutLibrary
import SwiftUI
extension View { extension View {
var themeIdiom: UIUserInterfaceIdiom { var themeIdiom: UIUserInterfaceIdiom {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import Foundation
import PassepartoutLibrary import PassepartoutLibrary
@MainActor @MainActor

View File

@ -24,8 +24,8 @@
// //
import Foundation import Foundation
import StoreKit
import PassepartoutLibrary import PassepartoutLibrary
import StoreKit
struct LocalProduct: RawRepresentable, Equatable, Hashable { struct LocalProduct: RawRepresentable, Equatable, Hashable {
private static let bundleSubdomain = "ios" private static let bundleSubdomain = "ios"

View File

@ -23,11 +23,11 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Combine
import Foundation import Foundation
import Kvitto
import PassepartoutLibrary import PassepartoutLibrary
import StoreKit import StoreKit
import Kvitto
import Combine
enum ProductError: Error { enum ProductError: Error {
case uneligible case uneligible

View File

@ -23,10 +23,10 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Combine
import Foundation import Foundation
import Intents import Intents
import IntentsUI import IntentsUI
import Combine
import PassepartoutLibrary import PassepartoutLibrary
@MainActor @MainActor

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Combine
import Foundation import Foundation
import PassepartoutLibrary import PassepartoutLibrary
import Combine
class DefaultLightProfile: LightProfile { class DefaultLightProfile: LightProfile {
let id: UUID let id: UUID

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import Foundation
import PassepartoutLibrary import PassepartoutLibrary
class DefaultLightProviderCategory: LightProviderCategory { class DefaultLightProviderCategory: LightProviderCategory {

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Combine
import Foundation import Foundation
import PassepartoutLibrary import PassepartoutLibrary
import Combine
class DefaultLightVPNManager: LightVPNManager { class DefaultLightVPNManager: LightVPNManager {
private let vpnManager = VPNManager.shared private let vpnManager = VPNManager.shared

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
@main @main
struct PassepartoutApp: App { struct PassepartoutApp: App {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import UIKit
import SwiftUI import SwiftUI
import UIKit
struct ActivityView: UIViewControllerRepresentable { struct ActivityView: UIViewControllerRepresentable {
let activityItems: [Any] let activityItems: [Any]

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import Intents import Intents
import IntentsUI import IntentsUI
import SwiftUI
struct IntentAddView: UIViewControllerRepresentable { struct IntentAddView: UIViewControllerRepresentable {
let shortcut: INShortcut let shortcut: INShortcut

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import Intents import Intents
import IntentsUI import IntentsUI
import SwiftUI
struct IntentEditView: UIViewControllerRepresentable { struct IntentEditView: UIViewControllerRepresentable {
let shortcut: Shortcut let shortcut: Shortcut

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import MessageUI import MessageUI
import SwiftUI
struct MailComposerView: UIViewControllerRepresentable { struct MailComposerView: UIViewControllerRepresentable {
class Coordinator: NSObject, MFMailComposeViewControllerDelegate { class Coordinator: NSObject, MFMailComposeViewControllerDelegate {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import UIKit
import StoreKit import StoreKit
import UIKit
public class Reviewer: ObservableObject { public class Reviewer: ObservableObject {
private struct Keys { private struct Keys {

View File

@ -61,13 +61,12 @@ struct Validators {
var sin = sockaddr_in() var sin = sockaddr_in()
var sin6 = sockaddr_in6() var sin6 = sockaddr_in6()
if string.withCString({ cstring in inet_pton(AF_INET6, cstring, &sin6.sin6_addr) }) == 1 { guard string.withCString({ cstring in inet_pton(AF_INET6, cstring, &sin6.sin6_addr) }) == 1 else {
return throw ValidationError.ipAddress
} }
if string.withCString({ cstring in inet_pton(AF_INET, cstring, &sin.sin_addr) }) == 1 { if string.withCString({ cstring in inet_pton(AF_INET, cstring, &sin.sin_addr) }) == 1 {
return throw ValidationError.ipAddress
} }
throw ValidationError.ipAddress
} }
static func domainName(_ string: String) throws { static func domainName(_ string: String) throws {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
enum ShortcutType: String { enum ShortcutType: String {
case enableVPN case enableVPN

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate { class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func sceneDidEnterBackground(_ scene: UIScene) { func sceneDidEnterBackground(_ scene: UIScene) {

View File

@ -73,7 +73,7 @@ struct AboutView: View {
private var supportSection: some View { private var supportSection: some View {
Section { Section {
Button(L10n.About.Items.JoinCommunity.caption) { Button(L10n.About.Items.JoinCommunity.caption) {
URL.openURL(redditURL) URL.open(redditURL)
} }
Button(L10n.About.Items.ShareTwitter.caption, action: shareOnTwitter) Button(L10n.About.Items.ShareTwitter.caption, action: shareOnTwitter)
Button(L10n.About.Items.WriteReview.caption, action: submitReview) Button(L10n.About.Items.WriteReview.caption, action: submitReview)
@ -85,16 +85,16 @@ struct AboutView: View {
private var webSection: some View { private var webSection: some View {
Section { Section {
Button(L10n.About.Items.Website.caption) { Button(L10n.About.Items.Website.caption) {
URL.openURL(homeURL) URL.open(homeURL)
} }
Button(Unlocalized.About.faq) { Button(Unlocalized.About.faq) {
URL.openURL(faqURL) URL.open(faqURL)
} }
Button(L10n.About.Items.Disclaimer.caption) { Button(L10n.About.Items.Disclaimer.caption) {
URL.openURL(disclaimerURL) URL.open(disclaimerURL)
} }
Button(L10n.About.Items.PrivacyPolicy.caption) { Button(L10n.About.Items.PrivacyPolicy.caption) {
URL.openURL(privacyURL) URL.open(privacyURL)
} }
} header: { } header: {
Text(L10n.About.Sections.Web.header) Text(L10n.About.Sections.Web.header)
@ -104,10 +104,10 @@ struct AboutView: View {
private var githubSection: some View { private var githubSection: some View {
Section { Section {
Button(Unlocalized.About.readme) { Button(Unlocalized.About.readme) {
URL.openURL(readmeURL) URL.open(readmeURL)
} }
Button(Unlocalized.About.changelog) { Button(Unlocalized.About.changelog) {
URL.openURL(changelogURL) URL.open(changelogURL)
} }
} header: { } header: {
Text(Unlocalized.About.github) Text(Unlocalized.About.github)
@ -118,11 +118,11 @@ struct AboutView: View {
extension AboutView { extension AboutView {
private func shareOnTwitter() { private func shareOnTwitter() {
let url = Unlocalized.Social.twitterIntent(withMessage: shareMessage) let url = Unlocalized.Social.twitterIntent(withMessage: shareMessage)
URL.openURL(url) URL.open(url)
} }
private func submitReview() { private func submitReview() {
let reviewURL = Reviewer.urlForReview(withAppId: Constants.App.appStoreId) let reviewURL = Reviewer.urlForReview(withAppId: Constants.App.appStoreId)
URL.openURL(reviewURL) URL.open(reviewURL)
} }
} }

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct AccountView: View { struct AccountView: View {
@ObservedObject private var providerManager: ProviderManager @ObservedObject private var providerManager: ProviderManager
@ -116,7 +116,7 @@ struct AccountView: View {
} }
private func openGuidanceURL(_ url: URL) { private func openGuidanceURL(_ url: URL) {
URL.openURL(url) URL.open(url)
} }
} }

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
import TunnelKitOpenVPN import TunnelKitOpenVPN
import TunnelKitWireGuard import TunnelKitWireGuard

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct AddProfileMenu: View { struct AddProfileMenu: View {
enum ModalType: Identifiable { enum ModalType: Identifiable {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
enum AddProfileView { enum AddProfileView {
struct Bindings { struct Bindings {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension AddProviderView { extension AddProviderView {
struct NameView: View { struct NameView: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct AddProviderView: View { struct AddProviderView: View {
@ObservedObject private var providerManager: ProviderManager @ObservedObject private var providerManager: ProviderManager

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import Combine import Combine
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct DebugLogView: View { struct DebugLogView: View {
private let title: String private let title: String

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
import TunnelKitOpenVPN import TunnelKitOpenVPN
extension DiagnosticsView { extension DiagnosticsView {
@ -178,7 +178,7 @@ extension DiagnosticsView.OpenVPNView {
guard let url = URL.mailto(to: V.recipient, subject: V.subject, body: body) else { guard let url = URL.mailto(to: V.recipient, subject: V.subject, body: body) else {
return return
} }
guard URL.openURL(url) else { guard URL.open(url) else {
alertType = .emailNotConfigured alertType = .emailNotConfigured
return return
} }

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
import TunnelKitWireGuard import TunnelKitWireGuard
extension DiagnosticsView { extension DiagnosticsView {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct DiagnosticsView: View { struct DiagnosticsView: View {
let vpnProtocol: VPNProtocolType let vpnProtocol: VPNProtocolType

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import StoreKit
import PassepartoutLibrary import PassepartoutLibrary
import StoreKit
import SwiftUI
struct DonateView: View { struct DonateView: View {
enum AlertType: Identifiable { enum AlertType: Identifiable {

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import PassepartoutLibrary
import SwiftUI import SwiftUI
import TunnelKitOpenVPN import TunnelKitOpenVPN
import PassepartoutLibrary
extension EndpointAdvancedView { extension EndpointAdvancedView {
struct OpenVPNView: View { struct OpenVPNView: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
import TunnelKitOpenVPN import TunnelKitOpenVPN
extension EndpointView { extension EndpointView {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
import TunnelKitWireGuard import TunnelKitWireGuard
extension EndpointView { extension EndpointView {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct EndpointView: View { struct EndpointView: View {
@ObservedObject private var currentProfile: ObservableProfile @ObservedObject private var currentProfile: ObservableProfile

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct InteractiveConnectionView: View { struct InteractiveConnectionView: View {
@Environment(\.presentationMode) private var presentationMode @Environment(\.presentationMode) private var presentationMode

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct NetworkSettingsView: View { struct NetworkSettingsView: View {
@ObservedObject private var currentProfile: ObservableProfile @ObservedObject private var currentProfile: ObservableProfile

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension OnDemandView { extension OnDemandView {
struct SSIDList: View { struct SSIDList: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct OnDemandView: View { struct OnDemandView: View {
@ObservedObject private var productManager: ProductManager @ObservedObject private var productManager: ProductManager

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension OrganizerView { extension OrganizerView {
struct ProfileRow: View { struct ProfileRow: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension OrganizerView { extension OrganizerView {
struct ProfilesList: View { struct ProfilesList: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension OrganizerView { extension OrganizerView {
struct SceneView: View { struct SceneView: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct OrganizerView: View { struct OrganizerView: View {
enum ModalType: Identifiable { enum ModalType: Identifiable {
@ -151,7 +151,7 @@ extension OrganizerView {
message: Text(L10n.Organizer.Alerts.Reddit.message), message: Text(L10n.Organizer.Alerts.Reddit.message),
primaryButton: .default(Text(L10n.Organizer.Alerts.Reddit.Buttons.subscribe)) { primaryButton: .default(Text(L10n.Organizer.Alerts.Reddit.Buttons.subscribe)) {
didHandleSubreddit = true didHandleSubreddit = true
URL.openURL(redditURL) URL.open(redditURL)
}, },
secondaryButton: .cancel(Text(L10n.Global.Alerts.Buttons.never)) { secondaryButton: .cancel(Text(L10n.Global.Alerts.Buttons.never)) {
didHandleSubreddit = true didHandleSubreddit = true

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import StoreKit
import PassepartoutLibrary import PassepartoutLibrary
import StoreKit
import SwiftUI
extension PaywallView { extension PaywallView {
struct PurchaseView: View { struct PurchaseView: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension ProfileView { extension ProfileView {
struct ConfigurationSection: View { struct ConfigurationSection: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension ProfileView { extension ProfileView {
struct DiagnosticsSection: View { struct DiagnosticsSection: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension ProfileView { extension ProfileView {
struct ExtraSection: View { struct ExtraSection: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension ProfileView { extension ProfileView {
struct MainMenu: View { struct MainMenu: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension ProfileView { extension ProfileView {
struct ProviderSection: View, ProviderProfileAvailability { struct ProviderSection: View, ProviderProfileAvailability {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension ProfileView { extension ProfileView {
struct RenameView: View { struct RenameView: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension ProfileView { extension ProfileView {
struct VPNSection: View { struct VPNSection: View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct ProfileView: View { struct ProfileView: View {
enum ModalType: Int, Identifiable { enum ModalType: Int, Identifiable {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct ProviderLocationView: View, ProviderProfileAvailability { struct ProviderLocationView: View, ProviderProfileAvailability {
@ObservedObject var providerManager: ProviderManager @ObservedObject var providerManager: ProviderManager

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct ProviderPresetView: View { struct ProviderPresetView: View {
@Environment(\.presentationMode) private var presentationMode @Environment(\.presentationMode) private var presentationMode

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import MessageUI import MessageUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct ReportIssueView: View { struct ReportIssueView: View {
@Binding private var isPresented: Bool @Binding private var isPresented: Bool

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct SettingsButton: View { struct SettingsButton: View {
@State private var isPresented = false @State private var isPresented = false

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct SettingsView: View { struct SettingsView: View {
@ObservedObject private var profileManager: ProfileManager @ObservedObject private var profileManager: ProfileManager

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import Intents import Intents
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
extension ShortcutsView { extension ShortcutsView {
struct AddView: View { struct AddView: View {

View File

@ -23,9 +23,9 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import Intents import Intents
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct ShortcutsView: View { struct ShortcutsView: View {
enum ModalType: Identifiable { enum ModalType: Identifiable {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct VPNStatusText: View { struct VPNStatusText: View {
@ObservedObject private var currentVPNState: ObservableVPNState @ObservedObject private var currentVPNState: ObservableVPNState

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
struct VPNToggle: View { struct VPNToggle: View {
@ObservedObject private var profileManager: ProfileManager @ObservedObject private var profileManager: ProfileManager

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import SwiftUI
import PassepartoutLibrary import PassepartoutLibrary
import SwiftUI
import SwiftyBeaver import SwiftyBeaver
extension View { extension View {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import Foundation
import PassepartoutLibrary import PassepartoutLibrary
@MainActor @MainActor

View File

@ -24,11 +24,11 @@
// //
import Foundation import Foundation
import NetworkExtension
import PassepartoutLibrary
import TunnelKitManager import TunnelKitManager
import TunnelKitOpenVPN import TunnelKitOpenVPN
import TunnelKitWireGuard import TunnelKitWireGuard
import NetworkExtension
import PassepartoutLibrary
extension VPNStatus { extension VPNStatus {
var localizedDescription: String { var localizedDescription: String {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject { class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
private let appURL = Constants.Launcher.appURL private let appURL = Constants.Launcher.appURL

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
private let bundle = Constants.Mac.bundle private let bundle = Constants.Mac.bundle

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
class DefaultMacUtils: MacUtils { class DefaultMacUtils: MacUtils {
private(set) lazy var isStartedByLauncher = NSApp.isHidden private(set) lazy var isStartedByLauncher = NSApp.isHidden

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct HostProfileItem: Item { struct HostProfileItem: Item {
private let viewModel: ViewModel private let viewModel: ViewModel

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import Foundation
import ServiceManagement import ServiceManagement
extension LaunchOnLoginItem { extension LaunchOnLoginItem {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct LaunchOnLoginItem: Item { struct LaunchOnLoginItem: Item {
private let viewModel: ViewModel private let viewModel: ViewModel

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
extension PassepartoutMenu { extension PassepartoutMenu {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
@MainActor @MainActor
class PassepartoutMenu { class PassepartoutMenu {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct ProfileItemGroup: ItemGroup { struct ProfileItemGroup: ItemGroup {
private let profileManager: LightProfileManager private let profileManager: LightProfileManager

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct ProviderLocationItem: Item { struct ProviderLocationItem: Item {
private let profile: LightProfile private let profile: LightProfile

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct ProviderProfileItem: Item { struct ProviderProfileItem: Item {
private let viewModel: ViewModel private let viewModel: ViewModel

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct ProviderServerItem: Item { struct ProviderServerItem: Item {
private let profile: LightProfile private let profile: LightProfile

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import Foundation
extension VPNItemGroup { extension VPNItemGroup {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct VPNItemGroup: ItemGroup { struct VPNItemGroup: ItemGroup {
private let viewModel: ViewModel private let viewModel: ViewModel

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
extension VisibilityItem { extension VisibilityItem {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct VisibilityItem: Item { struct VisibilityItem: Item {
private let title: String private let title: String

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
protocol Item: ItemGroup { protocol Item: ItemGroup {
func asMenuItem(withParent parent: NSMenu) -> NSMenuItem func asMenuItem(withParent parent: NSMenu) -> NSMenuItem

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
@MainActor @MainActor
protocol ItemGroup { protocol ItemGroup {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import Foundation
class ObservableProcessTransformer: ObservableObject { class ObservableProcessTransformer: ObservableObject {
static let shared = ObservableProcessTransformer() static let shared = ObservableProcessTransformer()

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct SeparatorItem: Item { struct SeparatorItem: Item {
func asMenuItem(withParent parent: NSMenu) -> NSMenuItem { func asMenuItem(withParent parent: NSMenu) -> NSMenuItem {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct StaticSystemMenu: SystemMenu { struct StaticSystemMenu: SystemMenu {
let children: [ItemGroup] let children: [ItemGroup]

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
@MainActor @MainActor
protocol SystemMenu { protocol SystemMenu {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import Foundation
extension TextItem { extension TextItem {
class ViewModel { class ViewModel {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import AppKit import AppKit
import Foundation
struct TextItem: Item { struct TextItem: Item {
enum State { enum State {

View File

@ -24,7 +24,6 @@
// //
import Foundation import Foundation
import TunnelKit
extension Profile { extension Profile {
public struct NetworkSettings: Codable, Equatable { public struct NetworkSettings: Codable, Equatable {

View File

@ -25,7 +25,7 @@
import Foundation import Foundation
public enum VPNProtocolType: String, Codable { public enum VPNProtocolType: String, CaseIterable, Codable {
case openVPN = "ovpn" case openVPN = "ovpn"
case wireGuard = "wg" case wireGuard = "wg"

View File

@ -1,8 +1,8 @@
@_exported import PassepartoutVPN @_exported import PassepartoutCore
@_exported import PassepartoutProfiles @_exported import PassepartoutProfiles
@_exported import PassepartoutProviders @_exported import PassepartoutProviders
@_exported import PassepartoutServices @_exported import PassepartoutServices
@_exported import PassepartoutUtils @_exported import PassepartoutUtils
@_exported import PassepartoutCore @_exported import PassepartoutVPN
@_exported import TunnelKit @_exported import TunnelKit
@_exported import TunnelKitCore @_exported import TunnelKitCore

View File

@ -25,11 +25,11 @@
import Foundation import Foundation
import GenericJSON import GenericJSON
import TunnelKitCore
import TunnelKitOpenVPNCore
import TunnelKitManager
import PassepartoutCore import PassepartoutCore
import PassepartoutUtils import PassepartoutUtils
import TunnelKitCore
import TunnelKitManager
import TunnelKitOpenVPNCore
private typealias Map = [String: Any] private typealias Map = [String: Any]

View File

@ -23,11 +23,11 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import CoreData import CoreData
import SwiftyBeaver import Foundation
import PassepartoutCore import PassepartoutCore
import PassepartoutUtils import PassepartoutUtils
import SwiftyBeaver
@MainActor @MainActor
public final class UpgradeManager: ObservableObject { public final class UpgradeManager: ObservableObject {

View File

@ -7,8 +7,8 @@
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
// //
import Foundation
import CoreData import CoreData
import Foundation
@objc(CDProfile) @objc(CDProfile)
public class CDProfile: NSManagedObject { public class CDProfile: NSManagedObject {

View File

@ -7,8 +7,8 @@
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
// //
import Foundation
import CoreData import CoreData
import Foundation
extension CDProfile { extension CDProfile {

View File

@ -24,9 +24,9 @@
// //
import Foundation import Foundation
import PassepartoutCore
import TunnelKitCore import TunnelKitCore
import TunnelKitOpenVPN import TunnelKitOpenVPN
import PassepartoutCore
extension Profile.OpenVPNSettings: GatewaySettingsProviding { extension Profile.OpenVPNSettings: GatewaySettingsProviding {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import CoreData import CoreData
import Foundation
import PassepartoutCore import PassepartoutCore
extension PassepartoutDataModels { extension PassepartoutDataModels {

View File

@ -23,12 +23,12 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import TunnelKitOpenVPN import Foundation
import TunnelKitWireGuard
import PassepartoutCore import PassepartoutCore
import PassepartoutUtils import PassepartoutUtils
import TunnelKitOpenVPN
import TunnelKitWireGuard
extension ProviderServer.Preset { extension ProviderServer.Preset {
public var openVPNConfiguration: OpenVPN.Configuration? { public var openVPNConfiguration: OpenVPN.Configuration? {

View File

@ -23,8 +23,8 @@
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>. // along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
// //
import Foundation
import Combine import Combine
import Foundation
import PassepartoutCore import PassepartoutCore
import PassepartoutProviders import PassepartoutProviders

Some files were not shown because too many files have changed in this diff Show More