use of org.odk.collect.android.backgroundwork.FormUpdateAndInstanceSubmitScheduler in project collect by opendatakit.
the class InstanceUploaderListActivity method updateAutoSendStatus.
/**
* Updates whether an auto-send job is ongoing.
*/
private void updateAutoSendStatus() {
// This shouldn't use WorkManager directly but it's likely this code will be removed when
// we eventually move sending forms to a Foreground Service (rather than a blocking AsyncTask)
String tag = ((FormUpdateAndInstanceSubmitScheduler) instanceSubmitScheduler).getAutoSendTag(currentProjectProvider.getCurrentProject().getUuid());
LiveData<List<WorkInfo>> statuses = WorkManager.getInstance().getWorkInfosForUniqueWorkLiveData(tag);
statuses.observe(this, workStatuses -> {
if (workStatuses != null) {
for (WorkInfo status : workStatuses) {
if (status.getState().equals(WorkInfo.State.RUNNING)) {
autoSendOngoing = true;
return;
}
}
autoSendOngoing = false;
}
});
}
Aggregations