Skip to content

Commit

Permalink
Merge pull request #43 from Myzel394/delete-recordings-immediately-an…
Browse files Browse the repository at this point in the history
…d-fix-dir

Delete recordings immediately and fix dir
  • Loading branch information
Myzel394 authored Oct 27, 2023
2 parents dd58ce2 + 68438a6 commit 66a54d8
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 185 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-app-google-play.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and publish app
name: Build and publish app to Google Play

on:
release:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun BitrateTile() {
fun BitrateTile(
settings: AppSettings,
) {
val scope = rememberCoroutineScope()
val showDialog = rememberUseCaseState()
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

fun updateValue(bitRate: Int) {
scope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@ import app.myzel394.alibi.ui.enums.Screen
@Composable
fun CustomNotificationTile(
navController: NavController,
settings: AppSettings,
) {
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

val label = if (settings.notificationSettings == null)
stringResource(R.string.ui_settings_option_customNotification_description_setup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ import app.myzel394.alibi.ui.components.atoms.SettingsTile
import kotlinx.coroutines.launch

@Composable
fun DeleteRecordingsImmediatelyTile() {
fun DeleteRecordingsImmediatelyTile(
settings: AppSettings,
) {
val scope = rememberCoroutineScope()

val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

SettingsTile(
title = stringResource(R.string.ui_settings_option_deleteRecordingsImmediately_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package app.myzel394.alibi.ui.components.SettingsScreen.atoms

import android.media.MediaRecorder
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AudioFile
import androidx.compose.material.icons.filled.Memory
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
Expand Down Expand Up @@ -35,17 +34,15 @@ import kotlinx.coroutines.launch
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun EncoderTile(
snackbarHostState: SnackbarHostState
snackbarHostState: SnackbarHostState,
settings: AppSettings,
) {
val scope = rememberCoroutineScope()
val showDialog = rememberUseCaseState()
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

val updatedOutputFormatLabel = stringResource(R.string.ui_settings_option_encoder_extra_outputFormatChanged)
val updatedOutputFormatLabel =
stringResource(R.string.ui_settings_option_encoder_extra_outputFormatChanged)

fun updateValue(encoder: Int?) {
scope.launch {
Expand Down Expand Up @@ -92,7 +89,7 @@ fun EncoderTile(
selected = settings.audioRecorderSettings.encoder == index,
)
}.toList()
) {index, option ->
) { index, _ ->
updateValue(index)
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ import kotlinx.coroutines.launch


@Composable
fun ForceExactMaxDurationTile() {
fun ForceExactMaxDurationTile(
settings: AppSettings,
) {
val scope = rememberCoroutineScope()
val showDialog = rememberUseCaseState()
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

fun updateValue(forceExactMaxDuration: Boolean) {
scope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.compose.ui.res.stringResource
import androidx.core.os.LocaleListCompat
import app.myzel394.alibi.R
import app.myzel394.alibi.SUPPORTED_LOCALES
import app.myzel394.alibi.db.AppSettings
import app.myzel394.alibi.db.AudioRecorderSettings
import app.myzel394.alibi.ui.components.atoms.SettingsTile
import app.myzel394.alibi.ui.utils.IconResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun IntervalDurationTile() {
fun IntervalDurationTile(
settings: AppSettings,
) {
val scope = rememberCoroutineScope()
val showDialog = rememberUseCaseState()
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

fun updateValue(intervalDuration: Long) {
scope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MaxDurationTile() {
fun MaxDurationTile(
settings: AppSettings,
) {
val scope = rememberCoroutineScope()
val showDialog = rememberUseCaseState()
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

fun updateValue(maxDuration: Long) {
scope.launch {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package app.myzel394.alibi.ui.components.SettingsScreen.atoms

import android.media.MediaRecorder
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AudioFile
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarVisuals
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
Expand All @@ -35,14 +29,12 @@ import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun OutputFormatTile() {
fun OutputFormatTile(
settings: AppSettings,
) {
val scope = rememberCoroutineScope()
val showDialog = rememberUseCaseState()
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value
val availableOptions = if (settings.audioRecorderSettings.encoder == null)
AudioRecorderSettings.OUTPUT_FORMAT_INDEX_TEXT_MAP.keys.toTypedArray()
else AudioRecorderSettings.ENCODER_SUPPORTED_OUTPUT_FORMATS_MAP[settings.audioRecorderSettings.encoder]!!
Expand Down Expand Up @@ -74,7 +66,7 @@ fun OutputFormatTile() {
selected = settings.audioRecorderSettings.outputFormat == option,
)
}.toList()
) {index, option ->
) { index, _ ->
updateValue(availableOptions[index])
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,12 @@ import kotlinx.coroutines.launch

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SamplingRateTile() {
fun SamplingRateTile(
settings: AppSettings,
) {
val scope = rememberCoroutineScope()
val showDialog = rememberUseCaseState()
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

fun updateValue(samplingRate: Int?) {
scope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ import kotlinx.coroutines.launch


@Composable
fun ShowAllMicrophonesTile() {
fun ShowAllMicrophonesTile(
settings: AppSettings,
) {
val scope = rememberCoroutineScope()
val dataStore = LocalContext.current.dataStore
val settings = dataStore
.data
.collectAsState(initial = AppSettings.getDefaultInstance())
.value

fun updateValue(showAllMicrophones: Boolean) {
scope.launch {
Expand Down
Loading

0 comments on commit 66a54d8

Please sign in to comment.