mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Streamline invalid qr code dialog in link device flow.
This commit is contained in:
committed by
jeffrey-signal
parent
437979373c
commit
0ea3d524da
@@ -77,7 +77,6 @@ class AddLinkDeviceFragment : ComposeFragment() {
|
||||
viewModel.addDevice(shouldSync = false)
|
||||
},
|
||||
onQrCodeDismissed = { viewModel.onQrCodeDismissed() },
|
||||
onQrCodeRetry = { viewModel.onQrCodeScanned(state.linkUri.toString()) },
|
||||
onLinkDeviceSuccess = {
|
||||
viewModel.onLinkDeviceResult(showSheet = true)
|
||||
},
|
||||
@@ -110,7 +109,6 @@ private fun MainScreen(
|
||||
onQrCodeScanned: (String) -> Unit = {},
|
||||
onQrCodeApproved: () -> Unit = {},
|
||||
onQrCodeDismissed: () -> Unit = {},
|
||||
onQrCodeRetry: () -> Unit = {},
|
||||
onLinkDeviceSuccess: () -> Unit = {},
|
||||
onLinkDeviceFailure: () -> Unit = {}
|
||||
) {
|
||||
@@ -133,7 +131,6 @@ private fun MainScreen(
|
||||
onQrCodeScanned = onQrCodeScanned,
|
||||
onQrCodeAccepted = onQrCodeApproved,
|
||||
onQrCodeDismissed = onQrCodeDismissed,
|
||||
onQrCodeRetry = onQrCodeRetry,
|
||||
linkDeviceResult = state.linkDeviceResult,
|
||||
onLinkDeviceSuccess = onLinkDeviceSuccess,
|
||||
onLinkDeviceFailure = onLinkDeviceFailure,
|
||||
|
||||
@@ -34,7 +34,6 @@ fun LinkDeviceQrScanScreen(
|
||||
onQrCodeScanned: (String) -> Unit,
|
||||
onQrCodeAccepted: () -> Unit,
|
||||
onQrCodeDismissed: () -> Unit,
|
||||
onQrCodeRetry: () -> Unit,
|
||||
linkDeviceResult: LinkDeviceResult,
|
||||
onLinkDeviceSuccess: () -> Unit,
|
||||
onLinkDeviceFailure: () -> Unit,
|
||||
@@ -45,12 +44,11 @@ fun LinkDeviceQrScanScreen(
|
||||
val context = LocalContext.current
|
||||
|
||||
when (qrCodeState) {
|
||||
LinkDeviceSettingsState.QrCodeState.NONE -> {
|
||||
Unit
|
||||
}
|
||||
LinkDeviceSettingsState.QrCodeState.NONE -> Unit
|
||||
LinkDeviceSettingsState.QrCodeState.VALID_WITH_SYNC -> {
|
||||
navController?.safeNavigate(R.id.action_addLinkDeviceFragment_to_linkDeviceSyncBottomSheet)
|
||||
}
|
||||
|
||||
LinkDeviceSettingsState.QrCodeState.VALID_WITHOUT_SYNC -> {
|
||||
Dialogs.SimpleAlertDialog(
|
||||
title = stringResource(id = R.string.DeviceProvisioningActivity_link_this_device),
|
||||
@@ -61,13 +59,13 @@ fun LinkDeviceQrScanScreen(
|
||||
onDismiss = onQrCodeDismissed
|
||||
)
|
||||
}
|
||||
|
||||
LinkDeviceSettingsState.QrCodeState.INVALID -> {
|
||||
Dialogs.SimpleAlertDialog(
|
||||
title = stringResource(id = R.string.AddLinkDeviceFragment__linking_device_failed),
|
||||
body = stringResource(id = R.string.AddLinkDeviceFragment__this_qr_code_not_valid),
|
||||
confirm = stringResource(id = R.string.AddLinkDeviceFragment__retry),
|
||||
onConfirm = onQrCodeRetry,
|
||||
dismiss = stringResource(id = android.R.string.cancel),
|
||||
onConfirm = { },
|
||||
onDismiss = onQrCodeDismissed
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user