diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj index 05a800581dcf..2678f777b10c 100644 --- a/ios/MullvadVPN.xcodeproj/project.pbxproj +++ b/ios/MullvadVPN.xcodeproj/project.pbxproj @@ -1433,7 +1433,6 @@ 44B3C4392BFE2C800079782C /* PacketTunnelActorReducer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PacketTunnelActorReducer.swift; sourceTree = ""; }; 44B3C43C2C00CBBC0079782C /* PacketTunnelActorReducerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PacketTunnelActorReducerTests.swift; sourceTree = ""; }; 44BB5F962BE527F4002520EB /* TunnelState+UI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TunnelState+UI.swift"; sourceTree = ""; }; - 44BB5F992BE529FE002520EB /* TunnelStateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelStateTests.swift; sourceTree = ""; }; 44DD7D232B6CFFD70005F67F /* StartTunnelOperationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartTunnelOperationTests.swift; sourceTree = ""; }; 44DD7D262B6D18FB0005F67F /* MockTunnelInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTunnelInteractor.swift; sourceTree = ""; }; 44DD7D282B7113CA0005F67F /* MockTunnel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTunnel.swift; sourceTree = ""; }; @@ -2620,7 +2619,6 @@ 44DD7D232B6CFFD70005F67F /* StartTunnelOperationTests.swift */, A9A5F9A12ACB003D0083449F /* TunnelManagerTests.swift */, F0A0868F2C22D6A700BF83E7 /* TunnelSettingsStrategyTests.swift */, - 44BB5F992BE529FE002520EB /* TunnelStateTests.swift */, F073FCB22C6617D70062EA1D /* TunnelStore+Stubs.swift */, A9E031792ACB0AE70095D843 /* UIApplication+Stubs.swift */, 58165EBD2A262CBB00688EAD /* WgKeyRotationTests.swift */, diff --git a/ios/MullvadVPN/TunnelManager/TunnelState+UI.swift b/ios/MullvadVPN/TunnelManager/TunnelState+UI.swift index e87afd87b37d..759f802fc142 100644 --- a/ios/MullvadVPN/TunnelManager/TunnelState+UI.swift +++ b/ios/MullvadVPN/TunnelManager/TunnelState+UI.swift @@ -9,7 +9,7 @@ import UIKit extension TunnelState { - var textColorForSecureLabel: UIColor { + var textColorForConnectionStatusLabel: UIColor { switch self { case .connecting, .reconnecting, .waitingForConnectivity(.noConnection), .negotiatingEphemeralPeer: .white @@ -32,55 +32,20 @@ extension TunnelState { var localizedTitleForSecureLabel: String { switch self { - case let .connecting(_, isPostQuantum, _), let .reconnecting(_, isPostQuantum, _): - if isPostQuantum { - NSLocalizedString( - "TUNNEL_STATE_PQ_CONNECTING", - tableName: "Main", - value: "Creating quantum secure connection", - comment: "" - ) - } else { - NSLocalizedString( - "TUNNEL_STATE_CONNECTING", - tableName: "Main", - value: "Creating secure connection", - comment: "" - ) - } - - case let .negotiatingEphemeralPeer(_, _, isPostQuantum, _): - if isPostQuantum { - NSLocalizedString( - "TUNNEL_STATE_NEGOTIATING_KEY", - tableName: "Main", - value: "Creating quantum secure connection", - comment: "" - ) - } else { - NSLocalizedString( - "TUNNEL_STATE_CONNECTING", - tableName: "Main", - value: "Creating secure connection", - comment: "" - ) - } - case let .connected(_, isPostQuantum, _): - if isPostQuantum { - NSLocalizedString( - "TUNNEL_STATE_PQ_CONNECTED", - tableName: "Main", - value: "Quantum secure connection", - comment: "" - ) - } else { - NSLocalizedString( - "TUNNEL_STATE_CONNECTED", - tableName: "Main", - value: "Secure connection", - comment: "" - ) - } + case .connecting, .reconnecting, .negotiatingEphemeralPeer: + NSLocalizedString( + "TUNNEL_STATE_CONNECTING", + tableName: "Main", + value: "Connecting...", + comment: "" + ) + case .connected: + NSLocalizedString( + "TUNNEL_STATE_CONNECTED", + tableName: "Main", + value: "Connected", + comment: "" + ) case .disconnecting(.nothing): NSLocalizedString( @@ -101,7 +66,7 @@ extension TunnelState { NSLocalizedString( "TUNNEL_STATE_DISCONNECTED", tableName: "Main", - value: "Unsecured connection", + value: "Disconnected", comment: "" ) @@ -159,62 +124,33 @@ extension TunnelState { } } - func secureConnectionLabel(isPostQuantum: Bool) -> String { - if isPostQuantum { - NSLocalizedString( - "TUNNEL_STATE_PQ_CONNECTING_ACCESSIBILITY_LABEL", - tableName: "Main", - value: "Creating quantum secure connection", - comment: "" - ) - } else { + var localizedAccessibilityLabel: String { + switch self { + case .connecting, .negotiatingEphemeralPeer: NSLocalizedString( "TUNNEL_STATE_CONNECTING_ACCESSIBILITY_LABEL", tableName: "Main", - value: "Creating secure connection", + value: "Connecting", comment: "" ) - } - } - var localizedAccessibilityLabel: String { - switch self { - case let .connecting(_, isPostQuantum, _): - secureConnectionLabel(isPostQuantum: isPostQuantum) - - case let .negotiatingEphemeralPeer(_, _, isPostQuantum, _): - secureConnectionLabel(isPostQuantum: isPostQuantum) - - case let .connected(tunnelInfo, isPostQuantum, _): - if isPostQuantum { - String( - format: NSLocalizedString( - "TUNNEL_STATE_PQ_CONNECTED_ACCESSIBILITY_LABEL", - tableName: "Main", - value: "Quantum secure connection. Connected to %@, %@", - comment: "" - ), - tunnelInfo.exit.location.city, - tunnelInfo.exit.location.country - ) - } else { - String( - format: NSLocalizedString( - "TUNNEL_STATE_CONNECTED_ACCESSIBILITY_LABEL", - tableName: "Main", - value: "Secure connection. Connected to %@, %@", - comment: "" - ), - tunnelInfo.exit.location.city, - tunnelInfo.exit.location.country - ) - } + case let .connected(tunnelInfo, _, _): + String( + format: NSLocalizedString( + "TUNNEL_STATE_CONNECTED_ACCESSIBILITY_LABEL", + tableName: "Main", + value: "Connected to %@, %@", + comment: "" + ), + tunnelInfo.exit.location.city, + tunnelInfo.exit.location.country + ) case .disconnected: NSLocalizedString( "TUNNEL_STATE_DISCONNECTED_ACCESSIBILITY_LABEL", tableName: "Main", - value: "Unsecured connection", + value: "Disconnected", comment: "" ) diff --git a/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift b/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift index 5c9d6970f537..89a1a48be761 100644 --- a/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift +++ b/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift @@ -28,7 +28,7 @@ private enum TunnelControlActionButton { } final class TunnelControlView: UIView { - private let secureLabel = makeBoldTextLabel(ofSize: 20, numberOfLines: 0) + private let connectionStatusLabel = makeBoldTextLabel(ofSize: 20, numberOfLines: 0) private let cityLabel = makeBoldTextLabel(ofSize: 34) private let countryLabel = makeBoldTextLabel(ofSize: 34) @@ -135,8 +135,8 @@ final class TunnelControlView: UIView { func update(with model: TunnelControlViewModel) { viewModel = model let tunnelState = model.tunnelStatus.state - secureLabel.text = model.secureLabelText - secureLabel.textColor = tunnelState.textColorForSecureLabel + connectionStatusLabel.text = model.connectionStatusLabelText + connectionStatusLabel.textColor = tunnelState.textColorForConnectionStatusLabel selectLocationButtonBlurView.isEnabled = model.enableButtons connectButtonBlurView.isEnabled = model.enableButtons cityLabel.attributedText = attributedStringForLocation(string: model.city) @@ -144,7 +144,7 @@ final class TunnelControlView: UIView { connectionPanel.connectedRelayName = model.connectedRelaysName connectionPanel.dataSource = model.connectionPanel - updateSecureLabel(tunnelState: tunnelState) + updateConnectionStatusLabel(tunnelState: tunnelState) updateActionButtons(tunnelState: tunnelState) updateTunnelRelays(tunnelStatus: model.tunnelStatus) } @@ -166,17 +166,17 @@ final class TunnelControlView: UIView { setArrangedButtons(views) } - private func updateSecureLabel(tunnelState: TunnelState) { - secureLabel.text = tunnelState.localizedTitleForSecureLabel.uppercased() - secureLabel.textColor = tunnelState.textColorForSecureLabel + private func updateConnectionStatusLabel(tunnelState: TunnelState) { + connectionStatusLabel.text = tunnelState.localizedTitleForSecureLabel.uppercased() + connectionStatusLabel.textColor = tunnelState.textColorForConnectionStatusLabel switch tunnelState { case .connected: - secureLabel.setAccessibilityIdentifier(.connectionStatusConnectedLabel) + connectionStatusLabel.setAccessibilityIdentifier(.connectionStatusConnectedLabel) case .connecting: - secureLabel.setAccessibilityIdentifier(.connectionStatusConnectingLabel) + connectionStatusLabel.setAccessibilityIdentifier(.connectionStatusConnectingLabel) default: - secureLabel.setAccessibilityIdentifier(.connectionStatusNotConnectedLabel) + connectionStatusLabel.setAccessibilityIdentifier(.connectionStatusNotConnectedLabel) } } @@ -185,7 +185,7 @@ final class TunnelControlView: UIView { NSLocalizedString( "CONNECT_BUTTON_TITLE", tableName: "Main", - value: "Secure connection", + value: "Connect", comment: "" ), for: .normal ) @@ -274,7 +274,7 @@ final class TunnelControlView: UIView { // MARK: - Private private func addSubviews() { - for subview in [secureLabel, countryLabel, cityLabel, connectionPanel] { + for subview in [connectionStatusLabel, countryLabel, cityLabel, connectionPanel] { locationContainerView.addArrangedSubview(subview) } diff --git a/ios/MullvadVPN/View controllers/Tunnel/TunnelControlViewModel.swift b/ios/MullvadVPN/View controllers/Tunnel/TunnelControlViewModel.swift index d1ce7b3a7a93..660024f41230 100644 --- a/ios/MullvadVPN/View controllers/Tunnel/TunnelControlViewModel.swift +++ b/ios/MullvadVPN/View controllers/Tunnel/TunnelControlViewModel.swift @@ -10,7 +10,7 @@ import Foundation struct TunnelControlViewModel { let tunnelStatus: TunnelStatus - let secureLabelText: String + let connectionStatusLabelText: String let enableButtons: Bool let city: String let country: String @@ -37,7 +37,7 @@ struct TunnelControlViewModel { static var empty: Self { TunnelControlViewModel( tunnelStatus: TunnelStatus(), - secureLabelText: "", + connectionStatusLabelText: "", enableButtons: true, city: "", country: "", @@ -49,7 +49,7 @@ struct TunnelControlViewModel { func update(status: TunnelStatus) -> TunnelControlViewModel { TunnelControlViewModel( tunnelStatus: status, - secureLabelText: secureLabelText, + connectionStatusLabelText: connectionStatusLabelText, enableButtons: enableButtons, city: city, country: country, @@ -61,7 +61,7 @@ struct TunnelControlViewModel { func update(outgoingConnectionInfo: OutgoingConnectionInfo) -> TunnelControlViewModel { TunnelControlViewModel( tunnelStatus: tunnelStatus, - secureLabelText: secureLabelText, + connectionStatusLabelText: connectionStatusLabelText, enableButtons: enableButtons, city: city, country: country, diff --git a/ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelStateTests.swift b/ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelStateTests.swift deleted file mode 100644 index 9a707fb30d3f..000000000000 --- a/ios/MullvadVPNTests/MullvadVPN/TunnelManager/TunnelStateTests.swift +++ /dev/null @@ -1,139 +0,0 @@ -// -// TunnelStateTests.swift -// MullvadVPNTests -// -// Created by Andrew Bulhak on 2024-05-03. -// Copyright © 2024 Mullvad VPN AB. All rights reserved. -// - -import MullvadTypes -import PacketTunnelCore -import XCTest - -final class TunnelStateTests: XCTestCase { - let arbitrarySelectedRelay = SelectedRelay( - endpoint: MullvadEndpoint( - ipv4Relay: IPv4Endpoint(ip: .any, port: 0), - ipv4Gateway: .any, - ipv6Gateway: .any, - publicKey: Data() - ), - hostname: "hostname-goes-here", - location: Location(country: "country", countryCode: "", city: "city", cityCode: "", latitude: 0, longitude: 0), - retryAttempts: 0 - ) - - // MARK: description - - func testDescription_Connecting_NoRelay() { - XCTAssertEqual( - TunnelState.connecting(nil, isPostQuantum: false).description, - "connecting, fetching relay" - ) - - XCTAssertEqual( - TunnelState.connecting(nil, isPostQuantum: true).description, - "connecting (PQ), fetching relay" - ) - } - - func testDescription_Connecting_WithRelay() { - XCTAssertEqual( - TunnelState.connecting(arbitrarySelectedRelay, isPostQuantum: false).description, - "connecting to hostname-goes-here" - ) - - XCTAssertEqual( - TunnelState.connecting(arbitrarySelectedRelay, isPostQuantum: true).description, - "connecting (PQ) to hostname-goes-here" - ) - } - - func testDescription_Connected() { - XCTAssertEqual( - TunnelState.connected(arbitrarySelectedRelay, isPostQuantum: false).description, - "connected to hostname-goes-here" - ) - - XCTAssertEqual( - TunnelState.connected(arbitrarySelectedRelay, isPostQuantum: true).description, - "connected (PQ) to hostname-goes-here" - ) - } - - // MARK: localizedTitleForSecureLabel - - func testLocalizedTitleForSecureLabel_Connecting() { - XCTAssertEqual( - TunnelState.connecting(nil, isPostQuantum: false).localizedTitleForSecureLabel, - "Creating secure connection" - ) - - XCTAssertEqual( - TunnelState.connecting(nil, isPostQuantum: true).localizedTitleForSecureLabel, - "Creating quantum secure connection" - ) - } - - func testLocalizedTitleForSecureLabel_Reconnecting() { - XCTAssertEqual( - TunnelState.reconnecting(arbitrarySelectedRelay, isPostQuantum: false).localizedTitleForSecureLabel, - "Creating secure connection" - ) - - XCTAssertEqual( - TunnelState.reconnecting(arbitrarySelectedRelay, isPostQuantum: true).localizedTitleForSecureLabel, - "Creating quantum secure connection" - ) - } - - func testLocalizedTitleForSecureLabel_Connected() { - XCTAssertEqual( - TunnelState.connected(arbitrarySelectedRelay, isPostQuantum: false).localizedTitleForSecureLabel, - "Secure connection" - ) - - XCTAssertEqual( - TunnelState.connected(arbitrarySelectedRelay, isPostQuantum: true).localizedTitleForSecureLabel, - "Quantum secure connection" - ) - } - - // MARK: localizedAccessibilityLabel - - func testLocalizedAccessibilityLabel_Connecting() { - XCTAssertEqual( - TunnelState.connecting(nil, isPostQuantum: false).localizedAccessibilityLabel, - "Creating secure connection" - ) - - XCTAssertEqual( - TunnelState.connecting(nil, isPostQuantum: true).localizedAccessibilityLabel, - "Creating quantum secure connection" - ) - } - - func testLocalizedAccessibilityLabel_Reconnecting() { - XCTAssertEqual( - TunnelState.reconnecting(arbitrarySelectedRelay, isPostQuantum: false).localizedAccessibilityLabel, - "Reconnecting to city, country" - ) - - XCTAssertEqual( - TunnelState.reconnecting(arbitrarySelectedRelay, isPostQuantum: true).localizedAccessibilityLabel, - "Reconnecting to city, country" - ) - } - - func testLocalizedAccessibilityLabel_Connected() { - XCTAssertEqual( - TunnelState.connected(arbitrarySelectedRelay, isPostQuantum: false).localizedAccessibilityLabel, - "Secure connection. Connected to city, country" - ) - - XCTAssertEqual( - TunnelState.connected(arbitrarySelectedRelay, isPostQuantum: true).localizedAccessibilityLabel, - "Quantum secure connection. Connected to city, country" - ) - } -} diff --git a/ios/MullvadVPNUITests/ConnectivityTests.swift b/ios/MullvadVPNUITests/ConnectivityTests.swift index 909cdce159da..86597c4953ce 100644 --- a/ios/MullvadVPNUITests/ConnectivityTests.swift +++ b/ios/MullvadVPNUITests/ConnectivityTests.swift @@ -210,7 +210,7 @@ class ConnectivityTests: LoggedOutUITestCase { allowAddVPNConfigurationsIfAsked() TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() HeaderBar(app) .tapAccountButton() diff --git a/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift b/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift index 6929ee1f5ac5..ab127d5ccb72 100644 --- a/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift +++ b/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift @@ -112,10 +112,10 @@ class TunnelControlPage: Page { return self } - @discardableResult func waitForSecureConnectionLabel() -> Self { + @discardableResult func waitForConnectedLabel() -> Self { let labelFound = app.staticTexts[.connectionStatusConnectedLabel] .waitForExistence(timeout: BaseUITestCase.extremelyLongTimeout) - XCTAssertTrue(labelFound, "Secure connection label presented") + XCTAssertTrue(labelFound, "Connected label presented") return self } diff --git a/ios/MullvadVPNUITests/RelayTests.swift b/ios/MullvadVPNUITests/RelayTests.swift index 9bf9c790421f..e55f70c72e42 100644 --- a/ios/MullvadVPNUITests/RelayTests.swift +++ b/ios/MullvadVPNUITests/RelayTests.swift @@ -80,7 +80,7 @@ class RelayTests: LoggedInWithTimeUITestCase { allowAddVPNConfigurationsIfAsked() // Allow adding VPN configurations iOS permission TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() try Networking.verifyCannotReachAdServingDomain() @@ -95,7 +95,7 @@ class RelayTests: LoggedInWithTimeUITestCase { allowAddVPNConfigurationsIfAsked() TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() try Networking.verifyCanAccessInternet() try Networking.verifyConnectedThroughMullvad() @@ -163,7 +163,7 @@ class RelayTests: LoggedInWithTimeUITestCase { allowAddVPNConfigurationsIfAsked() TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() try Networking.verifyCanAccessInternet() @@ -204,7 +204,7 @@ class RelayTests: LoggedInWithTimeUITestCase { allowAddVPNConfigurationsIfAsked() TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() try Networking.verifyCanAccessInternet() @@ -253,7 +253,7 @@ class RelayTests: LoggedInWithTimeUITestCase { // Should be two UDP connection attempts but sometimes only one is shown in the UI TunnelControlPage(app) .verifyConnectingOverTCPAfterUDPAttempts() - .waitForSecureConnectionLabel() + .waitForConnectedLabel() .tapDisconnectButton() } @@ -282,7 +282,7 @@ class RelayTests: LoggedInWithTimeUITestCase { TunnelControlPage(app) .tapRelayStatusExpandCollapseButton() .verifyConnectingToPort("4001") - .waitForSecureConnectionLabel() + .waitForConnectedLabel() .tapDisconnectButton() } @@ -323,7 +323,7 @@ class RelayTests: LoggedInWithTimeUITestCase { allowAddVPNConfigurationsIfAsked() TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() .verifyConnectingUsingDAITA() .tapDisconnectButton() } @@ -363,7 +363,7 @@ class RelayTests: LoggedInWithTimeUITestCase { allowAddVPNConfigurationsIfAsked() TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() .verifyConnectingOverMultihop() .tapDisconnectButton() } @@ -386,7 +386,7 @@ class RelayTests: LoggedInWithTimeUITestCase { allowAddVPNConfigurationsIfAsked() let relayIPAddress = TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() .tapRelayStatusExpandCollapseButton() .getInIPAddressFromConnectionStatus() @@ -408,7 +408,7 @@ class RelayTests: LoggedInWithTimeUITestCase { allowAddVPNConfigurationsIfAsked() TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() try Networking.verifyCanAccessInternet() diff --git a/ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift b/ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift index 326a5c56a189..dc53791101f5 100644 --- a/ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift +++ b/ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift @@ -50,7 +50,7 @@ class ScreenshotTests: LoggedInWithTimeUITestCase { .tapLocationCell(withName: "Sweden") TunnelControlPage(app) - .waitForSecureConnectionLabel() + .waitForConnectedLabel() snapshot("QuantumConnectionSecured") }