chore: Add logging; fixes

Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
Myzel394 2024-03-29 14:39:34 +01:00
parent 03e80861e9
commit fa88f59170
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
3 changed files with 16 additions and 3 deletions

View File

@ -30,6 +30,7 @@ import app.myzel394.alibi.ui.screens.SettingsScreen
import app.myzel394.alibi.ui.screens.WelcomeScreen
const val SCALE_IN = 1.25f
const val DEBUG_SKIP_WELCOME = false;
@Composable
fun Navigation(
@ -58,7 +59,7 @@ fun Navigation(
modifier = Modifier
.background(MaterialTheme.colorScheme.background),
navController = navController,
startDestination = if (settings.hasSeenOnboarding) Screen.AudioRecorder.route else Screen.Welcome.route,
startDestination = if (settings.hasSeenOnboarding || DEBUG_SKIP_WELCOME) Screen.AudioRecorder.route else Screen.Welcome.route,
) {
composable(Screen.Welcome.route) {
WelcomeScreen(

View File

@ -248,7 +248,7 @@ fun RecorderEventsHandler(
}
// Register audio recorder events
DisposableEffect(key1 = audioRecorder, key2 = settings) {
DisposableEffect(Unit) {
audioRecorder.onRecordingSave = { cleanupOldFiles ->
saveRecording(audioRecorder as RecorderModel, cleanupOldFiles)
}
@ -291,7 +291,8 @@ fun RecorderEventsHandler(
}
// Register video recorder events
DisposableEffect(key1 = videoRecorder, key2 = settings) {
DisposableEffect(Unit) {
Log.d("Alibi", "===== Registering videoRecorder events $videoRecorder")
videoRecorder.onRecordingSave = { cleanupOldFiles ->
saveRecording(videoRecorder as RecorderModel, cleanupOldFiles)
}
@ -326,6 +327,7 @@ fun RecorderEventsHandler(
}
onDispose {
Log.d("Alibi", "===== Disposing videoRecorder events")
videoRecorder.onRecordingSave = {
throw NotImplementedError("onRecordingSave should not be called now")
}

View File

@ -1,6 +1,7 @@
package app.myzel394.alibi.ui.components.RecorderScreen.organisms
import android.content.res.Configuration
import android.util.Log
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@ -241,18 +242,27 @@ fun _PrimitiveControls(videoRecorder: VideoRecorderModel) {
}
},
onSaveAndStop = {
println("User initiated video recording save and stop")
scope.launch {
Log.d("Alibi", "====== Asking to stop recording...")
videoRecorder.stopRecording(context)
Log.d("Alibi", "====== Asking to stop recording... done")
Log.d("Alibi", "====== Updating data store...")
dataStore.updateData {
it.saveLastRecording(videoRecorder as RecorderModel)
}
Log.d("Alibi", "====== Updating data store... done")
Log.d("Alibi", "===== Asking to save recording...")
videoRecorder.onRecordingSave(false).join()
Log.d("Alibi", "===== Asking to save recording... done")
Log.d("Alibi", "===== Destroying service...")
runCatching {
videoRecorder.destroyService(context)
}
Log.d("Alibi", "===== Destroying service... done")
}
},
onSaveCurrent = {