Skip to content

Commit 68d48c9

Browse files
mojganiirablador
authored andcommitted
Add FeaturesIndicatoresView
1 parent 37e90ed commit 68d48c9

18 files changed

+1655
-45
lines changed

ios/MullvadSettings/IPOverrideRepository.swift

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,23 @@
66
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
77
//
88

9-
import Foundation
9+
import Combine
1010
import MullvadLogging
1111

1212
public protocol IPOverrideRepositoryProtocol {
13+
var overridesPublisher: AnyPublisher<[IPOverride], Never> { get }
1314
func add(_ overrides: [IPOverride])
1415
func fetchAll() -> [IPOverride]
1516
func deleteAll()
1617
func parse(data: Data) throws -> [IPOverride]
1718
}
1819

1920
public class IPOverrideRepository: IPOverrideRepositoryProtocol {
21+
private let overridesSubject: CurrentValueSubject<[IPOverride], Never> = .init([])
22+
public var overridesPublisher: AnyPublisher<[IPOverride], Never> {
23+
overridesSubject.eraseToAnyPublisher()
24+
}
25+
2026
private let logger = Logger(label: "IPOverrideRepository")
2127
private let readWriteLock = NSLock()
2228

@@ -58,6 +64,7 @@ public class IPOverrideRepository: IPOverrideRepositoryProtocol {
5864
do {
5965
try readWriteLock.withLock {
6066
try SettingsManager.store.delete(key: .ipOverrides)
67+
overridesSubject.send([])
6168
}
6269
} catch {
6370
logger.error("Could not delete all overrides. \nError: \(error)")
@@ -85,6 +92,7 @@ public class IPOverrideRepository: IPOverrideRepositoryProtocol {
8592

8693
try readWriteLock.withLock {
8794
try SettingsManager.store.write(data, for: .ipOverrides)
95+
overridesSubject.send(overrides)
8896
}
8997
}
9098

ios/MullvadSettings/WireGuardObfuscationSettings.swift

+4
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ public enum WireGuardObfuscationState: Codable {
4646
self = .off
4747
}
4848
}
49+
50+
public var isEnabled: Bool {
51+
[.udpOverTcp, .shadowsocks].contains(self)
52+
}
4953
}
5054

5155
public enum WireGuardObfuscationUdpOverTcpPort: Codable, Equatable, CustomStringConvertible {

ios/MullvadVPN.xcodeproj/project.pbxproj

+40-13
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,10 @@
659659
7AF9BE902A39F26000DBFEDB /* Collection+Sorting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF9BE8F2A39F26000DBFEDB /* Collection+Sorting.swift */; };
660660
7AF9BE952A40461100DBFEDB /* RelayFilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF9BE942A40461100DBFEDB /* RelayFilterView.swift */; };
661661
7AF9BE972A41C71F00DBFEDB /* ChipViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AF9BE962A41C71F00DBFEDB /* ChipViewCell.swift */; };
662-
7AFBE38B2D09AAFF002335FC /* SinglehopPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AFBE38A2D09AAFF002335FC /* SinglehopPicker.swift */; };
663-
7AFBE38D2D09AB2E002335FC /* MultihopPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AFBE38C2D09AB2E002335FC /* MultihopPicker.swift */; };
664662
7AFBE3872D084C9D002335FC /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AFBE3862D084C96002335FC /* ActivityIndicator.swift */; };
665663
7AFBE3892D089163002335FC /* FI_TunnelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AFBE3882D08915D002335FC /* FI_TunnelViewController.swift */; };
664+
7AFBE38B2D09AAFF002335FC /* SinglehopPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AFBE38A2D09AAFF002335FC /* SinglehopPicker.swift */; };
665+
7AFBE38D2D09AB2E002335FC /* MultihopPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AFBE38C2D09AB2E002335FC /* MultihopPicker.swift */; };
666666
850201DB2B503D7700EF8C96 /* RelayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850201DA2B503D7700EF8C96 /* RelayTests.swift */; };
667667
850201DD2B503D8C00EF8C96 /* SelectLocationPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850201DC2B503D8C00EF8C96 /* SelectLocationPage.swift */; };
668668
850201DF2B5040A500EF8C96 /* TunnelControlPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850201DE2B5040A500EF8C96 /* TunnelControlPage.swift */; };
@@ -997,7 +997,14 @@
997997
F0ADC3722CD3AD1600A1AD97 /* ChipCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0ADC3712CD3AD1600A1AD97 /* ChipCollectionView.swift */; };
998998
F0ADC3742CD3C47400A1AD97 /* ChipFlowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0ADC3732CD3C47400A1AD97 /* ChipFlowLayout.swift */; };
999999
F0ADF1CD2CFDFF3100299F09 /* StringConversionError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0ADF1CC2CFDFF3100299F09 /* StringConversionError.swift */; };
1000+
F0ADF1D12D01B55C00299F09 /* ChipModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0ADF1D02D01B55C00299F09 /* ChipModel.swift */; };
1001+
F0ADF1D32D01B6B400299F09 /* FeatureIndicatorsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0ADF1D22D01B6B400299F09 /* FeatureIndicatorsViewModel.swift */; };
1002+
F0ADF1D52D01DCFD00299F09 /* ChipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0ADF1D42D01DCFD00299F09 /* ChipView.swift */; };
10001003
F0B0E6972AFE6E7E001DC66B /* XCTest+Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B0E6962AFE6E7E001DC66B /* XCTest+Async.swift */; };
1004+
F0B495762D02025200CFEC2A /* ChipContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B495752D02025200CFEC2A /* ChipContainerView.swift */; };
1005+
F0B495782D02038B00CFEC2A /* ChipViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B495772D02038B00CFEC2A /* ChipViewModelProtocol.swift */; };
1006+
F0B4957A2D02F49200CFEC2A /* ChipFeatures.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B495792D02F41F00CFEC2A /* ChipFeatures.swift */; };
1007+
F0B4957C2D03154200CFEC2A /* FeatureIndicatorsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B4957B2D03154200CFEC2A /* FeatureIndicatorsView.swift */; };
10011008
F0B894EF2BF751C500817A42 /* RelayWithLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B894EE2BF751C500817A42 /* RelayWithLocation.swift */; };
10021009
F0B894F12BF751E300817A42 /* RelayWithDistance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B894F02BF751E300817A42 /* RelayWithDistance.swift */; };
10031010
F0B894F32BF7526700817A42 /* RelaySelector+Wireguard.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0B894F22BF7526700817A42 /* RelaySelector+Wireguard.swift */; };
@@ -2020,10 +2027,10 @@
20202027
7AF9BE8F2A39F26000DBFEDB /* Collection+Sorting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Collection+Sorting.swift"; sourceTree = "<group>"; };
20212028
7AF9BE942A40461100DBFEDB /* RelayFilterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayFilterView.swift; sourceTree = "<group>"; };
20222029
7AF9BE962A41C71F00DBFEDB /* ChipViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipViewCell.swift; sourceTree = "<group>"; };
2023-
7AFBE38A2D09AAFF002335FC /* SinglehopPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SinglehopPicker.swift; sourceTree = "<group>"; };
2024-
7AFBE38C2D09AB2E002335FC /* MultihopPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultihopPicker.swift; sourceTree = "<group>"; };
20252030
7AFBE3862D084C96002335FC /* ActivityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = "<group>"; };
20262031
7AFBE3882D08915D002335FC /* FI_TunnelViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FI_TunnelViewController.swift; sourceTree = "<group>"; };
2032+
7AFBE38A2D09AAFF002335FC /* SinglehopPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SinglehopPicker.swift; sourceTree = "<group>"; };
2033+
7AFBE38C2D09AB2E002335FC /* MultihopPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultihopPicker.swift; sourceTree = "<group>"; };
20272034
85006A8E2B73EF67004AD8FB /* MullvadVPNUITestsSmoke.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = MullvadVPNUITestsSmoke.xctestplan; sourceTree = "<group>"; };
20282035
850201DA2B503D7700EF8C96 /* RelayTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayTests.swift; sourceTree = "<group>"; };
20292036
850201DC2B503D8C00EF8C96 /* SelectLocationPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectLocationPage.swift; sourceTree = "<group>"; };
@@ -2236,7 +2243,14 @@
22362243
F0ADC3712CD3AD1600A1AD97 /* ChipCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipCollectionView.swift; sourceTree = "<group>"; };
22372244
F0ADC3732CD3C47400A1AD97 /* ChipFlowLayout.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipFlowLayout.swift; sourceTree = "<group>"; };
22382245
F0ADF1CC2CFDFF3100299F09 /* StringConversionError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringConversionError.swift; sourceTree = "<group>"; };
2246+
F0ADF1D02D01B55C00299F09 /* ChipModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipModel.swift; sourceTree = "<group>"; };
2247+
F0ADF1D22D01B6B400299F09 /* FeatureIndicatorsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureIndicatorsViewModel.swift; sourceTree = "<group>"; };
2248+
F0ADF1D42D01DCFD00299F09 /* ChipView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipView.swift; sourceTree = "<group>"; };
22392249
F0B0E6962AFE6E7E001DC66B /* XCTest+Async.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTest+Async.swift"; sourceTree = "<group>"; };
2250+
F0B495752D02025200CFEC2A /* ChipContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipContainerView.swift; sourceTree = "<group>"; };
2251+
F0B495772D02038B00CFEC2A /* ChipViewModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipViewModelProtocol.swift; sourceTree = "<group>"; };
2252+
F0B495792D02F41F00CFEC2A /* ChipFeatures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipFeatures.swift; sourceTree = "<group>"; };
2253+
F0B4957B2D03154200CFEC2A /* FeatureIndicatorsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureIndicatorsView.swift; sourceTree = "<group>"; };
22402254
F0B894EE2BF751C500817A42 /* RelayWithLocation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayWithLocation.swift; sourceTree = "<group>"; };
22412255
F0B894F02BF751E300817A42 /* RelayWithDistance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayWithDistance.swift; sourceTree = "<group>"; };
22422256
F0B894F22BF7526700817A42 /* RelaySelector+Wireguard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RelaySelector+Wireguard.swift"; sourceTree = "<group>"; };
@@ -3624,7 +3638,6 @@
36243638
A9D9A4C12C36D53C004088DD /* MullvadRustRuntimeTests */,
36253639
58CE5E61224146200008646E /* Products */,
36263640
584F991F2902CBDD001F858D /* Frameworks */,
3627-
7A0EAE982D01B29E00D3EB8B /* Recovered References */,
36283641
);
36293642
sourceTree = "<group>";
36303643
};
@@ -3925,14 +3938,6 @@
39253938
path = Edit;
39263939
sourceTree = "<group>";
39273940
};
3928-
7A0EAE982D01B29E00D3EB8B /* Recovered References */ = {
3929-
isa = PBXGroup;
3930-
children = (
3931-
7AA1309C2D0072F900640DF9 /* View+Size.swift */,
3932-
);
3933-
name = "Recovered References";
3934-
sourceTree = "<group>";
3935-
};
39363941
7A2960F72A964A3500389B82 /* Alert */ = {
39373942
isa = PBXGroup;
39383943
children = (
@@ -4067,9 +4072,13 @@
40674072
7AA130972CFF364F00640DF9 /* FeatureIndicators */ = {
40684073
isa = PBXGroup;
40694074
children = (
4075+
F0ADF1CF2D01B50B00299F09 /* ChipView */,
40704076
7AFBE3862D084C96002335FC /* ActivityIndicator.swift */,
4077+
F0B495792D02F41F00CFEC2A /* ChipFeatures.swift */,
40714078
7AA130982CFF365A00640DF9 /* ConnectionView.swift */,
40724079
7A0EAEA32D06DF8200D3EB8B /* ConnectionViewViewModel.swift */,
4080+
F0B4957B2D03154200CFEC2A /* FeatureIndicatorsView.swift */,
4081+
F0ADF1D22D01B6B400299F09 /* FeatureIndicatorsViewModel.swift */,
40734082
7AFBE3882D08915D002335FC /* FI_TunnelViewController.swift */,
40744083
);
40754084
path = FeatureIndicators;
@@ -4392,6 +4401,17 @@
43924401
path = MullvadTypes;
43934402
sourceTree = "<group>";
43944403
};
4404+
F0ADF1CF2D01B50B00299F09 /* ChipView */ = {
4405+
isa = PBXGroup;
4406+
children = (
4407+
F0B495752D02025200CFEC2A /* ChipContainerView.swift */,
4408+
F0ADF1D02D01B55C00299F09 /* ChipModel.swift */,
4409+
F0ADF1D42D01DCFD00299F09 /* ChipView.swift */,
4410+
F0B495772D02038B00CFEC2A /* ChipViewModelProtocol.swift */,
4411+
);
4412+
path = ChipView;
4413+
sourceTree = "<group>";
4414+
};
43954415
F0DC779F2B2222D20087F09D /* Relay */ = {
43964416
isa = PBXGroup;
43974417
children = (
@@ -5917,6 +5937,7 @@
59175937
5878A27129091CF20096FC88 /* AccountInteractor.swift in Sources */,
59185938
7AF9BE882A30C62100DBFEDB /* SelectableSettingsCell.swift in Sources */,
59195939
58CCA010224249A1004F3011 /* TunnelViewController.swift in Sources */,
5940+
F0B495782D02038B00CFEC2A /* ChipViewModelProtocol.swift in Sources */,
59205941
58CEB30A2AFD584700E6E088 /* CustomCellDisclosureHandling.swift in Sources */,
59215942
58B26E22294351EA00D5980C /* InAppNotificationProvider.swift in Sources */,
59225943
5893716A28817A45004EE76C /* DeviceManagementViewController.swift in Sources */,
@@ -5991,6 +6012,7 @@
59916012
58293FB3251241B4005D0BB5 /* CustomTextView.swift in Sources */,
59926013
586A950E290125F3007BAF2B /* ProductsRequestOperation.swift in Sources */,
59936014
7AF9BE902A39F26000DBFEDB /* Collection+Sorting.swift in Sources */,
6015+
F0B495762D02025200CFEC2A /* ChipContainerView.swift in Sources */,
59946016
58F19E35228C15BA00C7710B /* SpinnerActivityIndicatorView.swift in Sources */,
59956017
7A0EAE9A2D01B41500D3EB8B /* MainButtonStyle.swift in Sources */,
59966018
58CEB3022AFD365600E6E088 /* SwitchCellContentConfiguration.swift in Sources */,
@@ -6100,6 +6122,7 @@
61006122
588D7EDE2AF3A585005DF40A /* ListAccessMethodItem.swift in Sources */,
61016123
5827B0B02B0F4CCD00CCBBA1 /* ListAccessMethodViewControllerDelegate.swift in Sources */,
61026124
588D7EE02AF3A595005DF40A /* ListAccessMethodInteractor.swift in Sources */,
6125+
F0B4957A2D02F49200CFEC2A /* ChipFeatures.swift in Sources */,
61036126
58607A4D2947287800BC467D /* AccountExpiryInAppNotificationProvider.swift in Sources */,
61046127
7A8A18FD2CE4BE8D000BCB5B /* CustomToggleStyle.swift in Sources */,
61056128
58C8191829FAA2C400DEB1B4 /* NotificationConfiguration.swift in Sources */,
@@ -6134,8 +6157,10 @@
61346157
586C0D782B039CC000E7CDD7 /* AccessMethodProtocolPicker.swift in Sources */,
61356158
58677710290975E9006F721F /* SettingsInteractorFactory.swift in Sources */,
61366159
7A9CCCC02A96302800DD6A34 /* ProfileVoucherCoordinator.swift in Sources */,
6160+
F0B4957C2D03154200CFEC2A /* FeatureIndicatorsView.swift in Sources */,
61376161
7A9CCCBC2A96302800DD6A34 /* ChangeLogCoordinator.swift in Sources */,
61386162
58B26E282943527300D5980C /* SystemNotificationProvider.swift in Sources */,
6163+
F0ADF1D52D01DCFD00299F09 /* ChipView.swift in Sources */,
61396164
586C0D932B03D90700E7CDD7 /* ShadowsocksItemIdentifier.swift in Sources */,
61406165
58EFC7712AFB45E500E9F4CB /* SettingsChildCoordinator.swift in Sources */,
61416166
7A8A19102CEE391B000BCB5B /* RowSeparator.swift in Sources */,
@@ -6179,6 +6204,7 @@
61796204
7A9CCCC22A96302800DD6A34 /* SafariCoordinator.swift in Sources */,
61806205
58CEB3082AFD484100E6E088 /* BasicCell.swift in Sources */,
61816206
7A5869C12B57D21A00640D27 /* IPOverrideStatusView.swift in Sources */,
6207+
F0ADF1D32D01B6B400299F09 /* FeatureIndicatorsViewModel.swift in Sources */,
61826208
58CEB2F52AFD0BB500E6E088 /* TextCellContentConfiguration.swift in Sources */,
61836209
58E20771274672CA00DE5D77 /* LaunchViewController.swift in Sources */,
61846210
F0E8CC032A4C753B007ED3B4 /* WelcomeViewController.swift in Sources */,
@@ -6198,6 +6224,7 @@
61986224
A99E5EE02B7628150033F241 /* ProblemReportViewModel.swift in Sources */,
61996225
58FD5BF024238EB300112C88 /* SKProduct+Formatting.swift in Sources */,
62006226
58B43C1925F77DB60002C8C3 /* TunnelControlView.swift in Sources */,
6227+
F0ADF1D12D01B55C00299F09 /* ChipModel.swift in Sources */,
62016228
F09A297B2A9F8A9B00EA3B6F /* LogoutDialogueView.swift in Sources */,
62026229
58CEB2FB2AFD13E600E6E088 /* UIListContentConfiguration+Extensions.swift in Sources */,
62036230
5811DE50239014550011EB53 /* NEVPNStatus+Debug.swift in Sources */,

ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ final class ApplicationCoordinator: Coordinator, Presenting, RootContainerViewCo
486486
private func makeTunnelCoordinator() -> TunnelCoordinator {
487487
let tunnelCoordinator = TunnelCoordinator(
488488
tunnelManager: tunnelManager,
489-
outgoingConnectionService: outgoingConnectionService
489+
outgoingConnectionService: outgoingConnectionService,
490+
ipOverrideRepository: ipOverrideRepository
490491
)
491492

492493
tunnelCoordinator.showSelectLocationPicker = { [weak self] in

ios/MullvadVPN/Coordinators/TunnelCoordinator.swift

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Copyright © 2023 Mullvad VPN AB. All rights reserved.
77
//
88

9+
import MullvadSettings
910
import Routing
1011
import UIKit
1112

@@ -32,13 +33,15 @@ class TunnelCoordinator: Coordinator, Presenting {
3233

3334
init(
3435
tunnelManager: TunnelManager,
35-
outgoingConnectionService: OutgoingConnectionServiceHandling
36+
outgoingConnectionService: OutgoingConnectionServiceHandling,
37+
ipOverrideRepository: IPOverrideRepositoryProtocol
3638
) {
3739
self.tunnelManager = tunnelManager
3840

3941
let interactor = TunnelViewControllerInteractor(
4042
tunnelManager: tunnelManager,
41-
outgoingConnectionService: outgoingConnectionService
43+
outgoingConnectionService: outgoingConnectionService,
44+
ipOverrideRepository: ipOverrideRepository
4245
)
4346

4447
#if DEBUG
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
//
2+
// ChipFeatures.swift
3+
// MullvadVPN
4+
//
5+
// Created by Mojgan on 2024-12-06.
6+
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
7+
//
8+
import Foundation
9+
import MullvadSettings
10+
import SwiftUI
11+
12+
protocol ChipFeature {
13+
var isEnabled: Bool { get }
14+
var name: LocalizedStringKey { get }
15+
}
16+
17+
struct DaitaFeature: ChipFeature {
18+
let settings: LatestTunnelSettings
19+
20+
var isEnabled: Bool {
21+
settings.daita.daitaState.isEnabled
22+
}
23+
24+
var name: LocalizedStringKey {
25+
LocalizedStringKey("DAITA")
26+
}
27+
}
28+
29+
struct QuantumResistanceFeature: ChipFeature {
30+
let settings: LatestTunnelSettings
31+
var isEnabled: Bool {
32+
settings.tunnelQuantumResistance.isEnabled
33+
}
34+
35+
var name: LocalizedStringKey {
36+
LocalizedStringKey("Quantum resistance")
37+
}
38+
}
39+
40+
struct MultihopFeature: ChipFeature {
41+
let settings: LatestTunnelSettings
42+
var isEnabled: Bool {
43+
settings.tunnelMultihopState.isEnabled
44+
}
45+
46+
var name: LocalizedStringKey {
47+
LocalizedStringKey("Multihop")
48+
}
49+
}
50+
51+
struct ObfuscationFeature: ChipFeature {
52+
let settings: LatestTunnelSettings
53+
54+
var isEnabled: Bool {
55+
settings.wireGuardObfuscation.state.isEnabled
56+
}
57+
58+
var name: LocalizedStringKey {
59+
LocalizedStringKey("Obfuscation")
60+
}
61+
}
62+
63+
struct DNSFeature: ChipFeature {
64+
let settings: LatestTunnelSettings
65+
66+
var isEnabled: Bool {
67+
settings.dnsSettings.enableCustomDNS || !settings.dnsSettings.blockingOptions.isEmpty
68+
}
69+
70+
var name: LocalizedStringKey {
71+
if !settings.dnsSettings.blockingOptions.isEmpty {
72+
return LocalizedStringKey("DNS content blockers")
73+
}
74+
return LocalizedStringKey("Custom DNS")
75+
}
76+
}
77+
78+
struct IPOverrideFeature: ChipFeature {
79+
let overrides: [IPOverride]
80+
81+
var isEnabled: Bool {
82+
!overrides.isEmpty
83+
}
84+
85+
var name: LocalizedStringKey {
86+
LocalizedStringKey("Server IP override")
87+
}
88+
}

0 commit comments

Comments
 (0)