Skip to content

Commit

Permalink
chore: Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Nov 19, 2024
1 parent 388b9c0 commit 811cc53
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ enum class TransferTypeUi(
);

companion object {
fun TransferType.toTransferTypeUi() = when(this) {
fun TransferType.toTransferTypeUi() = when (this) {
TransferType.LINK -> LINK
TransferType.QR_CODE -> QR_CODE
TransferType.PROXIMITY -> PROXIMITY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class UploadProgressViewModel @Inject constructor(
}.stateIn(
scope = viewModelScope,
started = SharingStarted.Eagerly,
initialValue = UploadWorker.UploadProgressUiState.Default
initialValue = UploadWorker.UploadProgressUiState.Default,
)

fun trackUploadProgress() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fun ColumnScope.AdHeader(adScreenType: UploadProgressAdType) {
Column(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
.weight(1.0f)
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
) {
Expand All @@ -53,6 +53,7 @@ fun ColumnScope.AdHeader(adScreenType: UploadProgressAdType) {
)

Spacer(Modifier.height(Margin.Huge))

Text(
text = adScreenType.description(),
modifier = Modifier.widthIn(max = Dimens.DescriptionWidth),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fun Progress(
TotalSize(totalSizeInBytes)
}
}

@Composable
private fun Percentage(uploadedSizeInBytes: () -> Long, totalSizeInBytes: Long) {
val percentageNoDecimals by remember {
Expand All @@ -52,6 +53,7 @@ private fun Percentage(uploadedSizeInBytes: () -> Long, totalSizeInBytes: Long)

Text("$percentageNoDecimals%")
}

@Composable
private fun UploadedSize(uploadedSizeInBytes: () -> Long) {
val context = LocalContext.current
Expand All @@ -61,6 +63,7 @@ private fun UploadedSize(uploadedSizeInBytes: () -> Long) {

Text(humanReadableSize)
}

@Composable
private fun TotalSize(totalSizeInBytes: Long) {
val context = LocalContext.current
Expand Down

0 comments on commit 811cc53

Please sign in to comment.