Make sure to save the tokens the Client might return when its session is restored (#3378)

* Use `ClientSessionDelegate` to ensure tokens are always updated.

Refreshed tokens on client restoration might not have been stored to disk if the token refresh happened before `RustMatrixClient` was built and the `ClientDelegate` was set in it.

Using `ClientSessionDelegate` should ensure the tokens refreshed callback is called at any point in time.

* Improve how assigning the Client works, fix docs

* Fix review comments
This commit is contained in:
Jorge Martin Espinosa 2024-09-04 10:54:31 +02:00 committed by GitHub
parent 9fb82a1e86
commit 2c8b0d0b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 161 additions and 98 deletions

View file

@ -88,9 +88,10 @@ interface MatrixClient : Closeable {
* Logout the user.
* Returns an optional URL. When the URL is there, it should be presented to the user after logout for
* Relying Party (RP) initiated logout on their account page.
* @param userInitiated if false, the logout came from the HS, no request will be made and the session entry will be kept in the store.
* @param ignoreSdkError if true, the SDK will ignore any error and delete the session data anyway.
*/
suspend fun logout(ignoreSdkError: Boolean): String?
suspend fun logout(userInitiated: Boolean, ignoreSdkError: Boolean): String?
/**
* Retrieve the user profile, will also eventually emit a new value to [userProfile].