Handle camera cache failures and remove unused photo submission wrapper

This commit is contained in:
evgeny committed 2026-10-28 12:08:06 +01:00
1 parent 684062c115
commit 3c74fc89fe
2 files changed
+4 -4

No files matched your search

@@ -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)
@@ -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 {