Code cleanup

This commit is contained in:
Benoit Marty 2024-09-18 14:14:10 +02:00
parent 406c000ecd
commit 7f7612ef12
2 changed files with 14 additions and 14 deletions

View file

@ -251,18 +251,17 @@ class RustMatrixAuthenticationService @Inject constructor(
oidcConfiguration = oidcConfiguration, oidcConfiguration = oidcConfiguration,
progressListener = progressListener, progressListener = progressListener,
) )
val sessionData = client.use { rustClient ->
client.use { rustClient -> rustClient.session()
val sessionData = rustClient.session()
.toSessionData( .toSessionData(
isTokenValid = true, isTokenValid = true,
loginType = LoginType.QR, loginType = LoginType.QR,
passphrase = pendingPassphrase, passphrase = pendingPassphrase,
sessionPaths = emptySessionPaths, sessionPaths = emptySessionPaths,
) )
}
sessionStore.storeData(sessionData) sessionStore.storeData(sessionData)
SessionId(sessionData.userId) SessionId(sessionData.userId)
}
}.mapFailure { }.mapFailure {
when (it) { when (it) {
is QrCodeDecodeException -> QrErrorMapper.map(it) is QrCodeDecodeException -> QrErrorMapper.map(it)
@ -291,7 +290,7 @@ class RustMatrixAuthenticationService @Inject constructor(
passphrase = pendingPassphrase, passphrase = pendingPassphrase,
slidingSyncType = slidingSyncType, slidingSyncType = slidingSyncType,
) )
.run { config() } .config()
.build() .build()
} catch (e: HumanQrLoginException.SlidingSyncNotAvailable) { } catch (e: HumanQrLoginException.SlidingSyncNotAvailable) {
Timber.e(e, "Failed to create client with simplified sliding sync, trying with Proxy now") Timber.e(e, "Failed to create client with simplified sliding sync, trying with Proxy now")
@ -304,7 +303,7 @@ class RustMatrixAuthenticationService @Inject constructor(
passphrase = pendingPassphrase, passphrase = pendingPassphrase,
slidingSyncType = getSlidingSyncProxy(), slidingSyncType = getSlidingSyncProxy(),
) )
.run { config() } .config()
.build() .build()
} }

View file

@ -206,6 +206,7 @@ class RustSessionVerificationService(
} }
} }
} }
private suspend fun updateVerificationStatus() { private suspend fun updateVerificationStatus() {
if (verificationFlowState.value == VerificationFlowState.Finished) { if (verificationFlowState.value == VerificationFlowState.Finished) {
// Calling `encryptionService.verificationState()` performs a network call and it will deadlock if there is no network // Calling `encryptionService.verificationState()` performs a network call and it will deadlock if there is no network