[Link new device] Handle split steps in the SDK

This commit is contained in:
Benoit Marty
2026-05-04 18:09:06 +02:00
parent 6cd9ab0f4e
commit 9c66cd331f
11 changed files with 152 additions and 17 deletions
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
* Please see LICENSE files in the repository root for full details.
*/
package io.element.android.libraries.matrix.api.linknewdevice
interface ContinuationMessageSender {
suspend fun cancel(): Result<Unit>
suspend fun confirm(): Result<Unit>
}
@@ -18,8 +18,10 @@ interface LinkDesktopHandler {
sealed interface LinkDesktopStep {
data object Uninitialized : LinkDesktopStep
data object Starting : LinkDesktopStep
data class WaitingForAuth(
val verificationUri: String,
val continuationMessageSender: ContinuationMessageSender,
) : LinkDesktopStep
data class EstablishingSecureChannel(
@@ -22,7 +22,12 @@ sealed interface LinkMobileStep {
data object Starting : LinkMobileStep
data class QrReady(val data: String) : LinkMobileStep
data object QrRotating : LinkMobileStep
data class WaitingForAuth(val verificationUri: String) : LinkMobileStep
data class WaitingForAuth(
val verificationUri: String,
val continuationMessageSender: ContinuationMessageSender,
) : LinkMobileStep
data class QrScanned(val checkCodeSender: CheckCodeSender) : LinkMobileStep
data class Error(val errorType: ErrorType) : LinkMobileStep
data object SyncingSecrets : LinkMobileStep