Cache account management URL (#3826)

* cache account management URL

when sync starts

* better documentation
This commit is contained in:
Mauro 2025-02-25 17:51:28 +01:00 committed by GitHub
parent b46a7e44d4
commit 1bc3723c34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -280,6 +280,10 @@ class ClientProxy: ClientProxyProtocol {
Task {
await syncService?.start()
// If we are using OIDC we want to cache the account management URL in volatile memory on the SDK side.
// To avoid the cache being invalidated while the app is backgrounded, we cache at every sync start.
await cacheAccountURL()
}
}
@ -753,6 +757,11 @@ class ClientProxy: ClientProxyProtocol {
// MARK: - Private
private func cacheAccountURL() async {
// Calling this function for the first time will cache the account URL in volatile memory for 24 hrs on the SDK.
_ = try? await client.accountUrl(action: nil)
}
private func updateVerificationState(_ verificationState: VerificationState) async {
let verificationState: SessionVerificationState = switch verificationState {
case .unknown:

View File

@ -112,6 +112,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
func startSync()
func stopSync()
func stopSync(completion: (() -> Void)?) // Hopefully this will become async once we get SE-0371.
func accountURL(action: AccountManagementAction) async -> URL?