summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2021-07-20 15:21:24 +0200
committerAndrej Mihajlov <and@mullvad.net>2021-07-20 15:21:24 +0200
commita115c2154ef0cf68f087d88fb60a6fdc8a25afa4 (patch)
tree00ae2b5436aac5cd751cb8663ad38339d85ea58d
parentde0141539145ea8f25e7433569ae3db45ad671bc (diff)
parentbe224cabbd02e8b88913ac7fde973a2da8252c3d (diff)
downloadmullvadvpn-a115c2154ef0cf68f087d88fb60a6fdc8a25afa4.tar.xz
mullvadvpn-a115c2154ef0cf68f087d88fb60a6fdc8a25afa4.zip
Merge branch 'main-controller-ax'
-rw-r--r--ios/MullvadVPN.xcodeproj/project.pbxproj12
-rw-r--r--ios/MullvadVPN/ConnectMainContentView.swift40
-rw-r--r--ios/MullvadVPN/ConnectViewController.swift125
-rw-r--r--ios/MullvadVPN/en.lproj/Main.strings41
4 files changed, 194 insertions, 24 deletions
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj
index 107af7f8fe..8ff8894616 100644
--- a/ios/MullvadVPN.xcodeproj/project.pbxproj
+++ b/ios/MullvadVPN.xcodeproj/project.pbxproj
@@ -220,6 +220,7 @@
58F3C0A4249CB069003E76BE /* HeaderBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58F3C0A3249CB069003E76BE /* HeaderBarView.swift */; };
58F3C0A624A50157003E76BE /* relays.json in Resources */ = {isa = PBXBuildFile; fileRef = 58F3C0A524A50155003E76BE /* relays.json */; };
58F3C0A724A50C02003E76BE /* relays.json in Resources */ = {isa = PBXBuildFile; fileRef = 58F3C0A524A50155003E76BE /* relays.json */; };
+ 58F5590E2697002100F630D0 /* Main.strings in Resources */ = {isa = PBXBuildFile; fileRef = 58F559052697002000F630D0 /* Main.strings */; };
58F5590F2697002100F630D0 /* ConnectionPanel.strings in Resources */ = {isa = PBXBuildFile; fileRef = 58F559072697002100F630D0 /* ConnectionPanel.strings */; };
58F61F4F2692F21C00DCFC2B /* WireguardKeys.strings in Resources */ = {isa = PBXBuildFile; fileRef = 58F61F4D2692F21C00DCFC2B /* WireguardKeys.strings */; };
58F7CA882692E34000FC59FD /* WireguardKeysContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58F7CA872692E34000FC59FD /* WireguardKeysContentView.swift */; };
@@ -435,6 +436,7 @@
58F19E34228C15BA00C7710B /* SpinnerActivityIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpinnerActivityIndicatorView.swift; sourceTree = "<group>"; };
58F3C0A3249CB069003E76BE /* HeaderBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderBarView.swift; sourceTree = "<group>"; };
58F3C0A524A50155003E76BE /* relays.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = relays.json; sourceTree = "<group>"; };
+ 58F559062697002000F630D0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = "<group>"; };
58F559082697002100F630D0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/ConnectionPanel.strings; sourceTree = "<group>"; };
58F61F4E2692F21C00DCFC2B /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/WireguardKeys.strings; sourceTree = "<group>"; };
58F7CA872692E34000FC59FD /* WireguardKeysContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WireguardKeysContentView.swift; sourceTree = "<group>"; };
@@ -543,6 +545,7 @@
582CFEE526945FC30072883A /* AppStoreSubscriptions.strings */,
58F559072697002100F630D0 /* ConnectionPanel.strings */,
587B7543266922BF00DEF7E9 /* Localizable.strings */,
+ 58F559052697002000F630D0 /* Main.strings */,
58F61F4D2692F21C00DCFC2B /* WireguardKeys.strings */,
);
name = Localizations;
@@ -958,6 +961,7 @@
584789BE264D4A2A000E45FB /* new_le_root_cert.cer in Resources */,
58F61F4F2692F21C00DCFC2B /* WireguardKeys.strings in Resources */,
58E5BC2624FEB6DB00A53A76 /* AccountViewController.xib in Resources */,
+ 58F5590E2697002100F630D0 /* Main.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1268,6 +1272,14 @@
name = Localizable.strings;
sourceTree = "<group>";
};
+ 58F559052697002000F630D0 /* Main.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 58F559062697002000F630D0 /* en */,
+ );
+ name = Main.strings;
+ sourceTree = "<group>";
+ };
58F559072697002100F630D0 /* ConnectionPanel.strings */ = {
isa = PBXVariantGroup;
children = (
diff --git a/ios/MullvadVPN/ConnectMainContentView.swift b/ios/MullvadVPN/ConnectMainContentView.swift
index 86464a45a3..3be22d95bd 100644
--- a/ios/MullvadVPN/ConnectMainContentView.swift
+++ b/ios/MullvadVPN/ConnectMainContentView.swift
@@ -32,6 +32,14 @@ class ConnectMainContentView: UIView {
let cityLabel = makeBoldTextLabel(ofSize: 34)
let countryLabel = makeBoldTextLabel(ofSize: 34)
+ let locationContainerView: UIView = {
+ let view = UIView()
+ view.translatesAutoresizingMaskIntoConstraints = false
+ view.isAccessibilityElement = true
+ view.accessibilityTraits = .summaryElement
+ return view
+ }()
+
lazy var connectionPanel: ConnectionPanelView = {
let view = ConnectionPanelView()
view.translatesAutoresizingMaskIntoConstraints = false
@@ -111,29 +119,41 @@ class ConnectMainContentView: UIView {
private func addSubviews() {
mapView.frame = self.bounds
+
+ locationContainerView.addSubview(secureLabel)
+ locationContainerView.addSubview(cityLabel)
+ locationContainerView.addSubview(countryLabel)
+
+ containerView.addSubview(locationContainerView)
+ containerView.addSubview(connectionPanel)
+ containerView.addSubview(buttonsStackView)
+
addSubview(mapView)
addSubview(containerView)
- [secureLabel, cityLabel, countryLabel, connectionPanel, buttonsStackView].forEach { containerView.addSubview($0) }
-
NSLayoutConstraint.activate([
containerView.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor),
containerView.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor),
containerView.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor),
- secureLabel.topAnchor.constraint(greaterThanOrEqualTo: containerView.topAnchor),
- secureLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
- secureLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
+ locationContainerView.topAnchor.constraint(greaterThanOrEqualTo: containerView.topAnchor),
+ locationContainerView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
+ locationContainerView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
+
+ secureLabel.topAnchor.constraint(equalTo: locationContainerView.topAnchor),
+ secureLabel.leadingAnchor.constraint(equalTo: locationContainerView.leadingAnchor),
+ secureLabel.trailingAnchor.constraint(equalTo: locationContainerView.trailingAnchor),
cityLabel.topAnchor.constraint(equalTo: secureLabel.bottomAnchor, constant: 8),
- cityLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
- cityLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
+ cityLabel.leadingAnchor.constraint(equalTo: locationContainerView.leadingAnchor),
+ cityLabel.trailingAnchor.constraint(equalTo: locationContainerView.trailingAnchor),
countryLabel.topAnchor.constraint(equalTo: cityLabel.bottomAnchor, constant: 8),
- countryLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
- countryLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
+ countryLabel.leadingAnchor.constraint(equalTo: locationContainerView.leadingAnchor),
+ countryLabel.trailingAnchor.constraint(equalTo: locationContainerView.trailingAnchor),
+ countryLabel.bottomAnchor.constraint(equalTo: locationContainerView.bottomAnchor),
- connectionPanel.topAnchor.constraint(equalTo: countryLabel.bottomAnchor, constant: 8),
+ connectionPanel.topAnchor.constraint(equalTo: locationContainerView.bottomAnchor, constant: 8),
connectionPanel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
connectionPanel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
diff --git a/ios/MullvadVPN/ConnectViewController.swift b/ios/MullvadVPN/ConnectViewController.swift
index d0587ccea1..f010eec162 100644
--- a/ios/MullvadVPN/ConnectViewController.swift
+++ b/ios/MullvadVPN/ConnectViewController.swift
@@ -163,7 +163,12 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
mainContentView.connectButton.setTitle(tunnelState.localizedTitleForConnectButton, for: .normal)
mainContentView.selectLocationButton.setTitle(tunnelState.localizedTitleForSelectLocationButton, for: .normal)
mainContentView.splitDisconnectButton.primaryButton.setTitle(tunnelState.localizedTitleForDisconnectButton, for: .normal)
- mainContentView.splitDisconnectButton.secondaryButton.accessibilityLabel = NSLocalizedString("RECONNECT_BUTTON_ACCESSIBILITY_LABEL", comment: "")
+ mainContentView.splitDisconnectButton.secondaryButton.accessibilityLabel = NSLocalizedString(
+ "RECONNECT_BUTTON_ACCESSIBILITY_LABEL",
+ tableName: "Main",
+ value: "Reconnect",
+ comment: ""
+ )
updateTraitDependentViews()
}
@@ -200,6 +205,8 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
mainContentView.connectionPanel.dataSource = nil
mainContentView.connectionPanel.isHidden = true
}
+
+ mainContentView.locationContainerView.accessibilityLabel = tunnelState.localizedAccessibilityLabel
}
private func locationMarkerOffset() -> CGPoint {
@@ -406,37 +413,127 @@ private extension TunnelState {
var localizedTitleForSecureLabel: String {
switch self {
case .connecting, .reconnecting:
- return NSLocalizedString("Creating secure connection", comment: "")
+ return NSLocalizedString(
+ "TUNNEL_STATE_CONNECTING",
+ tableName: "Main",
+ value: "Creating secure connection",
+ comment: ""
+ )
case .connected:
- return NSLocalizedString("Secure connection", comment: "")
+ return NSLocalizedString(
+ "TUNNEL_STATE_CONNECTED",
+ tableName: "Main",
+ value: "Secure connection",
+ comment: ""
+ )
case .disconnecting, .disconnected:
- return NSLocalizedString("Unsecure connection", comment: "")
+ return NSLocalizedString(
+ "TUNNEL_STATE_DISCONNECTED",
+ tableName: "Main",
+ value: "Unsecure connection",
+ comment: ""
+ )
}
}
var localizedTitleForSelectLocationButton: String? {
switch self {
case .disconnected, .disconnecting:
- return NSLocalizedString("Select location", comment: "")
+ return NSLocalizedString(
+ "SELECT_LOCATION_BUTTON_TITLE",
+ tableName: "Main",
+ value: "Select location",
+ comment: ""
+ )
case .connecting, .connected, .reconnecting:
- return NSLocalizedString("Switch location", comment: "")
+ return NSLocalizedString(
+ "SWITCH_LOCATION_BUTTON_TITLE",
+ tableName: "Main",
+ value: "Switch location",
+ comment: ""
+ )
}
}
- var localizedTitleForConnectButton: String? {
- return NSLocalizedString("Secure connection", comment: "")
+ var localizedTitleForConnectButton: String {
+ return NSLocalizedString(
+ "CONNECT_BUTTON_TITLE",
+ tableName: "Main",
+ value: "Secure connection",
+ comment: ""
+ )
}
- var localizedTitleForDisconnectButton: String? {
+ var localizedTitleForDisconnectButton: String {
switch self {
case .connecting:
- return NSLocalizedString("Cancel", comment: "")
- case .connected, .reconnecting:
- return NSLocalizedString("Disconnect", comment: "")
- case .disconnecting, .disconnected:
- return nil
+ return NSLocalizedString(
+ "CANCEL_BUTTON_TITLE",
+ tableName: "Main",
+ value: "Cancel",
+ comment: ""
+ )
+ case .connected, .reconnecting, .disconnecting, .disconnected:
+ return NSLocalizedString(
+ "DISCONNECT_BUTTON_TITLE",
+ tableName: "Main",
+ value: "Disconnect",
+ comment: ""
+ )
+ }
+ }
+
+ var localizedAccessibilityLabel: String {
+ switch self {
+ case .connecting:
+ return NSLocalizedString(
+ "TUNNEL_STATE_CONNECTING_ACCESSIBILITY_LABEL",
+ tableName: "Main",
+ value: "Creating secure connection",
+ comment: ""
+ )
+
+ case .connected(let tunnelInfo):
+ return String(
+ format: NSLocalizedString(
+ "TUNNEL_STATE_CONNECTED_ACCESSIBILITY_LABEL",
+ tableName: "Main",
+ value: "Secure connection. Connected to %@, %@",
+ comment: ""
+ ),
+ tunnelInfo.location.city,
+ tunnelInfo.location.country
+ )
+
+ case .disconnected:
+ return NSLocalizedString(
+ "TUNNEL_STATE_DISCONNECTED_ACCESSIBILITY_LABEL",
+ tableName: "Main",
+ value: "Unsecured connection",
+ comment: ""
+ )
+
+ case .reconnecting(let tunnelInfo):
+ return String(
+ format: NSLocalizedString(
+ "TUNNEL_STATE_RECONNECTING_ACCESSIBILITY_LABEL",
+ tableName: "Main",
+ value: "Reconnecting to %@, %@",
+ comment: ""
+ ),
+ tunnelInfo.location.city,
+ tunnelInfo.location.country
+ )
+
+ case .disconnecting:
+ return NSLocalizedString(
+ "TUNNEL_STATE_DISCONNECTING_ACCESSIBILITY_LABEL",
+ tableName: "Main",
+ value: "Disconnecting",
+ comment: ""
+ )
}
}
diff --git a/ios/MullvadVPN/en.lproj/Main.strings b/ios/MullvadVPN/en.lproj/Main.strings
new file mode 100644
index 0000000000..8e5b567739
--- /dev/null
+++ b/ios/MullvadVPN/en.lproj/Main.strings
@@ -0,0 +1,41 @@
+/* No comment provided by engineer. */
+"CANCEL_BUTTON_TITLE" = "Cancel";
+
+/* No comment provided by engineer. */
+"CONNECT_BUTTON_TITLE" = "Secure connection";
+
+/* No comment provided by engineer. */
+"DISCONNECT_BUTTON_TITLE" = "Disconnect";
+
+/* No comment provided by engineer. */
+"RECONNECT_BUTTON_ACCESSIBILITY_LABEL" = "Reconnect";
+
+/* No comment provided by engineer. */
+"SELECT_LOCATION_BUTTON_TITLE" = "Select location";
+
+/* No comment provided by engineer. */
+"SWITCH_LOCATION_BUTTON_TITLE" = "Switch location";
+
+/* No comment provided by engineer. */
+"TUNNEL_STATE_CONNECTED" = "Secure connection";
+
+/* No comment provided by engineer. */
+"TUNNEL_STATE_CONNECTED_ACCESSIBILITY_LABEL" = "Secure connection. Connected to %1$@, %2$@";
+
+/* No comment provided by engineer. */
+"TUNNEL_STATE_CONNECTING" = "Creating secure connection";
+
+/* No comment provided by engineer. */
+"TUNNEL_STATE_CONNECTING_ACCESSIBILITY_LABEL" = "Creating secure connection";
+
+/* No comment provided by engineer. */
+"TUNNEL_STATE_DISCONNECTED" = "Unsecure connection";
+
+/* No comment provided by engineer. */
+"TUNNEL_STATE_DISCONNECTED_ACCESSIBILITY_LABEL" = "Unsecured connection";
+
+/* No comment provided by engineer. */
+"TUNNEL_STATE_DISCONNECTING_ACCESSIBILITY_LABEL" = "Disconnecting";
+
+/* No comment provided by engineer. */
+"TUNNEL_STATE_RECONNECTING_ACCESSIBILITY_LABEL" = "Reconnecting to %1$@, %2$@";