diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwipeToDismissComponent.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwipeToDismissComponent.kt index 7195584a8..5e57adef5 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwipeToDismissComponent.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/SwipeToDismissComponent.kt @@ -24,7 +24,11 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding -import androidx.compose.material3.* +import androidx.compose.material3.Icon +import androidx.compose.material3.Surface +import androidx.compose.material3.SwipeToDismissBox +import androidx.compose.material3.SwipeToDismissBoxValue.EndToStart +import androidx.compose.material3.rememberSwipeToDismissBoxState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment @@ -61,10 +65,10 @@ fun SwipeToDismissComponent( positionalThreshold = { totalDistance -> totalDistance * dismissThreshold }, ) - if (state.currentValue == SwipeToDismissBoxValue.EndToStart) onSwiped() + if (state.currentValue == EndToStart) onSwiped() val backgroundColor by animateColorAsState( - targetValue = if (state.targetValue == SwipeToDismissBoxValue.EndToStart) { + targetValue = if (state.targetValue == EndToStart) { SwissTransferTheme.colors.swipeDelete } else { SwissTransferTheme.colors.swipeDefault @@ -72,11 +76,11 @@ fun SwipeToDismissComponent( label = "Background color animation", ) val iconScale by animateFloatAsState( - targetValue = if (state.targetValue == SwipeToDismissBoxValue.EndToStart) maxIconScale else minIconScale, + targetValue = if (state.targetValue == EndToStart) maxIconScale else minIconScale, label = "Icon scale animation", ) val contentElevation by animateDpAsState( - targetValue = if (state.dismissDirection == SwipeToDismissBoxValue.EndToStart) swipedElevation else 0.dp, + targetValue = if (state.dismissDirection == EndToStart) swipedElevation else 0.dp, label = "Content elevation animation", ) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItemList.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItemList.kt index ab04d9ee4..6cec38fc2 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItemList.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/components/transfer/TransferItemList.kt @@ -47,11 +47,11 @@ fun TransferItemList( ) { val selectedTransferUuid = getSelectedTransferUuid() + val itemShape = CustomShapes.SMALL val titleRes = when (direction) { TransferDirection.SENT -> R.string.sentFilesTitle TransferDirection.RECEIVED -> R.string.receivedFilesTitle } - val itemShape = CustomShapes.SMALL LazyColumn( modifier = modifier, diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt index 2b0a985c5..2f7c9eaf4 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/received/ReceivedScreen.kt @@ -52,7 +52,7 @@ fun ReceivedScreen( navigateToDetails = navigateToDetails, getSelectedTransferUuid = getSelectedTransferUuid, getTransfers = { transfers!! }, - onSwiped = transfersViewModel::deleteSwipedTransfer, + onSwiped = transfersViewModel::deleteTransfer, ) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/sent/SentScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/sent/SentScreen.kt index 2d8b3d08e..a4a541c93 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/sent/SentScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/sent/SentScreen.kt @@ -59,7 +59,7 @@ fun SentScreen( navigateToDetails = navigateToDetails, getSelectedTransferUuid = getSelectedTransferUuid, getTransfers = { transfers!! }, - onSwiped = transfersViewModel::deleteSwipedTransfer, + onSwiped = transfersViewModel::deleteTransfer, ) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt index 10deeaea2..c48eb7160 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/transfers/TransfersViewModel.kt @@ -59,7 +59,7 @@ class TransfersViewModel @Inject constructor( } } - fun deleteSwipedTransfer(transferUuid: String) { + fun deleteTransfer(transferUuid: String) { viewModelScope.launch(ioDispatcher) { runCatching { transferManager.deleteTransfer(transferUuid)