From e0c8b478bb684d1ce01bb4528c7ba0c9fb59b203 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 11 Apr 2019 18:07:59 +0200 Subject: [PATCH] Unzip NordVPN external resources to cache --- Passepartout.xcodeproj/project.pbxproj | 4 ++++ Passepartout/Sources/Services/Infrastructure.swift | 11 +++++++++-- Podfile | 1 + Podfile.lock | 6 +++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Passepartout.xcodeproj/project.pbxproj b/Passepartout.xcodeproj/project.pbxproj index 4d76924d..ce67e0a9 100644 --- a/Passepartout.xcodeproj/project.pbxproj +++ b/Passepartout.xcodeproj/project.pbxproj @@ -861,6 +861,7 @@ "${PODS_ROOT}/Target Support Files/Pods-Passepartout-iOS/Pods-Passepartout-iOS-frameworks.sh", "${BUILT_PRODUCTS_DIR}/MBProgressHUD/MBProgressHUD.framework", "${PODS_ROOT}/OpenSSL-Apple/frameworks/iPhone/openssl.framework", + "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", "${BUILT_PRODUCTS_DIR}/SwiftyBeaver/SwiftyBeaver.framework", "${BUILT_PRODUCTS_DIR}/TunnelKit/TunnelKit.framework", ); @@ -870,6 +871,7 @@ outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MBProgressHUD.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyBeaver.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TunnelKit.framework", ); @@ -954,6 +956,7 @@ inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Passepartout-CoreTests/Pods-Passepartout-CoreTests-frameworks.sh", "${PODS_ROOT}/OpenSSL-Apple/frameworks/iPhone/openssl.framework", + "${BUILT_PRODUCTS_DIR}/SSZipArchive/SSZipArchive.framework", "${BUILT_PRODUCTS_DIR}/SwiftyBeaver/SwiftyBeaver.framework", "${BUILT_PRODUCTS_DIR}/TunnelKit/TunnelKit.framework", ); @@ -962,6 +965,7 @@ ); outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SSZipArchive.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyBeaver.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TunnelKit.framework", ); diff --git a/Passepartout/Sources/Services/Infrastructure.swift b/Passepartout/Sources/Services/Infrastructure.swift index 19baa3e3..d7ca5872 100644 --- a/Passepartout/Sources/Services/Infrastructure.swift +++ b/Passepartout/Sources/Services/Infrastructure.swift @@ -24,7 +24,7 @@ // import Foundation -import TunnelKit +import SSZipArchive public struct Infrastructure: Codable { public enum Name: String, Codable, Comparable { @@ -89,10 +89,17 @@ extension Infrastructure.Name { } public func importExternalResources(from url: URL, completionHandler: @escaping () -> Void) { + var task: () -> Void switch self { + case .nordVPN: + task = { + SSZipArchive.unzipFile(atPath: url.path, toDestination: self.externalURL.path) + } + default: - break + task = {} } + execute(task: task, completionHandler: completionHandler) } private func execute(task: @escaping () -> Void, completionHandler: @escaping () -> Void) { diff --git a/Podfile b/Podfile index 90ee2d66..90890e0b 100644 --- a/Podfile +++ b/Podfile @@ -9,6 +9,7 @@ def shared_pods pod 'TunnelKit/LZO', :git => 'https://github.com/keeshux/tunnelkit', :commit => '4af8305' #pod 'TunnelKit', :path => '../../personal/tunnelkit' #pod 'TunnelKit/LZO', :path => '../../personal/tunnelkit' + pod 'SSZipArchive' end target 'Passepartout-Core' do diff --git a/Podfile.lock b/Podfile.lock index f0a4b6f2..b576f8ed 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,6 +1,7 @@ PODS: - MBProgressHUD (1.1.0) - OpenSSL-Apple (1.1.0i.2) + - SSZipArchive (2.1.4) - SwiftyBeaver (1.7.0) - TunnelKit (1.6.2): - TunnelKit/AppExtension (= 1.6.2) @@ -15,6 +16,7 @@ PODS: DEPENDENCIES: - MBProgressHUD + - SSZipArchive - TunnelKit (from `https://github.com/keeshux/tunnelkit`, commit `4af8305`) - TunnelKit/LZO (from `https://github.com/keeshux/tunnelkit`, commit `4af8305`) @@ -22,6 +24,7 @@ SPEC REPOS: https://github.com/cocoapods/specs.git: - MBProgressHUD - OpenSSL-Apple + - SSZipArchive - SwiftyBeaver EXTERNAL SOURCES: @@ -37,9 +40,10 @@ CHECKOUT OPTIONS: SPEC CHECKSUMS: MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9 OpenSSL-Apple: 37a8c0b04df4bb8971deef4671cc29222861319c + SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322 SwiftyBeaver: 4cc0080d2e23f980652e28978db11a5c9da39165 TunnelKit: 6be99150922d3f14187dc29732032712dd4400e3 -PODFILE CHECKSUM: 2447c6354060c9edf9e9c5e1f1cf276750540090 +PODFILE CHECKSUM: 3eb482b1422e230476ee092236e7b47d3ac13025 COCOAPODS: 1.6.1