mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Using UiaCancelledException on reAuth cancellation
This commit is contained in:
parent
0d7d841d73
commit
99c2088d0e
@ -20,6 +20,7 @@ import im.vector.app.core.di.ActiveSessionHolder
|
||||
import org.matrix.android.sdk.api.Matrix
|
||||
import org.matrix.android.sdk.api.auth.UIABaseAuth
|
||||
import org.matrix.android.sdk.api.auth.UserPasswordAuth
|
||||
import org.matrix.android.sdk.api.session.uia.exceptions.UiaCancelledException
|
||||
import org.matrix.android.sdk.api.util.fromBase64
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
@ -62,7 +63,7 @@ class PendingAuthHandler @Inject constructor(
|
||||
|
||||
fun reAuthCancelled() {
|
||||
Timber.d("reAuthCancelled")
|
||||
uiaContinuation?.resumeWithException(Exception())
|
||||
uiaContinuation?.resumeWithException(UiaCancelledException())
|
||||
uiaContinuation = null
|
||||
pendingAuth = null
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.matrix.android.sdk.api.auth.UIABaseAuth
|
||||
import org.matrix.android.sdk.api.auth.UserPasswordAuth
|
||||
import org.matrix.android.sdk.api.session.uia.exceptions.UiaCancelledException
|
||||
import kotlin.coroutines.Continuation
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.resumeWithException
|
||||
@ -90,7 +91,7 @@ class PendingAuthHandlerTest {
|
||||
pendingAuthHandler.ssoAuthDone()
|
||||
|
||||
// Then
|
||||
verify { continuation.resumeWithException(match { it is IllegalArgumentException })}
|
||||
verify { continuation.resumeWithException(match { it is IllegalArgumentException }) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -138,6 +139,6 @@ class PendingAuthHandlerTest {
|
||||
// Then
|
||||
pendingAuthHandler.pendingAuth shouldBe null
|
||||
pendingAuthHandler.uiaContinuation shouldBe null
|
||||
verify { continuation.resumeWithException(match { it is Exception })}
|
||||
verify { continuation.resumeWithException(match { it is UiaCancelledException }) }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user