mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
QRCode login: treat not found error as expired error. (#6161)
Reorder some when cases.
This commit is contained in:
+5
-2
@@ -119,7 +119,8 @@ class QrCodeLoginFlowNode(
|
|||||||
is QrLoginException.Cancelled -> {
|
is QrLoginException.Cancelled -> {
|
||||||
backstack.replace(NavTarget.Error(QrCodeErrorScreenType.Cancelled))
|
backstack.replace(NavTarget.Error(QrCodeErrorScreenType.Cancelled))
|
||||||
}
|
}
|
||||||
is QrLoginException.Expired -> {
|
is QrLoginException.Expired,
|
||||||
|
is QrLoginException.NotFound -> {
|
||||||
backstack.replace(NavTarget.Error(QrCodeErrorScreenType.Expired))
|
backstack.replace(NavTarget.Error(QrCodeErrorScreenType.Expired))
|
||||||
}
|
}
|
||||||
is QrLoginException.Declined -> {
|
is QrLoginException.Declined -> {
|
||||||
@@ -138,7 +139,9 @@ class QrCodeLoginFlowNode(
|
|||||||
Timber.e(error, "OIDC metadata is invalid")
|
Timber.e(error, "OIDC metadata is invalid")
|
||||||
backstack.replace(NavTarget.Error(QrCodeErrorScreenType.UnknownError))
|
backstack.replace(NavTarget.Error(QrCodeErrorScreenType.UnknownError))
|
||||||
}
|
}
|
||||||
else -> {
|
QrLoginException.CheckCodeAlreadySent,
|
||||||
|
QrLoginException.CheckCodeCannotBeSent,
|
||||||
|
QrLoginException.Unknown -> {
|
||||||
Timber.e(error, "Unknown error found")
|
Timber.e(error, "Unknown error found")
|
||||||
backstack.replace(NavTarget.Error(QrCodeErrorScreenType.UnknownError))
|
backstack.replace(NavTarget.Error(QrCodeErrorScreenType.UnknownError))
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -61,6 +61,9 @@ class QrCodeLoginFlowNodeTest {
|
|||||||
qrCodeLoginManager.currentLoginStep.value = QrCodeLoginStep.Failed(QrLoginException.Expired)
|
qrCodeLoginManager.currentLoginStep.value = QrCodeLoginStep.Failed(QrLoginException.Expired)
|
||||||
assertThat(flowNode.currentNavTarget()).isEqualTo(QrCodeLoginFlowNode.NavTarget.Error(QrCodeErrorScreenType.Expired))
|
assertThat(flowNode.currentNavTarget()).isEqualTo(QrCodeLoginFlowNode.NavTarget.Error(QrCodeErrorScreenType.Expired))
|
||||||
|
|
||||||
|
qrCodeLoginManager.currentLoginStep.value = QrCodeLoginStep.Failed(QrLoginException.NotFound)
|
||||||
|
assertThat(flowNode.currentNavTarget()).isEqualTo(QrCodeLoginFlowNode.NavTarget.Error(QrCodeErrorScreenType.Expired))
|
||||||
|
|
||||||
qrCodeLoginManager.currentLoginStep.value = QrCodeLoginStep.Failed(QrLoginException.Declined)
|
qrCodeLoginManager.currentLoginStep.value = QrCodeLoginStep.Failed(QrLoginException.Declined)
|
||||||
assertThat(flowNode.currentNavTarget()).isEqualTo(QrCodeLoginFlowNode.NavTarget.Error(QrCodeErrorScreenType.Declined))
|
assertThat(flowNode.currentNavTarget()).isEqualTo(QrCodeLoginFlowNode.NavTarget.Error(QrCodeErrorScreenType.Declined))
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,6 +13,7 @@ sealed class QrLoginException : Exception() {
|
|||||||
data object ConnectionInsecure : QrLoginException()
|
data object ConnectionInsecure : QrLoginException()
|
||||||
data object Declined : QrLoginException()
|
data object Declined : QrLoginException()
|
||||||
data object Expired : QrLoginException()
|
data object Expired : QrLoginException()
|
||||||
|
data object NotFound : QrLoginException()
|
||||||
data object LinkingNotSupported : QrLoginException()
|
data object LinkingNotSupported : QrLoginException()
|
||||||
data object OidcMetadataInvalid : QrLoginException()
|
data object OidcMetadataInvalid : QrLoginException()
|
||||||
data object SlidingSyncNotAvailable : QrLoginException()
|
data object SlidingSyncNotAvailable : QrLoginException()
|
||||||
@@ -20,5 +21,4 @@ sealed class QrLoginException : Exception() {
|
|||||||
data object CheckCodeAlreadySent : QrLoginException()
|
data object CheckCodeAlreadySent : QrLoginException()
|
||||||
data object CheckCodeCannotBeSent : QrLoginException()
|
data object CheckCodeCannotBeSent : QrLoginException()
|
||||||
data object Unknown : QrLoginException()
|
data object Unknown : QrLoginException()
|
||||||
data object NotFound : QrLoginException()
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -38,6 +38,7 @@ object QrErrorMapper {
|
|||||||
is RustHumanQrLoginException.ConnectionInsecure -> QrLoginException.ConnectionInsecure
|
is RustHumanQrLoginException.ConnectionInsecure -> QrLoginException.ConnectionInsecure
|
||||||
is RustHumanQrLoginException.Declined -> QrLoginException.Declined
|
is RustHumanQrLoginException.Declined -> QrLoginException.Declined
|
||||||
is RustHumanQrLoginException.Expired -> QrLoginException.Expired
|
is RustHumanQrLoginException.Expired -> QrLoginException.Expired
|
||||||
|
is RustHumanQrLoginException.NotFound -> QrLoginException.NotFound
|
||||||
is RustHumanQrLoginException.OtherDeviceNotSignedIn -> QrLoginException.OtherDeviceNotSignedIn
|
is RustHumanQrLoginException.OtherDeviceNotSignedIn -> QrLoginException.OtherDeviceNotSignedIn
|
||||||
is RustHumanQrLoginException.LinkingNotSupported -> QrLoginException.LinkingNotSupported
|
is RustHumanQrLoginException.LinkingNotSupported -> QrLoginException.LinkingNotSupported
|
||||||
is RustHumanQrLoginException.Unknown -> QrLoginException.Unknown
|
is RustHumanQrLoginException.Unknown -> QrLoginException.Unknown
|
||||||
@@ -45,6 +46,5 @@ object QrErrorMapper {
|
|||||||
is RustHumanQrLoginException.SlidingSyncNotAvailable -> QrLoginException.SlidingSyncNotAvailable
|
is RustHumanQrLoginException.SlidingSyncNotAvailable -> QrLoginException.SlidingSyncNotAvailable
|
||||||
is RustHumanQrLoginException.CheckCodeAlreadySent -> QrLoginException.CheckCodeAlreadySent
|
is RustHumanQrLoginException.CheckCodeAlreadySent -> QrLoginException.CheckCodeAlreadySent
|
||||||
is RustHumanQrLoginException.CheckCodeCannotBeSent -> QrLoginException.CheckCodeCannotBeSent
|
is RustHumanQrLoginException.CheckCodeCannotBeSent -> QrLoginException.CheckCodeCannotBeSent
|
||||||
is RustHumanQrLoginException.NotFound -> QrLoginException.NotFound
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user