Fix api breaks:

- `ComposerDraft` now takes a list of media attachments.
- `HumanQrLoginException` has a couple of new cases.
- `Client.loginWithQrCode` now returns a `LoginWithQrCodeHandle`, which we need to call using `scan` to have the same behaviour as before.
This commit is contained in:
Jorge Martín 2025-10-28 17:12:40 +01:00
parent 64be18da36
commit 0d40a2fd79
5 changed files with 20 additions and 10 deletions

View file

@ -289,10 +289,13 @@ class RustMatrixAuthenticationService(
qrCodeData = sdkQrCodeLoginData,
)
client.loginWithQrCode(
qrCodeData = qrCodeData.rustQrCodeData,
oidcConfiguration = oidcConfiguration,
progressListener = progressListener,
)
).use {
it.scan(
qrCodeData = qrCodeData.rustQrCodeData,
progressListener = progressListener,
)
}
// Ensure that the user is not already logged in with the same account
ensureNotAlreadyLoggedIn(client)
val sessionData = client.session()

View file

@ -42,5 +42,7 @@ object QrErrorMapper {
is RustHumanQrLoginException.Unknown -> QrLoginException.Unknown
is RustHumanQrLoginException.OidcMetadataInvalid -> QrLoginException.OidcMetadataInvalid
is RustHumanQrLoginException.SlidingSyncNotAvailable -> QrLoginException.SlidingSyncNotAvailable
is RustHumanQrLoginException.CheckCodeAlreadySent -> QrLoginException.CheckCodeAlreadySent
is RustHumanQrLoginException.CheckCodeCannotBeSent -> QrLoginException.CheckCodeCannotBeSent
}
}

View file

@ -17,7 +17,9 @@ internal fun ComposerDraft.into(): RustComposerDraft {
return RustComposerDraft(
plainText = plainText,
htmlText = htmlText,
draftType = draftType.into()
draftType = draftType.into(),
// TODO add media attachments to the draft
attachments = emptyList(),
)
}