Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions LocalPackages/PIALibrary/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ let package = Package(
.package(url: "https://github.com/Orderella/PopupDialog.git", branch: "master"),
.package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver.git", from: "1.9.0"),
.package(url: "https://github.com/ashleymills/Reachability.swift.git", from: "4.3.0"),
.package(url: "https://github.com/Alamofire/Alamofire.git", exact: "5.0.1"),
.package(url: "git@github.com:pia-foss/mobile-ios-networking.git", exact: "1.3.1")
],
targets: [
Expand All @@ -43,7 +42,6 @@ let package = Package(
"SwiftyBeaver",
"Gloss",
"PIALibraryUtilObjC",
"Alamofire",
.product(name: "PopupDialog", package: "PopupDialog", condition: .when(platforms: [.iOS])),
.product(name: "SwiftEntryKit", package: "SwiftEntryKit", condition: .when(platforms: [.iOS])),
.product(name: "Lottie", package: "lottie-ios"),
Expand Down
1 change: 0 additions & 1 deletion LocalPackages/PIALibrary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ This project is licensed under the [MIT (Expat) license](https://choosealicense.

- SwiftyBeaver - © 2015 Sebastian Kreutzberger
- Gloss - © 2017 Harlan Kellaway
- Alamofire - © 2014-2018 Alamofire Software Foundation (http://alamofire.org/)
- ReachabilitySwift - © 2016 Ashley Mills
- TunnelKit - © 2018 - Present Davide de Rosa (https://github.com/passepartoutvpn/tunnelkit) - TunnelKit is not MIT software and remains under the terms of the GPL license (https://github.com/passepartoutvpn/tunnelkit/blob/master/LICENSE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
//

import Foundation
import Alamofire

@available(tvOS 17.0, *)
extension Client {
Expand Down Expand Up @@ -147,8 +146,6 @@ extension Client {

public let maceDelay: Int

let sessionManager: Session

// MARK: VPN

private var availableVPNProfiles: [VPNProfile]
Expand Down Expand Up @@ -253,12 +250,6 @@ extension Client {
macePort = 1111
maceDelay = 5000

let urlscfg = URLSessionConfiguration.default
urlscfg.timeoutIntervalForRequest = Double(webTimeout) / 1000.0
urlscfg.timeoutIntervalForResource = Double(webTimeout) / 1000.0
urlscfg.urlCache = nil
sessionManager = Session(configuration: urlscfg)

#if os(iOS) || os(tvOS)
inAppPlans = [:]
eligibleForTrial = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
//

import Foundation
import Alamofire
import Gloss
import SwiftyBeaver
import regions
Expand Down Expand Up @@ -537,59 +536,3 @@ class PIAWebServices: WebServices, ConfigurationAccess {
}
}
}

typealias HandlerType<T> = (T?, Int?, Error?) -> Void

private protocol RequestExecutor {
func execute(_ method: HTTPMethod, _ url: URL, _ request: DataRequest)
}

private class DataRequestExecutor: RequestExecutor {
let completionHandler: HandlerType<Data>

init(_ completionHandler: @escaping HandlerType<Data>) {
self.completionHandler = completionHandler
}

func execute(_ method: HTTPMethod, _ url: URL, _ request: DataRequest) {
request.responseData { (response) in
let status = response.response?.statusCode
if let error = response.error {
log.error("Request failed: \(method) \"\(url)\" -> \(error)")
self.completionHandler(nil, status, error)
return
}
guard let data = response.value else {
self.completionHandler(nil, status, ClientError.malformedResponseData)
return
}
log.debug("Response: \(data)")
self.completionHandler(data, status, nil)
}
}
}

private class JSONRequestExecutor: RequestExecutor {
let completionHandler: HandlerType<JSON>

init(_ completionHandler: @escaping HandlerType<JSON>) {
self.completionHandler = completionHandler
}

func execute(_ method: HTTPMethod, _ url: URL, _ request: DataRequest) {
request.validate(contentType: ["application/json"]).responseJSON { (response) in
let status = response.response?.statusCode
if let error = response.error {
log.error("Request failed: \(method) \"\(url)\" -> \(error)")
self.completionHandler(nil, status, error)
return
}
guard let json = response.value as? [String: Any] else {
self.completionHandler(nil, status, ClientError.malformedResponseData)
return
}
log.debug("Response: \(json)")
self.completionHandler(json, status, nil)
}
}
}
8 changes: 0 additions & 8 deletions PIA VPN-tvOS/Resources/Licences.plist
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@
<key>LicenseURL</key>
<string>https://raw.githubusercontent.com/ashleymills/Reachability.swift/master/LICENSE</string>
</dict>
<dict>
<key>Name</key>
<string>Alamofire</string>
<key>Copyright</key>
<string>Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)</string>
<key>LicenseURL</key>
<string>https://raw.githubusercontent.com/Alamofire/Alamofire/master/LICENSE</string>
</dict>
<dict>
<key>Name</key>
<string>TunnelKit</string>
Expand Down
25 changes: 0 additions & 25 deletions PIA VPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@
AA36CDCC28A673C900180A33 /* GradientProgressBar in Frameworks */ = {isa = PBXBuildFile; productRef = AA36CDCB28A673C900180A33 /* GradientProgressBar */; };
AA36CDCF28A6746500180A33 /* SideMenu in Frameworks */ = {isa = PBXBuildFile; productRef = AA36CDCE28A6746500180A33 /* SideMenu */; };
AA36CDDB28A6860F00180A33 /* TweetNacl in Frameworks */ = {isa = PBXBuildFile; productRef = AA36CDDA28A6860F00180A33 /* TweetNacl */; };
AA36CDDE28A6878000180A33 /* AlamofireImage in Frameworks */ = {isa = PBXBuildFile; productRef = AA36CDDD28A6878000180A33 /* AlamofireImage */; };
AABF826D28AD185E00CDAC64 /* TweetNacl in Frameworks */ = {isa = PBXBuildFile; productRef = AABF826C28AD185E00CDAC64 /* TweetNacl */; };
AABF826F28AD187800CDAC64 /* Popover in Frameworks */ = {isa = PBXBuildFile; productRef = AABF826E28AD187800CDAC64 /* Popover */; };
AABF827128AD188700CDAC64 /* AlamofireImage in Frameworks */ = {isa = PBXBuildFile; productRef = AABF827028AD188700CDAC64 /* AlamofireImage */; };
AABF827328AE2FF500CDAC64 /* GradientProgressBar in Frameworks */ = {isa = PBXBuildFile; productRef = AABF827228AE2FF500CDAC64 /* GradientProgressBar */; };
AABF827528AE2FFE00CDAC64 /* SideMenu in Frameworks */ = {isa = PBXBuildFile; productRef = AABF827428AE2FFE00CDAC64 /* SideMenu */; };
AABF827628AE302300CDAC64 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD606AB921C7A17900E0781D /* NetworkExtension.framework */; };
Expand Down Expand Up @@ -481,7 +479,6 @@
buildActionMask = 2147483647;
files = (
3F7B4C8D2EE7333300EE1F4C /* PIADesignSystem in Frameworks */,
AABF827128AD188700CDAC64 /* AlamofireImage in Frameworks */,
AABF827628AE302300CDAC64 /* NetworkExtension.framework in Frameworks */,
0EE220571F4EF307002805AE /* Security.framework in Frameworks */,
0EE220581F4EF307002805AE /* SystemConfiguration.framework in Frameworks */,
Expand Down Expand Up @@ -524,7 +521,6 @@
AA36CDCC28A673C900180A33 /* GradientProgressBar in Frameworks */,
AA36CDCF28A6746500180A33 /* SideMenu in Frameworks */,
AA36CDBB28A6622A00180A33 /* TweetNacl in Frameworks */,
AA36CDDE28A6878000180A33 /* AlamofireImage in Frameworks */,
2909869018566430002D9687 /* Security.framework in Frameworks */,
299E58511856BD31004CFD63 /* SystemConfiguration.framework in Frameworks */,
299E585F1856C6EE004CFD63 /* libz.dylib in Frameworks */,
Expand Down Expand Up @@ -741,7 +737,6 @@
packageProductDependencies = (
AABF826C28AD185E00CDAC64 /* TweetNacl */,
AABF826E28AD187800CDAC64 /* Popover */,
AABF827028AD188700CDAC64 /* AlamofireImage */,
AABF827228AE2FF500CDAC64 /* GradientProgressBar */,
AABF827428AE2FFE00CDAC64 /* SideMenu */,
AABF827728AE333200CDAC64 /* DZNEmptyDataSet */,
Expand Down Expand Up @@ -820,7 +815,6 @@
AA36CDC828A6733500180A33 /* DZNEmptyDataSet */,
AA36CDCB28A673C900180A33 /* GradientProgressBar */,
AA36CDCE28A6746500180A33 /* SideMenu */,
AA36CDDD28A6878000180A33 /* AlamofireImage */,
3F7B4C8A2EE7332B00EE1F4C /* PIADesignSystem */,
3F7BD9B72EE8A09800EE1F4C /* PIALibrary */,
);
Expand Down Expand Up @@ -1164,7 +1158,6 @@
AA36CDC728A6733500180A33 /* XCRemoteSwiftPackageReference "DZNEmptyDataSet" */,
AA36CDCA28A673C900180A33 /* XCRemoteSwiftPackageReference "GradientProgressBar" */,
AA36CDCD28A6746500180A33 /* XCRemoteSwiftPackageReference "SideMenu" */,
AA36CDDC28A6878000180A33 /* XCRemoteSwiftPackageReference "AlamofireImage" */,
35950B2F2ADD2877006F3CD9 /* XCRemoteSwiftPackageReference "Quick" */,
35950B322ADD2EE5006F3CD9 /* XCRemoteSwiftPackageReference "Nimble" */,
E548E1EE2C12383E001E9874 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */,
Expand Down Expand Up @@ -2894,14 +2887,6 @@
version = 6.5.0;
};
};
AA36CDDC28A6878000180A33 /* XCRemoteSwiftPackageReference "AlamofireImage" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Alamofire/AlamofireImage.git";
requirement = {
kind = exactVersion;
version = 4.0.0;
};
};
E548E1EE2C12383E001E9874 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/pointfreeco/swift-snapshot-testing";
Expand Down Expand Up @@ -2991,11 +2976,6 @@
package = AA36CDB928A6622A00180A33 /* XCRemoteSwiftPackageReference "tweetnacl-swiftwrap" */;
productName = TweetNacl;
};
AA36CDDD28A6878000180A33 /* AlamofireImage */ = {
isa = XCSwiftPackageProductDependency;
package = AA36CDDC28A6878000180A33 /* XCRemoteSwiftPackageReference "AlamofireImage" */;
productName = AlamofireImage;
};
AABF826C28AD185E00CDAC64 /* TweetNacl */ = {
isa = XCSwiftPackageProductDependency;
package = AA36CDB928A6622A00180A33 /* XCRemoteSwiftPackageReference "tweetnacl-swiftwrap" */;
Expand All @@ -3006,11 +2986,6 @@
package = AA36CDC228A6711300180A33 /* XCRemoteSwiftPackageReference "Popover" */;
productName = Popover;
};
AABF827028AD188700CDAC64 /* AlamofireImage */ = {
isa = XCSwiftPackageProductDependency;
package = AA36CDDC28A6878000180A33 /* XCRemoteSwiftPackageReference "AlamofireImage" */;
productName = AlamofireImage;
};
AABF827228AE2FF500CDAC64 /* GradientProgressBar */ = {
isa = XCSwiftPackageProductDependency;
package = AA36CDCA28A673C900180A33 /* XCRemoteSwiftPackageReference "GradientProgressBar" */;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion PIA VPN/Core/Extensions/Server+UI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import Foundation
import PIALibrary
import Alamofire
import UIKit

extension Server: CustomStringConvertible {
Expand Down Expand Up @@ -104,4 +103,20 @@ extension UIImage {
UIGraphicsEndImageContext()
return newImage
}

func aspectScaled(toFit size: CGSize) -> UIImage? {
let aspectWidth = size.width / self.size.width
let aspectHeight = size.height / self.size.height
let aspectRatio = min(aspectWidth, aspectHeight)

let scaledSize = CGSize(
width: self.size.width * aspectRatio,
height: self.size.height * aspectRatio
)

let renderer = UIGraphicsImageRenderer(size: scaledSize)
return renderer.image { _ in
self.draw(in: CGRect(origin: .zero, size: scaledSize))
}
}
}
24 changes: 8 additions & 16 deletions PIA VPN/Resources/Components.plist
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@
<key>LicenseURL</key>
<string>https://raw.githubusercontent.com/hkellaway/Gloss/develop/LICENSE</string>
</dict>
<dict>
<key>Name</key>
<string>Alamofire</string>
<key>Copyright</key>
<string>Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)</string>
<key>LicenseURL</key>
<string>https://raw.githubusercontent.com/Alamofire/Alamofire/master/LICENSE</string>
</dict>
<dict>
<key>Name</key>
<string>ReachabilitySwift</string>
Expand Down Expand Up @@ -159,14 +151,14 @@
<key>LicenseURL</key>
<string>https://raw.githubusercontent.com/nanopb/nanopb/master/LICENSE.txt</string>
</dict>
<dict>
<key>Name</key>
<string>Popover</string>
<key>Copyright</key>
<string>© 2020 corin8823</string>
<key>LicenseURL</key>
<string>https://raw.githubusercontent.com/corin8823/Popover/master/LICENSE</string>
</dict>
<dict>
<key>Name</key>
<string>Popover</string>
<key>Copyright</key>
<string>© 2020 corin8823</string>
<key>LicenseURL</key>
<string>https://raw.githubusercontent.com/corin8823/Popover/master/LICENSE</string>
</dict>
</array>
</dict>
</plist>
3 changes: 1 addition & 2 deletions PIA VPN/UI/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import SafariServices
import SwiftyBeaver
import PIAWireguard
import WidgetKit
import AlamofireImage

private let log = SwiftyBeaver.self

Expand Down Expand Up @@ -578,7 +577,7 @@ extension SettingsViewController: UITableViewDataSource, UITableViewDelegate {

cell.textLabel?.text = section.localizedTitleMessage()
cell.detailTextLabel?.text = ""
cell.imageView?.image = section.imageForSection().af_imageAspectScaled(toFit: CGSize(width: 25, height: 25))
cell.imageView?.image = section.imageForSection().aspectScaled(toFit: CGSize(width: 25, height: 25))

switch section {
case .automation:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ This project is licensed under the [MIT (Expat) license](https://choosealicense.
## Acknowledgements

- SwiftyBeaver - © 2015 Sebastian Kreutzberger
- Alamofire - © 2014-2018 Alamofire Software Foundation (http://alamofire.org/)
- iRate - © 2011 Charcoal Design
- TPKeyboardAvoiding - © 2013 Michael Tyson
- SideMenu - © 2015 Jonathan Kent <contact@jonkent.me>
Expand Down