aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/ViewControllers/SetttingsTableViewController.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/ViewControllers/SetttingsTableViewController.swift')
-rw-r--r--WireGuard/ViewControllers/SetttingsTableViewController.swift18
1 files changed, 16 insertions, 2 deletions
diff --git a/WireGuard/ViewControllers/SetttingsTableViewController.swift b/WireGuard/ViewControllers/SetttingsTableViewController.swift
index 0421815..8f87bb7 100644
--- a/WireGuard/ViewControllers/SetttingsTableViewController.swift
+++ b/WireGuard/ViewControllers/SetttingsTableViewController.swift
@@ -35,8 +35,15 @@ class SettingsTableViewController: UITableViewController {
label.text = goVersion
}
return Guarantee.value(())
- }.recover({ (_) in
- self.goVersionInfoLabel.text = NSLocalizedString("Unknown", comment: "")
+ }.recover({ (error) in
+ switch error {
+ case GoVersionCoordinatorError.noEnabledSession:
+ self.goVersionInfoLabel.text = NSLocalizedString("Unavailable", comment: "")
+ self.showNotEnabledAlert()
+ default:
+ self.goVersionInfoLabel.text = NSLocalizedString("Unknown", comment: "")
+ }
+
})
}
@@ -69,6 +76,13 @@ class SettingsTableViewController: UITableViewController {
return self.delegate?.goVersionInformation() ?? Promise(error: GoVersionError.noDelegate)
}
+ private func showNotEnabledAlert() {
+ let notEnabledAlertController = UIAlertController(title: NSLocalizedString("Go version", comment: ""), message: NSLocalizedString("Enable a WireGuard config by connecting or by selecting one in the VPN section of the device Settings app.", comment: ""), preferredStyle: .alert)
+ notEnabledAlertController.addAction(UIAlertAction(title: NSLocalizedString("Ok", comment: "Generic OK button"), style: .default, handler: nil))
+
+ present(notEnabledAlertController, animated: true, completion: nil)
+ }
+
private func showCopyConfirmation() {
let confirmationAlertController = UIAlertController(title: NSLocalizedString("Copied version information", comment: ""), message: UIPasteboard.general.string, preferredStyle: .alert)
confirmationAlertController.addAction(UIAlertAction(title: NSLocalizedString("Ok", comment: "Generic OK button"), style: .default, handler: nil))