diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-06-04 14:52:32 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-06-04 14:52:32 +0200 |
| commit | 7c6b8b514e428f29dcf27483597e39e48402516f (patch) | |
| tree | 5821fae11df33a5301f32189efd8650dedff99f3 | |
| parent | bc494116418341129ab006b99fce7cfc167136ff (diff) | |
| parent | 93d7188918e2e8b044c0dd895fd14c8b98abb1b2 (diff) | |
| download | mullvadvpn-7c6b8b514e428f29dcf27483597e39e48402516f.tar.xz mullvadvpn-7c6b8b514e428f29dcf27483597e39e48402516f.zip | |
Merge branch 'accessibility'
| -rw-r--r-- | ios/MullvadVPN.xcodeproj/project.pbxproj | 15 | ||||
| -rw-r--r-- | ios/MullvadVPN/ConnectMainContentView.swift | 1 | ||||
| -rw-r--r-- | ios/MullvadVPN/ConnectViewController.swift | 1 | ||||
| -rw-r--r-- | ios/MullvadVPN/HeaderBarView.swift | 2 | ||||
| -rw-r--r-- | ios/MullvadVPN/SelectLocationCell.swift | 30 | ||||
| -rw-r--r-- | ios/MullvadVPN/en.lproj/Localizable.strings | 13 |
6 files changed, 61 insertions, 1 deletions
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj index 523f0b4446..6f2b14eee4 100644 --- a/ios/MullvadVPN.xcodeproj/project.pbxproj +++ b/ios/MullvadVPN.xcodeproj/project.pbxproj @@ -129,6 +129,7 @@ 587AD7C623421D7000E93A53 /* TunnelSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587AD7C523421D7000E93A53 /* TunnelSettings.swift */; }; 587AD7C723421D8600E93A53 /* TunnelSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587AD7C523421D7000E93A53 /* TunnelSettings.swift */; }; 587AD7CA2342283900E93A53 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587AD7C92342283900E93A53 /* Account.swift */; }; + 587B7545266922BF00DEF7E9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 587B7543266922BF00DEF7E9 /* Localizable.strings */; }; 587CBFE322807F530028DED3 /* UIColor+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587CBFE222807F530028DED3 /* UIColor+Helpers.swift */; }; 588534BF246193D90018B744 /* AutomaticKeyRotationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 588534BD246193C00018B744 /* AutomaticKeyRotationManager.swift */; }; 58871D1825D5359B002297FA /* MullvadRest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58CB0EDF24B86751001EF0D8 /* MullvadRest.swift */; }; @@ -358,6 +359,7 @@ 587A01FB23F1F0BE00B68763 /* SimulatorTunnelProviderHost.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimulatorTunnelProviderHost.swift; sourceTree = "<group>"; }; 587AD7C523421D7000E93A53 /* TunnelSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TunnelSettings.swift; sourceTree = "<group>"; }; 587AD7C92342283900E93A53 /* Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = "<group>"; }; + 587B7544266922BF00DEF7E9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; }; 587CBFE222807F530028DED3 /* UIColor+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Helpers.swift"; sourceTree = "<group>"; }; 588534BD246193C00018B744 /* AutomaticKeyRotationManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutomaticKeyRotationManager.swift; sourceTree = "<group>"; }; 5888AD7E2279B6BF0051EB06 /* RelayStatusIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RelayStatusIndicatorView.swift; sourceTree = "<group>"; }; @@ -633,6 +635,7 @@ 58FAEDFC24533A5500CB0F5B /* KeychainMatchLimit.swift */, 58FAEDFE24533A7000CB0F5B /* KeychainReturn.swift */, 58727282265D173C00F315B2 /* LaunchScreen.storyboard */, + 587B7543266922BF00DEF7E9 /* Localizable.strings */, 58A1AA8623F43901009F7EA6 /* Location.swift */, 583DA21325FA4B5C00318683 /* LocationDataSource.swift */, 58BA692D23E99EFF009DC256 /* Locking.swift */, @@ -925,6 +928,7 @@ 58727283265D173C00F315B2 /* LaunchScreen.storyboard in Resources */, 586ADD4723FC13F400CE9E87 /* countries.geo.json in Resources */, 58CE5E6B224146210008646E /* Assets.xcassets in Resources */, + 587B7545266922BF00DEF7E9 /* Localizable.strings in Resources */, 584789B8264D4A2A000E45FB /* old_le_root_cert.cer in Resources */, 584789BE264D4A2A000E45FB /* new_le_root_cert.cer in Resources */, 58E5BC2624FEB6DB00A53A76 /* AccountViewController.xib in Resources */, @@ -1219,6 +1223,17 @@ }; /* End PBXTargetDependency section */ +/* Begin PBXVariantGroup section */ + 587B7543266922BF00DEF7E9 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 587B7544266922BF00DEF7E9 /* en */, + ); + name = Localizable.strings; + sourceTree = "<group>"; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 58B0A2A6238EE67E00BC001D /* Debug */ = { isa = XCBuildConfiguration; diff --git a/ios/MullvadVPN/ConnectMainContentView.swift b/ios/MullvadVPN/ConnectMainContentView.swift index 99e181ab0d..53a3ff5fd4 100644 --- a/ios/MullvadVPN/ConnectMainContentView.swift +++ b/ios/MullvadVPN/ConnectMainContentView.swift @@ -24,6 +24,7 @@ class ConnectMainContentView: UIView { mapView.isZoomEnabled = false mapView.isScrollEnabled = false mapView.isUserInteractionEnabled = false + mapView.accessibilityElementsHidden = true return mapView }() diff --git a/ios/MullvadVPN/ConnectViewController.swift b/ios/MullvadVPN/ConnectViewController.swift index 6c641f1e65..df9dfded02 100644 --- a/ios/MullvadVPN/ConnectViewController.swift +++ b/ios/MullvadVPN/ConnectViewController.swift @@ -161,6 +161,7 @@ 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: "") updateTraitDependentViews() } diff --git a/ios/MullvadVPN/HeaderBarView.swift b/ios/MullvadVPN/HeaderBarView.swift index 72acecbf35..056bfcbb73 100644 --- a/ios/MullvadVPN/HeaderBarView.swift +++ b/ios/MullvadVPN/HeaderBarView.swift @@ -22,6 +22,7 @@ class HeaderBarView: UIView { titleLabel.text = "MULLVAD VPN" titleLabel.font = UIFont.boldSystemFont(ofSize: 24) titleLabel.textColor = UIColor.white.withAlphaComponent(0.8) + titleLabel.accessibilityTraits.insert(.header) return titleLabel }() @@ -32,6 +33,7 @@ class HeaderBarView: UIView { settingsButton.setImage(UIImage(named: "IconSettings"), for: .normal) settingsButton.translatesAutoresizingMaskIntoConstraints = false settingsButton.accessibilityIdentifier = "SettingsButton" + settingsButton.accessibilityLabel = NSLocalizedString("HEADER_BAR_SETTINGS_BUTTON_ACCESSIBILITY_LABEL", comment: "") return settingsButton } diff --git a/ios/MullvadVPN/SelectLocationCell.swift b/ios/MullvadVPN/SelectLocationCell.swift index 1aa60d93bf..ef41257303 100644 --- a/ios/MullvadVPN/SelectLocationCell.swift +++ b/ios/MullvadVPN/SelectLocationCell.swift @@ -31,12 +31,14 @@ class SelectLocationCell: BasicTableViewCell { var isExpanded = false { didSet { updateCollapseImage() + updateAccessibilityCustomActions() } } var showsCollapseControl = false { didSet { collapseButton.isHidden = !showsCollapseControl + updateAccessibilityCustomActions() } } @@ -92,8 +94,8 @@ class SelectLocationCell: BasicTableViewCell { tickImageView.tintColor = .white collapseButton.accessibilityIdentifier = "CollapseButton" + collapseButton.isAccessibilityElement = false collapseButton.tintColor = .white - collapseButton.setImage(chevronDown, for: .normal) collapseButton.addTarget(self, action: #selector(handleCollapseButton(_ :)), for: .touchUpInside) [locationLabel, tickImageView, statusIndicator, collapseButton].forEach { (subview) in @@ -102,6 +104,7 @@ class SelectLocationCell: BasicTableViewCell { } updateCollapseImage() + updateAccessibilityCustomActions() updateDisabled() updateBackgroundColor() @@ -134,6 +137,12 @@ class SelectLocationCell: BasicTableViewCell { private func updateDisabled() { locationLabel.alpha = isDisabled ? 0.2 : 1 collapseButton.alpha = isDisabled ? 0.2 : 1 + + if isDisabled { + accessibilityTraits.insert(.notEnabled) + } else { + accessibilityTraits.remove(.notEnabled) + } } private func updateBackgroundColor() { @@ -164,9 +173,28 @@ class SelectLocationCell: BasicTableViewCell { didCollapseHandler?(self) } + @objc private func toggleCollapseAccessibilityAction() -> Bool { + didCollapseHandler?(self) + return true + } + private func updateCollapseImage() { let image = isExpanded ? chevronUp : chevronDown collapseButton.setImage(image, for: .normal) } + + private func updateAccessibilityCustomActions() { + if showsCollapseControl { + let actionName = isExpanded + ? NSLocalizedString("SELECT_LOCATION_COLLAPSE_ACCESSIBILITY_ACTION", comment: "") + : NSLocalizedString("SELECT_LOCATION_EXPAND_ACCESSIBILITY_ACTION", comment: "") + + accessibilityCustomActions = [ + UIAccessibilityCustomAction(name: actionName, target: self, selector: #selector(toggleCollapseAccessibilityAction)) + ] + } else { + accessibilityCustomActions = nil + } + } } diff --git a/ios/MullvadVPN/en.lproj/Localizable.strings b/ios/MullvadVPN/en.lproj/Localizable.strings new file mode 100644 index 0000000000..df0fac65e3 --- /dev/null +++ b/ios/MullvadVPN/en.lproj/Localizable.strings @@ -0,0 +1,13 @@ +/* + Localizable.strings + MullvadVPN + + Created by pronebird on 31/05/2021. + Copyright © 2021 Mullvad VPN AB. All rights reserved. +*/ + +"HEADER_BAR_SETTINGS_BUTTON_ACCESSIBILITY_LABEL" = "Settings"; +"RECONNECT_BUTTON_ACCESSIBILITY_LABEL" = "Reconnect"; + +"SELECT_LOCATION_COLLAPSE_ACCESSIBILITY_ACTION" = "Collapse location"; +"SELECT_LOCATION_EXPAND_ACCESSIBILITY_ACTION" = "Expand location"; |
