aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-11-03 19:48:10 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-11-03 19:48:10 +0100
commite43de890e079ddf1d1a14f29a4babcdc8a918b63 (patch)
tree12b62e0a41048189f14cfc40985f47e9061f174e /WireGuard
parentGlobal: run through swiftlint (diff)
downloadwireguard-apple-e43de890e079ddf1d1a14f29a4babcdc8a918b63.tar.xz
wireguard-apple-e43de890e079ddf1d1a14f29a4babcdc8a918b63.zip
Settings: simplify
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift29
1 files changed, 5 insertions, 24 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
index ca8f45b..841fb21 100644
--- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
@@ -40,19 +40,11 @@ class SettingsTableViewController: UITableViewController {
self.tableView.register(TunnelSettingsTableViewKeyValueCell.self, forCellReuseIdentifier: TunnelSettingsTableViewKeyValueCell.id)
self.tableView.register(TunnelSettingsTableViewButtonCell.self, forCellReuseIdentifier: TunnelSettingsTableViewButtonCell.id)
- let wireguardCaptionedImage = UIImage(named: "wireguard.pdf", in: Bundle.main, compatibleWith: nil)!
- let wireguardCaptionedImageView = UIImageView(image: wireguardCaptionedImage)
- wireguardCaptionedImageView.contentMode = .scaleAspectFit
- let wireguardCaptionedImageContainerView = UIView()
- wireguardCaptionedImageContainerView.addSubview(wireguardCaptionedImageView)
- wireguardCaptionedImageView.translatesAutoresizingMaskIntoConstraints = false
- NSLayoutConstraint.activate([
- wireguardCaptionedImageView.topAnchor.constraint(equalTo: wireguardCaptionedImageContainerView.layoutMarginsGuide.topAnchor),
- wireguardCaptionedImageView.bottomAnchor.constraint(equalTo: wireguardCaptionedImageContainerView.layoutMarginsGuide.bottomAnchor),
- wireguardCaptionedImageView.leftAnchor.constraint(equalTo: wireguardCaptionedImageContainerView.layoutMarginsGuide.leftAnchor),
- wireguardCaptionedImageView.rightAnchor.constraint(equalTo: wireguardCaptionedImageContainerView.layoutMarginsGuide.rightAnchor),
- ])
- self.wireguardCaptionedImage = (view: wireguardCaptionedImageContainerView, size: wireguardCaptionedImage.size)
+ let logo = UIImageView(image: UIImage(named: "wireguard.pdf", in: Bundle.main, compatibleWith: nil)!)
+ logo.contentMode = .scaleAspectFit
+ //TODO(roopesh): limit size to 1.5 * rowheight, and anchor to bottom
+ self.tableView.tableFooterView = logo
+
}
@objc func doneTapped() {
@@ -156,17 +148,6 @@ extension SettingsTableViewController {
return cell
}
}
-
- override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
- guard (section == 1) else { return nil }
- return self.wireguardCaptionedImage?.view
- }
-
- override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
- guard (section == 1) else { return 0 }
- guard let imageSize = self.wireguardCaptionedImage?.size else { return 0 }
- return min(tableView.rowHeight * 1.5, (tableView.bounds.width / imageSize.width) * imageSize.height)
- }
}
class TunnelSettingsTableViewKeyValueCell: UITableViewCell {