mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 19:53:25 +01:00
Updates Keychain.patreonAccountID in PatreonAPI.fetchAccount()
PatreonAPI.fetchAccount() is called by both PatreonAPI.authenticate() and PatreonAPI.refreshPatreonAccount(), so this ensures the keychain is updated via both ways.
This commit is contained in:
@@ -120,15 +120,7 @@ public extension PatreonAPI
|
|||||||
Keychain.shared.patreonAccessToken = accessToken
|
Keychain.shared.patreonAccessToken = accessToken
|
||||||
Keychain.shared.patreonRefreshToken = refreshToken
|
Keychain.shared.patreonRefreshToken = refreshToken
|
||||||
|
|
||||||
self.fetchAccount { (result) in
|
self.fetchAccount(completion: completion)
|
||||||
switch result
|
|
||||||
{
|
|
||||||
case .success(let account): Keychain.shared.patreonAccountID = account.identifier
|
|
||||||
case .failure: break
|
|
||||||
}
|
|
||||||
|
|
||||||
completion(result)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,6 +160,7 @@ public extension PatreonAPI
|
|||||||
case .success(let response):
|
case .success(let response):
|
||||||
DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in
|
DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in
|
||||||
let account = PatreonAccount(response: response, context: context)
|
let account = PatreonAccount(response: response, context: context)
|
||||||
|
Keychain.shared.patreonAccountID = account.identifier
|
||||||
completion(.success(account))
|
completion(.success(account))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user