From 6c6df6d0989c00c4daa4bb84c99b7d26e5732cd7 Mon Sep 17 00:00:00 2001 From: Gibran Chevalley Date: Wed, 13 Nov 2024 10:46:14 +0100 Subject: [PATCH] Merge SuccessMessage and ScreenContent --- .../upload/UploadSuccessQrScreen.kt | 52 ++++++++----------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessQrScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessQrScreen.kt index d5febff5a..7b289a82e 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessQrScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadSuccessQrScreen.kt @@ -58,7 +58,7 @@ fun UploadSuccessQrScreen(transferType: TransferType, transferUrl: String, close }, ) { Column { - ScreenContent(transferType, transferUrl) + SuccessMessage(transferType, transferUrl) ShareAndCopyButtons( modifier = Modifier.padding(bottom = Margin.Medium, top = Margin.Mini), @@ -70,10 +70,7 @@ fun UploadSuccessQrScreen(transferType: TransferType, transferUrl: String, close } @Composable -private fun ColumnScope.ScreenContent( - transferType: TransferType, - transferUrl: String -) { +private fun ColumnScope.SuccessMessage(transferType: TransferType, transferUrl: String) { Column( modifier = Modifier .fillMaxWidth() @@ -83,37 +80,32 @@ private fun ColumnScope.ScreenContent( horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center, ) { - SuccessMessage(transferType, transferUrl) - } -} - -@Composable -private fun SuccessMessage(transferType: TransferType, transferUrl: String) { - Spacer(modifier = Modifier.height(Margin.Medium)) + Spacer(modifier = Modifier.height(Margin.Medium)) - Image(imageVector = AppIllus.Beers.image(), contentDescription = null) + Image(imageVector = AppIllus.Beers.image(), contentDescription = null) - Spacer(Modifier.height(Margin.Huge)) + Spacer(Modifier.height(Margin.Huge)) - Text( - text = stringResource(transferType.titleRes), - style = SwissTransferTheme.typography.h1, - color = SwissTransferTheme.colors.primaryTextColor, - ) + Text( + text = stringResource(transferType.titleRes), + style = SwissTransferTheme.typography.h1, + color = SwissTransferTheme.colors.primaryTextColor, + ) - Spacer(Modifier.height(Margin.Huge)) + Spacer(Modifier.height(Margin.Huge)) - QrCode(transferUrl) + QrCode(transferUrl) - transferType.descriptionRes?.let { descriptionRes -> - Spacer(Modifier.height(Margin.Huge)) - Text( - text = stringResource(descriptionRes), - style = SwissTransferTheme.typography.bodyRegular, - textAlign = TextAlign.Center, - color = SwissTransferTheme.colors.secondaryTextColor, - modifier = Modifier.widthIn(max = Dimens.DescriptionWidth), - ) + transferType.descriptionRes?.let { descriptionRes -> + Spacer(Modifier.height(Margin.Huge)) + Text( + text = stringResource(descriptionRes), + style = SwissTransferTheme.typography.bodyRegular, + textAlign = TextAlign.Center, + color = SwissTransferTheme.colors.secondaryTextColor, + modifier = Modifier.widthIn(max = Dimens.DescriptionWidth), + ) + } } }