Invalidate conversation list when it is not newly started.

fork-5.53.8
Alex Hart 2021-08-27 10:12:12 -03:00
rodzic 349ad06c45
commit 7790cac0ee
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -60,6 +60,7 @@ class ConversationListViewModel extends ViewModel {
private String activeQuery;
private SearchResult activeSearchResult;
private int pinnedCount;
private boolean isNewlyCreated;
private ConversationListViewModel(@NonNull Application application, @NonNull SearchRepository searchRepository, boolean isArchived) {
this.megaphone = new MutableLiveData<>();
@ -85,6 +86,7 @@ class ConversationListViewModel extends ViewModel {
}
pagedData.getController().onDataInvalidated();
});
this.isNewlyCreated = true;
};
this.hasNoConversations = LiveDataUtil.mapAsync(pagedData.getData(), conversations -> {
@ -141,6 +143,12 @@ class ConversationListViewModel extends ViewModel {
}
void onStart() {
if (!isNewlyCreated) {
pagedData.getController().onDataInvalidated();
}
isNewlyCreated = false;
ApplicationDependencies.getDatabaseObserver().registerConversationListObserver(observer);
}