mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43: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.patreonRefreshToken = refreshToken
|
||||
|
||||
self.fetchAccount { (result) in
|
||||
switch result
|
||||
{
|
||||
case .success(let account): Keychain.shared.patreonAccountID = account.identifier
|
||||
case .failure: break
|
||||
}
|
||||
|
||||
completion(result)
|
||||
}
|
||||
self.fetchAccount(completion: completion)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -168,6 +160,7 @@ public extension PatreonAPI
|
||||
case .success(let response):
|
||||
DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in
|
||||
let account = PatreonAccount(response: response, context: context)
|
||||
Keychain.shared.patreonAccountID = account.identifier
|
||||
completion(.success(account))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user