mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 13:37:11 +00:00
Cache account management URL (#3826)
* cache account management URL when sync starts * better documentation
This commit is contained in:
parent
b46a7e44d4
commit
1bc3723c34
@ -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,8 +112,9 @@ 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?
|
||||||
|
|
||||||
func directRoomForUserID(_ userID: String) async -> Result<String?, ClientProxyError>
|
func directRoomForUserID(_ userID: String) async -> Result<String?, ClientProxyError>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user