Skip to content

Commit

Permalink
review: Use derivedStateOf {…} for TransferInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Nov 7, 2024
1 parent e71cf27 commit 0c57b4e
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ import androidx.annotation.StringRes
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
Expand Down Expand Up @@ -147,7 +144,7 @@ fun TransferDetailsScreen(
) {
Column {
Spacer(modifier = Modifier.height(Margin.Large))
TransferInfos(transfer)
TransferInfo(transfer)
TransferMessage(transfer, transferSenderEmail)
Spacer(modifier = Modifier.height(Margin.Large))
TransferContentHeader()
Expand Down Expand Up @@ -176,10 +173,10 @@ fun TransferDetailsScreen(
}

@Composable
private fun TransferInfos(transfer: TransferUi) {
private fun TransferInfo(transfer: TransferUi) {

val filesCount = transfer.files.count()
val downloadedCount = transfer.downloadLimit - transfer.downloadLeft
val filesCount by remember { derivedStateOf { transfer.files.count() } }
val downloadedCount by remember { derivedStateOf { transfer.downloadLimit - transfer.downloadLeft } }

Row(verticalAlignment = Alignment.CenterVertically) {
Icon(
Expand Down

0 comments on commit 0c57b4e

Please sign in to comment.