feat: Add filename format to AppSettings

Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
Myzel394 2024-06-09 16:30:11 +02:00
parent 048e285f9c
commit ee4529a9dc
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185

View File

@ -29,6 +29,8 @@ data class AppSettings(
val theme: Theme = Theme.SYSTEM,
val lastRecording: RecordingInformation? = null,
val filenameFormat: FilenameFormat = FilenameFormat.DATETIME_RELATIVE_START,
/// Recording information
// 30 minutes
val maxDuration: Long = 15 * 60 * 1000L,
@ -67,6 +69,10 @@ data class AppSettings(
return copy(lastRecording = lastRecording)
}
fun setFilenameFormat(filenameFormat: FilenameFormat): AppSettings {
return copy(filenameFormat = filenameFormat)
}
fun setMaxDuration(duration: Long): AppSettings {
if (duration < 60 * 1000L || duration > 10 * 24 * 60 * 60 * 1000L) {
throw Exception("Max duration must be between 1 minute and 10 days")
@ -124,14 +130,19 @@ data class AppSettings(
))
}
fun exportToString(): String {
return Json.encodeToString(serializer(), this)
}
enum class Theme {
SYSTEM,
LIGHT,
DARK,
}
fun exportToString(): String {
return Json.encodeToString(serializer(), this)
enum class FilenameFormat {
DATETIME_ABSOLUTE_START,
DATETIME_RELATIVE_START,
}
companion object {