diff options
| author | Emīls <emils@mullvad.net> | 2024-09-06 14:46:58 +0200 |
|---|---|---|
| committer | Emīls <emils@mullvad.net> | 2024-09-06 14:46:58 +0200 |
| commit | b0b7db0926b7e78f1e320e2cf206c45989a02c93 (patch) | |
| tree | 4c1bd77877f62675704b4864bd9b89963a962391 | |
| parent | 8953c78366ab7ba95eb4726fc76c07b655113a36 (diff) | |
| parent | aab3dd7a326a7720a02bbef1824b11a33b9d0629 (diff) | |
| download | mullvadvpn-b0b7db0926b7e78f1e320e2cf206c45989a02c93.tar.xz mullvadvpn-b0b7db0926b7e78f1e320e2cf206c45989a02c93.zip | |
Merge branch 'update-connection-details-on-main-view-to-indicate-that-ios-775'
| -rw-r--r-- | ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift b/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift index 2a8d5fccc8..fc8a7fb76c 100644 --- a/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift +++ b/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift @@ -146,11 +146,7 @@ final class TunnelControlView: UIView { updateSecureLabel(tunnelState: tunnelState) updateActionButtons(tunnelState: tunnelState) - if tunnelState.isSecured { - updateTunnelRelays(tunnelRelays: tunnelState.relays) - } else { - updateTunnelRelays(tunnelRelays: nil) - } + updateTunnelRelays(tunnelStatus: model.tunnelStatus) } func setAnimatingActivity(_ isAnimating: Bool) { @@ -226,8 +222,11 @@ final class TunnelControlView: UIView { connectButtonBlurView.isEnabled = shouldEnableButtons } - private func updateTunnelRelays(tunnelRelays: SelectedRelays?) { - if let tunnelRelays { + private func updateTunnelRelays(tunnelStatus: TunnelStatus) { + let tunnelState = tunnelStatus.state + let observedState = tunnelStatus.observedState + + if tunnelState.isSecured, let tunnelRelays = tunnelState.relays { cityLabel.attributedText = attributedStringForLocation( string: tunnelRelays.exit.location.city ) @@ -235,9 +234,33 @@ final class TunnelControlView: UIView { string: tunnelRelays.exit.location.country ) + let exitName = tunnelRelays.exit.hostname + let entryName = tunnelRelays.entry?.hostname + let usingDaita = observedState.connectionState?.isDaitaEnabled == true + + let connectedRelayName = if let entryName { + String(format: NSLocalizedString( + "CONNECT_PANEL_TITLE", + tableName: "Main", + value: "%@ via %@ \(usingDaita ? "using DAITA" : "")", + comment: "" + ), exitName, entryName) + } else { + String(format: NSLocalizedString( + "CONNECT_PANEL_TITLE", + tableName: "Main", + value: "%@ \(usingDaita ? "using DAITA" : "")", + comment: "" + ), exitName) + } + connectionPanel.isHidden = false - connectionPanel.connectedRelayName = tunnelRelays.exit - .hostname + "\(tunnelRelays.entry.flatMap { " via \($0.hostname)" } ?? "")" + connectionPanel.connectedRelayName = NSLocalizedString( + "CONNECT_PANEL_TITLE", + tableName: "Main", + value: connectedRelayName, + comment: "" + ) } else { countryLabel.attributedText = attributedStringForLocation(string: " ") cityLabel.attributedText = attributedStringForLocation(string: " ") |
