[Link new device] Add missing screen for the error case OtherDeviceAlreadySignedIn
Closes #6678
This commit is contained in:
parent
414da30d33
commit
9438ff59f1
4 changed files with 32 additions and 8 deletions
|
|
@ -199,9 +199,7 @@ class LinkNewDeviceFlowNode(
|
||||||
is ErrorType.Expired,
|
is ErrorType.Expired,
|
||||||
is ErrorType.NotFound,
|
is ErrorType.NotFound,
|
||||||
is ErrorType.DeviceNotFound -> ErrorScreenType.Expired
|
is ErrorType.DeviceNotFound -> ErrorScreenType.Expired
|
||||||
// TODO we should show other_device_already_signed_in screen with checkmark when available
|
is ErrorType.OtherDeviceAlreadySignedIn -> ErrorScreenType.OtherDeviceAlreadySignedIn
|
||||||
// See: https://github.com/element-hq/element-x-android/issues/6678
|
|
||||||
is ErrorType.OtherDeviceAlreadySignedIn -> ErrorScreenType.UnknownError
|
|
||||||
// TODO check if we expect to hit this here or if it should be caught earlier on
|
// TODO check if we expect to hit this here or if it should be caught earlier on
|
||||||
is ErrorType.UnsupportedQrCodeType -> ErrorScreenType.UnknownError
|
is ErrorType.UnsupportedQrCodeType -> ErrorScreenType.UnknownError
|
||||||
is ErrorType.MissingSecretsBackup,
|
is ErrorType.MissingSecretsBackup,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ sealed interface ErrorScreenType : NodeInputs, Parcelable {
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data object Expired : ErrorScreenType
|
data object Expired : ErrorScreenType
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
data object OtherDeviceAlreadySignedIn : ErrorScreenType
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data object Mismatch2Digits : ErrorScreenType
|
data object Mismatch2Digits : ErrorScreenType
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,6 @@ class ErrorScreenTypeProvider : PreviewParameterProvider<ErrorScreenType> {
|
||||||
ErrorScreenType.InsecureChannelDetected,
|
ErrorScreenType.InsecureChannelDetected,
|
||||||
ErrorScreenType.SlidingSyncNotAvailable,
|
ErrorScreenType.SlidingSyncNotAvailable,
|
||||||
ErrorScreenType.UnknownError,
|
ErrorScreenType.UnknownError,
|
||||||
|
ErrorScreenType.OtherDeviceAlreadySignedIn,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,17 +47,26 @@ fun ErrorView(
|
||||||
) {
|
) {
|
||||||
val appName = LocalBuildMeta.current.applicationName
|
val appName = LocalBuildMeta.current.applicationName
|
||||||
BackHandler(onBack = onCancel)
|
BackHandler(onBack = onCancel)
|
||||||
|
val iconStyle = when (errorScreenType) {
|
||||||
|
ErrorScreenType.OtherDeviceAlreadySignedIn -> BigIcon.Style.SuccessSolid
|
||||||
|
else -> BigIcon.Style.AlertSolid
|
||||||
|
}
|
||||||
FlowStepPage(
|
FlowStepPage(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
iconStyle = BigIcon.Style.AlertSolid,
|
iconStyle = iconStyle,
|
||||||
title = titleText(errorScreenType, appName),
|
title = titleText(errorScreenType, appName),
|
||||||
subTitle = subtitleText(errorScreenType, appName),
|
subTitle = subtitleText(errorScreenType, appName),
|
||||||
content = { Content(errorScreenType) },
|
content = { Content(errorScreenType) },
|
||||||
buttons = {
|
buttons = {
|
||||||
Buttons(
|
when (errorScreenType) {
|
||||||
onRetry = onRetry,
|
ErrorScreenType.OtherDeviceAlreadySignedIn -> DoneButton(
|
||||||
onCancel = onCancel,
|
onDone = onCancel,
|
||||||
)
|
)
|
||||||
|
else -> Buttons(
|
||||||
|
onRetry = onRetry,
|
||||||
|
onCancel = onCancel,
|
||||||
|
)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -72,6 +81,7 @@ private fun titleText(errorScreenType: ErrorScreenType, appName: String) = when
|
||||||
ErrorScreenType.Mismatch2Digits -> stringResource(id = R.string.screen_link_new_device_wrong_number_title)
|
ErrorScreenType.Mismatch2Digits -> stringResource(id = R.string.screen_link_new_device_wrong_number_title)
|
||||||
ErrorScreenType.SlidingSyncNotAvailable -> stringResource(id = R.string.screen_qr_code_login_error_sliding_sync_not_supported_title, appName)
|
ErrorScreenType.SlidingSyncNotAvailable -> stringResource(id = R.string.screen_qr_code_login_error_sliding_sync_not_supported_title, appName)
|
||||||
is ErrorScreenType.UnknownError -> stringResource(CommonStrings.common_something_went_wrong)
|
is ErrorScreenType.UnknownError -> stringResource(CommonStrings.common_something_went_wrong)
|
||||||
|
ErrorScreenType.OtherDeviceAlreadySignedIn -> stringResource(R.string.screen_qr_code_login_error_device_already_signed_in_title)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -84,6 +94,7 @@ private fun subtitleText(errorScreenType: ErrorScreenType, appName: String) = wh
|
||||||
ErrorScreenType.InsecureChannelDetected -> stringResource(id = R.string.screen_qr_code_login_connection_note_secure_state_description)
|
ErrorScreenType.InsecureChannelDetected -> stringResource(id = R.string.screen_qr_code_login_connection_note_secure_state_description)
|
||||||
ErrorScreenType.SlidingSyncNotAvailable -> stringResource(id = R.string.screen_qr_code_login_error_sliding_sync_not_supported_subtitle, appName)
|
ErrorScreenType.SlidingSyncNotAvailable -> stringResource(id = R.string.screen_qr_code_login_error_sliding_sync_not_supported_subtitle, appName)
|
||||||
is ErrorScreenType.UnknownError -> stringResource(R.string.screen_qr_code_login_unknown_error_description)
|
is ErrorScreenType.UnknownError -> stringResource(R.string.screen_qr_code_login_unknown_error_description)
|
||||||
|
ErrorScreenType.OtherDeviceAlreadySignedIn -> stringResource(R.string.screen_qr_code_login_error_device_already_signed_in_subtitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
@ -124,6 +135,17 @@ private fun Content(errorScreenType: ErrorScreenType) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun DoneButton(
|
||||||
|
onDone: () -> Unit,
|
||||||
|
) {
|
||||||
|
Button(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
text = stringResource(CommonStrings.action_done),
|
||||||
|
onClick = onDone,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Buttons(
|
private fun Buttons(
|
||||||
onRetry: () -> Unit,
|
onRetry: () -> Unit,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue