diff --git a/src/main/kotlin/com/bolenpad/photophetch/transfer/Copier.kt b/src/main/kotlin/com/bolenpad/photophetch/transfer/Copier.kt index 4d9cb56..e90f922 100644 --- a/src/main/kotlin/com/bolenpad/photophetch/transfer/Copier.kt +++ b/src/main/kotlin/com/bolenpad/photophetch/transfer/Copier.kt @@ -143,7 +143,11 @@ class Copier( destSha256 = destHash, verified = verified, convertedFromHeic = wasConverted, - error = if (!verified) "Hash mismatch — file may be corrupt" else null, + error = when { + !verified && remoteHash != null -> "Hash mismatch — file may be corrupt" + !verified -> "Copy failed — file missing or empty" + else -> null + }, ) } catch (e: Exception) { pulledFile?.deleteIfExists() diff --git a/src/main/kotlin/com/bolenpad/photophetch/ui/VerifyScreen.kt b/src/main/kotlin/com/bolenpad/photophetch/ui/VerifyScreen.kt index a0cdcff..444fad6 100644 --- a/src/main/kotlin/com/bolenpad/photophetch/ui/VerifyScreen.kt +++ b/src/main/kotlin/com/bolenpad/photophetch/ui/VerifyScreen.kt @@ -224,16 +224,27 @@ private fun ResultSummaryHeader(success: Int, failure: Int, destination: String) @Composable private fun CopyResultRow(result: CopyResult) { + val hasRemoteHash = result.sourceSha256 != "(not available)" + val isVerifiedWithHash = result.verified && result.error == null && hasRemoteHash + val isVerifiedNoHash = result.verified && result.error == null && !hasRemoteHash + val isFailed = result.error != null || !result.verified + Row( modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically, ) { Icon( - if (result.verified && result.error == null) Icons.Default.CheckCircle else Icons.Default.Error, + when { + isFailed -> Icons.Default.Error + else -> Icons.Default.CheckCircle + }, contentDescription = null, - tint = if (result.verified && result.error == null) - MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.error, + tint = when { + isFailed -> MaterialTheme.colorScheme.error + isVerifiedWithHash -> MaterialTheme.colorScheme.primary + else -> MaterialTheme.colorScheme.secondary // verified, no hash + }, modifier = Modifier.size(18.dp), ) Column(modifier = Modifier.weight(1f)) { @@ -241,16 +252,18 @@ private fun CopyResultRow(result: CopyResult) { "${result.photo.filename} → ${result.destinationPath.fileName}" else result.photo.filename Text(displayName, style = MaterialTheme.typography.bodySmall, fontWeight = FontWeight.Medium) - if (result.error != null) { - Text(result.error, style = MaterialTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.error) - } else { - Text( - "${result.photo.sizeBytes / 1024} KB • SHA-256: ${result.destSha256.take(12)}…", - style = MaterialTheme.typography.labelSmall, - color = MaterialTheme.colorScheme.onSurfaceVariant, - ) - } + Text( + when { + isFailed -> result.error ?: "Failed" + isVerifiedWithHash -> "SHA-256 verified · ${result.photo.sizeBytes / 1024} KB" + else -> "Copied · ${result.photo.sizeBytes / 1024} KB (no remote checksum)" + }, + style = MaterialTheme.typography.labelSmall, + color = when { + isFailed -> MaterialTheme.colorScheme.error + else -> MaterialTheme.colorScheme.onSurfaceVariant + }, + ) } } }