Commit 9ccf39a2 authored by Jose Blaya's avatar Jose Blaya
Browse files

Refactor

parent ee125793
......@@ -160,23 +160,25 @@ class DefaultServerProvider: ServerProvider, ConfigurationAccess, DatabaseAccess
self.accessedDatabase.transient.serversConfiguration = configuration
}
self.currentServers = bundle.servers
if let tokens = self.accessedDatabase.secure.dipTokens(), !tokens.isEmpty {
self.webServices.activateDIPToken(tokens: tokens) { (servers, error) in
var allServers = bundle.servers
if let servers = servers {
for server in servers {
if !self.currentServers.contains(where: {$0.dipToken == server.dipToken}) {
self.currentServers.append(server)
if !bundle.servers.contains(where: {$0.dipToken == server.dipToken}) {
allServers.append(server)
}
}
}
NotificationCenter.default.post(name: .PIAThemeDidChange,
object: self,
userInfo: nil)
self.currentServers = allServers
Macros.postNotification(.PIAThemeDidChange)
callback?(self.currentServers, error)
}
} else {
self.currentServers = bundle.servers
callback?(self.currentServers, error)
}
......
......@@ -270,7 +270,14 @@ class PIAWebServices: WebServices, ConfigurationAccess {
func featureFlags(_ callback: LibraryCallback<[String]>?) {
callback?(["dedicated-ip"], nil)
self.accountAPI.featureFlags(stagingEndpoint: nil) { (info, error) in
if let flags = info?.flags {
callback?(flags, nil)
} else {
callback?([], ClientError.malformedResponseData)
}
}
//dedicated-ip
}
#if os(iOS)
......
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