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.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
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.utils.KeepScreenOn
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.time.LocalDateTime
@Composable
@ -40,6 +42,8 @@ fun RecordingStatus(
) {
val context = LocalContext.current
val scope = rememberCoroutineScope()
var now by remember { mutableStateOf(LocalDateTime.now()) }
LaunchedEffect(Unit) {
@ -97,8 +101,10 @@ fun RecordingStatus(
) {
DeleteButton(
onDelete = {
//audioRecorder.stopRecording(context)
audioRecorder.batchesFolder!!.deleteRecordings();
scope.launch {
audioRecorder.stopRecording(context)
audioRecorder.batchesFolder!!.deleteRecordings()
}
}
)
}
@ -126,10 +132,12 @@ fun RecordingStatus(
) {
SaveButton(
onSave = {
runCatching {
//audioRecorder.stopRecording(context)
scope.launch {
runCatching {
audioRecorder.stopRecording(context)
}
audioRecorder.onRecordingSave()
}
audioRecorder.onRecordingSave()
}
)
}

View File

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