Skip to content

Commit

Permalink
feat: When retrying the uploading transfer, we keep transfer data whe…
Browse files Browse the repository at this point in the history
…n going back to ImportFiles instead of resetting it
  • Loading branch information
KevinBoulongne committed Dec 17, 2024
1 parent 334653f commit 1f161a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ fun NewTransferNavHost(navController: NavHostController, closeActivity: () -> Un
navigateToUploadSuccess = { transferUrl ->
navController.navigate(UploadSuccessDestination(args.transferType, transferUrl))
},
navigateToUploadError = { navController.navigate(UploadErrorDestination) },
navigateToUploadError = {
// Go back to ImportFiles before going to UploadError, to be able
// to go back to ImportFiles when "Retry" button is clicked.
navController.popBackStack()
navController.navigate(UploadErrorDestination)
},
navigateBackToImportFiles = { navController.popBackStack() },
)
}
Expand All @@ -65,7 +70,7 @@ fun NewTransferNavHost(navController: NavHostController, closeActivity: () -> Un
)
}
composable<UploadErrorDestination> {
UploadErrorScreen(navigateToImportFiles = { navController.navigate(ImportFilesDestination) })
UploadErrorScreen(navigateBackToImportFiles = { navController.popBackStack() })
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows
import com.infomaniak.core2.R as RCore2

@Composable
fun UploadErrorScreen(navigateToImportFiles: () -> Unit) {
fun UploadErrorScreen(navigateBackToImportFiles: () -> Unit) {
BottomStickyButtonScaffold(
topBar = { BrandTopAppBar() },
bottomButton = {
LargeButton(
modifier = it,
title = stringResource(RCore2.string.buttonRetry),
onClick = navigateToImportFiles,
onClick = navigateBackToImportFiles,
)
}
) {
Expand All @@ -56,7 +56,7 @@ fun UploadErrorScreen(navigateToImportFiles: () -> Unit) {
private fun UploadErrorScreenPreview() {
SwissTransferTheme {
Surface {
UploadErrorScreen({})
UploadErrorScreen {}
}
}
}

0 comments on commit 1f161a1

Please sign in to comment.