mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +01:00
Initialise result LiveData before starting task.
This commit is contained in:
@@ -76,6 +76,8 @@ class AttachmentCreatorImpl implements AttachmentCreator {
|
|||||||
LiveData<GroupId> groupId, Collection<Uri> newUris) {
|
LiveData<GroupId> groupId, Collection<Uri> newUris) {
|
||||||
if (task != null || result != null || !uris.isEmpty())
|
if (task != null || result != null || !uris.isEmpty())
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
MutableLiveData<AttachmentResult> result = new MutableLiveData<>();
|
||||||
|
this.result = result;
|
||||||
uris.addAll(newUris);
|
uris.addAll(newUris);
|
||||||
observeForeverOnce(groupId, id -> {
|
observeForeverOnce(groupId, id -> {
|
||||||
if (id == null) throw new IllegalStateException();
|
if (id == null) throw new IllegalStateException();
|
||||||
@@ -85,8 +87,6 @@ class AttachmentCreatorImpl implements AttachmentCreator {
|
|||||||
uris, needsSize);
|
uris, needsSize);
|
||||||
ioExecutor.execute(() -> task.storeAttachments());
|
ioExecutor.execute(() -> task.storeAttachments());
|
||||||
});
|
});
|
||||||
MutableLiveData<AttachmentResult> result = new MutableLiveData<>();
|
|
||||||
this.result = result;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user