Kamera funktionalität

-AlbumAndroidViewModel
-AlbumEvents
-AlbumViewModel
-AlbumViewState
-file_patchs
SelectPictureScree.kt wurde gelöscht. Die Funktionanlität  AlbumScreen() wurde in ReportOverlay neu aufgebaut.
This commit is contained in:
2025-12-17 22:26:26 +01:00
parent 9048d31413
commit c644361ab8
12 changed files with 431 additions and 34 deletions

View File

@@ -32,19 +32,21 @@ class AlbumViewModel(private val coroutineContext: CoroutineContext
fun onReceive(intent: Intent) = viewModelScope.launch(coroutineContext) {
when(intent) {
is Intent.OnPermissionGrantedWith -> {
// Create an empty image file in the app's cache directory
println("DEBUG: OnPermissionGrantedWith empfangen")
val tempFile = File.createTempFile(
"temp_image_file_", /* prefix */
".jpg", /* suffix */
intent.compositionContext.cacheDir /* cache directory */
"temp_image_file_",
".jpg",
intent.compositionContext.cacheDir
)
println("DEBUG: TempFile erstellt: ${tempFile.absolutePath}")
// Create sandboxed url for this temp file - needed for the camera API
val uri = FileProvider.getUriForFile(intent.compositionContext,
"${BuildConfig.APPLICATION_ID}.provider", /* needs to match the provider information in the manifest */
"${BuildConfig.APPLICATION_ID}.provider",
tempFile
)
println("DEBUG: URI erstellt: $uri")
_albumViewState.value = _albumViewState.value.copy(tempFileUrl = uri)
println("DEBUG: tempFileUrl gesetzt in ViewState")
}
is Intent.OnPermissionDenied -> {