feat: FEATURE_CAMERA_ENABLED compile flag für KI-Kamera
- build.gradle.kts: buildConfigField FEATURE_CAMERA_ENABLED (default: true) - ItemListScreen: Camera-Icon nur wenn Flag gesetzt, onCameraClick optional - KrisenvorratNavGraph: CameraCapture-Route und Lambda nur wenn Flag gesetzt - SettingsScreen: KI-Erkennung-Section nur wenn Flag gesetzt
This commit is contained in:
parent
dd571f46fc
commit
809e6aa069
4 changed files with 46 additions and 37 deletions
|
|
@ -19,6 +19,7 @@ android {
|
||||||
versionName = "1.2"
|
versionName = "1.2"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
buildConfigField("boolean", "FEATURE_CAMERA_ENABLED", "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ internal fun ItemListScreen(
|
||||||
onItemClick: (String) -> Unit,
|
onItemClick: (String) -> Unit,
|
||||||
onCategoriesClick: () -> Unit,
|
onCategoriesClick: () -> Unit,
|
||||||
onLocationsClick: () -> Unit,
|
onLocationsClick: () -> Unit,
|
||||||
onCameraClick: () -> Unit,
|
onCameraClick: () -> Unit = {},
|
||||||
viewModel: ItemListViewModel = hiltViewModel()
|
viewModel: ItemListViewModel = hiltViewModel()
|
||||||
) {
|
) {
|
||||||
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
||||||
|
|
@ -61,12 +61,14 @@ internal fun ItemListScreen(
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Artikel") },
|
title = { Text("Artikel") },
|
||||||
actions = {
|
actions = {
|
||||||
|
if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||||
IconButton(onClick = onCameraClick) {
|
IconButton(onClick = onCameraClick) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.PhotoCamera,
|
imageVector = Icons.Default.PhotoCamera,
|
||||||
contentDescription = "Foto erfassen"
|
contentDescription = "Foto erfassen"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
IconButton(onClick = { isMenuExpanded = true }) {
|
IconButton(onClick = { isMenuExpanded = true }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.MoreVert,
|
imageVector = Icons.Default.MoreVert,
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,10 @@ internal fun KrisenvorratNavGraph(
|
||||||
onLocationsClick = {
|
onLocationsClick = {
|
||||||
navController.navigate(Screen.LocationManagement)
|
navController.navigate(Screen.LocationManagement)
|
||||||
},
|
},
|
||||||
onCameraClick = {
|
onCameraClick = if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||||
navController.navigate(Screen.CameraCapture)
|
{ navController.navigate(Screen.CameraCapture) }
|
||||||
|
} else {
|
||||||
|
{}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -56,6 +58,7 @@ internal fun KrisenvorratNavGraph(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||||
composable<Screen.CameraCapture> {
|
composable<Screen.CameraCapture> {
|
||||||
CameraScreen(
|
CameraScreen(
|
||||||
onNavigateToItemForm = { prefillJson ->
|
onNavigateToItemForm = { prefillJson ->
|
||||||
|
|
@ -64,6 +67,7 @@ internal fun KrisenvorratNavGraph(
|
||||||
onNavigateBack = { navController.popBackStack() }
|
onNavigateBack = { navController.popBackStack() }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
composable<Screen.CategoryManagement> {
|
composable<Screen.CategoryManagement> {
|
||||||
CategoryListScreen(
|
CategoryListScreen(
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,7 @@ internal fun SettingsScreen(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (de.krisenvorrat.app.BuildConfig.FEATURE_CAMERA_ENABLED) {
|
||||||
Spacer(modifier = Modifier.height(32.dp))
|
Spacer(modifier = Modifier.height(32.dp))
|
||||||
|
|
||||||
HorizontalDivider()
|
HorizontalDivider()
|
||||||
|
|
@ -348,6 +349,7 @@ internal fun SettingsScreen(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (uiState.pendingImportUri != null) {
|
if (uiState.pendingImportUri != null) {
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue