summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ios/MullvadVPN/ConnectViewController.swift5
-rw-r--r--ios/MullvadVPN/ConnectionPanelView.swift76
2 files changed, 30 insertions, 51 deletions
diff --git a/ios/MullvadVPN/ConnectViewController.swift b/ios/MullvadVPN/ConnectViewController.swift
index bceb172b34..f07e5914ab 100644
--- a/ios/MullvadVPN/ConnectViewController.swift
+++ b/ios/MullvadVPN/ConnectViewController.swift
@@ -80,7 +80,6 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
override func viewDidLoad() {
super.viewDidLoad()
- mainContentView.connectionPanel.collapseButton.addTarget(self, action: #selector(handleConnectionPanelButton(_:)), for: .touchUpInside)
mainContentView.connectButton.addTarget(self, action: #selector(handleConnect(_:)), for: .touchUpInside)
mainContentView.splitDisconnectButton.primaryButton.addTarget(self, action: #selector(handleDisconnect(_:)), for: .touchUpInside)
mainContentView.splitDisconnectButton.secondaryButton.addTarget(self, action: #selector(handleReconnect(_:)), for: .touchUpInside)
@@ -289,10 +288,6 @@ class ConnectViewController: UIViewController, MKMapViewDelegate, RootContainmen
// MARK: - Actions
- @objc func handleConnectionPanelButton(_ sender: Any) {
- mainContentView.connectionPanel.toggleConnectionInfoVisibility()
- }
-
@objc func handleConnect(_ sender: Any) {
delegate?.connectViewControllerShouldConnectTunnel(self)
}
diff --git a/ios/MullvadVPN/ConnectionPanelView.swift b/ios/MullvadVPN/ConnectionPanelView.swift
index 325fc17bc2..926ff9051f 100644
--- a/ios/MullvadVPN/ConnectionPanelView.swift
+++ b/ios/MullvadVPN/ConnectionPanelView.swift
@@ -35,12 +35,11 @@ class ConnectionPanelView: UIView {
return button
}()
- private let protocolRow = ConnectionPanelProtocolTypeRow()
private let inAddressRow = ConnectionPanelAddressRow()
private let outAddressRow = ConnectionPanelAddressRow()
private lazy var stackView: UIStackView = {
- let stackView = UIStackView(arrangedSubviews: [protocolRow, inAddressRow, outAddressRow])
+ let stackView = UIStackView(arrangedSubviews: [inAddressRow, outAddressRow])
stackView.axis = .vertical
stackView.translatesAutoresizingMaskIntoConstraints = false
return stackView
@@ -54,39 +53,18 @@ class ConnectionPanelView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
- commonInit()
- }
-
- required init?(coder: NSCoder) {
- super.init(coder: coder)
- commonInit()
- }
-
- func didChangeDataSource() {
- inAddressRow.detailTextLabel.text = dataSource?.inAddress
- outAddressRow.detailTextLabel.text = dataSource?.outAddress
- }
- func toggleConnectionInfoVisibility() {
- showsConnectionInfo = !showsConnectionInfo
- }
-
- private func updateConnectionInfoVisibility() {
- stackView.isHidden = !showsConnectionInfo
- collapseButton.style = showsConnectionInfo ? .up : .down
- }
-
- private func commonInit() {
- protocolRow.translatesAutoresizingMaskIntoConstraints = false
inAddressRow.translatesAutoresizingMaskIntoConstraints = false
outAddressRow.translatesAutoresizingMaskIntoConstraints = false
// TODO: Unhide it when we have out address
outAddressRow.isHidden = true
- protocolRow.textLabel.text = NSLocalizedString("WireGuard", comment: "")
- inAddressRow.textLabel.text = NSLocalizedString("In", comment: "")
- outAddressRow.textLabel.text = NSLocalizedString("Out", comment: "")
+ inAddressRow.textLabel.text = NSLocalizedString("CONNECTION_PANEL_IN_ADDRESS_LABEL", comment: "")
+ outAddressRow.textLabel.text = NSLocalizedString("CONNECTION_PANEL_OUT_ADDRESS_LABEL", comment: "")
+
+ inAddressRow.accessibilityLabel = NSLocalizedString("CONNECTION_PANEL_IN_ADDRESS_ACCESSIBILITY_LABEL", comment: "")
+ outAddressRow.accessibilityLabel = NSLocalizedString("CONNECTION_PANEL_OUT_ADDRESS_ACCESSIBILITY_LABEL", comment: "")
addSubview(collapseButton)
addSubview(stackView)
@@ -110,31 +88,38 @@ class ConnectionPanelView: UIView {
])
updateConnectionInfoVisibility()
+
+ collapseButton.addTarget(self, action: #selector(toggleCollapse(_:)), for: .touchUpInside)
}
-}
-class ConnectionPanelProtocolTypeRow: UIView {
- let textLabel = UILabel()
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
- override init(frame: CGRect) {
- super.init(frame: frame)
+ private func didChangeDataSource() {
+ inAddressRow.detailTextLabel.text = dataSource?.inAddress
+ outAddressRow.detailTextLabel.text = dataSource?.outAddress
- textLabel.translatesAutoresizingMaskIntoConstraints = false
- textLabel.font = UIFont.systemFont(ofSize: 17)
- textLabel.textColor = .white
+ inAddressRow.accessibilityValue = dataSource?.inAddress
+ outAddressRow.accessibilityValue = dataSource?.outAddress
+ }
- addSubview(textLabel)
+ private func toggleConnectionInfoVisibility() {
+ showsConnectionInfo = !showsConnectionInfo
+ }
- NSLayoutConstraint.activate([
- textLabel.topAnchor.constraint(equalTo: topAnchor),
- textLabel.bottomAnchor.constraint(equalTo: bottomAnchor),
- textLabel.leadingAnchor.constraint(equalTo: leadingAnchor),
- textLabel.trailingAnchor.constraint(equalTo: trailingAnchor)
- ])
+ @objc private func toggleCollapse(_ sender: Any) {
+ toggleConnectionInfoVisibility()
}
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
+ private func updateConnectionInfoVisibility() {
+ stackView.isHidden = !showsConnectionInfo
+ collapseButton.style = showsConnectionInfo ? .up : .down
+
+ if collapseButton.accessibilityElementIsFocused() {
+ let nextAccessibleElement = showsConnectionInfo ? stackView.arrangedSubviews.first : collapseButton
+ UIAccessibility.post(notification: .layoutChanged, argument: nextAccessibleElement)
+ }
}
}
@@ -144,7 +129,6 @@ class ConnectionPanelAddressRow: UIView {
let stackView: UIStackView
override init(frame: CGRect) {
-
let font = UIFont.systemFont(ofSize: 17)
textLabel.font = font