Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not warn users about multihop extra latency, add info button instead #6535

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions ios/MullvadVPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,6 @@
F0DA87492A9CBA9F006044F1 /* AccountDeviceRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DA87482A9CBA9F006044F1 /* AccountDeviceRow.swift */; };
F0DA874B2A9CBACB006044F1 /* AccountNumberRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DA874A2A9CBACB006044F1 /* AccountNumberRow.swift */; };
F0DAC8AD2C16EFE400F80144 /* TunnelSettingsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F04DD3D72C130DF600E03E28 /* TunnelSettingsManager.swift */; };
F0DAC8AF2C1712C300F80144 /* MultihopPromptAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DAC8AE2C1712C300F80144 /* MultihopPromptAlert.swift */; };
F0DDE4152B220458006B57A7 /* ShadowsocksConfigurationCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DDE4102B220458006B57A7 /* ShadowsocksConfigurationCache.swift */; };
F0DDE4162B220458006B57A7 /* TransportProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DDE4112B220458006B57A7 /* TransportProvider.swift */; };
F0DDE4182B220458006B57A7 /* ShadowsocksConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0DDE4132B220458006B57A7 /* ShadowsocksConfiguration.swift */; };
Expand Down Expand Up @@ -2129,7 +2128,6 @@
F0DA87462A9CB9A2006044F1 /* AccountExpiryRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountExpiryRow.swift; sourceTree = "<group>"; };
F0DA87482A9CBA9F006044F1 /* AccountDeviceRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountDeviceRow.swift; sourceTree = "<group>"; };
F0DA874A2A9CBACB006044F1 /* AccountNumberRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountNumberRow.swift; sourceTree = "<group>"; };
F0DAC8AE2C1712C300F80144 /* MultihopPromptAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultihopPromptAlert.swift; sourceTree = "<group>"; };
F0DDE40F2B220458006B57A7 /* ShadowSocksProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShadowSocksProxy.swift; sourceTree = "<group>"; };
F0DDE4102B220458006B57A7 /* ShadowsocksConfigurationCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShadowsocksConfigurationCache.swift; sourceTree = "<group>"; };
F0DDE4112B220458006B57A7 /* TransportProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransportProvider.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3911,33 +3909,32 @@
children = (
85FB5A0F2B6960A30015DCED /* AccountDeletionPage.swift */,
85557B1F2B5FBBD700795FE1 /* AccountPage.swift */,
852D054E2BC43DF7008578D2 /* AddAccessMethodPage.swift */,
7ACD79382C0DAADC00DBEE14 /* AddCustomListLocationsPage.swift */,
8529693B2B4F0257007EAD4C /* Alert.swift */,
852D054C2BC3DE3A008578D2 /* APIAccessPage.swift */,
85021CAD2BDBC4290098B400 /* AppLogsPage.swift */,
8587A05C2B84D43100152938 /* ChangeLogAlert.swift */,
A9BFB0002BD00B7F00F2BCA1 /* CustomListPage.swift */,
85A42B872BB44D31007BABF7 /* DeviceManagementPage.swift */,
852A26452BA9C9CB006EB9C8 /* DNSSettingsPage.swift */,
8585CBE22BC684180015B6A4 /* EditAccessMethodPage.swift */,
A998DA822BD2B055001D61A2 /* EditCustomListLocationsPage.swift */,
85557B1D2B5FB8C700795FE1 /* HeaderBar.swift */,
A998DA802BD147AD001D61A2 /* ListCustomListsPage.swift */,
852969342B4E9270007EAD4C /* LoginPage.swift */,
F0DAC8AE2C1712C300F80144 /* MultihopPromptAlert.swift */,
85139B2C2B84B4A700734217 /* OutOfTimePage.swift */,
852969322B4E9232007EAD4C /* Page.swift */,
855D9F5A2B63E56B00D7C64D /* ProblemReportPage.swift */,
8532E6862B8CCED600ACECD1 /* ProblemReportSubmittedPage.swift */,
8556EB552B9B0AC500D26DD4 /* RevokedDevicePage.swift */,
8542F7522BCFBD050035C042 /* SelectLocationFilterPage.swift */,
850201DC2B503D8C00EF8C96 /* SelectLocationPage.swift */,
850201E22B51A93C00EF8C96 /* SettingsPage.swift */,
852969392B4F0238007EAD4C /* TermsOfServicePage.swift */,
850201DE2B5040A500EF8C96 /* TunnelControlPage.swift */,
8542CE232B95F7B9006FCA14 /* VPNSettingsPage.swift */,
85FB5A0B2B6903990015DCED /* WelcomePage.swift */,
8542F7522BCFBD050035C042 /* SelectLocationFilterPage.swift */,
852D054C2BC3DE3A008578D2 /* APIAccessPage.swift */,
852D054E2BC43DF7008578D2 /* AddAccessMethodPage.swift */,
8585CBE22BC684180015B6A4 /* EditAccessMethodPage.swift */,
85021CAD2BDBC4290098B400 /* AppLogsPage.swift */,
);
path = Pages;
sourceTree = "<group>";
Expand Down Expand Up @@ -6049,7 +6046,6 @@
7A45CFC72C071DD400D80B21 /* SnapshotHelper.swift in Sources */,
856952DC2BD2922A008C1F84 /* PartnerAPIClient.swift in Sources */,
85557B162B5ABBBE00795FE1 /* XCUIElementQuery+Extensions.swift in Sources */,
F0DAC8AF2C1712C300F80144 /* MultihopPromptAlert.swift in Sources */,
855D9F5B2B63E56B00D7C64D /* ProblemReportPage.swift in Sources */,
8529693A2B4F0238007EAD4C /* TermsOfServicePage.swift in Sources */,
85A42B882BB44D31007BABF7 /* DeviceManagementPage.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ final class VPNSettingsCellFactory: CellFactoryProtocol {
cell.accessibilityIdentifier = item.accessibilityIdentifier
cell.setOn(viewModel.multihopState.isEnabled, animated: false)

cell.infoButtonHandler = { [weak self] in
self?.delegate?.showInfo(for: .multihop)
}

cell.action = { [weak self] isEnabled in
let state: MultihopState = isEnabled ? .on : .off
self?.delegate?.switchMultihop(state)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -617,19 +617,8 @@ extension VPNSettingsDataSource: VPNSettingsCellEventHandler {
}

func switchMultihop(_ state: MultihopState) {
if state == .on {
delegate?.showMultihopConfirmation({ [weak self] in
guard let self else { return }
viewModel.setMultihop(state)
self.delegate?.didChangeViewModel(viewModel)
}, onDiscard: { [weak self] in
guard let self else { return }
reload(item: .multihop)
})
} else {
viewModel.setMultihop(state)
delegate?.didChangeViewModel(viewModel)
}
viewModel.setMultihop(state)
delegate?.didChangeViewModel(viewModel)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ protocol VPNSettingsDataSourceDelegate: AnyObject {
func showDNSSettings()
func showIPOverrides()
func didSelectWireGuardPort(_ port: UInt16?)
func showMultihopConfirmation(_ onSave: @escaping () -> Void, onDiscard: @escaping () -> Void)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ enum VPNSettingsInfoButtonItem {
case wireGuardObfuscation
case wireGuardObfuscationPort
case quantumResistance
case multihop
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ extension VPNSettingsViewController: VPNSettingsDataSourceDelegate {
""",
comment: ""
)

case .multihop:
message = 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: ""
)
default:
assertionFailure("No matching InfoButtonItem")
}
Expand All @@ -194,48 +206,4 @@ extension VPNSettingsViewController: VPNSettingsDataSourceDelegate {
func didSelectWireGuardPort(_ port: UInt16?) {
interactor.setPort(port)
}

func showMultihopConfirmation(_ onSave: @escaping () -> Void, onDiscard: @escaping () -> Void) {
let presentation = AlertPresentation(
id: "multihop-confirm-alert",
accessibilityIdentifier: .multihopPromptAlert,
icon: .info,
message: NSLocalizedString(
"MULTIHOP_CONFIRM_ALERT_TEXT",
tableName: "Multihop",
value: "This setting increases latency. Use only if needed.",
comment: ""
),
buttons: [
AlertAction(
title: NSLocalizedString(
"MULTIHOP_CONFIRM_ALERT_ENABLE_BUTTON",
tableName: "Multihop",
value: "Enable anyway",
comment: ""
),
style: .destructive,
accessibilityId: .multihopConfirmAlertEnableButton,
handler: {
onSave()
}
),
AlertAction(
title: NSLocalizedString(
"MULTIHOP_CONFIRM_ALERT_BACK_BUTTON",
tableName: "Multihop",
value: "Back",
comment: ""
),
style: .default,
accessibilityId: .multihopConfirmAlertBackButton,
handler: {
onDiscard()
}
),
]
)

alertPresenter.showAlert(presentation: presentation, animated: true)
}
}
29 changes: 0 additions & 29 deletions ios/MullvadVPNUITests/Pages/MultihopPromptAlert.swift

This file was deleted.

10 changes: 0 additions & 10 deletions ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,6 @@ class VPNSettingsPage: Page {
app.cells[AccessibilityIdentifier.multihopSwitch]
.switches[AccessibilityIdentifier.customSwitch]
.tap()

let promptIsShown = app
.otherElements[AccessibilityIdentifier.multihopPromptAlert.rawValue]
.waitForExistence(timeout: 1.0)

if promptIsShown {
MultihopPromptAlert(app)
.tapEnableAnyway()
}

return self
}

Expand Down
Loading