Re-enabled converation list observation while a conversation is open.

It honestly doesn't feel great to not have this, because when you back
out to the conversation list you have to wait for it to update.

Right now this seems like the lesser of two evils.
fork-5.53.8
Greyson Parrelli 2021-08-30 12:50:20 -04:00 zatwierdzone przez Cody Henthorne
rodzic eba3c55ec8
commit 32888fa00b
2 zmienionych plików z 2 dodań i 18 usunięć

Wyświetl plik

@ -320,7 +320,6 @@ public class ConversationListFragment extends MainFragment implements ActionMode
super.onStart();
ConversationFragment.prepare(requireContext());
ApplicationDependencies.getAppForegroundObserver().addListener(appForegroundObserver);
viewModel.onStart();
}
@Override
@ -336,7 +335,6 @@ public class ConversationListFragment extends MainFragment implements ActionMode
public void onStop() {
super.onStop();
ApplicationDependencies.getAppForegroundObserver().removeListener(appForegroundObserver);
viewModel.onStop();
}
@Override

Wyświetl plik

@ -60,7 +60,6 @@ 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<>();
@ -87,7 +86,6 @@ class ConversationListViewModel extends ViewModel {
pagedData.getController().onDataInvalidated();
});
};
this.isNewlyCreated = true;
this.hasNoConversations = LiveDataUtil.mapAsync(pagedData.getData(), conversations -> {
pinnedCount = DatabaseFactory.getThreadDatabase(application).getPinnedConversationListCount();
@ -98,6 +96,8 @@ class ConversationListViewModel extends ViewModel {
return DatabaseFactory.getThreadDatabase(application).getArchivedConversationListCount() == 0;
}
});
ApplicationDependencies.getDatabaseObserver().registerConversationListObserver(observer);
}
public LiveData<Boolean> hasNoConversations() {
@ -142,20 +142,6 @@ class ConversationListViewModel extends ViewModel {
coldStart = false;
}
void onStart() {
if (!isNewlyCreated) {
pagedData.getController().onDataInvalidated();
}
isNewlyCreated = false;
ApplicationDependencies.getDatabaseObserver().registerConversationListObserver(observer);
}
void onStop() {
ApplicationDependencies.getDatabaseObserver().unregisterObserver(observer);
}
void onMegaphoneCompleted(@NonNull Megaphones.Event event) {
megaphone.postValue(null);
megaphoneRepository.markFinished(event);