summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@kvadrat.se>2024-09-02 15:14:26 +0200
committerJon Petersson <jon.petersson@kvadrat.se>2024-09-06 14:42:02 +0200
commitaab3dd7a326a7720a02bbef1824b11a33b9d0629 (patch)
tree4c1bd77877f62675704b4864bd9b89963a962391
parent8953c78366ab7ba95eb4726fc76c07b655113a36 (diff)
downloadmullvadvpn-aab3dd7a326a7720a02bbef1824b11a33b9d0629.tar.xz
mullvadvpn-aab3dd7a326a7720a02bbef1824b11a33b9d0629.zip
Update connection details on main view to indicate that DAITA is used
-rw-r--r--ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift41
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: " ")