@Override public void loadMenuConversation(String conversationId) { menuConversation = conversationsList.getConversation(conversationId); menuConversation.removeUpdateListener(menuConversationUpdateListener); menuConversation.addUpdateListener(menuConversationUpdateListener); menuConversationUpdateListener.updated(); }
@Override public void onStart() { super.onStart(); if (self == null) { self = getStoreFactory().getZMessagingApiStore().getApi().getSelf(); self.addUpdateListener(selfUpdateListener); selfUpdateListener.updated(); } }
public ScalaConversationStore(ZMessagingApi zMessagingApi) { conversationsList = zMessagingApi.getConversations(); establishedConversationsList = conversationsList.getEstablishedConversations(); inboxList = conversationsList.getIncomingConversations(); conversationUiSignal = conversationsList.selectedConversation(); selectedConvSubscription = conversationUiSignal.subscribe( new Subscriber<IConversation>() { @Override public void next(IConversation value) { IConversation prev = selectedConversation; selectedConversation = value; boolean changeSelectedConversation = selectedConversation == null && (conversationsList.size() > 0 || inboxList.size() > 0); if (conversationsList.isReady() && changeSelectedConversation) { identifyCurrentConversation(prev); } else { // TODO: Check with SE. In some cases like clicking on inapp-notification signal // will also notify when conversation changes to another conversation boolean conversationChanged = (prev != null && selectedConversation != null && !prev.getId().equals(selectedConversation.getId())); ConversationChangeRequester changeRequester = conversationChanged ? conversationChangeRequester : ConversationChangeRequester.UPDATER; notifyCurrentConversationHasChanged(prev, selectedConversation, changeRequester); } } }); conversationsList.addUpdateListener(conversationListUpdateListener); conversationListUpdateListener.updated(); conversationsList.onVerificationStateChange(verificationStateCallback); inboxList.addUpdateListener(inboxListUpdateListener); syncIndicator = conversationsList.getSyncIndicator(); syncIndicator.addUpdateListener(syncStateUpdateListener); }