android: fix voice recording — init g_rec, move includes, check startRecording result

- voice_recorder_init(db_path) in utun_bridge_init (was never called, g_rec stayed NULL)
- voice_recorder_deinit() in utun_bridge_destroy
- ViewModel: set _isRecording only after startRecording() succeeds
This commit is contained in:
evgeny committed 2026-07-28 23:52:33 +03:00
1 parent 50214d50c1
commit fc2adcf81d
2 files changed
+8 -4

No files matched your search

@@ -195,11 +195,14 @@ class ChatViewModel : ViewModel() {
fun startVoiceRecording() {
val ch = _currentChannel.value ?: return
if (!audioRecorder.startRecording(ch.id)) {
LogManager.addLog("ERROR", "VM", "voice recording failed to start")
return
}
_isRecording.value = true
_isRecordingLocked.value = false
recordingStartTimeMs = System.currentTimeMillis()
_recordingDurationMs.value = 0
audioRecorder.startRecording(ch.id)
LogManager.addLog("INFO", "VM", "voice recording started ch=${ch.id}")
}