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.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,12 +257,22 @@ private fun VideoRow(
|
|||||||
color = MaterialTheme.colorScheme.primary
|
color = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
Text(
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
text = if (video.uploaded) "Uploaded" else "Pending",
|
Icon(
|
||||||
style = MaterialTheme.typography.bodySmall,
|
if (video.uploaded) Icons.Filled.CloudDone else Icons.Filled.CloudQueue,
|
||||||
color = if (video.uploaded) MaterialTheme.colorScheme.primary
|
contentDescription = if (video.uploaded) "On server" else "Not on server",
|
||||||
else MaterialTheme.colorScheme.error
|
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) "On server" else "Not uploaded",
|
||||||
|
style = MaterialTheme.typography.bodySmall,
|
||||||
|
color = if (video.uploaded) MaterialTheme.colorScheme.primary
|
||||||
|
else MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user