mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Improve code readability in aggregation processor
This commit is contained in:
parent
b081429725
commit
cfdc18d421
@ -79,22 +79,22 @@ internal class LiveLocationAggregationProcessor @Inject constructor(
|
||||
}
|
||||
|
||||
private fun scheduleDeactivationAfterTimeout(eventId: String, roomId: String, endOfLiveTimestampMillis: Long?) {
|
||||
endOfLiveTimestampMillis?.let { endOfLiveMillis ->
|
||||
val workParams = DeactivateLiveLocationShareWorker.Params(sessionId = sessionId, eventId = eventId, roomId = roomId)
|
||||
val workData = WorkerParamsFactory.toData(workParams)
|
||||
val workName = DeactivateLiveLocationShareWorker.getWorkName(eventId = eventId, roomId = roomId)
|
||||
val workDelayMillis = (endOfLiveMillis - clock.epochMillis()).coerceAtLeast(0)
|
||||
val workRequest = workManagerProvider.matrixOneTimeWorkRequestBuilder<DeactivateLiveLocationShareWorker>()
|
||||
.setInitialDelay(workDelayMillis, TimeUnit.MILLISECONDS)
|
||||
.setInputData(workData)
|
||||
.build()
|
||||
endOfLiveTimestampMillis ?: return
|
||||
|
||||
workManagerProvider.workManager.enqueueUniqueWork(
|
||||
workName,
|
||||
ExistingWorkPolicy.KEEP,
|
||||
workRequest
|
||||
)
|
||||
}
|
||||
val workParams = DeactivateLiveLocationShareWorker.Params(sessionId = sessionId, eventId = eventId, roomId = roomId)
|
||||
val workData = WorkerParamsFactory.toData(workParams)
|
||||
val workName = DeactivateLiveLocationShareWorker.getWorkName(eventId = eventId, roomId = roomId)
|
||||
val workDelayMillis = (endOfLiveTimestampMillis - clock.epochMillis()).coerceAtLeast(0)
|
||||
val workRequest = workManagerProvider.matrixOneTimeWorkRequestBuilder<DeactivateLiveLocationShareWorker>()
|
||||
.setInitialDelay(workDelayMillis, TimeUnit.MILLISECONDS)
|
||||
.setInputData(workData)
|
||||
.build()
|
||||
|
||||
workManagerProvider.workManager.enqueueUniqueWork(
|
||||
workName,
|
||||
ExistingWorkPolicy.KEEP,
|
||||
workRequest
|
||||
)
|
||||
}
|
||||
|
||||
private fun cancelDeactivationAfterTimeout(eventId: String, roomId: String) {
|
||||
|
Loading…
Reference in New Issue
Block a user