use flow pref for libraryUpdateRestriction

since theres a crash using reg prefs for some reason
This commit is contained in:
Jays2Kings 2021-10-17 16:08:41 -04:00
parent 5addec2d82
commit 841293b8e8
2 changed files with 3 additions and 3 deletions

View file

@ -37,7 +37,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
val preferences = Injekt.get<PreferencesHelper>()
val interval = prefInterval ?: preferences.libraryUpdateInterval().get()
if (interval > 0) {
val restrictions = preferences.libraryUpdateRestriction().orEmpty()
val restrictions = preferences.libraryUpdateRestriction().get()
val constraints = Constraints.Builder()
.setRequiredNetworkType(NetworkType.CONNECTED)
@ -61,7 +61,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
}
fun requiresWifiConnection(preferences: PreferencesHelper): Boolean {
val restrictions = preferences.libraryUpdateRestriction().orEmpty()
val restrictions = preferences.libraryUpdateRestriction().get()
return "wifi" in restrictions
}
}

View file

@ -250,7 +250,7 @@ class PreferencesHelper(val context: Context) {
fun libraryUpdateInterval() = flowPrefs.getInt(Keys.libraryUpdateInterval, 24)
fun libraryUpdateRestriction() = prefs.getStringSet(Keys.libraryUpdateRestriction, emptySet())
fun libraryUpdateRestriction() = flowPrefs.getStringSet(Keys.libraryUpdateRestriction, emptySet())
fun libraryUpdateCategories() = flowPrefs.getStringSet(Keys.libraryUpdateCategories, emptySet())
fun libraryUpdateCategoriesExclude() = flowPrefs.getStringSet(Keys.libraryUpdateCategoriesExclude, emptySet())