diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-11-15 13:21:45 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-11-16 11:12:35 +0100 |
| commit | ec699fc61bd05cf4567ca1521967dda9a1882ae9 (patch) | |
| tree | 717dff13093c5a8aafabe9b247a0d5504b47d7ec | |
| parent | 8602854d62dfd774b9ce229be28a933131ea4e24 (diff) | |
| download | mullvadvpn-ec699fc61bd05cf4567ca1521967dda9a1882ae9.tar.xz mullvadvpn-ec699fc61bd05cf4567ca1521967dda9a1882ae9.zip | |
Add HeaderBarButton and increase hit area
| -rw-r--r-- | ios/MullvadVPN.xcodeproj/project.pbxproj | 4 | ||||
| -rw-r--r-- | ios/MullvadVPN/HeaderBarButton.swift | 15 | ||||
| -rw-r--r-- | ios/MullvadVPN/HeaderBarView.swift | 7 |
3 files changed, 23 insertions, 3 deletions
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj index 4f0f3ab3a8..c8c259d5ae 100644 --- a/ios/MullvadVPN.xcodeproj/project.pbxproj +++ b/ios/MullvadVPN.xcodeproj/project.pbxproj @@ -219,6 +219,7 @@ 58B0A2AA238EE6A900BC001D /* RelaySelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58781CD422AFBA39009B9D8E /* RelaySelector.swift */; }; 58B0A2AC238EE6D500BC001D /* IPAddress+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5840250022B1124600E4CFEC /* IPAddress+Codable.swift */; }; 58B0A2AD238EE6EC00BC001D /* MullvadEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5840250322B11AB700E4CFEC /* MullvadEndpoint.swift */; }; + 58B3F30F2742708B00A2DD38 /* HeaderBarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58B3F30E2742708B00A2DD38 /* HeaderBarButton.swift */; }; 58B43C1925F77DB60002C8C3 /* ConnectMainContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58B43C1825F77DB60002C8C3 /* ConnectMainContentView.swift */; }; 58B67B482602079E008EF58E /* RelaySelector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58781CD422AFBA39009B9D8E /* RelaySelector.swift */; }; 58B8743222B25A7600015324 /* WireguardAssociatedAddresses.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58B8743122B25A7600015324 /* WireguardAssociatedAddresses.swift */; }; @@ -481,6 +482,7 @@ 58AEEF6A2344A46200C9BBD5 /* TunnelSettingsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TunnelSettingsManager.swift; sourceTree = "<group>"; }; 58B0A2A0238EE67E00BC001D /* MullvadVPNTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MullvadVPNTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 58B0A2A4238EE67E00BC001D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + 58B3F30E2742708B00A2DD38 /* HeaderBarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderBarButton.swift; sourceTree = "<group>"; }; 58B43C1825F77DB60002C8C3 /* ConnectMainContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectMainContentView.swift; sourceTree = "<group>"; }; 58B8743122B25A7600015324 /* WireguardAssociatedAddresses.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WireguardAssociatedAddresses.swift; sourceTree = "<group>"; }; 58B93A1226C3F13600A55733 /* TunnelState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TunnelState.swift; sourceTree = "<group>"; }; @@ -837,6 +839,7 @@ 58B9EB142489139B00095626 /* DisplayChainedError.swift */, 5892A45D265FABFF00890742 /* EmptyTableViewHeaderFooterView.swift */, 58FEEB45260A028D00A621A8 /* GeoJSON.swift */, + 58B3F30E2742708B00A2DD38 /* HeaderBarButton.swift */, 58F3C0A3249CB069003E76BE /* HeaderBarView.swift */, 58FD5BF32428C67600112C88 /* InAppPurchaseButton.swift */, 58CE5E6F224146210008646E /* Info.plist */, @@ -1305,6 +1308,7 @@ 58CCA010224249A1004F3011 /* ConnectViewController.swift in Sources */, 58BFA5C622A7C97F00A6173D /* RelayCacheTracker.swift in Sources */, 582BB1B1229569620055B6EF /* CustomNavigationBar.swift in Sources */, + 58B3F30F2742708B00A2DD38 /* HeaderBarButton.swift in Sources */, 584789E026529D72000E45FB /* SSLPinningURLSessionDelegate.swift in Sources */, 58ACF6492655365700ACE4B7 /* PreferencesViewController.swift in Sources */, 5860392926DCE7AB00554C79 /* PromiseCompletion.swift in Sources */, diff --git a/ios/MullvadVPN/HeaderBarButton.swift b/ios/MullvadVPN/HeaderBarButton.swift new file mode 100644 index 0000000000..df3858d42c --- /dev/null +++ b/ios/MullvadVPN/HeaderBarButton.swift @@ -0,0 +1,15 @@ +// +// HeaderBarButton.swift +// MullvadVPN +// +// Created by pronebird on 15/11/2021. +// Copyright © 2021 Mullvad VPN AB. All rights reserved. +// + +import UIKit + +class HeaderBarButton: UIButton { + override func point(inside point: CGPoint, with event: UIEvent?) -> Bool { + return bounds.insetBy(dx: -10, dy: -10).contains(point) + } +} diff --git a/ios/MullvadVPN/HeaderBarView.swift b/ios/MullvadVPN/HeaderBarView.swift index 4dd1d68ce5..d9f23c75a6 100644 --- a/ios/MullvadVPN/HeaderBarView.swift +++ b/ios/MullvadVPN/HeaderBarView.swift @@ -28,9 +28,10 @@ class HeaderBarView: UIView { let settingsButton = makeSettingsButton() - class func makeSettingsButton() -> UIButton { - let settingsButton = UIButton(type: .custom) - settingsButton.setImage(UIImage(named: "IconSettings"), for: .normal) + class func makeSettingsButton() -> HeaderBarButton { + let settingsImage = UIImage(named: "IconSettings")?.withRenderingMode(.alwaysOriginal) + let settingsButton = HeaderBarButton(type: .system) + settingsButton.setImage(settingsImage, for: .normal) settingsButton.translatesAutoresizingMaskIntoConstraints = false settingsButton.accessibilityIdentifier = "SettingsButton" settingsButton.accessibilityLabel = NSLocalizedString( |
