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 f03cf2ff8..7d3105600 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 @@ -56,6 +56,7 @@ fun NewTransferNavHost(navController: NavHostController, closeActivity: () -> Un navigateToUploadSuccess = { transferLink -> navController.navigate(UploadSuccessDestination(args.transferType, transferLink)) }, + navigateToUploadError = { navController.navigate(UploadErrorDestination) }, closeActivity = closeActivity ) } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadProgressScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadProgressScreen.kt index b60aba9d2..1404ecfe7 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadProgressScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadProgressScreen.kt @@ -48,6 +48,7 @@ fun UploadProgressScreen( uploadProgressViewModel: UploadProgressViewModel = hiltViewModel(), totalSizeInBytes: Long, navigateToUploadSuccess: (String) -> Unit, + navigateToUploadError: () -> Unit, closeActivity: () -> Unit, ) { val uiState by uploadProgressViewModel.transferProgressUiState.collectAsStateWithLifecycle() @@ -63,7 +64,7 @@ fun UploadProgressScreen( uploadProgressViewModel.trackUploadProgress() } - HandleProgressState({ uiState }, navigateToUploadSuccess) + HandleProgressState({ uiState }, navigateToUploadSuccess, navigateToUploadError) UploadProgressScreen( progressState = { uiState }, @@ -80,7 +81,8 @@ fun UploadProgressScreen( @Composable private fun HandleProgressState( uiState: () -> UploadProgressUiState, - navigateToUploadSuccess: (String) -> Unit + navigateToUploadSuccess: (String) -> Unit, + navigateToUploadError: () -> Unit, ) { val currentUiState = uiState() LaunchedEffect(uiState()) { @@ -89,7 +91,7 @@ private fun HandleProgressState( navigateToUploadSuccess(currentUiState.transferLink) } is UploadProgressUiState.Cancelled -> { - // TODO: navigate to failure screen + navigateToUploadError() } else -> Unit }