diff --git a/tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt b/tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt index 54e21d69..bf54d4a6 100644 --- a/tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt +++ b/tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt @@ -370,8 +370,6 @@ class ChatRepository { fun sendAttachment(channelId: String, filePath: String) = NativeLib.attachmentSend(channelId, filePath) fun sendVideo(channelId: String, filePath: String, durationMs: Int, width: Int, height: Int) = NativeLib.videoSend(channelId, filePath, durationMs, width, height) - fun sendPhoto(channelId: String, filePath: String, width: Int, height: Int) = - NativeLib.photoSend(channelId, filePath, width, height) fun createChannel(name: String, channelId: String) = NativeLib.createChannel(name, channelId) fun connectNode(address: String, port: Int, pubkeyHex: String) = NativeLib.connectNode(address, port, pubkeyHex) fun joinChannel(link: String, request: Long): Int = NativeLib.joinChannel(link, request) diff --git a/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/CameraRecordScreen.kt b/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/CameraRecordScreen.kt index ce89e34d..53ca8bb6 100644 --- a/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/CameraRecordScreen.kt +++ b/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/CameraRecordScreen.kt @@ -188,7 +188,8 @@ fun CameraRecordScreen(initialMode: CaptureMode, onSend: (String, CaptureMode) - fun capturePhoto() { if (phase != CapturePhase.IDLE || camera == null) return - val file = File.createTempFile("photo_msg_", ".jpg", context.cacheDir) + val file = try { File.createTempFile("photo_msg_", ".jpg", context.cacheDir) } + catch (e: Exception) { error = true; LogManager.addLog("ERROR", "Capture", "Photo cache failed: ${e.message}"); return } output = file; phase = CapturePhase.CAPTURING; error = false imageCapture.targetRotation = view.display?.rotation ?: android.view.Surface.ROTATION_0 try { @@ -212,7 +213,8 @@ fun CameraRecordScreen(initialMode: CaptureMode, onSend: (String, CaptureMode) - } fun startVideo() { if (phase != CapturePhase.IDLE || camera == null || !hasAudio) return - val file = File.createTempFile("video_msg_", ".mp4", context.cacheDir) + val file = try { File.createTempFile("video_msg_", ".mp4", context.cacheDir) } + catch (e: Exception) { error = true; LogManager.addLog("ERROR", "Capture", "Video cache failed: ${e.message}"); return } output = file; phase = CapturePhase.CAPTURING; elapsed = 0; error = false videoCapture.targetRotation = view.display?.rotation ?: android.view.Surface.ROTATION_0 try {