[android] Reload conversation when contact name changes

This commit is contained in:
Torsten Grote
2018-10-31 18:51:38 -03:00
parent 7059f376f1
commit aa15b68d24
2 changed files with 3 additions and 3 deletions

View File

@@ -203,6 +203,7 @@ public class ConversationActivity extends BriarActivity
if (deleted) finish(); if (deleted) finish();
}); });
viewModel.loadContact(contactId); viewModel.loadContact(contactId);
viewModel.getContactDisplayName().observe(this, name -> loadMessages());
setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId)); setTransitionName(toolbarAvatar, getAvatarTransitionName(contactId));
setTransitionName(toolbarStatus, getBulbTransitionName(contactId)); setTransitionName(toolbarStatus, getBulbTransitionName(contactId));
@@ -243,8 +244,8 @@ public class ConversationActivity extends BriarActivity
notificationManager.blockContactNotification(contactId); notificationManager.blockContactNotification(contactId);
notificationManager.clearContactNotification(contactId); notificationManager.clearContactNotification(contactId);
displayContactOnlineStatus(); displayContactOnlineStatus();
observeOnce(viewModel.getContactDisplayName(), this, if (viewModel.getContactDisplayName().getValue() != null)
name -> loadMessages()); loadMessages();
list.startPeriodicUpdate(); list.startPeriodicUpdate();
} }

View File

@@ -77,7 +77,6 @@ public class ConversationViewModel extends AndroidViewModel {
try { try {
contactManager.setContactAlias(contactId, contactManager.setContactAlias(contactId,
alias.isEmpty() ? null : alias); alias.isEmpty() ? null : alias);
// TODO also reload the conversation
loadContact(contactId); loadContact(contactId);
} catch (DbException e) { } catch (DbException e) {
logException(LOG, WARNING, e); logException(LOG, WARNING, e);