-
public final class WorkManagerReplicationKt
-
-
Method Summary
Modifier and Type Method Description final static ReplicatorStatustoReplicatorStatus(Data $self, String replId)Convert a Dataobject found inWorkflowInfo, to aReplicatorStatusOnce aReplicatorWorkerhas been scheduled, its progress can be tracked using theLiveDataobject provide by theWorkManager, like this:
That bit of code will produces aWorkManager.getInstance(context).getWorkInfosByTagLiveData(InventoryReplicatorFactory().tag)LiveData<List<WorkflowInfo>>.-
-
Method Detail
-
toReplicatorStatus
final static ReplicatorStatus toReplicatorStatus(Data $self, String replId)
Convert a
Dataobject found inWorkflowInfo, to aReplicatorStatusOnce a
ReplicatorWorkerhas been scheduled, its progress can be tracked using theLiveDataobject provide by theWorkManager, like this:WorkManager.getInstance(context).getWorkInfosByTagLiveData(InventoryReplicatorFactory().tag)That bit of code will produces a
LiveData<List<WorkflowInfo>>. Again, presuming that client code uses the tag from theWorkManagerReplicatorFactory, for this and no otherWorkManagerjobs, this code can be used to recover theReplicatorStatusfrom theDataobject in theWorkflowInfo:.map { if (it.isEmpty()) { null } else { it[0].progress.toReplicatorStatus() } }
-
-
-
-