mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +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 {
|
||||
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:
|
||||
|
||||
@@ -112,8 +112,9 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
|
||||
func startSync()
|
||||
|
||||
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 directRoomForUserID(_ userID: String) async -> Result<String?, ClientProxyError>
|
||||
|
||||
Reference in New Issue
Block a user