From 334653f154aa17d5a0b71e521e3bcb14befa6e0b Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Tue, 17 Dec 2024 11:44:17 +0100 Subject: [PATCH] docs: Add explanatory comment --- .../ui/screen/newtransfer/importfiles/ImportFilesScreen.kt | 4 ++++ 1 file changed, 4 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 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) }