Commit 4ee4905e authored by Torsten Grote's avatar Torsten Grote

[android] migrate added conversation header to new LiveEvent

parent 67b7517f
......@@ -243,7 +243,7 @@ public class ConversationActivity extends BriarActivity
requireNonNull(deleted);
if (deleted) finish();
});
viewModel.getAddedPrivateMessage().observe(this,
viewModel.getAddedPrivateMessage().observeEvent(this,
this::onAddedPrivateMessage);
setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId));
......@@ -678,7 +678,6 @@ public class ConversationActivity extends BriarActivity
private void onAddedPrivateMessage(@Nullable PrivateMessageHeader h) {
if (h == null) return;
addConversationItem(h.accept(visitor));
viewModel.onAddedPrivateMessageSeen();
}
private void askToRemoveContact() {
......
......@@ -97,8 +97,8 @@ public class ConversationViewModel extends AndroidViewModel
new MutableLiveData<>();
private final MutableLiveData<Boolean> contactDeleted =
new MutableLiveData<>();
private final MutableLiveData<PrivateMessageHeader> addedHeader =
new MutableLiveData<>();
private final MutableLiveEvent<PrivateMessageHeader> addedHeader =
new MutableLiveEvent<>();
@Inject
ConversationViewModel(Application application,
......@@ -301,18 +301,13 @@ public class ConversationViewModel extends AndroidViewModel
text != null, attachments);
attachmentCreator.onAttachmentsSent(m.getMessage().getId());
// TODO add text to cache when available here
addedHeader.postValue(h);
addedHeader.postEvent(h);
} catch (DbException e) {
logException(LOG, WARNING, e);
}
});
}
@UiThread
void onAddedPrivateMessageSeen() {
addedHeader.setValue(null);
}
AttachmentRetriever getAttachmentRetriever() {
return attachmentRetriever;
}
......@@ -349,7 +344,7 @@ public class ConversationViewModel extends AndroidViewModel
return contactDeleted;
}
LiveData<PrivateMessageHeader> getAddedPrivateMessage() {
LiveEvent<PrivateMessageHeader> getAddedPrivateMessage() {
return addedHeader;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment