From 092d4f5de2a66c11eafb02074a1acd769d747c21 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 4 Sep 2022 20:09:31 +0200 Subject: [PATCH] Drop return in one-line functions --- .../App/Constants/Constants+App.swift | 4 ++-- .../App/Extensions/DebugLog+Constants.swift | 4 ++-- .../Extensions/TunnelKit+Identifiable.swift | 6 ++--- Passepartout/App/InApp/LocalProduct.swift | 10 ++++----- Passepartout/App/InApp/ProductManager.swift | 14 ++++++------ .../App/Intents/IntentDispatcher.swift | 12 +++++----- Passepartout/App/Reusable/ActivityView.swift | 2 +- .../App/Reusable/EditableTextList.swift | 2 +- .../App/Reusable/GenericCreditsView.swift | 8 +++---- .../App/Reusable/IntentActivity.swift | 2 +- Passepartout/App/Reusable/Reviewer.swift | 4 ++-- Passepartout/App/Reusable/Shortcut.swift | 8 +++---- Passepartout/App/Views/AddHostView+Name.swift | 2 +- Passepartout/App/Views/AddProviderView.swift | 2 +- .../App/Views/DiagnosticsView+OpenVPN.swift | 2 +- .../App/Views/DiagnosticsView+WireGuard.swift | 2 +- Passepartout/App/Views/DonateView.swift | 2 +- .../App/Views/EndpointView+OpenVPN.swift | 2 +- .../App/Views/PaywallView+Purchase.swift | 8 +++---- .../App/Views/ProfileView+Provider.swift | 6 ++--- .../App/Views/ProfileView+Rename.swift | 2 +- Passepartout/App/Views/ProfileView.swift | 2 +- .../App/Views/ProviderLocationView.swift | 4 ++-- .../App/Views/ProviderPresetView.swift | 2 +- Passepartout/App/Views/VPNStatusText.swift | 2 +- Passepartout/AppShared/L10n/Core+L10n.swift | 6 ++--- Passepartout/AppShared/L10n/Unlocalized.swift | 6 ++--- Passepartout/Mac/Menu/ProfileItemGroup.swift | 6 +---- .../Menu/ProviderLocationItem+ViewModel.swift | 2 +- .../Extensions/Host+Extensions.swift | 2 +- .../Extensions/Profile+Extensions.swift | 2 +- .../Extensions/Provider+Extensions.swift | 8 +++---- .../PassepartoutCore/Models/DebugLog.swift | 2 +- .../Models/Profile+Header.swift | 2 +- .../Models/Profile+OpenVPNSettings.swift | 2 +- .../Models/Profile+WireGuardSettings.swift | 2 +- .../PassepartoutCore/Models/Profile.swift | 2 +- .../Models/ProviderServer.swift | 2 +- .../Managers/UpgradeManager+Migrations.swift | 4 ++-- .../Extensions/OpenVPNSettings+Network.swift | 22 +++++++++---------- .../PassepartoutProfiles+Logging.swift | 4 ++-- .../WireGuardSettings+Network.swift | 12 +++++----- .../Managers/ProfileManager+Keychain.swift | 2 +- .../Repositories/ServerMapper.swift | 13 +++++------ .../DataModels/WSProvidersIndex.swift | 2 +- .../DefaultWebServices.swift | 4 ++-- .../PassepartoutServices/WebServices.swift | 2 +- .../Reusable/GenericWebParser.swift | 4 ++-- .../Reusable/GenericWebResponse.swift | 2 +- .../PassepartoutUtils/Reusable/InApp.swift | 6 ++--- .../Reusable/KeyedCache.swift | 4 ++-- .../Utils/Utils+Codable.swift | 2 +- .../PassepartoutUtils/Utils/Utils+Dates.swift | 2 +- .../Utils/Utils+Network.swift | 2 +- .../Utils/Utils+Strings.swift | 6 ++--- .../Utils/Utils+TestFlight.swift | 6 ++--- .../PassepartoutUtils/Utils/Utils+URL.swift | 2 +- .../Extensions/OnDemand+Rules.swift | 2 +- .../VPNProtocolType+Extensions.swift | 14 ++++++------ .../Managers/MockVPNManagerStrategy.swift | 4 ++-- .../PassepartoutVPN/Managers/VPNManager.swift | 4 ++-- .../PassepartoutUtilsTests/UtilsTests.swift | 4 ++-- 62 files changed, 140 insertions(+), 147 deletions(-) diff --git a/Passepartout/App/Constants/Constants+App.swift b/Passepartout/App/Constants/Constants+App.swift index b573e334..5ed28512 100644 --- a/Passepartout/App/Constants/Constants+App.swift +++ b/Passepartout/App/Constants/Constants+App.swift @@ -204,11 +204,11 @@ extension Constants { private static let githubRawRoot = URL(string: "https://\(Domain.name)/")! private static func github(repo: String) -> URL { - return githubRoot.appendingPathComponent(repo) + githubRoot.appendingPathComponent(repo) } private static func githubRaw(repo: String) -> URL { - return githubRawRoot.appendingPathComponent(repo) + githubRawRoot.appendingPathComponent(repo) } static let apple = github(repo: "passepartout-apple") diff --git a/Passepartout/App/Extensions/DebugLog+Constants.swift b/Passepartout/App/Extensions/DebugLog+Constants.swift index 55173fce..b1ed4ead 100644 --- a/Passepartout/App/Extensions/DebugLog+Constants.swift +++ b/Passepartout/App/Extensions/DebugLog+Constants.swift @@ -28,10 +28,10 @@ import PassepartoutLibrary extension DebugLog { func decoratedString() -> String { - return decoratedString(Constants.Global.appName, Constants.Global.appVersionString) + decoratedString(Constants.Global.appName, Constants.Global.appVersionString) } func decoratedData() -> Data { - return decoratedData(Constants.Global.appName, Constants.Global.appVersionString) + decoratedData(Constants.Global.appName, Constants.Global.appVersionString) } } diff --git a/Passepartout/App/Extensions/TunnelKit+Identifiable.swift b/Passepartout/App/Extensions/TunnelKit+Identifiable.swift index c148273d..2e73dc4d 100644 --- a/Passepartout/App/Extensions/TunnelKit+Identifiable.swift +++ b/Passepartout/App/Extensions/TunnelKit+Identifiable.swift @@ -28,18 +28,18 @@ import TunnelKitCore extension Endpoint: Identifiable { public var id: String { - return "\(address):\(proto.port):\(proto.socketType.rawValue)" + "\(address):\(proto.port):\(proto.socketType.rawValue)" } } extension IPv4Settings.Route: Identifiable { public var id: String { - return "\(destination):\(mask):\(gateway)" + "\(destination):\(mask):\(gateway)" } } extension IPv6Settings.Route: Identifiable { public var id: String { - return "\(destination):\(prefixLength):\(gateway)" + "\(destination):\(prefixLength):\(gateway)" } } diff --git a/Passepartout/App/InApp/LocalProduct.swift b/Passepartout/App/InApp/LocalProduct.swift index 21f8c1e3..bceb694d 100644 --- a/Passepartout/App/InApp/LocalProduct.swift +++ b/Passepartout/App/InApp/LocalProduct.swift @@ -98,19 +98,19 @@ struct LocalProduct: RawRepresentable, Equatable, Hashable { // MARK: All static var all: [LocalProduct] { - return allDonations + allFeatures// + allProviders + allDonations + allFeatures// + allProviders } var isDonation: Bool { - return rawValue.hasPrefix(LocalProduct.donationsBundle) + rawValue.hasPrefix(LocalProduct.donationsBundle) } var isFeature: Bool { - return rawValue.hasPrefix(LocalProduct.featuresBundle) + rawValue.hasPrefix(LocalProduct.featuresBundle) } var isProvider: Bool { - return rawValue.hasPrefix(LocalProduct.providersBundle) + rawValue.hasPrefix(LocalProduct.providersBundle) } // MARK: RawRepresentable @@ -124,7 +124,7 @@ struct LocalProduct: RawRepresentable, Equatable, Hashable { extension LocalProduct { func matchesStoreKitProduct(_ skProduct: SKProduct) -> Bool { - return skProduct.productIdentifier == rawValue + skProduct.productIdentifier == rawValue } } diff --git a/Passepartout/App/InApp/ProductManager.swift b/Passepartout/App/InApp/ProductManager.swift index 0b578113..6fe12ad3 100644 --- a/Passepartout/App/InApp/ProductManager.swift +++ b/Passepartout/App/InApp/ProductManager.swift @@ -114,11 +114,11 @@ class ProductManager: NSObject, ObservableObject { } func product(withIdentifier identifier: LocalProduct) -> SKProduct? { - return inApp.product(withIdentifier: identifier) + inApp.product(withIdentifier: identifier) } func featureProducts(including: [LocalProduct]) -> [SKProduct] { - return inApp.products.filter { + inApp.products.filter { guard let p = LocalProduct(rawValue: $0.productIdentifier) else { return false } @@ -133,7 +133,7 @@ class ProductManager: NSObject, ObservableObject { } func featureProducts(excluding: [LocalProduct]) -> [SKProduct] { - return inApp.products.filter { + inApp.products.filter { guard let p = LocalProduct(rawValue: $0.productIdentifier) else { return false } @@ -203,19 +203,19 @@ class ProductManager: NSObject, ObservableObject { } func isEligibleForFeedback() -> Bool { - return appType == .beta || !purchasedFeatures.isEmpty + appType == .beta || !purchasedFeatures.isEmpty } func hasPurchased(_ product: LocalProduct) -> Bool { - return purchasedFeatures.contains(product) + purchasedFeatures.contains(product) } func isCancelledPurchase(_ product: LocalProduct) -> Bool { - return cancelledPurchases.contains(product) + cancelledPurchases.contains(product) } func purchaseDate(forProduct product: LocalProduct) -> Date? { - return purchaseDates[product] + purchaseDates[product] } func reloadReceipt(andNotify: Bool = true) { diff --git a/Passepartout/App/Intents/IntentDispatcher.swift b/Passepartout/App/Intents/IntentDispatcher.swift index bf364dda..a95b3835 100644 --- a/Passepartout/App/Intents/IntentDispatcher.swift +++ b/Passepartout/App/Intents/IntentDispatcher.swift @@ -53,27 +53,27 @@ class IntentDispatcher { } static func intentEnable() -> EnableVPNIntent { - return EnableVPNIntent() + EnableVPNIntent() } static func intentDisable() -> DisableVPNIntent { - return DisableVPNIntent() + DisableVPNIntent() } static func intentTrustWiFi() -> TrustCurrentNetworkIntent { - return TrustCurrentNetworkIntent() + TrustCurrentNetworkIntent() } static func intentUntrustWiFi() -> UntrustCurrentNetworkIntent { - return UntrustCurrentNetworkIntent() + UntrustCurrentNetworkIntent() } static func intentTrustCellular() -> TrustCellularNetworkIntent { - return TrustCellularNetworkIntent() + TrustCellularNetworkIntent() } static func intentUntrustCellular() -> UntrustCellularNetworkIntent { - return UntrustCellularNetworkIntent() + UntrustCellularNetworkIntent() } // MARK: Donations diff --git a/Passepartout/App/Reusable/ActivityView.swift b/Passepartout/App/Reusable/ActivityView.swift index 2fbe4aa6..f85e6e2c 100644 --- a/Passepartout/App/Reusable/ActivityView.swift +++ b/Passepartout/App/Reusable/ActivityView.swift @@ -32,7 +32,7 @@ struct ActivityView: UIViewControllerRepresentable { let applicationActivities: [UIActivity]? = nil func makeUIViewController(context: UIViewControllerRepresentableContext) -> UIActivityViewController { - return UIActivityViewController(activityItems: activityItems, applicationActivities: applicationActivities) + UIActivityViewController(activityItems: activityItems, applicationActivities: applicationActivities) } func updateUIViewController(_ uiViewController: UIActivityViewController, context: UIViewControllerRepresentableContext) { diff --git a/Passepartout/App/Reusable/EditableTextList.swift b/Passepartout/App/Reusable/EditableTextList.swift index 71df69dd..9a2c5fc2 100644 --- a/Passepartout/App/Reusable/EditableTextList.swift +++ b/Passepartout/App/Reusable/EditableTextList.swift @@ -158,7 +158,7 @@ extension EditableTextList { private func binding(toEditedElement element: IdentifiableString) -> Binding { // print(">>> <-> \(element)") - return .init { + .init { editedTextStrings[element.id] ?? element.string } set: { editedTextStrings[element.id] = $0 diff --git a/Passepartout/App/Reusable/GenericCreditsView.swift b/Passepartout/App/Reusable/GenericCreditsView.swift index 42e25497..52da9001 100644 --- a/Passepartout/App/Reusable/GenericCreditsView.swift +++ b/Passepartout/App/Reusable/GenericCreditsView.swift @@ -59,19 +59,19 @@ struct GenericCreditsView: View { } private var sortedLicenses: [License] { - return licenses.sorted { + licenses.sorted { $0.0.lowercased() < $1.0.lowercased() } } private var sortedNotices: [Notice] { - return notices.sorted { + notices.sorted { $0.0.lowercased() < $1.0.lowercased() } } private var sortedLanguages: [String] { - return translations.keys.sorted { + translations.keys.sorted { $0.localizedAsCountryCode < $1.localizedAsCountryCode } } @@ -174,6 +174,6 @@ extension GenericCreditsView { private extension String { var localizedAsCountryCode: String { - return Locale.current.localizedString(forLanguageCode: self)?.capitalized ?? self + Locale.current.localizedString(forLanguageCode: self)?.capitalized ?? self } } diff --git a/Passepartout/App/Reusable/IntentActivity.swift b/Passepartout/App/Reusable/IntentActivity.swift index d573fd66..bd2741e8 100644 --- a/Passepartout/App/Reusable/IntentActivity.swift +++ b/Passepartout/App/Reusable/IntentActivity.swift @@ -33,7 +33,7 @@ public struct IntentActivity { extension View { public func onIntentActivity(_ activity: IntentActivity, object: UserObject) -> some View { - return onContinueUserActivity(activity.name) { + onContinueUserActivity(activity.name) { activity.handler($0, object) } } diff --git a/Passepartout/App/Reusable/Reviewer.swift b/Passepartout/App/Reusable/Reviewer.swift index 929a157c..702c7c69 100644 --- a/Passepartout/App/Reusable/Reviewer.swift +++ b/Passepartout/App/Reusable/Reviewer.swift @@ -43,7 +43,7 @@ public class Reviewer: ObservableObject { @discardableResult public func reportEvent() -> Bool { - return reportEvents(1) + reportEvents(1) } @discardableResult @@ -88,6 +88,6 @@ public class Reviewer: ObservableObject { } public static func urlForReview(withAppId appId: String) -> URL { - return URL(string: "https://apps.apple.com/app/id\(appId)?action=write-review")! + URL(string: "https://apps.apple.com/app/id\(appId)?action=write-review")! } } diff --git a/Passepartout/App/Reusable/Shortcut.swift b/Passepartout/App/Reusable/Shortcut.swift index 7caad1ec..1ede32ef 100644 --- a/Passepartout/App/Reusable/Shortcut.swift +++ b/Passepartout/App/Reusable/Shortcut.swift @@ -34,15 +34,15 @@ struct Shortcut: Identifiable, Hashable, Comparable { } var id: UUID { - return native.identifier + native.identifier } static func ==(lhs: Self, rhs: Self) -> Bool { - return lhs.phrase == rhs.phrase + lhs.phrase == rhs.phrase } static func <(lhs: Self, rhs: Self) -> Bool { - return lhs.phrase < rhs.phrase + lhs.phrase < rhs.phrase } func hash(into hasher: inout Hasher) { @@ -50,6 +50,6 @@ struct Shortcut: Identifiable, Hashable, Comparable { } private var phrase: String { - return native.invocationPhrase.lowercased() + native.invocationPhrase.lowercased() } } diff --git a/Passepartout/App/Views/AddHostView+Name.swift b/Passepartout/App/Views/AddHostView+Name.swift index 7e713b79..f4ba892c 100644 --- a/Passepartout/App/Views/AddHostView+Name.swift +++ b/Passepartout/App/Views/AddHostView+Name.swift @@ -159,7 +159,7 @@ extension AddHostView { } private func alertOverwriteExistingProfile() -> Alert { - return Alert( + Alert( title: Text(L10n.AddProfile.Shared.title), message: Text(L10n.AddProfile.Shared.Alerts.Overwrite.message), primaryButton: .destructive(Text(L10n.Global.Strings.ok)) { diff --git a/Passepartout/App/Views/AddProviderView.swift b/Passepartout/App/Views/AddProviderView.swift index 1087be14..7e17788b 100644 --- a/Passepartout/App/Views/AddProviderView.swift +++ b/Passepartout/App/Views/AddProviderView.swift @@ -158,6 +158,6 @@ extension AddProviderView { private extension ProviderMetadata { var navigationId: String { - return "navigation.\(name)" + "navigation.\(name)" } } diff --git a/Passepartout/App/Views/DiagnosticsView+OpenVPN.swift b/Passepartout/App/Views/DiagnosticsView+OpenVPN.swift index 57471edc..a375000e 100644 --- a/Passepartout/App/Views/DiagnosticsView+OpenVPN.swift +++ b/Passepartout/App/Views/DiagnosticsView+OpenVPN.swift @@ -162,7 +162,7 @@ extension DiagnosticsView.OpenVPNView { } private var debugLogURL: URL? { - return vpnManager.debugLogURL(forProtocol: vpnProtocol) + vpnManager.debugLogURL(forProtocol: vpnProtocol) } } diff --git a/Passepartout/App/Views/DiagnosticsView+WireGuard.swift b/Passepartout/App/Views/DiagnosticsView+WireGuard.swift index 63734e12..fa455cd7 100644 --- a/Passepartout/App/Views/DiagnosticsView+WireGuard.swift +++ b/Passepartout/App/Views/DiagnosticsView+WireGuard.swift @@ -57,7 +57,7 @@ extension DiagnosticsView { } private var debugLogURL: URL? { - return vpnManager.debugLogURL(forProtocol: .wireGuard) + vpnManager.debugLogURL(forProtocol: .wireGuard) } } } diff --git a/Passepartout/App/Views/DonateView.swift b/Passepartout/App/Views/DonateView.swift index ac35a682..788c0ba9 100644 --- a/Passepartout/App/Views/DonateView.swift +++ b/Passepartout/App/Views/DonateView.swift @@ -148,7 +148,7 @@ extension DonateView { private extension ProductManager { var donations: [SKProduct] { - return products.filter { product in + products.filter { product in LocalProduct.allDonations.contains { $0.matchesStoreKitProduct(product) } diff --git a/Passepartout/App/Views/EndpointView+OpenVPN.swift b/Passepartout/App/Views/EndpointView+OpenVPN.swift index 16338c41..ca0fc3df 100644 --- a/Passepartout/App/Views/EndpointView+OpenVPN.swift +++ b/Passepartout/App/Views/EndpointView+OpenVPN.swift @@ -267,7 +267,7 @@ extension EndpointView.OpenVPNView { } private var filteredRemotes: [Endpoint]? { - return builder.remotes?.filter { + builder.remotes?.filter { $0.proto.socketType == selectedSocketType && $0.proto.port == selectedPort } } diff --git a/Passepartout/App/Views/PaywallView+Purchase.swift b/Passepartout/App/Views/PaywallView+Purchase.swift index d631c032..fd2ba182 100644 --- a/Passepartout/App/Views/PaywallView+Purchase.swift +++ b/Passepartout/App/Views/PaywallView+Purchase.swift @@ -194,9 +194,9 @@ extension PaywallView.PurchaseView { private var skPlatformVersion: SKProduct? { #if targetEnvironment(macCatalyst) - return productManager.product(withIdentifier: .fullVersion_macOS) + productManager.product(withIdentifier: .fullVersion_macOS) #else - return productManager.product(withIdentifier: .fullVersion_iOS) + productManager.product(withIdentifier: .fullVersion_iOS) #endif } @@ -215,7 +215,7 @@ extension PaywallView.PurchaseView { } private var platformVersionExtra: [String] { - return productManager.featureProducts(excluding: [ + productManager.featureProducts(excluding: [ .fullVersion, .fullVersion_iOS, .fullVersion_macOS @@ -227,7 +227,7 @@ extension PaywallView.PurchaseView { } private var fullVersionExtra: [String] { - return productManager.featureProducts(including: [ + productManager.featureProducts(including: [ .fullVersion_iOS, .fullVersion_macOS ]).map { diff --git a/Passepartout/App/Views/ProfileView+Provider.swift b/Passepartout/App/Views/ProfileView+Provider.swift index 99f8b808..1a527fff 100644 --- a/Passepartout/App/Views/ProfileView+Provider.swift +++ b/Passepartout/App/Views/ProfileView+Provider.swift @@ -107,7 +107,7 @@ extension ProfileView { } private var currentProviderServerDescription: String? { - return profile.providerServer(providerManager)?.localizedLongDescription + profile.providerServer(providerManager)?.localizedLongDescription } private var currentProviderCountryImage: Image? { @@ -118,11 +118,11 @@ extension ProfileView { } private var currentProviderPreset: String? { - return providerManager.localizedPreset(forProfile: profile) + providerManager.localizedPreset(forProfile: profile) } private var lastInfrastructureUpdate: String? { - return providerManager.localizedInfrastructureUpdate(forProfile: profile) + providerManager.localizedInfrastructureUpdate(forProfile: profile) } private func refreshInfrastructure() { diff --git a/Passepartout/App/Views/ProfileView+Rename.swift b/Passepartout/App/Views/ProfileView+Rename.swift index 16b653eb..deb3ddaa 100644 --- a/Passepartout/App/Views/ProfileView+Rename.swift +++ b/Passepartout/App/Views/ProfileView+Rename.swift @@ -63,7 +63,7 @@ extension ProfileView { } private func alertOverwriteExistingProfile() -> Alert { - return Alert( + Alert( title: Text(L10n.Profile.Alerts.Rename.title), message: Text(L10n.AddProfile.Shared.Alerts.Overwrite.message), primaryButton: .destructive(Text(L10n.Global.Strings.ok)) { diff --git a/Passepartout/App/Views/ProfileView.swift b/Passepartout/App/Views/ProfileView.swift index 13e1b628..b21fd830 100644 --- a/Passepartout/App/Views/ProfileView.swift +++ b/Passepartout/App/Views/ProfileView.swift @@ -39,7 +39,7 @@ struct ProfileView: View { case paywallTrustedNetworks var id: Int { - return rawValue + rawValue } } diff --git a/Passepartout/App/Views/ProviderLocationView.swift b/Passepartout/App/Views/ProviderLocationView.swift index efa12635..164fb89f 100644 --- a/Passepartout/App/Views/ProviderLocationView.swift +++ b/Passepartout/App/Views/ProviderLocationView.swift @@ -225,7 +225,7 @@ extension ProviderLocationView { } private func isFavoriteLocation(_ location: ProviderLocation) -> Bool { - return favoriteLocationIds?.contains(location.id) ?? false + favoriteLocationIds?.contains(location.id) ?? false } private func toggleFavoriteLocation(_ location: ProviderLocation) { @@ -295,7 +295,7 @@ extension ProviderLocationView { } private var servers: [ProviderServer] { - return providerManager.servers(forLocation: location).sorted() + providerManager.servers(forLocation: location).sorted() } } } diff --git a/Passepartout/App/Views/ProviderPresetView.swift b/Passepartout/App/Views/ProviderPresetView.swift index 8bb3edd7..2afce1d4 100644 --- a/Passepartout/App/Views/ProviderPresetView.swift +++ b/Passepartout/App/Views/ProviderPresetView.swift @@ -99,6 +99,6 @@ struct ProviderPresetView: View { // some providers (e.g. NordVPN) have specific presets based on selected server private var availablePresets: [ProviderServer.Preset] { - return server?.presets?.sorted() ?? [] + server?.presets?.sorted() ?? [] } } diff --git a/Passepartout/App/Views/VPNStatusText.swift b/Passepartout/App/Views/VPNStatusText.swift index dcebcbd9..1901a55b 100644 --- a/Passepartout/App/Views/VPNStatusText.swift +++ b/Passepartout/App/Views/VPNStatusText.swift @@ -41,7 +41,7 @@ struct VPNStatusText: View { } private var statusText: String { - return currentVPNState.localizedStatusDescription( + currentVPNState.localizedStatusDescription( isActiveProfile: isActiveProfile, withErrors: true, dataCountIfAvailable: true diff --git a/Passepartout/AppShared/L10n/Core+L10n.swift b/Passepartout/AppShared/L10n/Core+L10n.swift index 9830e9c3..8ce5e5b4 100644 --- a/Passepartout/AppShared/L10n/Core+L10n.swift +++ b/Passepartout/AppShared/L10n/Core+L10n.swift @@ -76,19 +76,19 @@ extension ObservableVPNState { extension Profile.Header: Comparable { public static func <(lhs: Self, rhs: Self) -> Bool { - return lhs.name.lowercased() < rhs.name.lowercased() + lhs.name.lowercased() < rhs.name.lowercased() } } extension Profile.OpenVPNSettings { var endpointDescription: String? { - return customEndpoint?.address ?? configuration.remotes?.first?.address + customEndpoint?.address ?? configuration.remotes?.first?.address } } extension Profile.WireGuardSettings { var endpointDescription: String? { - return configuration.tunnelConfiguration.peers.first?.endpoint?.stringRepresentation + configuration.tunnelConfiguration.peers.first?.endpoint?.stringRepresentation } } diff --git a/Passepartout/AppShared/L10n/Unlocalized.swift b/Passepartout/AppShared/L10n/Unlocalized.swift index d7af4657..58a8d727 100644 --- a/Passepartout/AppShared/L10n/Unlocalized.swift +++ b/Passepartout/AppShared/L10n/Unlocalized.swift @@ -57,7 +57,7 @@ enum Unlocalized { enum Keychain { static func passwordLabel(_ profileName: String, vpnProtocol: VPNProtocolType) -> String { - return "\(Constants.Global.appName): \(profileName) (\(vpnProtocol.description))" + "\(Constants.Global.appName): \(profileName) (\(vpnProtocol.description))" } } @@ -67,7 +67,7 @@ enum Unlocalized { static let subject = "\(appName) - Report issue" static func body(_ description: String, _ metadata: String) -> String { - return "Hi,\n\n\(description)\n\n\(metadata)\n\nRegards" + "Hi,\n\n\(description)\n\n\(metadata)\n\nRegards" } static let template = "description of the issue: " @@ -123,7 +123,7 @@ enum Unlocalized { static let subject = "\(appName) - Translations" static func body(_ description: String) -> String { - return "Hi,\n\n\(description)\n\nRegards" + "Hi,\n\n\(description)\n\nRegards" } static let template = "I offer to translate to: " diff --git a/Passepartout/Mac/Menu/ProfileItemGroup.swift b/Passepartout/Mac/Menu/ProfileItemGroup.swift index 0981304b..d2ace277 100644 --- a/Passepartout/Mac/Menu/ProfileItemGroup.swift +++ b/Passepartout/Mac/Menu/ProfileItemGroup.swift @@ -41,11 +41,7 @@ struct ProfileItemGroup: ItemGroup { func asMenuItems(withParent parent: NSMenu) -> [NSMenuItem] { profileManager.profiles.map { - if $0.isProvider { - return providerItem(withProfile: $0, parent: parent) - } else { - return hostItem(withProfile: $0, parent: parent) - } + $0.isProvider ? providerItem(withProfile: $0, parent: parent) : hostItem(withProfile: $0, parent: parent) } } diff --git a/Passepartout/Mac/Menu/ProviderLocationItem+ViewModel.swift b/Passepartout/Mac/Menu/ProviderLocationItem+ViewModel.swift index 7fd97be5..6c833f97 100644 --- a/Passepartout/Mac/Menu/ProviderLocationItem+ViewModel.swift +++ b/Passepartout/Mac/Menu/ProviderLocationItem+ViewModel.swift @@ -40,7 +40,7 @@ extension ProviderLocationItem { } var isActiveLocation: Bool { - return location.id == profile.providerServer?.locationId + location.id == profile.providerServer?.locationId } var isOnlyServer: Bool { diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Host+Extensions.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Host+Extensions.swift index bf3fe7a0..ec5209bd 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Host+Extensions.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Host+Extensions.swift @@ -58,7 +58,7 @@ extension Profile { public var hostWireGuardSettings: WireGuardSettings? { get { - return host?.wgSettings + host?.wgSettings } set { host?.wgSettings = newValue diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Profile+Extensions.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Profile+Extensions.swift index 097a78a4..9c4f080e 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Profile+Extensions.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Profile+Extensions.swift @@ -27,7 +27,7 @@ import Foundation extension Profile { public var isProvider: Bool { - return provider != nil + provider != nil } public var vpnProtocols: [VPNProtocolType] { diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Provider+Extensions.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Provider+Extensions.swift index a8628dd9..6c120cc6 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Provider+Extensions.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Extensions/Provider+Extensions.swift @@ -46,7 +46,7 @@ extension Profile { } public func providerServerId() -> String? { - return provider?.vpnSettings[currentVPNProtocol]?.serverId + provider?.vpnSettings[currentVPNProtocol]?.serverId } public mutating func setProviderServer(_ server: ProviderServer) { @@ -72,7 +72,7 @@ extension Profile { } public func providerFavoriteLocationIds() -> Set? { - return provider?.vpnSettings[currentVPNProtocol]?.favoriteLocationIds + provider?.vpnSettings[currentVPNProtocol]?.favoriteLocationIds } public mutating func setProviderFavoriteLocationIds(_ ids: Set?) { @@ -80,7 +80,7 @@ extension Profile { } public func providerCustomEndpoint() -> Endpoint? { - return provider?.vpnSettings[currentVPNProtocol]?.customEndpoint + provider?.vpnSettings[currentVPNProtocol]?.customEndpoint } public mutating func setProviderCustomEndpoint(_ endpoint: Endpoint?) { @@ -88,7 +88,7 @@ extension Profile { } public func providerAccount() -> Profile.Account? { - return provider?.vpnSettings[currentVPNProtocol]?.account + provider?.vpnSettings[currentVPNProtocol]?.account } public mutating func setProviderAccount(_ account: Profile.Account?) { diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Models/DebugLog.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Models/DebugLog.swift index 19f989f5..fcf9907d 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Models/DebugLog.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Models/DebugLog.swift @@ -33,6 +33,6 @@ public struct DebugLog { } public var contentData: Data? { - return content.data(using: .utf8) + content.data(using: .utf8) } } diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+Header.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+Header.swift index 6dde4289..54f98f64 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+Header.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+Header.swift @@ -64,7 +64,7 @@ extension Profile { // MARK: Identifiable public var id: UUID { - return uuid + uuid } } } diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+OpenVPNSettings.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+OpenVPNSettings.swift index 04cfb709..5838b31f 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+OpenVPNSettings.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+OpenVPNSettings.swift @@ -29,7 +29,7 @@ import TunnelKitOpenVPN extension Profile { public struct OpenVPNSettings: Codable, Equatable, VPNProtocolProviding { public var vpnProtocol: VPNProtocolType { - return .openVPN + .openVPN } public var configuration: OpenVPN.Configuration diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+WireGuardSettings.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+WireGuardSettings.swift index 1004aaec..9188c8c6 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+WireGuardSettings.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile+WireGuardSettings.swift @@ -29,7 +29,7 @@ import TunnelKitWireGuard extension Profile { public struct WireGuardSettings: Codable, Equatable, VPNProtocolProviding { public var vpnProtocol: VPNProtocolType { - return .wireGuard + .wireGuard } public var configuration: WireGuard.Configuration diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile.swift index 9b3fb782..4e328f7a 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Models/Profile.swift @@ -111,7 +111,7 @@ public struct Profile: Identifiable, Codable, Equatable { // MARK: Identifiable public var id: UUID { - return header.id + header.id } } diff --git a/PassepartoutLibrary/Sources/PassepartoutCore/Models/ProviderServer.swift b/PassepartoutLibrary/Sources/PassepartoutCore/Models/ProviderServer.swift index 1d71481e..db151bda 100644 --- a/PassepartoutLibrary/Sources/PassepartoutCore/Models/ProviderServer.swift +++ b/PassepartoutLibrary/Sources/PassepartoutCore/Models/ProviderServer.swift @@ -89,7 +89,7 @@ public struct ProviderServer: Identifiable { } public func preset(withId presetId: String) -> Preset? { - return presets?.first { + presets?.first { $0.id == presetId } } diff --git a/PassepartoutLibrary/Sources/PassepartoutLibrary/Managers/UpgradeManager+Migrations.swift b/PassepartoutLibrary/Sources/PassepartoutLibrary/Managers/UpgradeManager+Migrations.swift index 689ca634..3bf3598e 100644 --- a/PassepartoutLibrary/Sources/PassepartoutLibrary/Managers/UpgradeManager+Migrations.swift +++ b/PassepartoutLibrary/Sources/PassepartoutLibrary/Managers/UpgradeManager+Migrations.swift @@ -104,7 +104,7 @@ extension UpgradeManager { } private var appGroup: String { - return "group.com.algoritmico.Passepartout" + "group.com.algoritmico.Passepartout" } func doMigrateToV2() -> [Profile] { @@ -368,7 +368,7 @@ extension UpgradeManager { } private func migratedV1Choice(_ map: Map, key: String) -> Network.Choice { - return (map[key] as? String) == "manual" ? .manual : .automatic + (map[key] as? String) == "manual" ? .manual : .automatic } } diff --git a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/OpenVPNSettings+Network.swift b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/OpenVPNSettings+Network.swift index 2f29c240..5960dc5b 100644 --- a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/OpenVPNSettings+Network.swift +++ b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/OpenVPNSettings+Network.swift @@ -32,12 +32,12 @@ extension Profile.OpenVPNSettings: GatewaySettingsProviding { // route-gateway public var isDefaultIPv4: Bool { - return configuration.routingPolicies?.contains(.IPv4) ?? false + configuration.routingPolicies?.contains(.IPv4) ?? false } // ifconfig-ipv6 public var isDefaultIPv6: Bool { - return configuration.routingPolicies?.contains(.IPv6) ?? false + configuration.routingPolicies?.contains(.IPv6) ?? false } } @@ -45,27 +45,27 @@ extension Profile.OpenVPNSettings: DNSSettingsProviding { // not a dhcp-option public var dnsProtocol: DNSProtocol? { - return (configuration.isDNSEnabled ?? true) ? .plain : nil + (configuration.isDNSEnabled ?? true) ? .plain : nil } // dhcp-option DNS public var dnsServers: [String]? { - return configuration.dnsServers + configuration.dnsServers } // dhcp-option DOMAIN/DOMAIN-SEARCH public var dnsSearchDomains: [String]? { - return configuration.searchDomains + configuration.searchDomains } // not a dhcp-option public var dnsHTTPSURL: URL? { - return nil + nil } // not a dhcp-option public var dnsTLSServerName: String? { - return nil + nil } } @@ -73,17 +73,17 @@ extension Profile.OpenVPNSettings: ProxySettingsProviding { // dhcp-option PROXY_HTTP[S] public var proxyServer: Proxy? { - return configuration.httpsProxy ?? configuration.httpProxy + configuration.httpsProxy ?? configuration.httpProxy } // dhcp-option PROXY_BYPASS public var proxyBypassDomains: [String]? { - return configuration.proxyBypassDomains + configuration.proxyBypassDomains } // dhcp-option PROXY_AUTO_CONFIG_URL public var proxyAutoConfigurationURL: URL? { - return configuration.proxyAutoConfigurationURL + configuration.proxyAutoConfigurationURL } } @@ -91,6 +91,6 @@ extension Profile.OpenVPNSettings: MTUSettingsProviding { public var mtuBytes: Int { // tun-mtu - return configuration.mtu ?? 0 + configuration.mtu ?? 0 } } diff --git a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/PassepartoutProfiles+Logging.swift b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/PassepartoutProfiles+Logging.swift index fde64bf7..9652b6af 100644 --- a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/PassepartoutProfiles+Logging.swift +++ b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/PassepartoutProfiles+Logging.swift @@ -28,12 +28,12 @@ import PassepartoutCore extension Profile.Header { public var logDescription: String { - return "{\(id), '\(name)'}" + "{\(id), '\(name)'}" } } extension Profile { public var logDescription: String { - return header.logDescription + header.logDescription } } diff --git a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/WireGuardSettings+Network.swift b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/WireGuardSettings+Network.swift index 9dd128a9..7291b499 100644 --- a/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/WireGuardSettings+Network.swift +++ b/PassepartoutLibrary/Sources/PassepartoutProfiles/Extensions/WireGuardSettings+Network.swift @@ -30,28 +30,28 @@ import PassepartoutCore extension Profile.WireGuardSettings: DNSSettingsProviding { public var dnsProtocol: DNSProtocol? { - return .plain + .plain } public var dnsServers: [String]? { - return configuration.dnsServers + configuration.dnsServers } public var dnsSearchDomains: [String]? { - return configuration.dnsSearchDomains + configuration.dnsSearchDomains } public var dnsHTTPSURL: URL? { - return nil + nil } public var dnsTLSServerName: String? { - return nil + nil } } extension Profile.WireGuardSettings: MTUSettingsProviding { public var mtuBytes: Int { - return Int(configuration.mtu ?? 0) + Int(configuration.mtu ?? 0) } } diff --git a/PassepartoutLibrary/Sources/PassepartoutProfiles/Managers/ProfileManager+Keychain.swift b/PassepartoutLibrary/Sources/PassepartoutProfiles/Managers/ProfileManager+Keychain.swift index b72e064e..dc1ebad4 100644 --- a/PassepartoutLibrary/Sources/PassepartoutProfiles/Managers/ProfileManager+Keychain.swift +++ b/PassepartoutLibrary/Sources/PassepartoutProfiles/Managers/ProfileManager+Keychain.swift @@ -82,7 +82,7 @@ extension ProfileManager { private extension Profile { var keychainEntry: String? { - return "\(id.uuidString):\(currentVPNProtocol.description):\(account.username)" + "\(id.uuidString):\(currentVPNProtocol.description):\(account.username)" } } diff --git a/PassepartoutLibrary/Sources/PassepartoutProviders/Repositories/ServerMapper.swift b/PassepartoutLibrary/Sources/PassepartoutProviders/Repositories/ServerMapper.swift index 0dfed636..08160ae4 100644 --- a/PassepartoutLibrary/Sources/PassepartoutProviders/Repositories/ServerMapper.swift +++ b/PassepartoutLibrary/Sources/PassepartoutProviders/Repositories/ServerMapper.swift @@ -130,11 +130,11 @@ struct ServerMapper: DTOMapper, ModelMapper { private extension WSProviderServer { var encodedExtraCountryCodes: String? { - return extraCountryCodes?.joined(separator: ",") + extraCountryCodes?.joined(separator: ",") } var encodedTags: String? { - return tags?.joined(separator: ",") + tags?.joined(separator: ",") } var encodedIPAddresses: String? { @@ -149,18 +149,15 @@ private extension WSProviderServer { private extension CDInfrastructureServer { var decodedExtraCountryCodes: [String]? { - return extraCountryCodes? - .components(separatedBy: ",") + extraCountryCodes?.components(separatedBy: ",") } var decodedTags: [String]? { - return tags? - .components(separatedBy: ",") + tags?.components(separatedBy: ",") } var decodedIPAddresses: [String] { - return ipAddresses? - .components(separatedBy: ",") ?? [] + ipAddresses?.components(separatedBy: ",") ?? [] } } diff --git a/PassepartoutLibrary/Sources/PassepartoutServices/DataModels/WSProvidersIndex.swift b/PassepartoutLibrary/Sources/PassepartoutServices/DataModels/WSProvidersIndex.swift index 5921026f..32317dfa 100644 --- a/PassepartoutLibrary/Sources/PassepartoutServices/DataModels/WSProvidersIndex.swift +++ b/PassepartoutLibrary/Sources/PassepartoutServices/DataModels/WSProvidersIndex.swift @@ -50,7 +50,7 @@ public struct WSProvidersIndex: Codable { // MARK: CustomStringConvertible public var description: String { - return fullName + fullName } } diff --git a/PassepartoutLibrary/Sources/PassepartoutServices/DefaultWebServices.swift b/PassepartoutLibrary/Sources/PassepartoutServices/DefaultWebServices.swift index 9db94b45..8084ba7c 100644 --- a/PassepartoutLibrary/Sources/PassepartoutServices/DefaultWebServices.swift +++ b/PassepartoutLibrary/Sources/PassepartoutServices/DefaultWebServices.swift @@ -48,13 +48,13 @@ public class DefaultWebServices: WebServices { } private var fileType: String { - return "json" + "json" } // MARK: GenericWebEndpoint var path: String { - return "\(pathName).\(fileType)" + "\(pathName).\(fileType)" } } diff --git a/PassepartoutLibrary/Sources/PassepartoutServices/WebServices.swift b/PassepartoutLibrary/Sources/PassepartoutServices/WebServices.swift index 6569c4c3..c7a987f6 100644 --- a/PassepartoutLibrary/Sources/PassepartoutServices/WebServices.swift +++ b/PassepartoutLibrary/Sources/PassepartoutServices/WebServices.swift @@ -35,7 +35,7 @@ public enum WebError: GenericWebServicesError, LocalizedError { case unknown public static func httpStatus(_ status: Int) -> WebError { - return .http(status) + .http(status) } public var errorDescription: String? { diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/GenericWebParser.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/GenericWebParser.swift index 7636d0d7..3578c08c 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/GenericWebParser.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/GenericWebParser.swift @@ -35,11 +35,11 @@ public class GenericWebParser { }() public static func lastModifiedDate(string: String) -> Date? { - return lmFormatter.date(from: string) + lmFormatter.date(from: string) } public static func lastModifiedString(date: Date) -> String { - return lmFormatter.string(from: date) + lmFormatter.string(from: date) } public static func lastModifiedString(ofFileURL url: URL) -> String? { diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/GenericWebResponse.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/GenericWebResponse.swift index 0030b963..4e511899 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/GenericWebResponse.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/GenericWebResponse.swift @@ -40,6 +40,6 @@ public struct GenericWebResponse { public let isCached: Bool public static func empty() -> GenericWebResponse { - return GenericWebResponse(value: nil, lastModifiedString: nil, isCached: false) + GenericWebResponse(value: nil, lastModifiedString: nil, isCached: false) } } diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/InApp.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/InApp.swift index fbd48e44..93cfe1f7 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/InApp.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/InApp.swift @@ -51,7 +51,7 @@ public class InApp: NSObject, private var productsMap: [PID: SKProduct] public var products: [SKProduct] { - return [SKProduct](productsMap.values) + [SKProduct](productsMap.values) } private var productObservers: [ProductObserver] @@ -110,7 +110,7 @@ public class InApp: NSObject, } public func product(withIdentifier productIdentifier: PID) -> SKProduct? { - return productsMap[productIdentifier] + productsMap[productIdentifier] } // MARK: SKProductsRequestDelegate @@ -218,6 +218,6 @@ extension SKProduct { } public var localizedPrice: String? { - return localizedCurrencyFormatter.string(from: price) + localizedCurrencyFormatter.string(from: price) } } diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/KeyedCache.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/KeyedCache.swift index 8f8e5743..0a984e8c 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/KeyedCache.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Reusable/KeyedCache.swift @@ -31,11 +31,11 @@ public class KeyedCache { private var store: [K: V] = [:] public var isEmpty: Bool { - return store.isEmpty + store.isEmpty } public var storeValues: [V] { - return Array(store.values) + Array(store.values) } public init(_ query: String) { diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Codable.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Codable.swift index 9183dee9..f79d13eb 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Codable.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Codable.swift @@ -33,6 +33,6 @@ extension JSON { } public func encoded() throws -> Data { - return try JSONEncoder().encode(self) + try JSONEncoder().encode(self) } } diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Dates.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Dates.swift index 70e66711..b82a196e 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Dates.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Dates.swift @@ -40,7 +40,7 @@ private let componentsFormatter: DateComponentsFormatter = { extension Date { public var timestamp: String { - return timestampFormatter.string(from: self) + timestampFormatter.string(from: self) } } diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Network.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Network.swift index ac062283..493ee0d7 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Network.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Network.swift @@ -33,7 +33,7 @@ import CoreWLAN extension Utils { #if targetEnvironment(simulator) public static func hasCellularData() -> Bool { - return true + true } #else public static func hasCellularData() -> Bool { diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Strings.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Strings.swift index f7bd5c73..fac68c36 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Strings.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+Strings.swift @@ -45,7 +45,7 @@ extension Utils { extension String: StrippableContent { public var stripped: String { - return trimmingCharacters(in: .whitespacesAndNewlines) + trimmingCharacters(in: .whitespacesAndNewlines) } public var strippedNotEmpty: String? { @@ -59,13 +59,13 @@ extension String: StrippableContent { extension StringProtocol where Index == String.Index { public func nsRange(from range: Range) -> NSRange { - return NSRange(range, in: self) + NSRange(range, in: self) } } extension String { public var localizedAsCountryCode: String { - return Locale.current.localizedString(forRegionCode: self) ?? self + Locale.current.localizedString(forRegionCode: self) ?? self } } diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+TestFlight.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+TestFlight.swift index dc059d18..8d0a5e7e 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+TestFlight.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+TestFlight.swift @@ -31,7 +31,7 @@ import Foundation extension Bundle { public var isTestFlight: Bool { #if targetEnvironment(simulator) - return true + true #elseif targetEnvironment(macCatalyst) || os(macOS) var status = noErr @@ -64,9 +64,9 @@ extension Bundle { ) return status == errSecSuccess #elseif os(iOS) - return appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" + appStoreReceiptURL?.lastPathComponent == "sandboxReceipt" #else - return false + false #endif } } diff --git a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+URL.swift b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+URL.swift index 01776f33..5b5a88af 100644 --- a/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+URL.swift +++ b/PassepartoutLibrary/Sources/PassepartoutUtils/Utils/Utils+URL.swift @@ -48,7 +48,7 @@ extension URL { UIApplication.shared.open(url) return true #else - return NSWorkspace.shared.open(url) + NSWorkspace.shared.open(url) #endif } diff --git a/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/OnDemand+Rules.swift b/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/OnDemand+Rules.swift index b3d9d5bd..e64466ce 100644 --- a/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/OnDemand+Rules.swift +++ b/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/OnDemand+Rules.swift @@ -83,6 +83,6 @@ extension Profile.OnDemand { } private var policyRule: NEOnDemandRule { - return disconnectsIfNotMatching ? NEOnDemandRuleDisconnect() : NEOnDemandRuleIgnore() + disconnectsIfNotMatching ? NEOnDemandRuleDisconnect() : NEOnDemandRuleIgnore() } } diff --git a/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/VPNProtocolType+Extensions.swift b/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/VPNProtocolType+Extensions.swift index 4ea1efdf..13a45eff 100644 --- a/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/VPNProtocolType+Extensions.swift +++ b/PassepartoutLibrary/Sources/PassepartoutVPN/Extensions/VPNProtocolType+Extensions.swift @@ -30,36 +30,36 @@ import PassepartoutCore extension VPNProtocolType: Comparable { public static func <(lhs: Self, rhs: Self) -> Bool { - return lhs.description < rhs.description + lhs.description < rhs.description } } extension OpenVPN.ProviderConfiguration: VPNProtocolProviding { public var vpnProtocol: VPNProtocolType { - return .openVPN + .openVPN } } extension WireGuard.ProviderConfiguration: VPNProtocolProviding { public var vpnProtocol: VPNProtocolType { - return .wireGuard + .wireGuard } } extension VPNProtocolType { public var supportsGateway: Bool { - return true + true } public var supportsDNS: Bool { - return true + true } public var supportsProxy: Bool { - return self == .openVPN + self == .openVPN } public var supportsMTU: Bool { - return true + true } } diff --git a/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/MockVPNManagerStrategy.swift b/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/MockVPNManagerStrategy.swift index 1c54f407..0b13c7d3 100644 --- a/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/MockVPNManagerStrategy.swift +++ b/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/MockVPNManagerStrategy.swift @@ -117,10 +117,10 @@ public class MockVPNManagerStrategy: VPNManagerStrategy { } public func serverConfiguration(forProtocol vpnProtocol: VPNProtocolType) -> Any? { - return nil + nil } public func debugLogURL(forProtocol vpnProtocol: VPNProtocolType) -> URL? { - return nil + nil } } diff --git a/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/VPNManager.swift b/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/VPNManager.swift index 8bf51e31..f8461ed6 100644 --- a/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/VPNManager.swift +++ b/PassepartoutLibrary/Sources/PassepartoutVPN/Managers/VPNManager.swift @@ -122,11 +122,11 @@ public final class VPNManager: ObservableObject { } public func serverConfiguration(forProtocol vpnProtocol: VPNProtocolType) -> Any? { - return strategy.serverConfiguration(forProtocol: vpnProtocol) + strategy.serverConfiguration(forProtocol: vpnProtocol) } public func debugLogURL(forProtocol vpnProtocol: VPNProtocolType) -> URL? { - return strategy.debugLogURL(forProtocol: vpnProtocol) + strategy.debugLogURL(forProtocol: vpnProtocol) } private func clearLastError() { diff --git a/PassepartoutLibrary/Tests/PassepartoutUtilsTests/UtilsTests.swift b/PassepartoutLibrary/Tests/PassepartoutUtilsTests/UtilsTests.swift index efec327c..480a9a1f 100644 --- a/PassepartoutLibrary/Tests/PassepartoutUtilsTests/UtilsTests.swift +++ b/PassepartoutLibrary/Tests/PassepartoutUtilsTests/UtilsTests.swift @@ -62,8 +62,8 @@ class UtilsTests: XCTestCase { } private func privateSortedLanguages(_ languages: [String], with locale: Locale) -> [String] { - return languages.sorted { - return locale.localizedString(forLanguageCode: $0)! < locale.localizedString(forLanguageCode: $1)! + languages.sorted { + locale.localizedString(forLanguageCode: $0)! < locale.localizedString(forLanguageCode: $1)! } } }