mirror of
https://codeberg.org/NextPush/nextpush-android.git
synced 2025-01-22 23:40:00 +01:00
Lint RestartWorker.clean
This commit is contained in:
parent
c9d4e2fd13
commit
ef7d50cdbf
@ -36,16 +36,16 @@ class RestartWorker(ctx: Context, params: WorkerParameters) : Worker(ctx, params
|
|||||||
companion object {
|
companion object {
|
||||||
fun start(context: Context, delay: Long? = null) {
|
fun start(context: Context, delay: Long? = null) {
|
||||||
val work = PeriodicWorkRequestBuilder<RestartWorker>(16, TimeUnit.MINUTES)
|
val work = PeriodicWorkRequestBuilder<RestartWorker>(16, TimeUnit.MINUTES)
|
||||||
if (delay != null) {
|
delay?.let {
|
||||||
lastEventDate = null
|
lastEventDate = null
|
||||||
work.setInitialDelay(delay, TimeUnit.SECONDS)
|
work.setInitialDelay(it, TimeUnit.SECONDS)
|
||||||
}
|
}
|
||||||
val workManager = WorkManager.getInstance(context)
|
WorkManager.getInstance(context)
|
||||||
workManager.enqueueUniquePeriodicWork(
|
.enqueueUniquePeriodicWork(
|
||||||
UNIQUE_WORK_TAG,
|
UNIQUE_WORK_TAG,
|
||||||
ExistingPeriodicWorkPolicy.REPLACE,
|
ExistingPeriodicWorkPolicy.REPLACE,
|
||||||
work.build()
|
work.build()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user