diff options
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/SharedViews/BorderedTextButton.swift (renamed from WireGuard/WireGuard/UI/iOS/TunnelList/BorderedTextButton.swift) | 6 | ||||
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift | 6 | ||||
-rw-r--r-- | WireGuard/WireGuard/UI/iOS/TunnelList/TunnelsListTableViewController.swift | 16 |
3 files changed, 15 insertions, 13 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/TunnelList/BorderedTextButton.swift b/WireGuard/WireGuard/UI/iOS/SharedViews/BorderedTextButton.swift index 5114c09..94b76d6 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelList/BorderedTextButton.swift +++ b/WireGuard/WireGuard/UI/iOS/SharedViews/BorderedTextButton.swift @@ -33,9 +33,9 @@ class BorderedTextButton: UIView { addSubview(button) button.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ - button.centerXAnchor.constraint(equalTo: self.centerXAnchor), - button.centerYAnchor.constraint(equalTo: self.centerYAnchor) - ]) + button.centerXAnchor.constraint(equalTo: centerXAnchor), + button.centerYAnchor.constraint(equalTo: centerYAnchor) + ]) button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside) } diff --git a/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift b/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift index f0a16bf..14a7194 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelListCell.swift @@ -47,14 +47,14 @@ class TunnelListCell: UITableViewCell { NSLayoutConstraint.activate([ statusSwitch.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), contentView.rightAnchor.constraint(equalTo: statusSwitch.rightAnchor) - ]) + ]) contentView.addSubview(busyIndicator) busyIndicator.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ busyIndicator.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), statusSwitch.leftAnchor.constraint(equalToSystemSpacingAfter: busyIndicator.rightAnchor, multiplier: 1) - ]) + ]) contentView.addSubview(nameLabel) nameLabel.translatesAutoresizingMaskIntoConstraints = false @@ -66,7 +66,7 @@ class TunnelListCell: UITableViewCell { nameLabel.leftAnchor.constraint(equalToSystemSpacingAfter: contentView.layoutMarginsGuide.leftAnchor, multiplier: 1), busyIndicator.leftAnchor.constraint(equalToSystemSpacingAfter: nameLabel.rightAnchor, multiplier: 1), bottomAnchorConstraint - ]) + ]) accessoryType = .disclosureIndicator diff --git a/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelsListTableViewController.swift index eda09af..0188c62 100644 --- a/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelsListTableViewController.swift +++ b/WireGuard/WireGuard/UI/iOS/TunnelList/TunnelsListTableViewController.swift @@ -96,7 +96,8 @@ class TunnelsListTableViewController: UIViewController { } @objc func addButtonTapped(sender: AnyObject) { - if self.tunnelsManager == nil { return } // Do nothing until we've loaded the tunnels + guard tunnelsManager != nil else { return } + let alert = UIAlertController(title: "", message: "Add a new WireGuard tunnel", preferredStyle: .actionSheet) let importFileAction = UIAlertAction(title: "Create from file or archive", style: .default) { [weak self] _ in self?.presentViewControllerForFileImport() @@ -125,29 +126,30 @@ class TunnelsListTableViewController: UIViewController { alert.popoverPresentationController?.sourceView = sender alert.popoverPresentationController?.sourceRect = sender.bounds } - self.present(alert, animated: true, completion: nil) + present(alert, animated: true, completion: nil) } @objc func settingsButtonTapped(sender: UIBarButtonItem!) { - if self.tunnelsManager == nil { return } // Do nothing until we've loaded the tunnels + guard tunnelsManager != nil else { return } + let settingsVC = SettingsTableViewController(tunnelsManager: tunnelsManager) let settingsNC = UINavigationController(rootViewController: settingsVC) settingsNC.modalPresentationStyle = .formSheet - self.present(settingsNC, animated: true) + present(settingsNC, animated: true) } func presentViewControllerForTunnelCreation(tunnelsManager: TunnelsManager, tunnelConfiguration: TunnelConfiguration?) { let editVC = TunnelEditTableViewController(tunnelsManager: tunnelsManager, tunnelConfiguration: tunnelConfiguration) let editNC = UINavigationController(rootViewController: editVC) editNC.modalPresentationStyle = .formSheet - self.present(editNC, animated: true) + present(editNC, animated: true) } func presentViewControllerForFileImport() { let documentTypes = ["com.wireguard.config.quick", String(kUTTypeText), String(kUTTypeZipArchive)] let filePicker = UIDocumentPickerViewController(documentTypes: documentTypes, in: .import) filePicker.delegate = self - self.present(filePicker, animated: true) + present(filePicker, animated: true) } func presentViewControllerForScanningQRCode() { @@ -155,7 +157,7 @@ class TunnelsListTableViewController: UIViewController { scanQRCodeVC.delegate = self let scanQRCodeNC = UINavigationController(rootViewController: scanQRCodeVC) scanQRCodeNC.modalPresentationStyle = .fullScreen - self.present(scanQRCodeNC, animated: true) + present(scanQRCodeNC, animated: true) } func importFromFile(url: URL, completionHandler: (() -> Void)?) { |