feat: implemented the ability to choose external storage (if available) as storage for offline file downloads

This commit is contained in:
antonio 2023-08-04 23:46:33 +02:00
parent 838d4496e5
commit 5733dca68a
9 changed files with 214 additions and 9 deletions

View file

@ -33,6 +33,7 @@ object Preferences {
private const val MUSIC_DIRECTORY_SECTION_VISIBILITY = "music_directory_section_visibility"
private const val REPLAY_GAIN_MODE = "replay_gain_mode"
private const val AUDIO_TRANSCODE_PRIORITY = "audio_transcode_priority"
private const val DOWNLOAD_STORAGE = "download_storage"
@JvmStatic
fun getServer(): String? {
@ -258,4 +259,17 @@ object Preferences {
fun isServerPrioritized(): Boolean {
return App.getInstance().preferences.getBoolean(AUDIO_TRANSCODE_PRIORITY, false)
}
@JvmStatic
fun getDownloadStoragePreference(): Int {
return App.getInstance().preferences.getString(DOWNLOAD_STORAGE, "0")!!.toInt()
}
@JvmStatic
fun setDownloadStoragePreference(storagePreference: Int) {
return App.getInstance().preferences.edit().putString(
DOWNLOAD_STORAGE,
storagePreference.toString()
).apply()
}
}