Commit 5fdb50e6 authored by Jose Blaya's avatar Jose Blaya
Browse files

Get account information without refresh the token

parent e75e1d4b
......@@ -13,6 +13,28 @@ import SwiftyBeaver
private let log = SwiftyBeaver.self
extension AccountProvider {
func retrieveAccount() {
guard self.isLoggedIn else {
return
}
accountInformation({ (info, error) in
guard let error = error as? ClientError else {
return
}
guard self.isLoggedIn else {
return
}
if (error == .unauthorized) {
log.error("Account: Failed to retrieve the account info, user is unauthorized. Logging out...")
self.logout(nil)
}
})
}
func refreshAndLogoutUnauthorized(force: Bool = false) {
guard self.isLoggedIn else {
......
......@@ -85,7 +85,7 @@ class AccountViewController: AutolayoutViewController {
nc.addObserver(self, selector: #selector(redisplayAccount), name: .PIAAccountDidRefresh, object: nil)
nc.addObserver(self, selector: #selector(accountDidLogout(notification:)), name: .PIAAccountDidLogout, object: nil)
Client.providers.accountProvider.refreshAndLogoutUnauthorized(force: true)
Client.providers.accountProvider.retrieveAccount()
}
override func viewWillAppear(_ animated: Bool) {
......
......@@ -120,7 +120,7 @@ class AppPreferences {
private func refreshAPIToken() {
if Client.preferences.authMigrationSuccess == false {
Client.providers.accountProvider.refreshAndLogoutUnauthorized(force: true)
Client.providers.accountProvider.refreshAndLogoutUnauthorized()
}
}
......
......@@ -53,7 +53,7 @@ end
def shared_main_pods
pod 'AlamofireImage'
#library_by_path('')
library_by_git('5d20258')
library_by_git('30e9bfe')
#library_by_version('~> 1.1.3')
end
......
......@@ -104,10 +104,10 @@ DEPENDENCIES:
- HockeySDK
- iRate
- MBProgressHUD
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `5d20258`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `5d20258`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `5d20258`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `5d20258`)
- PIALibrary/Library (from `https://github.com/pia-foss/client-library-apple`, commit `30e9bfe`)
- PIALibrary/Mock (from `https://github.com/pia-foss/client-library-apple`, commit `30e9bfe`)
- PIALibrary/UI (from `https://github.com/pia-foss/client-library-apple`, commit `30e9bfe`)
- PIALibrary/VPN (from `https://github.com/pia-foss/client-library-apple`, commit `30e9bfe`)
- PIATunnel (from `https://github.com/pia-foss/tunnel-apple`, commit `269d6d1`)
- SideMenu (= 3.1.5)
- TPKeyboardAvoiding
......@@ -138,7 +138,7 @@ SPEC REPOS:
EXTERNAL SOURCES:
PIALibrary:
:commit: 5d20258
:commit: 30e9bfe
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 269d6d1
......@@ -146,7 +146,7 @@ EXTERNAL SOURCES:
CHECKOUT OPTIONS:
PIALibrary:
:commit: 5d20258
:commit: 30e9bfe
:git: https://github.com/pia-foss/client-library-apple
PIATunnel:
:commit: 269d6d1
......@@ -177,6 +177,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: ccfcdf85a04d429f1633f668650b0ce8020bda3a
TPKeyboardAvoiding: cb69d5ddbe90ce0170e4bc2db1e5e41d4a3ad9a4
PODFILE CHECKSUM: 302166843a1e31f3dd87d3441c48ff64633b6d24
PODFILE CHECKSUM: ec5db4d111f4fa86c5c7a43ae4fa09502f0ca474
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