From 01a6f49b77eb9c9ed0db179046fd72d376d529da Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:50:27 +0200 Subject: [PATCH] feat: Add NotificationSettings --- .../java/app/myzel394/alibi/db/AppSettings.kt | 45 +++++++++++++++++++ app/src/main/res/values/strings.xml | 3 ++ 2 files changed, 48 insertions(+) diff --git a/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt b/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt index 2fd5abc..f1fda67 100644 --- a/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt +++ b/app/src/main/java/app/myzel394/alibi/db/AppSettings.kt @@ -3,6 +3,7 @@ package app.myzel394.alibi.db import android.media.MediaRecorder import android.os.Build import android.util.Log +import app.myzel394.alibi.R import com.arthenica.ffmpegkit.FFmpegKit import com.arthenica.ffmpegkit.ReturnCode import kotlinx.serialization.Serializable @@ -14,6 +15,7 @@ import java.time.format.DateTimeFormatter.ISO_DATE_TIME @Serializable data class AppSettings( val audioRecorderSettings: AudioRecorderSettings = AudioRecorderSettings(), + val notificationSettings: NotificationSettings = NotificationSettings.fromPreset(NotificationSettings.Preset.Default), val hasSeenOnboarding: Boolean = false, val showAdvancedSettings: Boolean = false, val theme: Theme = Theme.SYSTEM, @@ -470,3 +472,46 @@ data class AudioRecorderSettings( } } } + +@Serializable +data class NotificationSettings( + val title: String, + val message: String, + val showOngoing: Boolean, + val preset: Preset? = null, +) { + @Serializable + sealed class Preset( + val titleID: Int, + val messageID: Int, + val showOngoing: Boolean, + ) { + data object Default : Preset( + R.string.ui_audioRecorder_state_recording_title, + R.string.ui_audioRecorder_state_recording_description, + true, + ) + data object Weather : Preset( + R.string.ui_audioRecorder_state_recording_fake_weather_title, + R.string.ui_audioRecorder_state_recording_fake_weather_description, + false, + ) + + data object Player : Preset( + R.string.ui_audioRecorder_state_recording_fake_weather_title, + R.string.ui_audioRecorder_state_recording_fake_weather_description, + false, + ) + } + + companion object { + fun fromPreset(preset: Preset): NotificationSettings { + return NotificationSettings( + title = "", + message = "", + showOngoing = preset.showOngoing, + preset = preset, + ) + } + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index baa7240..3ca07f3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,8 +28,11 @@ Alibi will continue recording in the background and store the last %s minutes at your request Processing Processing Audio, do not close Alibi! You will be automatically prompted to save the file once it\'s ready + Recording Audio Alibi keeps recording in the background + Current Weather + 14° with light chance of rain Welcome to Alibi! Alibi is like a dashcam for your phone. It allows you to record your audio continuously and save the last 30 minutes when you need it.