From a14a1a6078cf378cf88cdee2a681f138e9551020 Mon Sep 17 00:00:00 2001 From: Kevin Boulongne Date: Thu, 19 Dec 2024 07:49:34 +0100 Subject: [PATCH] refactor: Clean code --- .../infomaniak/swisstransfer/ui/components/HighlightedText.kt | 3 ++- .../swisstransfer/ui/components/transfer/TransferItem.kt | 4 +++- .../swisstransfer/ui/screen/main/settings/SettingsScreen.kt | 2 +- .../swisstransfer/ui/screen/newtransfer/NewTransferNavHost.kt | 2 +- .../ui/screen/newtransfer/importfiles/ImportFilesScreen.kt | 1 - .../com/infomaniak/swisstransfer/workers/UploadFileTask.kt | 1 - 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt index 414618e78..c7c4ffeda 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/HighlightedText.kt @@ -186,7 +186,8 @@ private fun TextLayoutResult.getBoundingBoxesForRange(start: Int, end: Int): Lis firstBoundingBoxRect = currentRect } - // Check if we reached the end of the current bounding box (i.e. if we reached a new line or the last character in the range) + // Check if we reached the end of the current bounding box + // (i.e. if we reached a new line or the last character in the range) if (previousRect != null && (areOnDifferentLines(previousRect, currentRect) || isLastCharacter)) { val lastBoundingBoxRect = if (isLastCharacter) currentRect else previousRect boundingBoxes.add(firstBoundingBoxRect.copy(right = lastBoundingBoxRect.right)) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItem.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItem.kt index 6454fa89a..0aafd71db 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItem.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItem.kt @@ -101,7 +101,9 @@ fun TransferItem( itemCount = files.count(), maxLines = 1, horizontalArrangement = Arrangement.spacedBy(Margin.Mini), - overflow = ContextualFlowRowOverflow.expandIndicator { TransferFilePreview(remainingFilesCount = totalItemCount - shownItemCount) }, + overflow = ContextualFlowRowOverflow.expandIndicator { + TransferFilePreview(remainingFilesCount = totalItemCount - shownItemCount) + }, ) { index -> TransferFilePreview(file = files[index]) } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt index cff6872c7..fafc20eca 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt @@ -17,6 +17,7 @@ */ package com.infomaniak.swisstransfer.ui.screen.main.settings +import android.os.Build import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState @@ -48,7 +49,6 @@ import com.infomaniak.swisstransfer.ui.theme.Margin import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme import com.infomaniak.swisstransfer.ui.utils.GetSetCallbacks import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows -import android.os.Build @Composable fun SettingsScreen( 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 6c04aad2e..1929e0861 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 @@ -61,7 +61,7 @@ fun NewTransferNavHost(navController: NavHostController, closeActivity: () -> Un UploadSuccessScreen( transferType = args.transferType, transferUrl = args.transferUrl, - closeActivity = closeActivity + closeActivity = closeActivity, ) } composable { 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 2e40b756b..4178ce1ce 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 @@ -93,7 +93,6 @@ fun ImportFilesScreen( resetSendActionResult = importFilesViewModel::resetSendActionResult, ) - LaunchedEffect(Unit) { importFilesViewModel.initTransferOptionsValues() } val transferOptionsCallbacks = importFilesViewModel.getTransferOptionsCallbacks( diff --git a/app/src/main/java/com/infomaniak/swisstransfer/workers/UploadFileTask.kt b/app/src/main/java/com/infomaniak/swisstransfer/workers/UploadFileTask.kt index 5fd620925..af00f30bd 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/workers/UploadFileTask.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/workers/UploadFileTask.kt @@ -52,7 +52,6 @@ class UploadFileTask( val totalChunks = fileChunkSizeManager.computeFileChunks(fileSize = uploadFileSession.size, fileChunkSize = chunkSize) val parallelChunks = fileChunkSizeManager.computeParallelChunks(fileChunkSize = chunkSize) - SentryLog.d(TAG, "chunkSize:$chunkSize | totalChunks:$totalChunks | parallelChunks:$parallelChunks") uploadFileSession.getLocalIoFile(uploadSession.uuid).inputStream().buffered().use { inputStream ->