Skip to content

Commit

Permalink
Fix some build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mojganii committed Sep 18, 2024
1 parent eea642f commit c5b0631
Show file tree
Hide file tree
Showing 12 changed files with 338 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ final public class ShadowsocksRelaySelector: ShadowsocksRelaySelectorProtocol {

public func getBridges() throws -> REST.ServerShadowsocks? {
let cachedRelays = try relayCache.read()
return RelaySelector.Shadowsocks.tcpBridge(from: try cachedRelays.relays)
return RelaySelector.Shadowsocks.tcpBridge(from: cachedRelays.relays)
}
}
12 changes: 10 additions & 2 deletions ios/MullvadVPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@
F03580252A13842C00E5DAFD /* IncreasedHitButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = F03580242A13842C00E5DAFD /* IncreasedHitButton.swift */; };
F03A69F72C2AD2D6000E2E7E /* TimeInterval+Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F03A69F62C2AD2D5000E2E7E /* TimeInterval+Timeout.swift */; };
F03A69F92C2AD414000E2E7E /* FormsheetPresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F03A69F82C2AD413000E2E7E /* FormsheetPresentationController.swift */; };
F041BE4F2C983C2B0083EC28 /* VPNSettingsPromptAlertItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F041BE4E2C983C2B0083EC28 /* VPNSettingsPromptAlertItem.swift */; };
F041BE532C9878B60083EC28 /* ConnectionConfigurationBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = F041BE522C9878B60083EC28 /* ConnectionConfigurationBuilder.swift */; };
F04413612BA45CD70018A6EE /* CustomListLocationNodeBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = F04413602BA45CD70018A6EE /* CustomListLocationNodeBuilder.swift */; };
F04413622BA45CE30018A6EE /* CustomListLocationNodeBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = F04413602BA45CD70018A6EE /* CustomListLocationNodeBuilder.swift */; };
F04AF92D2C466013004A8314 /* EphemeralPeerNegotiationState.swift in Sources */ = {isa = PBXBuildFile; fileRef = F04AF92C2C466013004A8314 /* EphemeralPeerNegotiationState.swift */; };
Expand Down Expand Up @@ -2077,6 +2079,8 @@
F03580242A13842C00E5DAFD /* IncreasedHitButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IncreasedHitButton.swift; sourceTree = "<group>"; };
F03A69F62C2AD2D5000E2E7E /* TimeInterval+Timeout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TimeInterval+Timeout.swift"; sourceTree = "<group>"; };
F03A69F82C2AD413000E2E7E /* FormsheetPresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormsheetPresentationController.swift; sourceTree = "<group>"; };
F041BE4E2C983C2B0083EC28 /* VPNSettingsPromptAlertItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNSettingsPromptAlertItem.swift; sourceTree = "<group>"; };
F041BE522C9878B60083EC28 /* ConnectionConfigurationBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionConfigurationBuilder.swift; sourceTree = "<group>"; };
F04413602BA45CD70018A6EE /* CustomListLocationNodeBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomListLocationNodeBuilder.swift; sourceTree = "<group>"; };
F04AF92C2C466013004A8314 /* EphemeralPeerNegotiationState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EphemeralPeerNegotiationState.swift; sourceTree = "<group>"; };
F04DD3D72C130DF600E03E28 /* TunnelSettingsManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelSettingsManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2819,6 +2823,7 @@
587EB6732714520600123C75 /* VPNSettingsDataSourceDelegate.swift */,
7A6F2FAE2AFE36E7006D0856 /* VPNSettingsInfoButtonItem.swift */,
5871167E2910035700D41AAC /* VPNSettingsInteractor.swift */,
F041BE4E2C983C2B0083EC28 /* VPNSettingsPromptAlertItem.swift */,
58ACF6482655365700ACE4B7 /* VPNSettingsViewController.swift */,
587EB671271451E300123C75 /* VPNSettingsViewModel.swift */,
);
Expand Down Expand Up @@ -3084,6 +3089,9 @@
58BDEBA02A9CA14B00F578F2 /* AnyTask.swift */,
58F3F3652AA086A400D3B0A4 /* AutoCancellingTask.swift */,
583E60952A9F6D0800DC61EF /* ConfigurationBuilder.swift */,
F041BE522C9878B60083EC28 /* ConnectionConfigurationBuilder.swift */,
F05919742C45194B00C301F3 /* EphemeralPeerKey.swift */,
F04AF92C2C466013004A8314 /* EphemeralPeerNegotiationState.swift */,
5838322A2AC3EF9600EA2071 /* EventChannel.swift */,
580D6B892AB31AB400B2D6E0 /* NetworkPath+NetworkReachability.swift */,
58CF95A12AD6F35800B59F5D /* ObservedState.swift */,
Expand All @@ -3100,8 +3108,6 @@
583832282AC3DF1300EA2071 /* PacketTunnelActorCommand.swift */,
7AD0AA192AD69B6E00119E10 /* PacketTunnelActorProtocol.swift */,
44B3C4392BFE2C800079782C /* PacketTunnelActorReducer.swift */,
F05919742C45194B00C301F3 /* EphemeralPeerKey.swift */,
F04AF92C2C466013004A8314 /* EphemeralPeerNegotiationState.swift */,
A97D25AD2B0BB18100946B2D /* ProtocolObfuscator.swift */,
58E7A0312AA0715100C57861 /* Protocols */,
58ED3A132A7C199C0085CE65 /* StartOptions.swift */,
Expand Down Expand Up @@ -5495,6 +5501,7 @@
5838322B2AC3EF9600EA2071 /* EventChannel.swift in Sources */,
586C145A2AC4735F00245C01 /* PacketTunnelActor+Public.swift in Sources */,
F0DAC8AD2C16EFE400F80144 /* TunnelSettingsManager.swift in Sources */,
F041BE532C9878B60083EC28 /* ConnectionConfigurationBuilder.swift in Sources */,
58342C042AAB61FB003BA12D /* State+Extensions.swift in Sources */,
A95EEE382B722DFC00A8A39B /* PingStats.swift in Sources */,
583832272AC3193600EA2071 /* PacketTunnelActor+SleepCycle.swift in Sources */,
Expand Down Expand Up @@ -5573,6 +5580,7 @@
7AC8A3AF2ABC71D600DC4939 /* TermsOfServiceCoordinator.swift in Sources */,
58FF9FE22B075BA600E4C97D /* EditAccessMethodSectionIdentifier.swift in Sources */,
F0C2AEFD2A0BB5CC00986207 /* NotificationProviderIdentifier.swift in Sources */,
F041BE4F2C983C2B0083EC28 /* VPNSettingsPromptAlertItem.swift in Sources */,
7A58699B2B482FE200640D27 /* UITableViewCell+Disable.swift in Sources */,
7AB2B6702BA1EB8C00B03E3B /* ListCustomListViewController.swift in Sources */,
7A9CCCB72A96302800DD6A34 /* RevokedCoordinator.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,38 +102,9 @@ extension CustomDNSViewController: DNSSettingsDataSourceDelegate {
}

func showInfo(for item: VPNSettingsInfoButtonItem) {
var message = NSAttributedString()

switch item {
case .contentBlockers:
message = NSAttributedString(markdownString: NSLocalizedString(
"VPN_SETTINGS_CONTENT_BLOCKERS_GENERAL",
tableName: "ContentBlockers",
value: """
When this feature is enabled it stops the device from contacting certain \
domains or websites known for distributing ads, malware, trackers and more. \
This might cause issues on certain websites, services, and apps.
Attention: this setting cannot be used in combination with **Use custom DNS server**.
""",
comment: ""
), options: MarkdownStylingOptions(font: .preferredFont(forTextStyle: .body)))

case .blockMalware:
message = NSAttributedString(markdownString: NSLocalizedString(
"VPN_SETTINGS_CONTENT_BLOCKERS_MALWARE",
tableName: "ContentBlockers",
value: """
Warning: The malware blocker is not an anti-virus and should not \
be treated as such, this is just an extra layer of protection.
""",
comment: ""
), options: MarkdownStylingOptions(font: .preferredFont(forTextStyle: .body)))

default:
assertionFailure("No matching InfoButtonItem")
}

showInfo(with: message)
showInfo(with: NSAttributedString(
markdownString: item.description,
options: MarkdownStylingOptions(font: .preferredFont(forTextStyle: .body))
))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ final class VPNSettingsDataSource: UITableViewDiffableDataSource<
header.accessibilityCustomActionName = title
header.isExpanded = isExpanded(.wireGuardPorts)
header.infoButtonHandler = { [weak self] in
if let self {
self.delegate?.showInfo(for: .wireGuardPorts)
if let self, let humanReadablePortRepresentation = delegate?.humanReadablePortRepresentation() {
self.delegate?.showInfo(for: .wireGuardPorts(humanReadablePortRepresentation))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ protocol VPNSettingsDataSourceDelegate: AnyObject {
func showIPOverrides()
func didSelectWireGuardPort(_ port: UInt16?)
func showPrompt(for: VPNSettingsPromptAlertItem, onSave: @escaping () -> Void, onDiscard: @escaping () -> Void)
func humanReadablePortRepresentation() -> String
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,112 @@
// Copyright © 2023 Mullvad VPN AB. All rights reserved.
//

enum VPNSettingsInfoButtonItem {
import Foundation

enum VPNSettingsInfoButtonItem: CustomStringConvertible {
case contentBlockers
case blockMalware
case wireGuardPorts
case wireGuardPorts(String)
case wireGuardObfuscation
case wireGuardObfuscationPort
case quantumResistance
case multihop
case daita
}

enum VPNSettingsPromptAlertItem {
case daitaSettingIncompatibleWithSinglehop
case daitaSettingIncompatibleWithMultihop
var description: String {
switch self {
case .contentBlockers:
NSLocalizedString(
"VPN_SETTINGS_CONTENT_BLOCKERS_GENERAL",
tableName: "ContentBlockers",
value: """
When this feature is enabled it stops the device from contacting certain \
domains or websites known for distributing ads, malware, trackers and more. \
This might cause issues on certain websites, services, and apps.
Attention: this setting cannot be used in combination with **Use custom DNS server**.
""",
comment: ""
)
case .blockMalware:
NSLocalizedString(
"VPN_SETTINGS_CONTENT_BLOCKERS_MALWARE",
tableName: "ContentBlockers",
value: """
Warning: The malware blocker is not an anti-virus and should not \
be treated as such, this is just an extra layer of protection.
""",
comment: ""
)
case let .wireGuardPorts(portsString):
String(
format: NSLocalizedString(
"VPN_SETTINGS_WIRE_GUARD_PORTS_GENERAL",
tableName: "WireGuardPorts",
value: """
The automatic setting will randomly choose from the valid port ranges shown below.
The custom port can be any value inside the valid ranges:
%@
""",
comment: ""
),
portsString
)
case .wireGuardObfuscation:
NSLocalizedString(
"VPN_SETTINGS_WIRE_GUARD_OBFUSCATION_GENERAL",
tableName: "WireGuardObfuscation",
value: """
Obfuscation hides the WireGuard traffic inside another protocol. \
It can be used to help circumvent censorship and other types of filtering, \
where a plain WireGuard connect would be blocked.
""",
comment: ""
)
case .wireGuardObfuscationPort:
NSLocalizedString(
"VPN_SETTINGS_WIRE_GUARD_OBFUSCATION_PORT_GENERAL",
tableName: "WireGuardObfuscation",
value: "Which TCP port the UDP-over-TCP obfuscation protocol should connect to on the VPN server.",
comment: ""
)
case .quantumResistance:
NSLocalizedString(
"VPN_SETTINGS_QUANTUM_RESISTANCE_GENERAL",
tableName: "QuantumResistance",
value: """
This feature makes the WireGuard tunnel resistant to potential attacks from quantum computers.
It does this by performing an extra key exchange using a quantum safe algorithm and mixing \
the result into WireGuard’s regular encryption.
This extra step uses approximately 500 kiB of traffic every time a new tunnel is established.
""",
comment: ""
)
case .multihop:
NSLocalizedString(
"MULTIHOP_INFORMATION_TEXT",
tableName: "Multihop",
value: """
Multihop routes your traffic into one WireGuard server and out another, making it harder to trace.
This results in increased latency but increases anonymity online.
""",
comment: ""
)
case .daita:
NSLocalizedString(
"DAITA_INFORMATION_TEXT",
tableName: "DAITA",
value: """
DAITA (Defence against AI-guided Traffic Analysis) hides patterns in your encrypted VPN traffic. \
If anyone is monitoring your connection, this makes it significantly harder for them to identify \
what websites you are visiting. It does this by carefully adding network noise and making all \
network packets the same size.
Attention: Since this increases your total network traffic, \
be cautious if you have a limited data plan. \
It can also negatively impact your network speed and battery usage.
""",
comment: ""
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// VPNSettingsPromptAlertItem.swift
// MullvadVPN
//
// Created by Mojgan on 2024-09-16.
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
//

import Foundation
enum VPNSettingsPromptAlertItem: CustomStringConvertible {
case daitaSettingIncompatibleWithSinglehop
case daitaSettingIncompatibleWithMultihop

var description: String {
switch self {
case .daitaSettingIncompatibleWithSinglehop:
"""
DAITA isn’t available on the current server. After enabling, please go to the Switch \
location view and select a location that supports DAITA.
Attention: Since this increases your total network traffic, be cautious if you have a \
limited data plan. It can also negatively impact your network speed and battery usage.
"""
case .daitaSettingIncompatibleWithMultihop:
"""
DAITA isn’t available on the current entry server. After enabling, please go to the Switch \
location view and select an entry location that supports DAITA.
Attention: Since this increases your total network traffic, be cautious if you have a \
limited data plan. It can also negatively impact your network speed and battery usage.
"""
}
}
}
Loading

0 comments on commit c5b0631

Please sign in to comment.