summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/MullvadTypes/AccessMethodKind.swift23
-rw-r--r--ios/MullvadVPN.xcodeproj/project.pbxproj4
-rw-r--r--ios/MullvadVPN/Coordinators/Settings/APIAccess/Edit/MethodSettings/MethodSettingsItemIdentifier.swift1
-rw-r--r--ios/MullvadVPN/Coordinators/Settings/APIAccess/Models/AccessMethodKind.swift85
-rw-r--r--ios/MullvadVPN/Coordinators/Settings/APIAccess/Pickers/AccessMethodProtocolPicker.swift1
5 files changed, 25 insertions, 89 deletions
diff --git a/ios/MullvadTypes/AccessMethodKind.swift b/ios/MullvadTypes/AccessMethodKind.swift
index f01dd8b845..6d4482acb6 100644
--- a/ios/MullvadTypes/AccessMethodKind.swift
+++ b/ios/MullvadTypes/AccessMethodKind.swift
@@ -41,6 +41,29 @@ public extension AccessMethodKind {
static var allUserDefinedKinds: [AccessMethodKind] {
allCases.filter { !$0.isPermanent }
}
+
+ /// Returns localized description describing the access method.
+ var localizedDescription: String {
+ switch self {
+ case .direct, .bridges, .encryptedDNS:
+ ""
+ case .shadowsocks:
+ NSLocalizedString("SHADOWSOCKS", tableName: "APIAccess", value: "Shadowsocks", comment: "")
+ case .socks5:
+ NSLocalizedString("SOCKS_V5", tableName: "APIAccess", value: "Socks5", comment: "").uppercased()
+ }
+ }
+
+ /// Returns `true` if access method is configurable.
+ /// Methods that aren't configurable do not offer any additional configuration.
+ var hasProxyConfiguration: Bool {
+ switch self {
+ case .direct, .bridges, .encryptedDNS:
+ false
+ case .shadowsocks, .socks5:
+ true
+ }
+ }
}
extension PersistentAccessMethod {
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj
index 3df113f19b..113776ad9f 100644
--- a/ios/MullvadVPN.xcodeproj/project.pbxproj
+++ b/ios/MullvadVPN.xcodeproj/project.pbxproj
@@ -526,7 +526,6 @@
7A5869952B32E9C700640D27 /* LinkButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A5869942B32E9C700640D27 /* LinkButton.swift */; };
7A5869972B32EA4500640D27 /* AppButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A5869962B32EA4500640D27 /* AppButton.swift */; };
7A58699B2B482FE200640D27 /* UITableViewCell+Disable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A58699A2B482FE200640D27 /* UITableViewCell+Disable.swift */; };
- 7A58699F2B50057100640D27 /* AccessMethodKind.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A58699D2B50057100640D27 /* AccessMethodKind.swift */; };
7A5869A22B502EA800640D27 /* MethodSettingsSectionIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A5869A12B502EA700640D27 /* MethodSettingsSectionIdentifier.swift */; };
7A5869AB2B55527C00640D27 /* IPOverrideCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A5869AA2B55527C00640D27 /* IPOverrideCoordinator.swift */; };
7A5869AD2B5552E200640D27 /* IPOverrideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A5869AC2B5552E200640D27 /* IPOverrideViewController.swift */; };
@@ -2107,7 +2106,6 @@
7A5869942B32E9C700640D27 /* LinkButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkButton.swift; sourceTree = "<group>"; };
7A5869962B32EA4500640D27 /* AppButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppButton.swift; sourceTree = "<group>"; };
7A58699A2B482FE200640D27 /* UITableViewCell+Disable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+Disable.swift"; sourceTree = "<group>"; };
- 7A58699D2B50057100640D27 /* AccessMethodKind.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccessMethodKind.swift; sourceTree = "<group>"; };
7A5869A12B502EA700640D27 /* MethodSettingsSectionIdentifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MethodSettingsSectionIdentifier.swift; sourceTree = "<group>"; };
7A5869AA2B55527C00640D27 /* IPOverrideCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPOverrideCoordinator.swift; sourceTree = "<group>"; };
7A5869AC2B5552E200640D27 /* IPOverrideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPOverrideViewController.swift; sourceTree = "<group>"; };
@@ -3648,7 +3646,6 @@
586C0D7D2B03BDE500E7CDD7 /* Models */ = {
isa = PBXGroup;
children = (
- 7A58699D2B50057100640D27 /* AccessMethodKind.swift */,
58FF9FF32B07C61B00E4C97D /* AccessMethodValidationError.swift */,
586C0D7B2B03BDD100E7CDD7 /* AccessMethodViewModel.swift */,
581DFAEB2B1770C1005D6D1C /* AccessMethodViewModel+NavigationItem.swift */,
@@ -6561,7 +6558,6 @@
7A6389E92B7F8FE2008E77E1 /* CustomListValidationError.swift in Sources */,
585CA70F25F8C44600B47C62 /* UIMetrics.swift in Sources */,
E1187ABD289BBB850024E748 /* OutOfTimeContentView.swift in Sources */,
- 7A58699F2B50057100640D27 /* AccessMethodKind.swift in Sources */,
7A33538F2AA9FF1600F0A71C /* SimulatorTunnelProviderManager.swift in Sources */,
7A1A26432A2612AE00B978AA /* PaymentAlertPresenter.swift in Sources */,
58CCA01822426713004F3011 /* AccountViewController.swift in Sources */,
diff --git a/ios/MullvadVPN/Coordinators/Settings/APIAccess/Edit/MethodSettings/MethodSettingsItemIdentifier.swift b/ios/MullvadVPN/Coordinators/Settings/APIAccess/Edit/MethodSettings/MethodSettingsItemIdentifier.swift
index e5a13d1432..ed2c6f2c40 100644
--- a/ios/MullvadVPN/Coordinators/Settings/APIAccess/Edit/MethodSettings/MethodSettingsItemIdentifier.swift
+++ b/ios/MullvadVPN/Coordinators/Settings/APIAccess/Edit/MethodSettings/MethodSettingsItemIdentifier.swift
@@ -7,6 +7,7 @@
//
import Foundation
+import MullvadTypes
enum MethodSettingsItemIdentifier: Hashable {
case name
diff --git a/ios/MullvadVPN/Coordinators/Settings/APIAccess/Models/AccessMethodKind.swift b/ios/MullvadVPN/Coordinators/Settings/APIAccess/Models/AccessMethodKind.swift
deleted file mode 100644
index 814a3da68d..0000000000
--- a/ios/MullvadVPN/Coordinators/Settings/APIAccess/Models/AccessMethodKind.swift
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// AccessMethodKind.swift
-// MullvadVPN
-//
-// Created by pronebird on 02/11/2023.
-// Copyright © 2025 Mullvad VPN AB. All rights reserved.
-//
-
-import Foundation
-import MullvadSettings
-import MullvadTypes
-
-/// A kind of API access method.
-enum AccessMethodKind: Equatable, Hashable, CaseIterable {
- /// Direct communication.
- case direct
-
- /// Communication over bridges.
- case bridges
-
- /// Communication over shadowsocks.
- case shadowsocks
-
- /// Communication over proxy address from a DNS.
- case encryptedDNS
-
- /// Communication over socks v5 proxy.
- case socks5
-
- /// Returns `true` if the method is permanent and cannot be deleted.
- var isPermanent: Bool {
- switch self {
- case .direct, .bridges, .encryptedDNS:
- true
- case .shadowsocks, .socks5:
- false
- }
- }
-
- /// Returns all access method kinds that can be added by user.
- static var allUserDefinedKinds: [AccessMethodKind] {
- allCases.filter { !$0.isPermanent }
- }
-
- /// Returns localized description describing the access method.
- var localizedDescription: String {
- switch self {
- case .direct, .bridges, .encryptedDNS:
- ""
- case .shadowsocks:
- NSLocalizedString("SHADOWSOCKS", tableName: "APIAccess", value: "Shadowsocks", comment: "")
- case .socks5:
- NSLocalizedString("SOCKS_V5", tableName: "APIAccess", value: "Socks5", comment: "").uppercased()
- }
- }
-
- /// Returns `true` if access method is configurable.
- /// Methods that aren't configurable do not offer any additional configuration.
- var hasProxyConfiguration: Bool {
- switch self {
- case .direct, .bridges, .encryptedDNS:
- false
- case .shadowsocks, .socks5:
- true
- }
- }
-}
-
-extension PersistentAccessMethod {
- /// A kind of access method.
- var kind: AccessMethodKind {
- switch proxyConfiguration {
- case .direct:
- .direct
- case .encryptedDNS:
- .encryptedDNS
- case .bridges:
- .bridges
- case .shadowsocks:
- .shadowsocks
- case .socks5:
- .socks5
- }
- }
-}
diff --git a/ios/MullvadVPN/Coordinators/Settings/APIAccess/Pickers/AccessMethodProtocolPicker.swift b/ios/MullvadVPN/Coordinators/Settings/APIAccess/Pickers/AccessMethodProtocolPicker.swift
index 03467c4ffb..182621eb7b 100644
--- a/ios/MullvadVPN/Coordinators/Settings/APIAccess/Pickers/AccessMethodProtocolPicker.swift
+++ b/ios/MullvadVPN/Coordinators/Settings/APIAccess/Pickers/AccessMethodProtocolPicker.swift
@@ -7,6 +7,7 @@
//
import MullvadSettings
+import MullvadTypes
import UIKit
/// Type implementing the access method protocol picker.