fix: FGS type for upload worker + cloud icon for server status

- DownloadWorker.createForegroundNotification now passes FOREGROUND_SERVICE_TYPE_DATA_SYNC
  (was defaulting to 'none' → InvalidForegroundServiceTypeException crash on upload)
- Dashcam file rows show CloudDone (green, on server) / CloudQueue (grey, not uploaded)
This commit is contained in:
Mathieu Moran
2026-08-12 15:33:32 -04:00
parent 8101663dd0
commit 0c81f1835d
2 changed files with 23 additions and 7 deletions
@@ -30,6 +30,8 @@ import androidx.compose.material3.Text
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Download import androidx.compose.material.icons.filled.Download
import androidx.compose.material.icons.filled.CloudDone
import androidx.compose.material.icons.filled.CloudQueue
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
@@ -255,14 +257,24 @@ private fun VideoRow(
color = MaterialTheme.colorScheme.primary color = MaterialTheme.colorScheme.primary
) )
} else { } else {
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(
if (video.uploaded) Icons.Filled.CloudDone else Icons.Filled.CloudQueue,
contentDescription = if (video.uploaded) "On server" else "Not on server",
tint = if (video.uploaded) MaterialTheme.colorScheme.primary
else MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(16.dp)
)
Spacer(Modifier.width(4.dp))
Text( Text(
text = if (video.uploaded) "Uploaded" else "Pending", text = if (video.uploaded) "On server" else "Not uploaded",
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
color = if (video.uploaded) MaterialTheme.colorScheme.primary color = if (video.uploaded) MaterialTheme.colorScheme.primary
else MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.onSurfaceVariant
) )
} }
} }
}
// Actions // Actions
Row { Row {
@@ -75,7 +75,11 @@ class DownloadWorker(
.setContentIntent(pendingIntent) .setContentIntent(pendingIntent)
.setContentText("$progress%") .setContentText("$progress%")
.setProgress(100, progress, progress == 0) .setProgress(100, progress, progress == 0)
return ForegroundInfo(NOTIFICATION_ID_BASE, builder.build()) return ForegroundInfo(
NOTIFICATION_ID_BASE,
builder.build(),
android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC,
)
} }
} }