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) {
|
||||
Spacer(Modifier.height(8.dp))
|
||||
if (dl.progress > 0) {
|
||||
LinearProgressIndicator(
|
||||
progress = { dl.progress / 100f },
|
||||
modifier = Modifier.fillMaxWidth().height(6.dp).clip(RoundedCornerShape(3.dp)),
|
||||
color = MaterialTheme.colorScheme.tertiary,
|
||||
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) {
|
||||
CircularProgressIndicator(modifier = Modifier.size(20.dp), strokeWidth = 2.dp, color = MaterialTheme.colorScheme.error)
|
||||
} else {
|
||||
if (credentialsConfigured) {
|
||||
if (credentialsConfigured && file.name !in uploadedNames) {
|
||||
IconButton(onClick = { onUpload(file) }) {
|
||||
Icon(Icons.Filled.CloudUpload, "Upload", tint = MaterialTheme.colorScheme.tertiary)
|
||||
}
|
||||
@@ -248,7 +257,7 @@ fun DownloadsScreen(
|
||||
private fun uploadLabel(dl: ActiveDownload): String {
|
||||
val pct = "${dl.progress}%"
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user