Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
liberty
tunnel
liberty-tunnel-ios
Commits
3c5cc95b
Commit
3c5cc95b
authored
Feb 13, 2019
by
Jose Blaya
Browse files
Remove dispatch queue in Bootstrapper
parent
86695cc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
PIA VPN/Bootstrapper.swift
View file @
3c5cc95b
...
...
@@ -77,89 +77,87 @@ class Bootstrapper {
fatalError
(
"Could not parse bundled regions file:
\(
e
)
"
)
}
DispatchQueue
.
main
.
async
{
Client
.
environment
=
AppConfiguration
.
clientEnvironment
Client
.
configuration
.
isDevelopment
=
Flags
.
shared
.
usesDevelopmentClient
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
Client
.
configuration
.
enablesServerPings
=
true
Client
.
configuration
.
bundledServersJSON
=
bundledServersJSON
Client
.
configuration
.
webTimeout
=
AppConfiguration
.
ClientConfiguration
.
webTimeout
Client
.
configuration
.
vpnProfileName
=
AppConfiguration
.
VPN
.
profileName
Client
.
configuration
.
addVPNProfile
(
PIATunnelProfile
(
bundleIdentifier
:
AppConstants
.
Extensions
.
tunnelBundleIdentifier
))
let
defaults
=
Client
.
preferences
.
defaults
defaults
.
isPersistentConnection
=
true
defaults
.
mace
=
false
defaults
.
vpnType
=
PIATunnelProfile
.
vpnType
defaults
.
vpnCustomConfigurations
=
[
PIATunnelProfile
.
vpnType
:
AppConfiguration
.
VPN
.
piaDefaultConfigurationBuilder
.
build
()
]
Client
.
configuration
.
setPlan
(
.
yearly
,
forProductIdentifier
:
AppConstants
.
InApp
.
yearlyProductIdentifier
)
Client
.
configuration
.
setPlan
(
.
monthly
,
forProductIdentifier
:
AppConstants
.
InApp
.
monthlyProductIdentifier
)
if
(
self
.
isSimulator
||
Flags
.
shared
.
usesMockVPN
)
{
Client
.
configuration
.
enablesConnectivityUpdates
=
false
Client
.
useMockVPNProvider
()
}
if
Flags
.
shared
.
usesMockInApp
{
Client
.
useMockInAppProvider
()
}
if
Flags
.
shared
.
usesMockAccount
{
Client
.
useMockAccountProvider
(
AppConfiguration
.
Mock
.
accountProvider
)
}
Client
.
bootstrap
()
// Preferences
let
pref
=
Client
.
preferences
.
editable
()
// as per App Store guidelines
if
!
Flags
.
shared
.
enablesMACESetting
{
pref
.
mace
=
false
}
pref
.
commit
()
// Business objects
AccountObserver
.
shared
.
start
()
// DataCounter.shared.startCounting()
// Third parties
let
rater
=
iRate
.
sharedInstance
()
!
rater
.
usesUntilPrompt
=
AppConfiguration
.
Rating
.
usesUntilPrompt
rater
.
eventsUntilPrompt
=
AppConfiguration
.
Rating
.
eventsUntilPrompt
rater
.
daysUntilPrompt
=
AppConfiguration
.
Rating
.
daysUntilPrompt
rater
.
remindPeriod
=
AppConfiguration
.
Rating
.
remindPeriod
// Notifications
let
nc
=
NotificationCenter
.
default
nc
.
addObserver
(
self
,
selector
:
#selector(
self.reloadTheme
)
,
name
:
.
PIAThemeDidChange
,
object
:
nil
)
nc
.
addObserver
(
self
,
selector
:
#selector(
self.vpnStatusDidChange(notification:)
)
,
name
:
.
PIADaemonsDidUpdateVPNStatus
,
object
:
nil
)
// PIALibrary (Theme)
AppPreferences
.
shared
.
currentThemeCode
.
apply
(
theme
:
Theme
.
current
,
reload
:
true
)
// show walkthrough on upgrade except for logged in users
if
Client
.
providers
.
accountProvider
.
isLoggedIn
{
AppPreferences
.
shared
.
wasLaunched
=
true
Client
.
environment
=
AppConfiguration
.
clientEnvironment
Client
.
configuration
.
isDevelopment
=
Flags
.
shared
.
usesDevelopmentClient
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
Client
.
configuration
.
enablesServerPings
=
true
Client
.
configuration
.
bundledServersJSON
=
bundledServersJSON
Client
.
configuration
.
webTimeout
=
AppConfiguration
.
ClientConfiguration
.
webTimeout
Client
.
configuration
.
vpnProfileName
=
AppConfiguration
.
VPN
.
profileName
Client
.
configuration
.
addVPNProfile
(
PIATunnelProfile
(
bundleIdentifier
:
AppConstants
.
Extensions
.
tunnelBundleIdentifier
))
let
defaults
=
Client
.
preferences
.
defaults
defaults
.
isPersistentConnection
=
true
defaults
.
mace
=
false
defaults
.
vpnType
=
PIATunnelProfile
.
vpnType
defaults
.
vpnCustomConfigurations
=
[
PIATunnelProfile
.
vpnType
:
AppConfiguration
.
VPN
.
piaDefaultConfigurationBuilder
.
build
()
]
Client
.
configuration
.
setPlan
(
.
yearly
,
forProductIdentifier
:
AppConstants
.
InApp
.
yearlyProductIdentifier
)
Client
.
configuration
.
setPlan
(
.
monthly
,
forProductIdentifier
:
AppConstants
.
InApp
.
monthlyProductIdentifier
)
if
(
self
.
isSimulator
||
Flags
.
shared
.
usesMockVPN
)
{
Client
.
configuration
.
enablesConnectivityUpdates
=
false
Client
.
useMockVPNProvider
()
}
if
Flags
.
shared
.
usesMockInApp
{
Client
.
useMockInAppProvider
()
}
if
Flags
.
shared
.
usesMockAccount
{
Client
.
useMockAccountProvider
(
AppConfiguration
.
Mock
.
accountProvider
)
}
Client
.
bootstrap
()
// Preferences
let
pref
=
Client
.
preferences
.
editable
()
// as per App Store guidelines
if
!
Flags
.
shared
.
enablesMACESetting
{
pref
.
mace
=
false
}
pref
.
commit
()
// Business objects
AccountObserver
.
shared
.
start
()
// DataCounter.shared.startCounting()
// Third parties
let
rater
=
iRate
.
sharedInstance
()
!
rater
.
usesUntilPrompt
=
AppConfiguration
.
Rating
.
usesUntilPrompt
rater
.
eventsUntilPrompt
=
AppConfiguration
.
Rating
.
eventsUntilPrompt
rater
.
daysUntilPrompt
=
AppConfiguration
.
Rating
.
daysUntilPrompt
rater
.
remindPeriod
=
AppConfiguration
.
Rating
.
remindPeriod
// Notifications
let
nc
=
NotificationCenter
.
default
nc
.
addObserver
(
self
,
selector
:
#selector(
self.reloadTheme
)
,
name
:
.
PIAThemeDidChange
,
object
:
nil
)
nc
.
addObserver
(
self
,
selector
:
#selector(
self.vpnStatusDidChange(notification:)
)
,
name
:
.
PIADaemonsDidUpdateVPNStatus
,
object
:
nil
)
// PIALibrary (Theme)
AppPreferences
.
shared
.
currentThemeCode
.
apply
(
theme
:
Theme
.
current
,
reload
:
true
)
// show walkthrough on upgrade except for logged in users
if
Client
.
providers
.
accountProvider
.
isLoggedIn
{
AppPreferences
.
shared
.
wasLaunched
=
true
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment