aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-03 18:41:54 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-03 18:41:54 +0530
commit66389c60b5c4506569d6fbfffedade273bf1562c (patch)
treef9e79e7d351440bfed7125e3d2ea3bd3c4143bdc /WireGuard
parentSettings: Swap table view sections (diff)
downloadwireguard-apple-66389c60b5c4506569d6fbfffedade273bf1562c.tar.xz
wireguard-apple-66389c60b5c4506569d6fbfffedade273bf1562c.zip
Settings: Show the captioned WireGuard logo at the end
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift26
1 files changed, 26 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
index 5a120a0..b3d8c21 100644
--- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
@@ -18,6 +18,7 @@ class SettingsTableViewController: UITableViewController {
]
let tunnelsManager: TunnelsManager?
+ var wireguardCaptionedImage: (view: UIView, size: CGSize)? = nil
init(tunnelsManager: TunnelsManager?) {
self.tunnelsManager = tunnelsManager
@@ -38,6 +39,20 @@ 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)
}
@objc func doneTapped() {
@@ -141,6 +156,17 @@ 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.bounds.width, 480) / imageSize.width) * imageSize.height
+ }
}
class TunnelSettingsTableViewKeyValueCell: UITableViewCell {