Compare commits

..
1 Commits
Author SHA1 Message Date
admin 18baec5020 Ukryj galerie wedlug ustawien 2026-06-30 21:52:29 +02:00
4 changed files with 10 additions and 4 deletions
+2 -2
View File
@@ -12,8 +12,8 @@ android {
applicationId = "pl.firmatpp.kierowca" applicationId = "pl.firmatpp.kierowca"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 6 versionCode = 7
versionName = "1.0.5" versionName = "1.0.6"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "API_BASE_URL", "\"https://api-intranet.firmatpp.pl/api/\"") buildConfigField("String", "API_BASE_URL", "\"https://api-intranet.firmatpp.pl/api/\"")
@@ -40,6 +40,7 @@ data class DriverAppSettingsDto(
val selectedDate: String, val selectedDate: String,
val maxPastDays: Int, val maxPastDays: Int,
val autoRefreshSeconds: Int, val autoRefreshSeconds: Int,
val allowGalleryUploads: Boolean?,
) )
data class DriverSessionDto( data class DriverSessionDto(
@@ -603,7 +603,7 @@ private fun DetailScreen(
item { item {
Text("Zdjecia ladunku", style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.Bold) Text("Zdjecia ladunku", style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.Bold)
Spacer(Modifier.height(12.dp)) Spacer(Modifier.height(12.dp))
PhotoGrid(route.photos, state.imageAuthHeader, onPhoto, onCamera = { PhotoGrid(route.photos, state.imageAuthHeader, state.allowGalleryUploads, onPhoto, onCamera = {
val newUri = createCameraUri(context) val newUri = createCameraUri(context)
cameraUri = newUri cameraUri = newUri
if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
@@ -637,6 +637,7 @@ private fun ManifestSection(route: DriverRouteDto) {
private fun PhotoGrid( private fun PhotoGrid(
photos: List<RoutePhotoDto>, photos: List<RoutePhotoDto>,
imageAuthHeader: String?, imageAuthHeader: String?,
allowGalleryUploads: Boolean,
onPhoto: (RoutePhotoDto) -> Unit, onPhoto: (RoutePhotoDto) -> Unit,
onCamera: () -> Unit, onCamera: () -> Unit,
onGallery: () -> Unit, onGallery: () -> Unit,
@@ -648,7 +649,9 @@ private fun PhotoGrid(
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp),
) { ) {
item { ActionTile("Aparat", Icons.Outlined.CameraAlt, onCamera) } item { ActionTile("Aparat", Icons.Outlined.CameraAlt, onCamera) }
if (allowGalleryUploads) {
item { ActionTile("Galeria", Icons.Outlined.AddPhotoAlternate, onGallery) } item { ActionTile("Galeria", Icons.Outlined.AddPhotoAlternate, onGallery) }
}
items(photos, key = { it.id }) { photo -> items(photos, key = { it.id }) { photo ->
AsyncImage( AsyncImage(
model = imageRequest(photo.url, imageAuthHeader), model = imageRequest(photo.url, imageAuthHeader),
@@ -29,6 +29,7 @@ data class DriverUiState(
val minRouteDate: String = LocalDate.now().minusDays(7).toString(), val minRouteDate: String = LocalDate.now().minusDays(7).toString(),
val maxRouteDate: String = LocalDate.now().plusDays(1).toString(), val maxRouteDate: String = LocalDate.now().plusDays(1).toString(),
val autoRefreshSeconds: Int = 60, val autoRefreshSeconds: Int = 60,
val allowGalleryUploads: Boolean = true,
val selectedRoute: DriverRouteDto? = null, val selectedRoute: DriverRouteDto? = null,
val selectedPhoto: RoutePhotoDto? = null, val selectedPhoto: RoutePhotoDto? = null,
val imageAuthHeader: String? = null, val imageAuthHeader: String? = null,
@@ -91,6 +92,7 @@ class DriverViewModel(application: Application) : AndroidViewModel(application)
minRouteDate = settings?.minDate ?: it.minRouteDate, minRouteDate = settings?.minDate ?: it.minRouteDate,
maxRouteDate = settings?.maxDate ?: it.maxRouteDate, maxRouteDate = settings?.maxDate ?: it.maxRouteDate,
autoRefreshSeconds = settings?.autoRefreshSeconds ?: it.autoRefreshSeconds, autoRefreshSeconds = settings?.autoRefreshSeconds ?: it.autoRefreshSeconds,
allowGalleryUploads = settings?.allowGalleryUploads ?: it.allowGalleryUploads,
imageAuthHeader = repository.imageAuthHeader(), imageAuthHeader = repository.imageAuthHeader(),
error = null, error = null,
) )