diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2021-05-27 13:47:54 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2021-05-27 14:36:59 +0200 |
| commit | dc352b54a2fcf05a36204efaf18133331ae32aee (patch) | |
| tree | b9dd17fc97d3c83d30b4bf9ec37c70fbc3eab150 /ios | |
| parent | 08a9769440116b6f4c13ab5dd97b423eda7b7bd2 (diff) | |
| download | mullvadvpn-dc352b54a2fcf05a36204efaf18133331ae32aee.tar.xz mullvadvpn-dc352b54a2fcf05a36204efaf18133331ae32aee.zip | |
Add empty table header footer view
Diffstat (limited to 'ios')
| -rw-r--r-- | ios/MullvadVPN.xcodeproj/project.pbxproj | 40 | ||||
| -rw-r--r-- | ios/MullvadVPN/EmptyTableViewHeaderFooterView.swift | 26 | ||||
| -rw-r--r-- | ios/MullvadVPN/PreferencesViewController.swift | 13 | ||||
| -rw-r--r-- | ios/MullvadVPN/SettingsViewController.swift | 13 |
4 files changed, 58 insertions, 34 deletions
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj index 9d9d32f83e..5a3cffd849 100644 --- a/ios/MullvadVPN.xcodeproj/project.pbxproj +++ b/ios/MullvadVPN.xcodeproj/project.pbxproj @@ -141,6 +141,7 @@ 58907D9524D17B4E00CFC3F5 /* DisconnectSplitButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58907D9424D17B4E00CFC3F5 /* DisconnectSplitButton.swift */; }; 5891BF1C25E3E3EB006D6FB0 /* Bundle+ProductVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5891BF1B25E3E3EB006D6FB0 /* Bundle+ProductVersion.swift */; }; 5891BF5125E66B1E006D6FB0 /* UIBarButtonItem+KeyboardNavigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5891BF5025E66B1E006D6FB0 /* UIBarButtonItem+KeyboardNavigation.swift */; }; + 5892A45E265FABFF00890742 /* EmptyTableViewHeaderFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5892A45D265FABFF00890742 /* EmptyTableViewHeaderFooterView.swift */; }; 5896AE7E246ACE65005B36CB /* KeychainAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58FAEDEB245059F000CB0F5B /* KeychainAttributes.swift */; }; 5896AE7F246ACE76005B36CB /* Keychain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58FAEDF6245088E100CB0F5B /* Keychain.swift */; }; 5896AE80246ACE79005B36CB /* KeychainClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58FAEE0024533A9C00CB0F5B /* KeychainClass.swift */; }; @@ -366,6 +367,7 @@ 58907D9424D17B4E00CFC3F5 /* DisconnectSplitButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisconnectSplitButton.swift; sourceTree = "<group>"; }; 5891BF1B25E3E3EB006D6FB0 /* Bundle+ProductVersion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+ProductVersion.swift"; sourceTree = "<group>"; }; 5891BF5025E66B1E006D6FB0 /* UIBarButtonItem+KeyboardNavigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIBarButtonItem+KeyboardNavigation.swift"; sourceTree = "<group>"; }; + 5892A45D265FABFF00890742 /* EmptyTableViewHeaderFooterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyTableViewHeaderFooterView.swift; sourceTree = "<group>"; }; 5894E725236B2801008A2793 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; 5896AE83246D5889005B36CB /* CustomDateComponentsFormatting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomDateComponentsFormatting.swift; sourceTree = "<group>"; }; 5896AE85246D6AD8005B36CB /* CustomDateComponentsFormattingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomDateComponentsFormattingTests.swift; sourceTree = "<group>"; }; @@ -596,22 +598,29 @@ 58DF28A42417CB4B00E836B0 /* AppStorePaymentManager.swift */, 58FD5BE624192A2B00112C88 /* AppStoreReceipt.swift */, 58CE5E6A224146210008646E /* Assets.xcassets */, + 58FEEB57260B662E00A621A8 /* AutomaticKeyboardResponder.swift */, 588534BD246193C00018B744 /* AutomaticKeyRotationManager.swift */, 589AB4F6227B64450039131E /* BasicTableViewCell.swift */, + 5891BF1B25E3E3EB006D6FB0 /* Bundle+ProductVersion.swift */, 58F840B12464491D0044E708 /* ChainedError.swift */, 58A1AA8B23F5584B009F7EA6 /* ConnectionPanelView.swift */, - 58CCA00F224249A1004F3011 /* ConnectViewController.swift */, 58B43C1825F77DB60002C8C3 /* ConnectMainContentView.swift */, - 58A99ED2240014A0006599E9 /* ConsentViewController.swift */, + 58CCA00F224249A1004F3011 /* ConnectViewController.swift */, 584592602639B4A200EF967F /* ConsentContentView.swift */, + 58A99ED2240014A0006599E9 /* ConsentViewController.swift */, + 5871FB95254ADE4E0051A0A4 /* ConsolidatedApplicationLog.swift */, 5896AE83246D5889005B36CB /* CustomDateComponentsFormatting.swift */, 582BB1B0229569620055B6EF /* CustomNavigationBar.swift */, 58293FB625138B88005D0BB5 /* CustomNavigationController.swift */, + 5868BD32261DCD2600E6027F /* CustomSplitViewController.swift */, + 58ACF64C26567A4F00ACE4B7 /* CustomSwitch.swift */, + 58ACF64E26567A7100ACE4B7 /* CustomSwitchContainer.swift */, 58293FB025124117005D0BB5 /* CustomTextField.swift */, 58293FB2251241B3005D0BB5 /* CustomTextView.swift */, 58907D9424D17B4E00CFC3F5 /* DisconnectSplitButton.swift */, 58B9EB142489139B00095626 /* DisplayChainedError.swift */, 5873884C239E6D7E00E96C4E /* EmbeddedViewContainerView.swift */, + 5892A45D265FABFF00890742 /* EmptyTableViewHeaderFooterView.swift */, 58FEEB45260A028D00A621A8 /* GeoJSON.swift */, 58F3C0A3249CB069003E76BE /* HeaderBarView.swift */, 58FD5BF32428C67600112C88 /* InAppPurchaseButton.swift */, @@ -627,8 +636,10 @@ 58FAEDFE24533A7000CB0F5B /* KeychainReturn.swift */, 58CE5E6C224146210008646E /* LaunchScreen.storyboard */, 58A1AA8623F43901009F7EA6 /* Location.swift */, + 583DA21325FA4B5C00318683 /* LocationDataSource.swift */, 58BA692D23E99EFF009DC256 /* Locking.swift */, 5815039F24D6ECF200C9C50E /* Logging */, + 58B993B02608A34500BA7811 /* LoginContentView.swift */, 58CE5E65224146200008646E /* LoginViewController.swift */, 58C3B06624EA768100C0348E /* LogStreamerViewController.swift */, 58CE5E67224146200008646E /* Main.storyboard */, @@ -642,10 +653,11 @@ 580EE1FF24B3218800F9D8A1 /* Operations */, 583BC70624FE4DC400C9DE04 /* Optional+DispatchQueue.swift */, 5845F841236CBACD00B2D93C /* PacketTunnelIpc.swift */, + 58ACF6482655365700ACE4B7 /* PreferencesViewController.swift */, 58C6B35322BB87C4003C19AD /* PrivateKeyWithMetadata.swift */, - 5871FB95254ADE4E0051A0A4 /* ConsolidatedApplicationLog.swift */, - 58293FAC2510CA58005D0BB5 /* ProblemReportViewController.swift */, 58F8AC0D25D3F8CE002BE0ED /* ProblemReportReviewViewController.swift */, + 58EF580A25D69D7A00AEBA94 /* ProblemReportSubmissionOverlayView.swift */, + 58293FAC2510CA58005D0BB5 /* ProblemReportViewController.swift */, 58BFA5C522A7C97F00A6173D /* RelayCache.swift */, 58781CC822AE7CA8009B9D8E /* RelayConstraints.swift */, 58781CD422AFBA39009B9D8E /* RelaySelector.swift */, @@ -658,38 +670,29 @@ 582BB1B2229574F40055B6EF /* SettingsAccountCell.swift */, 582BB1AE229566420055B6EF /* SettingsCell.swift */, 58E6771E24ADFE7800AA26E7 /* SettingsNavigationController.swift */, + 58ACF64A26553C3F00ACE4B7 /* SettingsSwitchCell.swift */, 58CCA01122424D11004F3011 /* SettingsViewController.swift */, 58BA693023EADA6A009DC256 /* SimulatorTunnelProvider.swift */, 587A01FB23F1F0BE00B68763 /* SimulatorTunnelProviderHost.swift */, 58FD5BEF24238EB300112C88 /* SKProduct+Formatting.swift */, 58F19E34228C15BA00C7710B /* SpinnerActivityIndicatorView.swift */, + 584789DF26529D72000E45FB /* SSLPinningURLSessionDelegate.swift */, 581CBCED229826FD00727D7F /* StaticTableViewDataSource.swift */, + 58EF581025D69DB400AEBA94 /* StatusImageView.swift */, 5807E2BF2432038B00F5FF30 /* String+Split.swift */, 5871FB8225498CA20051A0A4 /* Swizzle.swift */, 5862805322428EF100F5A6E1 /* TranslucentButtonBlurView.swift */, 5835B7CB233B76CB0096D79F /* TunnelManager.swift */, 587AD7C523421D7000E93A53 /* TunnelSettings.swift */, 58AEEF6A2344A46200C9BBD5 /* TunnelSettingsManager.swift */, + 5891BF5025E66B1E006D6FB0 /* UIBarButtonItem+KeyboardNavigation.swift */, 587CBFE222807F530028DED3 /* UIColor+Helpers.swift */, 58CCA0152242560B004F3011 /* UIColor+Palette.swift */, + 585CA70E25F8C44600B47C62 /* UIMetrics.swift */, 58FD5BF12424F7D700112C88 /* UserInterfaceInteractionRestriction.swift */, 58B8743122B25A7600015324 /* WireguardAssociatedAddresses.swift */, 5877152F23981F7B001F8237 /* WireguardKeysViewController.swift */, 58B9814D24FEA70D00C0D59E /* WireguardKeysViewController.xib */, - 58EF580A25D69D7A00AEBA94 /* ProblemReportSubmissionOverlayView.swift */, - 58EF581025D69DB400AEBA94 /* StatusImageView.swift */, - 5891BF5025E66B1E006D6FB0 /* UIBarButtonItem+KeyboardNavigation.swift */, - 5891BF1B25E3E3EB006D6FB0 /* Bundle+ProductVersion.swift */, - 585CA70E25F8C44600B47C62 /* UIMetrics.swift */, - 583DA21325FA4B5C00318683 /* LocationDataSource.swift */, - 58B993B02608A34500BA7811 /* LoginContentView.swift */, - 58FEEB57260B662E00A621A8 /* AutomaticKeyboardResponder.swift */, - 5868BD32261DCD2600E6027F /* CustomSplitViewController.swift */, - 584789DF26529D72000E45FB /* SSLPinningURLSessionDelegate.swift */, - 58ACF6482655365700ACE4B7 /* PreferencesViewController.swift */, - 58ACF64A26553C3F00ACE4B7 /* SettingsSwitchCell.swift */, - 58ACF64C26567A4F00ACE4B7 /* CustomSwitch.swift */, - 58ACF64E26567A7100ACE4B7 /* CustomSwitchContainer.swift */, ); path = MullvadVPN; sourceTree = "<group>"; @@ -1078,6 +1081,7 @@ 580EE21B24B3236900F9D8A1 /* InputOperation.swift in Sources */, 58EF580B25D69D7A00AEBA94 /* ProblemReportSubmissionOverlayView.swift in Sources */, 58FD5BE724192A2C00112C88 /* AppStoreReceipt.swift in Sources */, + 5892A45E265FABFF00890742 /* EmptyTableViewHeaderFooterView.swift in Sources */, 5835B7CC233B76CB0096D79F /* TunnelManager.swift in Sources */, 58FEEB46260A028D00A621A8 /* GeoJSON.swift in Sources */, 5815039724D6ECAE00C9C50E /* CustomFormatLogHandler.swift in Sources */, diff --git a/ios/MullvadVPN/EmptyTableViewHeaderFooterView.swift b/ios/MullvadVPN/EmptyTableViewHeaderFooterView.swift new file mode 100644 index 0000000000..0d047ab045 --- /dev/null +++ b/ios/MullvadVPN/EmptyTableViewHeaderFooterView.swift @@ -0,0 +1,26 @@ +// +// EmptyTableViewHeaderFooterView.swift +// MullvadVPN +// +// Created by pronebird on 27/05/2021. +// Copyright © 2021 Mullvad VPN AB. All rights reserved. +// + +import UIKit + +class EmptyTableViewHeaderFooterView: UITableViewHeaderFooterView { + + static var reuseIdentifier = "EmptyTableViewHeaderFooterView" + + override init(reuseIdentifier: String?) { + super.init(reuseIdentifier: reuseIdentifier) + + self.textLabel?.isHidden = true + self.contentView.backgroundColor = .clear + self.backgroundView?.backgroundColor = .clear + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} diff --git a/ios/MullvadVPN/PreferencesViewController.swift b/ios/MullvadVPN/PreferencesViewController.swift index 4220d273e5..726bba49d3 100644 --- a/ios/MullvadVPN/PreferencesViewController.swift +++ b/ios/MullvadVPN/PreferencesViewController.swift @@ -35,13 +35,14 @@ class PreferencesViewController: UITableViewController, TunnelObserver { tableView.separatorColor = .secondaryColor tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 60 - tableView.sectionHeaderHeight = 18 - tableView.sectionFooterHeight = 18 + tableView.sectionHeaderHeight = UIMetrics.contentLayoutMargins.top + tableView.sectionFooterHeight = 0 tableView.dataSource = staticDataSource tableView.delegate = staticDataSource tableView.register(SettingsSwitchCell.self, forCellReuseIdentifier: CellIdentifier.switchCell.rawValue) + tableView.register(EmptyTableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: EmptyTableViewHeaderFooterView.reuseIdentifier) navigationItem.title = NSLocalizedString("Preferences", comment: "Navigation title") navigationItem.largeTitleDisplayMode = .always @@ -115,12 +116,8 @@ class PreferencesTableViewDataSource: StaticTableViewDataSource { // MARK: - UITableViewDelegate - func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - return 24 - } - - func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { - return 0.01 + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + return tableView.dequeueReusableHeaderFooterView(withIdentifier: EmptyTableViewHeaderFooterView.reuseIdentifier) } } diff --git a/ios/MullvadVPN/SettingsViewController.swift b/ios/MullvadVPN/SettingsViewController.swift index 67a2d78d99..0735c60542 100644 --- a/ios/MullvadVPN/SettingsViewController.swift +++ b/ios/MullvadVPN/SettingsViewController.swift @@ -46,14 +46,15 @@ class SettingsViewController: UITableViewController, AccountObserver { tableView.separatorColor = .secondaryColor tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 60 - tableView.sectionHeaderHeight = 18 - tableView.sectionFooterHeight = 18 + tableView.sectionHeaderHeight = UIMetrics.contentLayoutMargins.top + tableView.sectionFooterHeight = 0 tableView.dataSource = staticDataSource tableView.delegate = staticDataSource tableView.register(SettingsAccountCell.self, forCellReuseIdentifier: CellIdentifier.accountCell.rawValue) tableView.register(SettingsCell.self, forCellReuseIdentifier: CellIdentifier.basicCell.rawValue) + tableView.register(EmptyTableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: EmptyTableViewHeaderFooterView.reuseIdentifier) navigationItem.title = NSLocalizedString("Settings", comment: "Navigation title") navigationItem.largeTitleDisplayMode = .always @@ -182,12 +183,8 @@ class SettingsTableViewDataSource: StaticTableViewDataSource { // MARK: - UITableViewDelegate - func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - return 24 - } - - func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { - return 0.01 + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + return tableView.dequeueReusableHeaderFooterView(withIdentifier: EmptyTableViewHeaderFooterView.reuseIdentifier) } } |
