aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/ZipArchive
diff options
context:
space:
mode:
authorEric Kuck <eric@bluelinelabs.com>2018-12-12 21:09:52 -0600
committerEric Kuck <eric@bluelinelabs.com>2018-12-12 21:09:52 -0600
commit8a916beb389f84e21ed1aaf0d246801cd6acd73c (patch)
tree59ad4609e551e3259a802591eba9346b16408873 /WireGuard/WireGuard/ZipArchive
parentMore linter warnings fixed, enabled more swiftlint rules, project cleanup (diff)
downloadwireguard-apple-8a916beb389f84e21ed1aaf0d246801cd6acd73c.tar.xz
wireguard-apple-8a916beb389f84e21ed1aaf0d246801cd6acd73c.zip
More formatting nits and cyclomatic complexity fixes
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to 'WireGuard/WireGuard/ZipArchive')
-rw-r--r--WireGuard/WireGuard/ZipArchive/ZipArchive.swift4
-rw-r--r--WireGuard/WireGuard/ZipArchive/ZipExporter.swift5
-rw-r--r--WireGuard/WireGuard/ZipArchive/ZipImporter.swift2
3 files changed, 5 insertions, 6 deletions
diff --git a/WireGuard/WireGuard/ZipArchive/ZipArchive.swift b/WireGuard/WireGuard/ZipArchive/ZipArchive.swift
index 12cfb698..ad74d0e1 100644
--- a/WireGuard/WireGuard/ZipArchive/ZipArchive.swift
+++ b/WireGuard/WireGuard/ZipArchive/ZipArchive.swift
@@ -8,7 +8,7 @@ enum ZipArchiveError: WireGuardAppError {
case cantOpenOutputZipFileForWriting
case badArchive
- func alertText() -> (String, String)? {
+ func alertText() -> AlertText {
switch self {
case .cantOpenInputZipFile:
return ("Unable to read zip archive", "The zip archive could not be read.")
@@ -41,7 +41,7 @@ class ZipArchive {
static func unarchive(url: URL, requiredFileExtensions: [String]) throws -> [(fileBaseName: String, contents: Data)] {
- var results: [(fileBaseName: String, contents: Data)] = []
+ var results = [(fileBaseName: String, contents: Data)]()
guard let zipFile = unzOpen64(url.path) else {
throw ZipArchiveError.cantOpenInputZipFile
diff --git a/WireGuard/WireGuard/ZipArchive/ZipExporter.swift b/WireGuard/WireGuard/ZipArchive/ZipExporter.swift
index b0e6b15d..cdc9ac98 100644
--- a/WireGuard/WireGuard/ZipArchive/ZipExporter.swift
+++ b/WireGuard/WireGuard/ZipArchive/ZipExporter.swift
@@ -6,7 +6,7 @@ import UIKit
enum ZipExporterError: WireGuardAppError {
case noTunnelsToExport
- func alertText() -> (String, String)? {
+ func alertText() -> AlertText {
switch self {
case .noTunnelsToExport:
return ("Nothing to export", "There are no tunnels to export")
@@ -15,8 +15,7 @@ enum ZipExporterError: WireGuardAppError {
}
class ZipExporter {
- static func exportConfigFiles(tunnelConfigurations: [TunnelConfiguration], to url: URL,
- completion: @escaping (WireGuardAppError?) -> Void) {
+ static func exportConfigFiles(tunnelConfigurations: [TunnelConfiguration], to url: URL, completion: @escaping (WireGuardAppError?) -> Void) {
guard !tunnelConfigurations.isEmpty else {
completion(ZipExporterError.noTunnelsToExport)
diff --git a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
index e2767f2e..523614b9 100644
--- a/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
+++ b/WireGuard/WireGuard/ZipArchive/ZipImporter.swift
@@ -6,7 +6,7 @@ import UIKit
enum ZipImporterError: WireGuardAppError {
case noTunnelsInZipArchive
- func alertText() -> (String, String)? {
+ func alertText() -> AlertText {
switch self {
case .noTunnelsInZipArchive:
return ("No tunnels in zip archive", "No .conf tunnel files were found inside the zip archive.")