From 3ce7ee033ba98b10ca5db41ca1157ef782d72204 Mon Sep 17 00:00:00 2001 From: Vincent TE Date: Fri, 22 Nov 2024 09:39:01 +0100 Subject: [PATCH] chore: Fix rebase --- .../main/transferdetails/TransferDetailsScreen.kt | 2 -- .../main/transferdetails/TransferDetailsViewModel.kt | 6 ------ .../main/transferdetails/components/TransferInfo.kt | 12 ++++++------ 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt index 2995c1e10..8c35f536d 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsScreen.kt @@ -76,8 +76,6 @@ fun TransferDetailsScreen( navigateBack?.invoke() } else if (!isLoading) { TransferDetailsScreen( - transferDetailsViewModel, - transferUuid, transferUrl = transferDetailsViewModel.getTransferUrl(transferUuid), direction = direction, navigateBack = navigateBack, diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsViewModel.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsViewModel.kt index d82705f78..2f6546adc 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsViewModel.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/TransferDetailsViewModel.kt @@ -60,12 +60,6 @@ class TransferDetailsViewModel @Inject constructor( fun getTransferUrl(transferUuid: String): String = sharedApiUrlCreator.shareTransferUrl(transferUuid) - fun removeTransfer(transferUuid: String) { - viewModelScope.launch { - transferManager.removeTransfer(transferUuid) - } - } - sealed class TransferDetailsUiState { @Immutable diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/components/TransferInfo.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/components/TransferInfo.kt index d2df17cdd..7c1ad3929 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/components/TransferInfo.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transferdetails/components/TransferInfo.kt @@ -48,10 +48,10 @@ import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme import com.infomaniak.swisstransfer.ui.utils.PreviewLightAndDark @Composable -fun TransferInfo(transfer: () -> TransferUi) { +fun TransferInfo(getTransfer: () -> TransferUi) { - val filesCount by remember { derivedStateOf { transfer().files.count() } } - val downloadedCount by remember { derivedStateOf { transfer().downloadLimit - transfer().downloadLeft } } + val filesCount by remember { derivedStateOf { getTransfer().files.count() } } + val downloadedCount by remember { derivedStateOf { getTransfer().downloadLimit - getTransfer().downloadLeft } } Row(verticalAlignment = Alignment.CenterVertically) { Icon( @@ -62,7 +62,7 @@ fun TransferInfo(transfer: () -> TransferUi) { Spacer(Modifier.width(Margin.Mini)) TextDotText( firstText = { pluralStringResource(R.plurals.filesCount, filesCount, filesCount) }, - secondText = { Formatter.formatShortFileSize(LocalContext.current, transfer().sizeUploaded) }, + secondText = { Formatter.formatShortFileSize(LocalContext.current, getTransfer().sizeUploaded) }, color = SwissTransferTheme.colors.primaryTextColor, ) } @@ -71,14 +71,14 @@ fun TransferInfo(transfer: () -> TransferUi) { IconText( icon = AppIcons.Clock, - text = stringResource(R.string.expiresIn, transfer().expiresInDays), + text = stringResource(R.string.expiresIn, getTransfer().expiresInDays), ) HorizontalDivider(modifier = Modifier.padding(vertical = Margin.Medium)) IconText( icon = AppIcons.ArrowDownFile, - text = stringResource(R.string.downloadedTransferLabel, downloadedCount, transfer().downloadLimit), + text = stringResource(R.string.downloadedTransferLabel, downloadedCount, getTransfer().downloadLimit), ) }