Importing: Account for errors in showing the 'No configurations found' error

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-11-01 15:59:17 +05:30
parent 5138cdf9ea
commit 1377153bc6
1 changed files with 4 additions and 4 deletions

View File

@ -153,10 +153,6 @@ class TunnelsListTableViewController: UITableViewController {
} catch (let error) {
print("Error opening zip archive: \(error)")
}
guard (unarchivedFiles.count > 0) else {
showErrorAlert(title: "No configurations found", message: "Zip archive doesn't contain any .conf files")
return
}
var numberOfConfigFilesWithErrors = 0
var tunnelConfigurationsToAdd: [TunnelConfiguration] = []
for unarchivedFile in unarchivedFiles {
@ -170,6 +166,10 @@ class TunnelsListTableViewController: UITableViewController {
numberOfConfigFilesWithErrors = numberOfConfigFilesWithErrors + 1
}
}
guard (tunnelConfigurationsToAdd.count > 0) else {
showErrorAlert(title: "No configurations found", message: "Zip archive doesn't contain any valid .conf files")
return
}
var numberOfTunnelsRemainingAfterError = 0
tunnelsManager?.addMultiple(tunnelConfigurations: tunnelConfigurationsToAdd) { (numberOfTunnelsRemaining, error) in
if (error != nil) {