Drop return in single line functions
This commit is contained in:
parent
8d5f147194
commit
48d8173871
|
@ -28,15 +28,15 @@ import PassepartoutLibrary
|
||||||
|
|
||||||
extension ProviderMetadata: Identifiable, Comparable, Hashable {
|
extension ProviderMetadata: Identifiable, Comparable, Hashable {
|
||||||
public var id: String {
|
public var id: String {
|
||||||
return name
|
name
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.name == rhs.name
|
lhs.name == rhs.name
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func <(lhs: Self, rhs: Self) -> Bool {
|
public static func <(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.fullName.lowercased() < rhs.fullName.lowercased()
|
lhs.fullName.lowercased() < rhs.fullName.lowercased()
|
||||||
}
|
}
|
||||||
|
|
||||||
public func hash(into hasher: inout Hasher) {
|
public func hash(into hasher: inout Hasher) {
|
||||||
|
@ -46,27 +46,27 @@ extension ProviderMetadata: Identifiable, Comparable, Hashable {
|
||||||
|
|
||||||
extension ProviderCategory: Comparable {
|
extension ProviderCategory: Comparable {
|
||||||
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.name.lowercased() == rhs.name.lowercased()
|
lhs.name.lowercased() == rhs.name.lowercased()
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func <(lhs: Self, rhs: Self) -> Bool {
|
public static func <(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.name.lowercased() < rhs.name.lowercased()
|
lhs.name.lowercased() < rhs.name.lowercased()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProviderLocation: Comparable {
|
extension ProviderLocation: Comparable {
|
||||||
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.countryCode == rhs.countryCode
|
lhs.countryCode == rhs.countryCode
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func <(lhs: Self, rhs: Self) -> Bool {
|
public static func <(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.localizedCountry < rhs.localizedCountry
|
lhs.localizedCountry < rhs.localizedCountry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProviderServer: Comparable {
|
extension ProviderServer: Comparable {
|
||||||
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.id == rhs.id
|
lhs.id == rhs.id
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Default" comes first
|
// "Default" comes first
|
||||||
|
@ -86,11 +86,11 @@ extension ProviderServer: Comparable {
|
||||||
|
|
||||||
extension ProviderServer.Preset: Comparable {
|
extension ProviderServer.Preset: Comparable {
|
||||||
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
public static func ==(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.name == rhs.name
|
lhs.name == rhs.name
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func <(lhs: Self, rhs: Self) -> Bool {
|
public static func <(lhs: Self, rhs: Self) -> Bool {
|
||||||
return lhs.name < rhs.name
|
lhs.name < rhs.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,13 @@ import TunnelKitOpenVPN
|
||||||
|
|
||||||
extension OpenVPN.Cipher {
|
extension OpenVPN.Cipher {
|
||||||
var localizedDescription: String {
|
var localizedDescription: String {
|
||||||
return description
|
description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension OpenVPN.Digest {
|
extension OpenVPN.Digest {
|
||||||
var localizedDescription: String {
|
var localizedDescription: String {
|
||||||
return description
|
description
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,6 @@ import Foundation
|
||||||
import PassepartoutLibrary
|
import PassepartoutLibrary
|
||||||
|
|
||||||
extension ProviderManager {
|
extension ProviderManager {
|
||||||
// func localizedLocation(forProfile profile: Profile) -> String? {
|
|
||||||
// return profile.providerServer(self)?.localizedDescription
|
|
||||||
// }
|
|
||||||
|
|
||||||
func localizedPreset(forProfile profile: Profile) -> String? {
|
func localizedPreset(forProfile profile: Profile) -> String? {
|
||||||
guard let server = profile.providerServer(self) else {
|
guard let server = profile.providerServer(self) else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -65,13 +61,13 @@ extension ProviderMetadata {
|
||||||
|
|
||||||
extension ProviderLocation {
|
extension ProviderLocation {
|
||||||
var localizedCountry: String {
|
var localizedCountry: String {
|
||||||
return countryCode.localizedAsCountryCode
|
countryCode.localizedAsCountryCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProviderServer {
|
extension ProviderServer {
|
||||||
var localizedCountry: String {
|
var localizedCountry: String {
|
||||||
return countryCode.localizedAsCountryCode
|
countryCode.localizedAsCountryCode
|
||||||
}
|
}
|
||||||
|
|
||||||
var localizedDescription: String {
|
var localizedDescription: String {
|
||||||
|
@ -83,16 +79,16 @@ extension ProviderServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
var localizedDetails: String {
|
var localizedDetails: String {
|
||||||
return details ?? ""
|
details ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
var localizedDetailsWithDefault: String {
|
var localizedDetailsWithDefault: String {
|
||||||
return details ?? "\(L10n.Global.Strings.default) [\(apiId)]"
|
details ?? "\(L10n.Global.Strings.default) [\(apiId)]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProviderServer.Preset {
|
extension ProviderServer.Preset {
|
||||||
var localizedDescription: String {
|
var localizedDescription: String {
|
||||||
return name
|
name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ extension Optional where Wrapped == IPv4Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
var localizedDefaultGateway: String {
|
var localizedDefaultGateway: String {
|
||||||
return self?.defaultGateway ?? L10n.Global.Strings.none
|
self?.defaultGateway ?? L10n.Global.Strings.none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,19 +100,19 @@ extension Optional where Wrapped == IPv6Settings {
|
||||||
}
|
}
|
||||||
|
|
||||||
var localizedDefaultGateway: String {
|
var localizedDefaultGateway: String {
|
||||||
return self?.defaultGateway ?? L10n.Global.Strings.none
|
self?.defaultGateway ?? L10n.Global.Strings.none
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension IPv4Settings.Route {
|
extension IPv4Settings.Route {
|
||||||
var localizedDescription: String {
|
var localizedDescription: String {
|
||||||
return "\(destination)/\(mask) -> \(gateway)"
|
"\(destination)/\(mask) -> \(gateway)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension IPv6Settings.Route {
|
extension IPv6Settings.Route {
|
||||||
var localizedDescription: String {
|
var localizedDescription: String {
|
||||||
return "\(destination)/\(prefixLength) -> \(gateway)"
|
"\(destination)/\(prefixLength) -> \(gateway)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ extension Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func neErrorDescription(_ error: NEVPNError) -> String? {
|
private func neErrorDescription(_ error: NEVPNError) -> String? {
|
||||||
return error.localizedDescription.capitalized
|
error.localizedDescription.capitalized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,19 +31,19 @@ import CryptoKit
|
||||||
|
|
||||||
extension ProviderCategory: Identifiable {
|
extension ProviderCategory: Identifiable {
|
||||||
public var id: String {
|
public var id: String {
|
||||||
return "\(providerMetadata.name):\(name)"
|
"\(providerMetadata.name):\(name)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProviderLocation: Identifiable {
|
extension ProviderLocation: Identifiable {
|
||||||
public var id: String {
|
public var id: String {
|
||||||
return "\(providerMetadata.name):\(categoryName):\(countryCode)"
|
"\(providerMetadata.name):\(categoryName):\(countryCode)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ProviderServer {
|
extension ProviderServer {
|
||||||
public var locationId: String {
|
public var locationId: String {
|
||||||
return "\(providerMetadata.name):\(categoryName):\(countryCode)"
|
"\(providerMetadata.name):\(categoryName):\(countryCode)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,6 @@ import PassepartoutCore
|
||||||
|
|
||||||
extension ProviderServer {
|
extension ProviderServer {
|
||||||
public var logDescription: String {
|
public var logDescription: String {
|
||||||
return "{'\(categoryName)', \(countryCode), '\(apiId)', \(id)}"
|
"{'\(categoryName)', \(countryCode), '\(apiId)', \(id)}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import PassepartoutCore
|
||||||
|
|
||||||
extension ProviderName {
|
extension ProviderName {
|
||||||
public func requiresCredentials(forProtocol vpnProtocol: VPNProtocolType) -> Bool {
|
public func requiresCredentials(forProtocol vpnProtocol: VPNProtocolType) -> Bool {
|
||||||
return vpnProtocol == .openVPN
|
vpnProtocol == .openVPN
|
||||||
}
|
}
|
||||||
|
|
||||||
public var credentialsPurpose: CredentialsPurpose {
|
public var credentialsPurpose: CredentialsPurpose {
|
||||||
|
|
Loading…
Reference in New Issue