mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Cache account management URL (#3826)
* cache account management URL when sync starts * better documentation
This commit is contained in:
@@ -280,6 +280,10 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
|
|
||||||
Task {
|
Task {
|
||||||
await syncService?.start()
|
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
|
// 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 {
|
private func updateVerificationState(_ verificationState: VerificationState) async {
|
||||||
let verificationState: SessionVerificationState = switch verificationState {
|
let verificationState: SessionVerificationState = switch verificationState {
|
||||||
case .unknown:
|
case .unknown:
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
|
|||||||
func startSync()
|
func startSync()
|
||||||
|
|
||||||
func stopSync()
|
func stopSync()
|
||||||
|
|
||||||
func stopSync(completion: (() -> Void)?) // Hopefully this will become async once we get SE-0371.
|
func stopSync(completion: (() -> Void)?) // Hopefully this will become async once we get SE-0371.
|
||||||
|
|
||||||
func accountURL(action: AccountManagementAction) async -> URL?
|
func accountURL(action: AccountManagementAction) async -> URL?
|
||||||
|
|||||||
Reference in New Issue
Block a user