mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
fix: Fix custom BatchesFolder
This commit is contained in:
parent
79ba18630c
commit
18195c9893
@ -62,7 +62,7 @@ data class BatchesFolder(
|
||||
.map {
|
||||
FFmpegKitConfig.getSafParameterForRead(
|
||||
context,
|
||||
customFolder!!.findFile(it.name!!)!!.uri
|
||||
it.uri,
|
||||
)!!
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,10 @@ data class BatchesFolder(
|
||||
BatchType.INTERNAL -> File(getInternalFolder(), "$name.$extension").absolutePath
|
||||
BatchType.CUSTOM -> FFmpegKitConfig.getSafParameterForWrite(
|
||||
context,
|
||||
customFolder!!.createFile("audio/${extension}", "${name}.${extension}")!!.uri
|
||||
getCustomDefinedFolder().createFile(
|
||||
"audio/${extension}",
|
||||
"${name}.${extension}"
|
||||
)!!.uri
|
||||
)!!
|
||||
}
|
||||
}
|
||||
@ -97,9 +100,7 @@ data class BatchesFolder(
|
||||
fun deleteRecordings() {
|
||||
when (type) {
|
||||
BatchType.INTERNAL -> getInternalFolder().deleteRecursively()
|
||||
BatchType.CUSTOM -> getCustomDefinedFolder().listFiles().forEach {
|
||||
it.delete()
|
||||
}
|
||||
BatchType.CUSTOM -> customFolder?.findFile(subfolderName)?.delete()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,6 @@ class AudioRecorderModel : ViewModel() {
|
||||
override fun onServiceConnected(className: ComponentName, service: IBinder) {
|
||||
recorderService =
|
||||
((service as RecorderService.RecorderBinder).getService() as AudioRecorderService).also { recorder ->
|
||||
recorder.clearAllRecordings()
|
||||
|
||||
// Init variables from us to the service
|
||||
recorder.onStateChange = { state ->
|
||||
recorderState = state
|
||||
@ -95,6 +93,8 @@ class AudioRecorderModel : ViewModel() {
|
||||
recorder.batchesFolder = batchesFolder ?: recorder.batchesFolder
|
||||
recorder.settings =
|
||||
IntervalRecorderService.Settings.from(settings.audioRecorderSettings)
|
||||
|
||||
recorder.clearAllRecordings()
|
||||
}.also {
|
||||
// Init UI from the service
|
||||
it.startRecording()
|
||||
@ -122,8 +122,8 @@ class AudioRecorderModel : ViewModel() {
|
||||
|
||||
fun startRecording(context: Context, settings: AppSettings) {
|
||||
runCatching {
|
||||
context.unbindService(connection)
|
||||
recorderService?.clearAllRecordings()
|
||||
context.unbindService(connection)
|
||||
}
|
||||
|
||||
notificationDetails = settings.notificationSettings.let {
|
||||
|
Loading…
x
Reference in New Issue
Block a user