Code cleanup
This commit is contained in:
@@ -251,18 +251,17 @@ class RustMatrixAuthenticationService @Inject constructor(
|
||||
oidcConfiguration = oidcConfiguration,
|
||||
progressListener = progressListener,
|
||||
)
|
||||
|
||||
client.use { rustClient ->
|
||||
val sessionData = rustClient.session()
|
||||
val sessionData = client.use { rustClient ->
|
||||
rustClient.session()
|
||||
.toSessionData(
|
||||
isTokenValid = true,
|
||||
loginType = LoginType.QR,
|
||||
passphrase = pendingPassphrase,
|
||||
sessionPaths = emptySessionPaths,
|
||||
)
|
||||
sessionStore.storeData(sessionData)
|
||||
SessionId(sessionData.userId)
|
||||
}
|
||||
sessionStore.storeData(sessionData)
|
||||
SessionId(sessionData.userId)
|
||||
}.mapFailure {
|
||||
when (it) {
|
||||
is QrCodeDecodeException -> QrErrorMapper.map(it)
|
||||
@@ -285,14 +284,14 @@ class RustMatrixAuthenticationService @Inject constructor(
|
||||
if (slidingSyncType is ClientBuilderSlidingSync.Simplified) {
|
||||
Timber.d("Creating client with simplified sliding sync")
|
||||
try {
|
||||
return rustMatrixClientFactory
|
||||
.getBaseClientBuilder(
|
||||
sessionPaths = sessionPaths,
|
||||
passphrase = pendingPassphrase,
|
||||
slidingSyncType = slidingSyncType,
|
||||
)
|
||||
.run { config() }
|
||||
.build()
|
||||
return rustMatrixClientFactory
|
||||
.getBaseClientBuilder(
|
||||
sessionPaths = sessionPaths,
|
||||
passphrase = pendingPassphrase,
|
||||
slidingSyncType = slidingSyncType,
|
||||
)
|
||||
.config()
|
||||
.build()
|
||||
} catch (e: HumanQrLoginException.SlidingSyncNotAvailable) {
|
||||
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,
|
||||
slidingSyncType = getSlidingSyncProxy(),
|
||||
)
|
||||
.run { config() }
|
||||
.config()
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +206,7 @@ class RustSessionVerificationService(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun updateVerificationStatus() {
|
||||
if (verificationFlowState.value == VerificationFlowState.Finished) {
|
||||
// Calling `encryptionService.verificationState()` performs a network call and it will deadlock if there is no network
|
||||
|
||||
Reference in New Issue
Block a user