mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 23:27:04 +05:30
fix(android): relax constraints on post update worker
This commit is contained in:
parent
fa57bc9695
commit
c293fced8a
1 changed files with 3 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright © 2021-2023 Harsh Shandilya.
|
* Copyright © 2021-2024 Harsh Shandilya.
|
||||||
* Use of this source code is governed by an MIT-style
|
* Use of this source code is governed by an MIT-style
|
||||||
* license that can be found in the LICENSE file or at
|
* license that can be found in the LICENSE file or at
|
||||||
* https://opensource.org/licenses/MIT.
|
* https://opensource.org/licenses/MIT.
|
||||||
|
@ -34,19 +34,12 @@ class ClawApplication : Application(), ApplicationComponentOwner {
|
||||||
plugins.forEach { plugin -> plugin.apply(this) }
|
plugins.forEach { plugin -> plugin.apply(this) }
|
||||||
val postUpdateWorkRequest =
|
val postUpdateWorkRequest =
|
||||||
PeriodicWorkRequestBuilder<SavedPostUpdaterWorker>(POST_REFRESH_PERIOD, TimeUnit.HOURS)
|
PeriodicWorkRequestBuilder<SavedPostUpdaterWorker>(POST_REFRESH_PERIOD, TimeUnit.HOURS)
|
||||||
.setConstraints(
|
.setConstraints(Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build())
|
||||||
Constraints.Builder()
|
|
||||||
.setRequiresCharging(false)
|
|
||||||
.setRequiresBatteryNotLow(true)
|
|
||||||
.setRequiredNetworkType(NetworkType.CONNECTED)
|
|
||||||
.setRequiresDeviceIdle(true)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.build()
|
.build()
|
||||||
WorkManager.getInstance(this)
|
WorkManager.getInstance(this)
|
||||||
.enqueueUniquePeriodicWork(
|
.enqueueUniquePeriodicWork(
|
||||||
"updateSavedPosts",
|
"updateSavedPosts",
|
||||||
ExistingPeriodicWorkPolicy.UPDATE,
|
ExistingPeriodicWorkPolicy.KEEP,
|
||||||
postUpdateWorkRequest,
|
postUpdateWorkRequest,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue