Commit e15fda89 authored by Davide De Rosa's avatar Davide De Rosa
Browse files

Merge branch 'mr/custom-servers-ci' into develop

parents dec7d420 f09d9933
......@@ -12,6 +12,7 @@ before_script:
- bundle update
#- bundle exec fastlane run ensure_git_status_clean
- echo "$PIA_STAGING_ENDPOINT" >"Resources/staging.endpoint"
- echo "$PIA_CUSTOM_SERVERS" >"Resources/custom.servers"
stages:
- test
......
......@@ -23,6 +23,7 @@
0E3A352D1FD9CDC5000B0F99 /* Theme+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3A352B1FD9CDC5000B0F99 /* Theme+App.swift */; };
0E3A35351FD9EBDA000B0F99 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3A35341FD9EBDA000B0F99 /* AppDelegate.swift */; };
0E3A35361FD9EBDA000B0F99 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E3A35341FD9EBDA000B0F99 /* AppDelegate.swift */; };
0E3C9A5E20EC004E00B199F9 /* custom.servers in Resources */ = {isa = PBXBuildFile; fileRef = 0E3C9A5D20EC004D00B199F9 /* custom.servers */; };
0E435DA11E748C3900101226 /* PIA VPN Tunnel.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 0E67FC221E3F802D00EF9929 /* PIA VPN Tunnel.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
0E441E262055AEDF007528D5 /* ThemeStrategy+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E441E252055AEDF007528D5 /* ThemeStrategy+App.swift */; };
0E441E272055AEDF007528D5 /* ThemeStrategy+App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E441E252055AEDF007528D5 /* ThemeStrategy+App.swift */; };
......@@ -272,6 +273,7 @@
0E3A35271FD9A960000B0F99 /* DashboardViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardViewController.swift; sourceTree = "<group>"; };
0E3A352B1FD9CDC5000B0F99 /* Theme+App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+App.swift"; sourceTree = "<group>"; };
0E3A35341FD9EBDA000B0F99 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
0E3C9A5D20EC004D00B199F9 /* custom.servers */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = custom.servers; sourceTree = "<group>"; };
0E441E252055AEDF007528D5 /* ThemeStrategy+App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ThemeStrategy+App.swift"; sourceTree = "<group>"; };
0E441E302055B8A7007528D5 /* Theme+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Theme+Extension.swift"; sourceTree = "<group>"; };
0E492C661FE60907007F23DF /* Flags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Flags.swift; sourceTree = "<group>"; };
......@@ -636,6 +638,7 @@
children = (
0ED984161FC48C5100542EE6 /* Fonts */,
0E0786DD1EFA7EAE00F77466 /* Components.plist */,
0E3C9A5D20EC004D00B199F9 /* custom.servers */,
0ED66BCF20A9918000333B35 /* staging.endpoint */,
);
path = Resources;
......@@ -1043,6 +1046,7 @@
0EE220631F4EF307002805AE /* Launch Screen.storyboard in Resources */,
0ED984201FC48C6500542EE6 /* Roboto-Medium.ttf in Resources */,
0ED984211FC48C6500542EE6 /* Roboto-Regular.ttf in Resources */,
0E3C9A5E20EC004E00B199F9 /* custom.servers in Resources */,
0EFDC1D51FE4607D007C0B9B /* Images.xcassets in Resources */,
0ED9841F1FC48C6500542EE6 /* Roboto-Light.ttf in Resources */,
0EE2206A1F4EF307002805AE /* Components.plist in Resources */,
......
......@@ -64,6 +64,48 @@ struct AppConstants {
}()
}
struct Servers {
static var customServers: [Server]? = {
guard let path = Bundle.main.path(forResource: "custom", ofType: "servers") else {
return nil
}
guard let content = try? String(contentsOfFile: path) else {
return nil
}
var servers: [Server] = []
let lines = content.components(separatedBy: "\n")
for line in lines {
let tokens = line.components(separatedBy: ":")
guard tokens.count == 6 else {
continue
}
let name = tokens[0]
let country = tokens[1]
let hostname = tokens[2]
let address = tokens[3]
guard let udpPort = UInt16(tokens[4]) else {
continue
}
guard let tcpPort = UInt16(tokens[5]) else {
continue
}
servers.append(Server(
name: name,
country: country,
hostname: hostname,
bestOpenVPNAddressForTCP: Server.Address(hostname: address, port: tcpPort),
bestOpenVPNAddressForUDP: Server.Address(hostname: address, port: udpPort),
pingAddress: nil
))
}
return servers
}()
}
struct Fonts {
static let typeface: Theme.Typeface = {
let typeface = Theme.Typeface()
......
......@@ -58,6 +58,11 @@ class Bootstrapper {
if let stagingUrl = AppConstants.Web.stagingEndpointURL {
Client.configuration.setBaseURL(stagingUrl.absoluteString, for: .staging)
}
if Client.configuration.isDevelopment, let customServers = AppConstants.Servers.customServers {
for server in customServers {
Client.configuration.addCustomServer(server)
}
}
Client.configuration.enablesConnectivityUpdates = true
Client.configuration.enablesServerUpdates = true
......
......@@ -53,7 +53,7 @@ end
def shared_main_pods
pod 'AlamofireImage'
#library_by_path('..')
library_by_git('070ca58')
library_by_git('ab78a47')
#library_by_version('1.1.1')
end
......
......@@ -10,25 +10,25 @@ PODS:
- iRate (1.12.2)
- MBProgressHUD (1.1.0)
- OpenSSL-Apple (1.1.0h)
- PIALibrary/Core (1.1.1)
- PIALibrary/Library (1.1.1):
- PIALibrary/Core (1.1.2)
- PIALibrary/Library (1.1.2):
- Alamofire (~> 4)
- Gloss (~> 2)
- PIALibrary/Core
- PIALibrary/Util
- ReachabilitySwift
- SwiftyBeaver
- PIALibrary/Mock (1.1.1):
- PIALibrary/Mock (1.1.2):
- PIALibrary/Library
- PIALibrary/UI (1.1.1):
- PIALibrary/UI (1.1.2):
- PIALibrary/Library
- SwiftyBeaver
- TPKeyboardAvoiding
- PIALibrary/Util (1.1.1):
- PIALibrary/Util (1.1.2):
- PIALibrary/Core
- PIALibrary/VPN (1.1.1):
- PIALibrary/VPN (1.1.2):
- PIALibrary/Library
- PIATunnel (~> 1.1)
- PIATunnel (~> 1.1.2)
- PIATunnel (1.1.2):
- PIATunnel/AppExtension (= 1.1.2)
- PIATunnel/Core (= 1.1.2)
......@@ -49,10 +49,10 @@ DEPENDENCIES:
- HockeySDK
- iRate
- MBProgressHUD
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `070ca58`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `070ca58`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `070ca58`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `070ca58`)
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `ab78a47`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `ab78a47`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `ab78a47`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `ab78a47`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `9ed3842`)
- SideMenu (= 3.1.5)
- TPKeyboardAvoiding
......@@ -74,7 +74,7 @@ SPEC REPOS:
EXTERNAL SOURCES:
PIALibrary:
:commit: 070ca58
:commit: ab78a47
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 9ed3842
......@@ -82,7 +82,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
PIALibrary:
:commit: 070ca58
:commit: ab78a47
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 9ed3842
......@@ -97,13 +97,13 @@ SPEC CHECKSUMS:
iRate: 4fc69958788624545e5d050c8ffd20884013c3f1
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
OpenSSL-Apple: cd153d705ef350eb834ae7ff5f21f792b51ed208
PIALibrary: 1575ba514507cdbff905e9dcd8c3b718a86176c4
PIALibrary: 42f62b18cd3f135481dc02d2a13714cacb1aa750
PIATunnel: c86cb855e2fb5ad217e6123884ec61fae736636f
ReachabilitySwift: 6849231cd4e06559f3b9ef4a97a0a0f96d41e09f
SideMenu: 47dbf9e4d878062d8994aed43f6e4bf6c1fea30b
SwiftyBeaver: e45759613e50b522b0e6f53b1f0f14389b45ca34
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: a14b2aedad8b1540b2a627365c5a76e9dfa2c735
PODFILE CHECKSUM: 12936fe1bcc7d646566989f75f9e8ba907e7e5b1
COCOAPODS: 1.5.3
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment