Revert "Simplify default value assignment"

This reverts commit d4090d15be.
This commit is contained in:
Nicholas Wallace 2025-02-06 17:45:33 -07:00
parent 840641681e
commit 853a12b0dd

View file

@ -48,24 +48,40 @@ object DeviceManager {
init { init {
Log.d(tag, "Device Manager Singleton invoked") Log.d(tag, "Device Manager Singleton invoked")
// Default settings if they have not been set yet. Removes Elvis operator for null safety due to // Initialize new sleep timer settings and shake sensitivity added in v0.9.61
// variables being non-nullable. if (deviceData.deviceSettings?.autoSleepTimerStartTime == null ||
deviceData.deviceSettings?.apply { deviceData.deviceSettings?.autoSleepTimerEndTime == null
// Sleep timer settings, added v0.9.61 ) {
autoSleepTimerStartTime = "22:00" deviceData.deviceSettings?.autoSleepTimerStartTime = "22:00"
autoSleepTimerEndTime = "06:00" deviceData.deviceSettings?.autoSleepTimerStartTime = "06:00"
sleepTimerLength = 900000L deviceData.deviceSettings?.sleepTimerLength = 900000L
shakeSensitivity = ShakeSensitivitySetting.MEDIUM }
// Auto sleep timer auto rewind, added v0.9.64 if (deviceData.deviceSettings?.shakeSensitivity == null) {
autoSleepTimerAutoRewindTime = 300000L // 5 minutes deviceData.deviceSettings?.shakeSensitivity = ShakeSensitivitySetting.MEDIUM
// Langugage code, added v0.9.69 }
languageCode = "en-us" // Initialize auto sleep timer auto rewind added in v0.9.64
// Download and streaming using cellular, added v0.9.75 if (deviceData.deviceSettings?.autoSleepTimerAutoRewindTime == null) {
downloadUsingCellular = DownloadUsingCellularSetting.ALWAYS deviceData.deviceSettings?.autoSleepTimerAutoRewindTime = 300000L // 5 minutes
streamingUsingCellular = StreamingUsingCellularSetting.ALWAYS }
// Android Auto settings, added v0.9.78
androidAutoBrowseLimitForGrouping = 100 // Language added in v0.9.69
androidAutoBrowseSeriesSequenceOrder = AndroidAutoBrowseSeriesSequenceOrderSetting.ASC if (deviceData.deviceSettings?.languageCode == null) {
deviceData.deviceSettings?.languageCode = "en-us"
}
if (deviceData.deviceSettings?.downloadUsingCellular == null) {
deviceData.deviceSettings?.downloadUsingCellular = DownloadUsingCellularSetting.ALWAYS
}
if (deviceData.deviceSettings?.streamingUsingCellular == null) {
deviceData.deviceSettings?.streamingUsingCellular = StreamingUsingCellularSetting.ALWAYS
}
if (deviceData.deviceSettings?.androidAutoBrowseLimitForGrouping == null) {
deviceData.deviceSettings?.androidAutoBrowseLimitForGrouping = 100
}
if (deviceData.deviceSettings?.androidAutoBrowseSeriesSequenceOrder == null) {
deviceData.deviceSettings?.androidAutoBrowseSeriesSequenceOrder =
AndroidAutoBrowseSeriesSequenceOrderSetting.ASC
} }
} }