Ensure old typing observers are unsubscribed.
This commit is contained in:
parent
728ec1c16d
commit
af2e17df9e
1 changed files with 7 additions and 0 deletions
|
@ -398,6 +398,8 @@ public class ConversationFragment extends Fragment
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
|
long oldThreadId = threadId;
|
||||||
|
|
||||||
this.recipient = Recipient.live(getActivity().getIntent().getParcelableExtra(ConversationActivity.RECIPIENT_EXTRA));
|
this.recipient = Recipient.live(getActivity().getIntent().getParcelableExtra(ConversationActivity.RECIPIENT_EXTRA));
|
||||||
this.threadId = this.getActivity().getIntent().getLongExtra(ConversationActivity.THREAD_ID_EXTRA, -1);
|
this.threadId = this.getActivity().getIntent().getLongExtra(ConversationActivity.THREAD_ID_EXTRA, -1);
|
||||||
this.lastSeen = this.getActivity().getIntent().getLongExtra(ConversationActivity.LAST_SEEN_EXTRA, -1);
|
this.lastSeen = this.getActivity().getIntent().getLongExtra(ConversationActivity.LAST_SEEN_EXTRA, -1);
|
||||||
|
@ -407,6 +409,10 @@ public class ConversationFragment extends Fragment
|
||||||
|
|
||||||
OnScrollListener scrollListener = new ConversationScrollListener(getActivity());
|
OnScrollListener scrollListener = new ConversationScrollListener(getActivity());
|
||||||
list.addOnScrollListener(scrollListener);
|
list.addOnScrollListener(scrollListener);
|
||||||
|
|
||||||
|
if (oldThreadId != threadId) {
|
||||||
|
ApplicationContext.getInstance(requireContext()).getTypingStatusRepository().getTypists(oldThreadId).removeObservers(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeListAdapter() {
|
private void initializeListAdapter() {
|
||||||
|
@ -440,6 +446,7 @@ public class ConversationFragment extends Fragment
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApplicationContext.getInstance(requireContext()).getTypingStatusRepository().getTypists(threadId).removeObservers(this);
|
||||||
ApplicationContext.getInstance(requireContext()).getTypingStatusRepository().getTypists(threadId).observe(this, typingState -> {
|
ApplicationContext.getInstance(requireContext()).getTypingStatusRepository().getTypists(threadId).observe(this, typingState -> {
|
||||||
List<Recipient> recipients;
|
List<Recipient> recipients;
|
||||||
boolean replacedByIncomingMessage;
|
boolean replacedByIncomingMessage;
|
||||||
|
|
Loading…
Add table
Reference in a new issue