From 38c46436cdddca547f7a0c116e0d18694c5b8e54 Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Mon, 18 Nov 2024 17:07:35 +0100 Subject: [PATCH] chore: Clean code --- .../ui/screen/newtransfer/upload/UploadProgressViewModel.kt | 2 +- .../ui/screen/newtransfer/upload/UploadSuccessQrScreen.kt | 2 +- .../ui/screen/newtransfer/upload/components/AdHeader.kt | 3 ++- .../ui/screen/newtransfer/upload/components/Progress.kt | 3 +++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadProgressViewModel.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadProgressViewModel.kt index ca126f22aa..a49aee8599 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadProgressViewModel.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/UploadProgressViewModel.kt @@ -48,7 +48,7 @@ class UploadProgressViewModel @Inject constructor( }.stateIn( scope = viewModelScope, started = SharingStarted.Eagerly, - initialValue = UploadWorker.UploadProgressUiState.Default + initialValue = UploadWorker.UploadProgressUiState.Default, ) fun trackUploadProgress() { 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 79af03773a..a5dcbf8c1a 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 @@ -74,7 +74,7 @@ private fun ColumnScope.SuccessMessage(transferType: TransferTypeUi, transferUrl Column( modifier = Modifier .fillMaxWidth() - .weight(1f) + .weight(1.0f) .verticalScroll(rememberScrollState()) .padding(horizontal = Margin.Medium), horizontalAlignment = Alignment.CenterHorizontally, diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/AdHeader.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/AdHeader.kt index 5a43d2de7c..1b89a08753 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/AdHeader.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/AdHeader.kt @@ -40,7 +40,7 @@ fun ColumnScope.AdHeader(adScreenType: UploadProgressAdType) { Column( modifier = Modifier .fillMaxWidth() - .weight(1f) + .weight(1.0f) .verticalScroll(rememberScrollState()), horizontalAlignment = Alignment.CenterHorizontally, ) { @@ -53,6 +53,7 @@ fun ColumnScope.AdHeader(adScreenType: UploadProgressAdType) { ) Spacer(Modifier.height(Margin.Huge)) + Text( text = adScreenType.description(), modifier = Modifier.widthIn(max = Dimens.DescriptionWidth), diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/Progress.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/Progress.kt index 2a403fbcf8..7da176a48c 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/Progress.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/upload/components/Progress.kt @@ -41,6 +41,7 @@ fun Progress( TotalSize(totalSizeInBytes) } } + @Composable private fun Percentage(uploadedSizeInBytes: () -> Long, totalSizeInBytes: Long) { val percentageNoDecimals by remember { @@ -52,6 +53,7 @@ private fun Percentage(uploadedSizeInBytes: () -> Long, totalSizeInBytes: Long) Text("$percentageNoDecimals%") } + @Composable private fun UploadedSize(uploadedSizeInBytes: () -> Long) { val context = LocalContext.current @@ -61,6 +63,7 @@ private fun UploadedSize(uploadedSizeInBytes: () -> Long) { Text(humanReadableSize) } + @Composable private fun TotalSize(totalSizeInBytes: Long) { val context = LocalContext.current