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:
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}")
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user