fix: reduced the frequency of the optimization prompt dialog and made it possible to disable it

This commit is contained in:
antonio 2023-06-24 12:12:14 +02:00
parent 200ce6555b
commit f147c762d5
3 changed files with 19 additions and 10 deletions

View file

@ -10,6 +10,7 @@ object Preferences {
private const val TOKEN = "token"
private const val SALT = "salt"
private const val LOW_SECURITY = "low_security"
private const val BATTERY_OPTIMIZATION = "battery_optimization"
private const val SERVER_ID = "server_id"
private const val PLAYBACK_SPEED = "playback_speed"
private const val SKIP_SILENCE = "skip_silence"
@ -100,6 +101,16 @@ object Preferences {
App.getInstance().preferences.edit().putString(SERVER_ID, serverId).apply()
}
@JvmStatic
fun askForOptimization(): Boolean? {
return App.getInstance().preferences.getBoolean(BATTERY_OPTIMIZATION, true)
}
@JvmStatic
fun dontAskForOptimization() {
App.getInstance().preferences.edit().putBoolean(BATTERY_OPTIMIZATION, false).apply()
}
@JvmStatic
fun getPlaybackSpeed(): Float {
return App.getInstance().preferences.getFloat(PLAYBACK_SPEED, 1f)