mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 01:55:04 +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.Matrix
|
||||||
import org.matrix.android.sdk.api.auth.UIABaseAuth
|
import org.matrix.android.sdk.api.auth.UIABaseAuth
|
||||||
import org.matrix.android.sdk.api.auth.UserPasswordAuth
|
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 org.matrix.android.sdk.api.util.fromBase64
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -62,7 +63,7 @@ class PendingAuthHandler @Inject constructor(
|
|||||||
|
|
||||||
fun reAuthCancelled() {
|
fun reAuthCancelled() {
|
||||||
Timber.d("reAuthCancelled")
|
Timber.d("reAuthCancelled")
|
||||||
uiaContinuation?.resumeWithException(Exception())
|
uiaContinuation?.resumeWithException(UiaCancelledException())
|
||||||
uiaContinuation = null
|
uiaContinuation = null
|
||||||
pendingAuth = null
|
pendingAuth = null
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import org.junit.Ignore
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.matrix.android.sdk.api.auth.UIABaseAuth
|
import org.matrix.android.sdk.api.auth.UIABaseAuth
|
||||||
import org.matrix.android.sdk.api.auth.UserPasswordAuth
|
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.Continuation
|
||||||
import kotlin.coroutines.resume
|
import kotlin.coroutines.resume
|
||||||
import kotlin.coroutines.resumeWithException
|
import kotlin.coroutines.resumeWithException
|
||||||
@ -90,7 +91,7 @@ class PendingAuthHandlerTest {
|
|||||||
pendingAuthHandler.ssoAuthDone()
|
pendingAuthHandler.ssoAuthDone()
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
verify { continuation.resumeWithException(match { it is IllegalArgumentException })}
|
verify { continuation.resumeWithException(match { it is IllegalArgumentException }) }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -138,6 +139,6 @@ class PendingAuthHandlerTest {
|
|||||||
// Then
|
// Then
|
||||||
pendingAuthHandler.pendingAuth shouldBe null
|
pendingAuthHandler.pendingAuth shouldBe null
|
||||||
pendingAuthHandler.uiaContinuation 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