Ukryj galerie wedlug ustawien
This commit is contained in:
@@ -12,8 +12,8 @@ android {
|
||||
applicationId = "pl.firmatpp.kierowca"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
versionCode = 6
|
||||
versionName = "1.0.5"
|
||||
versionCode = 7
|
||||
versionName = "1.0.6"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
buildConfigField("String", "API_BASE_URL", "\"https://api-intranet.firmatpp.pl/api/\"")
|
||||
|
||||
@@ -40,6 +40,7 @@ data class DriverAppSettingsDto(
|
||||
val selectedDate: String,
|
||||
val maxPastDays: Int,
|
||||
val autoRefreshSeconds: Int,
|
||||
val allowGalleryUploads: Boolean?,
|
||||
)
|
||||
|
||||
data class DriverSessionDto(
|
||||
|
||||
@@ -603,7 +603,7 @@ private fun DetailScreen(
|
||||
item {
|
||||
Text("Zdjecia ladunku", style = MaterialTheme.typography.titleLarge, fontWeight = FontWeight.Bold)
|
||||
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)
|
||||
cameraUri = newUri
|
||||
if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
||||
@@ -637,6 +637,7 @@ private fun ManifestSection(route: DriverRouteDto) {
|
||||
private fun PhotoGrid(
|
||||
photos: List<RoutePhotoDto>,
|
||||
imageAuthHeader: String?,
|
||||
allowGalleryUploads: Boolean,
|
||||
onPhoto: (RoutePhotoDto) -> Unit,
|
||||
onCamera: () -> Unit,
|
||||
onGallery: () -> Unit,
|
||||
@@ -648,7 +649,9 @@ private fun PhotoGrid(
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
) {
|
||||
item { ActionTile("Aparat", Icons.Outlined.CameraAlt, onCamera) }
|
||||
if (allowGalleryUploads) {
|
||||
item { ActionTile("Galeria", Icons.Outlined.AddPhotoAlternate, onGallery) }
|
||||
}
|
||||
items(photos, key = { it.id }) { photo ->
|
||||
AsyncImage(
|
||||
model = imageRequest(photo.url, imageAuthHeader),
|
||||
|
||||
@@ -29,6 +29,7 @@ data class DriverUiState(
|
||||
val minRouteDate: String = LocalDate.now().minusDays(7).toString(),
|
||||
val maxRouteDate: String = LocalDate.now().plusDays(1).toString(),
|
||||
val autoRefreshSeconds: Int = 60,
|
||||
val allowGalleryUploads: Boolean = true,
|
||||
val selectedRoute: DriverRouteDto? = null,
|
||||
val selectedPhoto: RoutePhotoDto? = null,
|
||||
val imageAuthHeader: String? = null,
|
||||
@@ -91,6 +92,7 @@ class DriverViewModel(application: Application) : AndroidViewModel(application)
|
||||
minRouteDate = settings?.minDate ?: it.minRouteDate,
|
||||
maxRouteDate = settings?.maxDate ?: it.maxRouteDate,
|
||||
autoRefreshSeconds = settings?.autoRefreshSeconds ?: it.autoRefreshSeconds,
|
||||
allowGalleryUploads = settings?.allowGalleryUploads ?: it.allowGalleryUploads,
|
||||
imageAuthHeader = repository.imageAuthHeader(),
|
||||
error = null,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user