From a2e2a6277395475e68715c37fd88a641c16ce5e6 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Thu, 12 Dec 2024 15:39:17 +0100 Subject: [PATCH 1/5] feat: Add confirmation when trying to leave the new transfer flow Don't let them escape! --- .../ui/components/SwissTransferAlertDialog.kt | 59 +++++++++++-------- .../screen/newtransfer/NewTransferScreen.kt | 42 ++++++++++++- .../components/PasswordOptionAlertDialog.kt | 10 +++- app/src/main/res/values-de/strings.xml | 4 ++ app/src/main/res/values-es/strings.xml | 4 ++ app/src/main/res/values-fr/strings.xml | 4 ++ app/src/main/res/values-it/strings.xml | 4 ++ app/src/main/res/values/strings.xml | 4 ++ 8 files changed, 103 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt index 93a2c6437..b1a86427b 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt @@ -31,15 +31,35 @@ import com.infomaniak.swisstransfer.ui.theme.Margin import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme import com.infomaniak.core2.R as RCore2 +object SwissTransferAlertDialogDefaults { + @Composable + fun confirmButton(isEnabled: () -> Boolean = { true }, onClick: () -> Unit) { + SmallButton( + title = stringResource(R.string.buttonConfirm), + enabled = isEnabled, + onClick = onClick, + ) + } + + @Composable + fun cancelButton(onClick: () -> Unit) { + SmallButton( + style = ButtonType.TERTIARY, + title = stringResource(RCore2.string.buttonCancel), + onClick = onClick, + ) + } +} + @OptIn(ExperimentalMaterial3Api::class) @Composable fun SwissTransferAlertDialog( modifier: Modifier = Modifier, @StringRes titleRes: Int, @StringRes descriptionRes: Int, + positiveButton: @Composable () -> Unit, + negativeButton: @Composable () -> Unit, onDismiss: () -> Unit, - onConfirmation: () -> Unit, - isConfirmButtonEnabled: () -> Boolean = { true }, content: @Composable (ColumnScope.() -> Unit)? = null, ) { BasicAlertDialog( @@ -52,11 +72,10 @@ fun SwissTransferAlertDialog( BasicAlertDialogContent( modifier = modifier, titleRes = titleRes, + positiveButton = positiveButton, + negativeButton = negativeButton, descriptionRes = descriptionRes, additionalContent = content, - onDismiss = onDismiss, - onConfirmation = onConfirmation, - isConfirmButtonEnabled = isConfirmButtonEnabled, ) } } @@ -67,10 +86,9 @@ private fun BasicAlertDialogContent( modifier: Modifier, @StringRes titleRes: Int, @StringRes descriptionRes: Int, + positiveButton: @Composable () -> Unit, + negativeButton: @Composable () -> Unit, additionalContent: @Composable (ColumnScope.() -> Unit)? = null, - onDismiss: () -> Unit, - onConfirmation: () -> Unit, - isConfirmButtonEnabled: () -> Boolean = { true }, ) { Column(modifier.padding(Margin.Large)) { TitleAndDescription(titleRes, descriptionRes) @@ -79,7 +97,7 @@ private fun BasicAlertDialogContent( it() Spacer(Modifier.height(Margin.Mini)) } - ActionButtons(onDismiss, onConfirmation, isConfirmButtonEnabled) + ActionButtons(positiveButton, negativeButton) } } @@ -99,23 +117,17 @@ private fun TitleAndDescription(titleRes: Int, descriptionRes: Int) { } @Composable -private fun ActionButtons(onDismissRequest: () -> Unit, onConfirmation: () -> Unit, isEnabled: () -> Boolean) { +private fun ActionButtons( + positiveButton: @Composable () -> Unit, + negativeButton: @Composable () -> Unit, +) { Row( modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.End, + horizontalArrangement = Arrangement.spacedBy(Margin.Micro, Alignment.End), verticalAlignment = Alignment.CenterVertically, ) { - SmallButton( - style = ButtonType.TERTIARY, - title = stringResource(RCore2.string.buttonCancel), - onClick = onDismissRequest, - ) - Spacer(Modifier.width(Margin.Micro)) - SmallButton( - title = stringResource(R.string.buttonConfirm), - onClick = onConfirmation, - enabled = isEnabled - ) + negativeButton() + positiveButton() } } @@ -127,8 +139,9 @@ private fun PreviewAlertDialog() { SwissTransferAlertDialog( titleRes = R.string.settingsOptionPassword, descriptionRes = R.string.settingsPasswordDescription, + positiveButton = { SwissTransferAlertDialogDefaults.confirmButton { } }, + negativeButton = { SwissTransferAlertDialogDefaults.cancelButton { } }, onDismiss = {}, - onConfirmation = {}, ) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt index e12920249..fddeca0e0 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt @@ -18,20 +18,56 @@ package com.infomaniak.swisstransfer.ui.screen.newtransfer import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.res.stringResource import androidx.navigation.compose.rememberNavController +import com.infomaniak.swisstransfer.R +import com.infomaniak.swisstransfer.ui.components.ButtonType +import com.infomaniak.swisstransfer.ui.components.SmallButton +import com.infomaniak.swisstransfer.ui.components.SwissTransferAlertDialog import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows @Composable fun NewTransferScreen(closeActivity: () -> Unit) { val navController = rememberNavController() - NewTransferNavHost(navController, closeActivity) + var displayConfirmationDialog by rememberSaveable { mutableStateOf(false) } + + NewTransferNavHost(navController, closeActivity = { displayConfirmationDialog = true }) + + if (displayConfirmationDialog) ConfirmLeavingDialog(onLeave = closeActivity, onCancel = { displayConfirmationDialog = false }) +} + +@Composable +fun ConfirmLeavingDialog(onLeave: () -> Unit, onCancel: () -> Unit) { + SwissTransferAlertDialog( + titleRes = R.string.newTransferConfirmLeavingDialogTitle, + descriptionRes = R.string.newTransferLeavingDialogDescription, + positiveButton = { + SmallButton( + title = stringResource(R.string.newTransferLeavingDialogPositiveButton), + style = ButtonType.ERROR, + onClick = onLeave, + ) + }, + negativeButton = { + SmallButton( + title = stringResource(R.string.newTransferLeavingDialogNegativeButton), + style = ButtonType.TERTIARY, + onClick = onCancel, + ) + }, + onDismiss = onCancel, + ) } @PreviewAllWindows @Composable -private fun NewTransferPreview() { +private fun Preview() { SwissTransferTheme { - NewTransferScreen {} + ConfirmLeavingDialog({}, {}) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt index 007742331..d8a8f33bd 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/PasswordOptionAlertDialog.kt @@ -33,6 +33,7 @@ import androidx.compose.ui.tooling.preview.Preview import com.infomaniak.swisstransfer.R import com.infomaniak.swisstransfer.ui.MatomoSwissTransfer.toFloat import com.infomaniak.swisstransfer.ui.components.SwissTransferAlertDialog +import com.infomaniak.swisstransfer.ui.components.SwissTransferAlertDialogDefaults import com.infomaniak.swisstransfer.ui.components.SwissTransferTextField import com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles.PasswordTransferOption import com.infomaniak.swisstransfer.ui.screen.newtransfer.upload.components.WeightOneSpacer @@ -72,9 +73,14 @@ fun PasswordOptionAlertDialog( SwissTransferAlertDialog( titleRes = R.string.settingsOptionPassword, descriptionRes = R.string.settingsPasswordDescription, + positiveButton = { + SwissTransferAlertDialogDefaults.confirmButton( + isEnabled = { !isPasswordActivated || isPasswordValid() }, + onClick = ::onConfirmButtonClicked, + ) + }, + negativeButton = { SwissTransferAlertDialogDefaults.cancelButton(onClick = ::onDismiss) }, onDismiss = ::onDismiss, - onConfirmation = ::onConfirmButtonClicked, - isConfirmButtonEnabled = { !isPasswordActivated || isPasswordValid() }, ) { ActivatePasswordSwitch(isChecked = isPasswordActivated, onCheckedChange = { isPasswordActivated = it }) Spacer(Modifier.height(Margin.Medium)) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index e5857ee4c..fa83c0595 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -48,6 +48,10 @@ Nachricht: Meine Dateien Auf Netzwerk warten + Ups, willst du wirklich abbrechen? + Dein Transfer ist fast fertig. Bist du sicher, dass du alles rückgängig machen willst? + Nein, weiter + Ja, abbrechen Fügt bis zu 50 GB an Dateien hinzu Keine Datei, keine Übertragung! Wählt einen Parameter zur Anzeige aus diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index b5b6331a5..16759ba75 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -48,6 +48,10 @@ Mensaje: Mis archivos Esperando la red + Ups, ¿realmente quieres cancelar? + Tu traslado está casi listo. ¿Estás seguro de que quieres cancelarlo? + No, continúe + Sí, cancelar Añade hasta 50 GB de archivos Si no hay archivo, no hay transferencia. Selecciona un parámetro para su visualización diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index efeee281f..3a101e391 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -49,6 +49,10 @@ Message : Mes fichiers En attente de réseau + Oups, tu veux vraiment annuler ? + Ton transfert est presque prêt. Es-tu sûr de vouloir tout annuler ? + Non, continuer + Oui, annuler Ajoute jusqu’à 50 Go de fichiers Pas de fichier, pas de transfert ! Sélectionne un paramètre pour l’afficher diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 375ce071f..8d102a4e5 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -48,6 +48,10 @@ Messaggio: I miei file In attesa della rete + Ops, vuoi davvero cancellarti? + Il trasferimento è quasi pronto. Sei sicuro di volerlo annullare? + No, continua + Sì, annulla Aggiungere fino a 50 GB di file Nessun file, nessun trasferimento! Seleziona un parametro da visualizzare diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eaa5766f1..f58008b27 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -52,6 +52,10 @@ Message: My files Waiting for network + Oops, do you really want to cancel? + Your transfer is almost ready. Are you sure you want to cancel it? + No, continue + Yes, cancel Add up to 50 GB of files No file, no transfer! Select a parameter to display it From 6991f432e4553340140d47e8d11d9ce4781ec1d8 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Mon, 16 Dec 2024 12:53:14 +0100 Subject: [PATCH 2/5] feat: Handle wide buttons inside alert dialogs --- .../ui/components/SwissTransferAlertDialog.kt | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt index b1a86427b..72b74edba 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt @@ -116,15 +116,17 @@ private fun TitleAndDescription(titleRes: Int, descriptionRes: Int) { ) } +@OptIn(ExperimentalLayoutApi::class) @Composable private fun ActionButtons( positiveButton: @Composable () -> Unit, negativeButton: @Composable () -> Unit, ) { - Row( + FlowRow( modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(Margin.Micro, Alignment.End), - verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(Margin.Mini, Alignment.End), + verticalArrangement = Arrangement.spacedBy(Margin.Mini), + itemVerticalAlignment = Alignment.CenterVertically, ) { negativeButton() positiveButton() @@ -146,3 +148,19 @@ private fun PreviewAlertDialog() { } } } + +@Preview +@Composable +private fun WideButtonsPreview() { + SwissTransferTheme { + Surface { + SwissTransferAlertDialog( + titleRes = R.string.settingsOptionPassword, + descriptionRes = R.string.settingsPasswordDescription, + positiveButton = { SmallButton("A very looong and wide button", onClick = {}) }, + negativeButton = { SwissTransferAlertDialogDefaults.cancelButton { } }, + onDismiss = {}, + ) + } + } +} From a5c5b89d93af5fd443579cfa8374db62ab7b13b6 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Mon, 16 Dec 2024 14:01:29 +0100 Subject: [PATCH 3/5] feat: Use native dialog button style to prevent issues with paddings --- .../com/infomaniak/swisstransfer/ui/components/Buttons.kt | 8 +++++--- .../ui/components/SwissTransferAlertDialog.kt | 6 +++--- .../swisstransfer/ui/components/SwissTransferButton.kt | 6 ++++++ .../ui/screen/newtransfer/NewTransferScreen.kt | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/Buttons.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/Buttons.kt index 9ed297de8..08a602d40 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/Buttons.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/Buttons.kt @@ -19,6 +19,7 @@ package com.infomaniak.swisstransfer.ui.components import android.content.res.Configuration import androidx.compose.foundation.layout.* +import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Icon import androidx.compose.material3.Surface import androidx.compose.material3.Text @@ -107,6 +108,7 @@ private fun CoreButton( showIndeterminateProgress, progress, onClick, + contentPadding = buttonSize.contentPadding ) { ButtonTextContent(imageVector, title) } @@ -121,9 +123,9 @@ private fun ButtonTextContent(imageVector: ImageVector?, title: String) { Text(text = title, style = SwissTransferTheme.typography.bodyMedium) } -private enum class ButtonSize(val height: Dp) { - LARGE(Dimens.LargeButtonHeight), - SMALL(40.dp), +private enum class ButtonSize(val height: Dp, val contentPadding: PaddingValues) { + LARGE(Dimens.LargeButtonHeight, ButtonDefaults.ContentPadding), + SMALL(40.dp, PaddingValues(horizontal = Margin.Medium)), } @Preview(name = "Light", widthDp = 800) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt index 72b74edba..8aa18cc62 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferAlertDialog.kt @@ -35,6 +35,7 @@ object SwissTransferAlertDialogDefaults { @Composable fun confirmButton(isEnabled: () -> Boolean = { true }, onClick: () -> Unit) { SmallButton( + style = ButtonType.TERTIARY, title = stringResource(R.string.buttonConfirm), enabled = isEnabled, onClick = onClick, @@ -124,8 +125,7 @@ private fun ActionButtons( ) { FlowRow( modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(Margin.Mini, Alignment.End), - verticalArrangement = Arrangement.spacedBy(Margin.Mini), + horizontalArrangement = Arrangement.End, itemVerticalAlignment = Alignment.CenterVertically, ) { negativeButton() @@ -157,7 +157,7 @@ private fun WideButtonsPreview() { SwissTransferAlertDialog( titleRes = R.string.settingsOptionPassword, descriptionRes = R.string.settingsPasswordDescription, - positiveButton = { SmallButton("A very looong and wide button", onClick = {}) }, + positiveButton = { SmallButton("A very looong and wide button", onClick = {}, style = ButtonType.TERTIARY) }, negativeButton = { SwissTransferAlertDialogDefaults.cancelButton { } }, onDismiss = {}, ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferButton.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferButton.kt index c81b6320f..6eba0a781 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferButton.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwissTransferButton.kt @@ -124,6 +124,12 @@ enum class ButtonType(val buttonColors: @Composable () -> ButtonColors) { contentColor = SwissTransferTheme.materialColors.onError, ) }), + ERROR_TEXT({ + ButtonDefaults.buttonColors( + containerColor = Color.Transparent, + contentColor = SwissTransferTheme.materialColors.error, + ) + }), } @PreviewLightAndDark diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt index fddeca0e0..14e5d4f2c 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt @@ -49,7 +49,7 @@ fun ConfirmLeavingDialog(onLeave: () -> Unit, onCancel: () -> Unit) { positiveButton = { SmallButton( title = stringResource(R.string.newTransferLeavingDialogPositiveButton), - style = ButtonType.ERROR, + style = ButtonType.ERROR_TEXT, onClick = onLeave, ) }, From 86e2b11be92d96b26f9881dfdeb7b80213a9dbf6 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Mon, 16 Dec 2024 14:14:16 +0100 Subject: [PATCH 4/5] feat: Also prompt user when backing from the root ImportFilesScreen --- .../ui/screen/newtransfer/importfiles/ImportFilesScreen.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt index c3f220a71..74626e624 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt @@ -18,6 +18,7 @@ package com.infomaniak.swisstransfer.ui.screen.newtransfer.importfiles import android.net.Uri +import androidx.activity.compose.BackHandler import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts import androidx.annotation.StringRes @@ -97,6 +98,8 @@ fun ImportFilesScreen( LaunchedEffect(Unit) { importFilesViewModel.initTransferOptionsValues() } + BackHandler { closeActivity() } // Closing the activity like other screens will prompt the user to be sure he wants to leave + val transferOptionsCallbacks = importFilesViewModel.getTransferOptionsCallbacks( transferOptionsStates = { buildList { From 109e6b529f5c4b66053b22e3f05a8ddabadb3a58 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Mon, 16 Dec 2024 14:54:43 +0100 Subject: [PATCH 5/5] feat: Avoid prompting the user when not needed When canceling an upload in progress, you'll be asked to confirm a first time and then when you're back on ImportFilesScreen, you'll need to confirm again to leave. This takes way too many clicks, the confirmation on ImportFilesScreen is not needed --- .../ui/screen/newtransfer/NewTransferNavHost.kt | 8 ++++++-- .../ui/screen/newtransfer/NewTransferScreen.kt | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt index f767d3cc0..5a9e472e2 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt @@ -31,7 +31,11 @@ import com.infomaniak.swisstransfer.ui.screen.newtransfer.upload.UploadSuccessSc import com.infomaniak.swisstransfer.ui.screen.newtransfer.validateemail.ValidateUserEmailScreen @Composable -fun NewTransferNavHost(navController: NavHostController, closeActivity: () -> Unit) { +fun NewTransferNavHost( + navController: NavHostController, + closeActivity: () -> Unit, + closeActivityAndPromptForValidation: () -> Unit, +) { NavHost(navController, NewTransferNavigation.startDestination) { composable { @@ -48,7 +52,7 @@ fun NewTransferNavHost(navController: NavHostController, closeActivity: () -> Un composable { val args = it.toRoute() ValidateUserEmailScreen( - closeActivity = closeActivity, + closeActivity = closeActivityAndPromptForValidation, navigateBack = { navController.popBackStack() }, emailToValidate = args.userEmail, ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt index 14e5d4f2c..c8c2811fc 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/NewTransferScreen.kt @@ -36,7 +36,11 @@ fun NewTransferScreen(closeActivity: () -> Unit) { val navController = rememberNavController() var displayConfirmationDialog by rememberSaveable { mutableStateOf(false) } - NewTransferNavHost(navController, closeActivity = { displayConfirmationDialog = true }) + NewTransferNavHost( + navController, + closeActivity = closeActivity, + closeActivityAndPromptForValidation = { displayConfirmationDialog = true }, + ) if (displayConfirmationDialog) ConfirmLeavingDialog(onLeave = closeActivity, onCancel = { displayConfirmationDialog = false }) }