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 09e6ab034..8960c916b 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 @@ -154,6 +154,10 @@ private fun HandleSendActionResult( LaunchedEffect(getSendActionResult()) { when (val actionResult = getSendActionResult()) { is SendActionResult.Success -> { + // If the user cancels the transfer while in UploadProgress, we're gonna popBackStack to ImportFiles. + // If we don't reset the ImportFiles state machine, we'll automatically navigate-back to UploadProgress again. + // So, before leaving ImportFiles to go to UploadProgress, we need to reset the ImportFiles state machine. + // TODO: Maybe merging the 2 screens state machines into 1 could help simplify this ? resetSendActionResult() navigateToUploadProgress(transferType(), actionResult.totalSize) }