feat: block re-upload of files already on server + visible upload progress
- Hide upload button when file is in uploadedNames (already on server) - UploadWorker still guards via /status already_uploaded check - Indeterminate progress bar during Hashing/Checking phases - Upload label always shows percentage
This commit is contained in:
@@ -120,12 +120,21 @@ fun DownloadsScreen(
|
|||||||
}
|
}
|
||||||
if (!dl.done) {
|
if (!dl.done) {
|
||||||
Spacer(Modifier.height(8.dp))
|
Spacer(Modifier.height(8.dp))
|
||||||
|
if (dl.progress > 0) {
|
||||||
LinearProgressIndicator(
|
LinearProgressIndicator(
|
||||||
progress = { dl.progress / 100f },
|
progress = { dl.progress / 100f },
|
||||||
modifier = Modifier.fillMaxWidth().height(6.dp).clip(RoundedCornerShape(3.dp)),
|
modifier = Modifier.fillMaxWidth().height(6.dp).clip(RoundedCornerShape(3.dp)),
|
||||||
color = MaterialTheme.colorScheme.tertiary,
|
color = MaterialTheme.colorScheme.tertiary,
|
||||||
trackColor = MaterialTheme.colorScheme.surfaceVariant,
|
trackColor = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
// Indeterminate bar so hashing/checking phases show visible activity
|
||||||
|
LinearProgressIndicator(
|
||||||
|
modifier = Modifier.fillMaxWidth().height(6.dp).clip(RoundedCornerShape(3.dp)),
|
||||||
|
color = MaterialTheme.colorScheme.tertiary,
|
||||||
|
trackColor = MaterialTheme.colorScheme.surfaceVariant,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,7 +237,7 @@ fun DownloadsScreen(
|
|||||||
if (isDeleting) {
|
if (isDeleting) {
|
||||||
CircularProgressIndicator(modifier = Modifier.size(20.dp), strokeWidth = 2.dp, color = MaterialTheme.colorScheme.error)
|
CircularProgressIndicator(modifier = Modifier.size(20.dp), strokeWidth = 2.dp, color = MaterialTheme.colorScheme.error)
|
||||||
} else {
|
} else {
|
||||||
if (credentialsConfigured) {
|
if (credentialsConfigured && file.name !in uploadedNames) {
|
||||||
IconButton(onClick = { onUpload(file) }) {
|
IconButton(onClick = { onUpload(file) }) {
|
||||||
Icon(Icons.Filled.CloudUpload, "Upload", tint = MaterialTheme.colorScheme.tertiary)
|
Icon(Icons.Filled.CloudUpload, "Upload", tint = MaterialTheme.colorScheme.tertiary)
|
||||||
}
|
}
|
||||||
@@ -248,7 +257,7 @@ fun DownloadsScreen(
|
|||||||
private fun uploadLabel(dl: ActiveDownload): String {
|
private fun uploadLabel(dl: ActiveDownload): String {
|
||||||
val pct = "${dl.progress}%"
|
val pct = "${dl.progress}%"
|
||||||
val status = dl.status ?: return pct
|
val status = dl.status ?: return pct
|
||||||
return if (dl.progress > 0) "$status · $pct" else status
|
return "$status · $pct"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatSize(bytes: Long): String = when {
|
private fun formatSize(bytes: Long): String = when {
|
||||||
|
|||||||
Reference in New Issue
Block a user