fix: Uncomment stopRecording on AudioRecorderService

This commit is contained in:
Myzel394 2023-12-05 18:40:33 +01:00
parent 699acb5311
commit 4d2d73d562
No known key found for this signature in database
GPG Key ID: 79CC92F37B3E1A2B
2 changed files with 13 additions and 6 deletions

View File

@ -18,6 +18,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
@ -32,6 +33,7 @@ import app.myzel394.alibi.ui.components.RecorderScreen.molecules.MicrophoneStatu
import app.myzel394.alibi.ui.models.AudioRecorderModel import app.myzel394.alibi.ui.models.AudioRecorderModel
import app.myzel394.alibi.ui.utils.KeepScreenOn import app.myzel394.alibi.ui.utils.KeepScreenOn
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.time.LocalDateTime import java.time.LocalDateTime
@Composable @Composable
@ -40,6 +42,8 @@ fun RecordingStatus(
) { ) {
val context = LocalContext.current val context = LocalContext.current
val scope = rememberCoroutineScope()
var now by remember { mutableStateOf(LocalDateTime.now()) } var now by remember { mutableStateOf(LocalDateTime.now()) }
LaunchedEffect(Unit) { LaunchedEffect(Unit) {
@ -97,8 +101,10 @@ fun RecordingStatus(
) { ) {
DeleteButton( DeleteButton(
onDelete = { onDelete = {
//audioRecorder.stopRecording(context) scope.launch {
audioRecorder.batchesFolder!!.deleteRecordings(); audioRecorder.stopRecording(context)
audioRecorder.batchesFolder!!.deleteRecordings()
}
} }
) )
} }
@ -126,11 +132,13 @@ fun RecordingStatus(
) { ) {
SaveButton( SaveButton(
onSave = { onSave = {
scope.launch {
runCatching { runCatching {
//audioRecorder.stopRecording(context) audioRecorder.stopRecording(context)
} }
audioRecorder.onRecordingSave() audioRecorder.onRecordingSave()
} }
}
) )
} }
} }

View File

@ -180,7 +180,6 @@ fun RecorderScreen(
audioRecorder.onError = { audioRecorder.onError = {
saveAsLastRecording() saveAsLastRecording()
//audioRecorder.stopRecording(context)
showRecorderError = true showRecorderError = true
} }