refactor: Use constants instead of hardcoded values

This commit is contained in:
Myzel394 2023-12-30 21:07:30 +01:00
parent 7c6e44dd69
commit 9d4345c2d1
No known key found for this signature in database
GPG Key ID: 79CC92F37B3E1A2B
3 changed files with 7 additions and 3 deletions

View File

@ -15,6 +15,8 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import com.arthenica.ffmpegkit.FFmpegKitConfig
import android.util.Log
import app.myzel394.alibi.ui.RECORDER_INTERNAL_SELECTED_VALUE
import app.myzel394.alibi.ui.RECORDER_MEDIA_SELECTED_VALUE
import kotlinx.coroutines.CompletableDeferred
import kotlin.reflect.KFunction3
@ -236,9 +238,9 @@ abstract class BatchesFolder(
fun exportFolderForSettings(): String {
return when (type) {
BatchType.INTERNAL -> "_'internal"
BatchType.INTERNAL -> RECORDER_INTERNAL_SELECTED_VALUE
BatchType.MEDIA -> RECORDER_MEDIA_SELECTED_VALUE
BatchType.CUSTOM -> customFolder!!.uri.toString()
BatchType.MEDIA -> "_'media"
}
}

View File

@ -7,6 +7,7 @@ import android.os.ParcelFileDescriptor
import android.provider.MediaStore
import androidx.documentfile.provider.DocumentFile
import app.myzel394.alibi.helpers.MediaConverter.Companion.concatenateVideoFiles
import app.myzel394.alibi.ui.RECORDER_INTERNAL_SELECTED_VALUE
import app.myzel394.alibi.ui.RECORDER_MEDIA_SELECTED_VALUE
import com.arthenica.ffmpegkit.FFmpegKitConfig
import java.time.LocalDateTime
@ -96,7 +97,7 @@ class VideoBatchesFolder(
fun viaMediaFolder(context: Context) = VideoBatchesFolder(context, BatchType.MEDIA)
fun importFromFolder(folder: String, context: Context) = when (folder) {
"_'internal" -> viaInternalFolder(context)
RECORDER_INTERNAL_SELECTED_VALUE -> viaInternalFolder(context)
RECORDER_MEDIA_SELECTED_VALUE -> viaMediaFolder(context)
else -> viaCustomFolder(
context,

View File

@ -11,6 +11,7 @@ val RECORDER_SUBFOLDER_NAME = ".recordings"
val VIDEO_RECORDER_SUPPORTS_CUSTOM_FOLDER = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
val MEDIA_RECORDINGS_PREFIX = "alibi-recording-"
val RECORDER_MEDIA_SELECTED_VALUE = "_'media"
val RECORDER_INTERNAL_SELECTED_VALUE = "_'internal"
// You are not allowed to change the constants below.
// If you do so, you will be blocked on GitHub.