Skip to content

Commit

Permalink
Improve OpenVPN Endpoint UX (#332)
Browse files Browse the repository at this point in the history
- Make selection linear by address
- Do not hide endpoints when automatic, show disabled
- Suggest manual endpoint required
- Pre-expand selected endpoint address
- Do not dismiss on selection, because selected value is not visible in
ProfileView
  • Loading branch information
keeshux authored Jul 22, 2023
1 parent 0734816 commit 1c3cbe0
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 132 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Changed

- OpenVPN: Endpoint UX. [#332](https://github.com/passepartoutvpn/passepartout-apple/pull/332)

## 2.1.2 (2023-07-06)

### Fixed
Expand Down
8 changes: 4 additions & 4 deletions Passepartout.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
0E2AC24522EC3AC10037B4B0 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 0E2AC24422EC3AC10037B4B0 /* Settings.bundle */; };
0E2C171B27CB5A3B007E8488 /* GenericCreditsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2C171A27CB5A3A007E8488 /* GenericCreditsView.swift */; };
0E2C172B27CB63F9007E8488 /* Reviewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2C172A27CB63F9007E8488 /* Reviewer.swift */; };
0E2DE71C27DCCFE80067B9E1 /* TunnelKit+Identifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2DE71B27DCCFE80067B9E1 /* TunnelKit+Identifiable.swift */; };
0E2DE71C27DCCFE80067B9E1 /* TunnelKit+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2DE71B27DCCFE80067B9E1 /* TunnelKit+Extensions.swift */; };
0E2DE71F27DCD0290067B9E1 /* TunnelKit+L10n.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2DE71E27DCD0290067B9E1 /* TunnelKit+L10n.swift */; };
0E2DE72527DCDF550067B9E1 /* WireGuard+L10n.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E2DE72427DCDF550067B9E1 /* WireGuard+L10n.swift */; };
0E34A2B627CAA8CC00C73B67 /* Core+L10n.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E34A2B527CAA8CC00C73B67 /* Core+L10n.swift */; };
Expand Down Expand Up @@ -330,7 +330,7 @@
0E2AC24422EC3AC10037B4B0 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
0E2C171A27CB5A3A007E8488 /* GenericCreditsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericCreditsView.swift; sourceTree = "<group>"; };
0E2C172A27CB63F9007E8488 /* Reviewer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reviewer.swift; sourceTree = "<group>"; };
0E2DE71B27DCCFE80067B9E1 /* TunnelKit+Identifiable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TunnelKit+Identifiable.swift"; sourceTree = "<group>"; };
0E2DE71B27DCCFE80067B9E1 /* TunnelKit+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TunnelKit+Extensions.swift"; sourceTree = "<group>"; };
0E2DE71E27DCD0290067B9E1 /* TunnelKit+L10n.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TunnelKit+L10n.swift"; sourceTree = "<group>"; };
0E2DE72427DCDF550067B9E1 /* WireGuard+L10n.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "WireGuard+L10n.swift"; sourceTree = "<group>"; };
0E34A2AF27CAA84500C73B67 /* OpenVPN+L10n.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OpenVPN+L10n.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -734,7 +734,7 @@
0EBC075C27EC529000208AD9 /* DebugLog+Constants.swift */,
0EB17EB927D2560300D473B5 /* PassepartoutProviders+Extensions.swift */,
0E35C099280E95BB0071FA35 /* ProviderProfileAvailability.swift */,
0E2DE71B27DCCFE80067B9E1 /* TunnelKit+Identifiable.swift */,
0E2DE71B27DCCFE80067B9E1 /* TunnelKit+Extensions.swift */,
0EE8B7E227FF340F00B68621 /* VPNProtocolType+FileExtensions.swift */,
);
path = Extensions;
Expand Down Expand Up @@ -1425,7 +1425,7 @@
0E34AC7827F840890042F2AB /* OrganizerView+Scene.swift in Sources */,
0E0BD27927B2EBE500583AC5 /* ShortcutsView.swift in Sources */,
0E92D7C627F103300033CB7B /* ProfileView+Configuration.swift in Sources */,
0E2DE71C27DCCFE80067B9E1 /* TunnelKit+Identifiable.swift in Sources */,
0E2DE71C27DCCFE80067B9E1 /* TunnelKit+Extensions.swift in Sources */,
0ED1D6DE27DBA42100983466 /* DiagnosticsView+WireGuard.swift in Sources */,
0EF2213127E674BD001D0BD7 /* AddProviderViewModel.swift in Sources */,
0E90DFE627BACC1500EF5078 /* AddHostViewModel.swift in Sources */,
Expand Down
1 change: 0 additions & 1 deletion Passepartout/App/Constants/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ extension View {
foregroundColor(themeLightTextColor)
}

@available(iOS 15, *)
func themePrimaryTintStyle() -> some View {
tint(themePrimaryBackgroundColor)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// TunnelKit+Identifiable.swift
// TunnelKit+Extensions.swift
// Passepartout
//
// Created by Davide De Rosa on 3/12/22.
Expand Down Expand Up @@ -32,6 +32,43 @@ extension Endpoint: Identifiable {
}
}

extension Endpoint: Comparable {
public static func < (lhs: Self, rhs: Self) -> Bool {
guard lhs.address != rhs.address else {
return lhs.proto < rhs.proto
}
guard lhs.isHostname == rhs.isHostname else {
return lhs.isHostname
}
return lhs.address < rhs.address
}
}

extension Endpoint: Hashable {
}

extension EndpointProtocol: Comparable {
public static func < (lhs: Self, rhs: Self) -> Bool {
guard lhs.socketType != rhs.socketType else {
return lhs.port < rhs.port
}
return lhs.socketType.orderValue < rhs.socketType.orderValue
}
}

private extension SocketType {
var orderValue: Int {
switch self {
case .udp: return 1
case .udp4: return 2
case .udp6: return 3
case .tcp: return 4
case .tcp4: return 5
case .tcp6: return 6
}
}
}

extension IPv4Settings.Route: Identifiable {
public var id: String {
[destination, mask, gateway ?? "*"].joined(separator: ":")
Expand Down
Loading

0 comments on commit 1c3cbe0

Please sign in to comment.