mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
let the user allow downloads on mobile data
Downloads asked the platform for an unmetered network and nothing more, so there was no way to run them on mobile. A setting under Downloads now decides, defaulting to Wi-Fi only, and it also governs roaming: the platform permits roaming by default, which would have contradicted the Wi-Fi-only choice. The flag rides the enqueue request like the download quality does, cached in the source repository so the poller does not read the preference per row.
This commit is contained in:
@@ -38,6 +38,11 @@ class SettingsViewModel(
|
||||
.downloadQuality()
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), StreamQuality())
|
||||
|
||||
val downloadOverMetered: StateFlow<Boolean> =
|
||||
userPreferences
|
||||
.downloadOverMetered()
|
||||
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), false)
|
||||
|
||||
val syncConcurrency: StateFlow<Int> =
|
||||
userPreferences
|
||||
.syncConcurrency()
|
||||
@@ -59,6 +64,10 @@ class SettingsViewModel(
|
||||
viewModelScope.launch { userPreferences.setDownloadQuality(quality) }
|
||||
}
|
||||
|
||||
fun setDownloadOverMetered(allowed: Boolean) {
|
||||
viewModelScope.launch { userPreferences.setDownloadOverMetered(allowed) }
|
||||
}
|
||||
|
||||
fun setSyncConcurrency(value: Int) {
|
||||
viewModelScope.launch { userPreferences.setSyncConcurrency(value) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user