aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift31
1 files changed, 17 insertions, 14 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift
index 64cd0f7d..3addea46 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/SettingsTableViewController.swift
@@ -86,22 +86,25 @@ class SettingsTableViewController: UITableViewController {
}
func exportConfigurationsAsZipFile(sourceView: UIView) {
- guard let tunnelsManager = tunnelsManager else { return }
- guard let destinationDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return }
-
- let destinationURL = destinationDir.appendingPathComponent("wireguard-export.zip")
- _ = FileManager.deleteFile(at: destinationURL)
+ PrivateDataConfirmation.confirmAccess(to: tr("iosExportPrivateData")) { [weak self] in
+ guard let self = self else { return }
+ guard let tunnelsManager = self.tunnelsManager else { return }
+ guard let destinationDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return }
+
+ let destinationURL = destinationDir.appendingPathComponent("wireguard-export.zip")
+ _ = FileManager.deleteFile(at: destinationURL)
+
+ let count = tunnelsManager.numberOfTunnels()
+ let tunnelConfigurations = (0 ..< count).compactMap { tunnelsManager.tunnel(at: $0).tunnelConfiguration }
+ ZipExporter.exportConfigFiles(tunnelConfigurations: tunnelConfigurations, to: destinationURL) { [weak self] error in
+ if let error = error {
+ ErrorPresenter.showErrorAlert(error: error, from: self)
+ return
+ }
- let count = tunnelsManager.numberOfTunnels()
- let tunnelConfigurations = (0 ..< count).compactMap { tunnelsManager.tunnel(at: $0).tunnelConfiguration }
- ZipExporter.exportConfigFiles(tunnelConfigurations: tunnelConfigurations, to: destinationURL) { [weak self] error in
- if let error = error {
- ErrorPresenter.showErrorAlert(error: error, from: self)
- return
+ let fileExportVC = UIDocumentPickerViewController(url: destinationURL, in: .exportToService)
+ self?.present(fileExportVC, animated: true, completion: nil)
}
-
- let fileExportVC = UIDocumentPickerViewController(url: destinationURL, in: .exportToService)
- self?.present(fileExportVC, animated: true, completion: nil)
}
}