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:
@@ -30,6 +30,8 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
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.LaunchedEffect
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -255,14 +257,24 @@ private fun VideoRow(
|
||||
color = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
} 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 = if (video.uploaded) "Uploaded" else "Pending",
|
||||
text = if (video.uploaded) "On server" else "Not uploaded",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = if (video.uploaded) MaterialTheme.colorScheme.primary
|
||||
else MaterialTheme.colorScheme.error
|
||||
else MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
Row {
|
||||
|
||||
@@ -75,7 +75,11 @@ class DownloadWorker(
|
||||
.setContentIntent(pendingIntent)
|
||||
.setContentText("$progress%")
|
||||
.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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user