@Override public void onReceiveNotification(ApptentiveNotification notification) { checkConversationQueue(); appIsInForeground = true; if (activeConversation != null && activeConversation.hasActiveState()) { ApptentiveLog.v(CONVERSATION, "App entered foreground notification received. Trying to fetch app configuration and interactions..."); final Context context = getContext(); if (context != null) { fetchAppConfiguration(activeConversation); activeConversation.fetchInteractions(context); } else { ApptentiveLog.w(CONVERSATION, "Can't fetch app configuration and conversation interactions: context is lost"); } } } });
private synchronized void synchronize() { personEmail = conversation.getPerson().getEmail(); personName = conversation.getPerson().getName(); messageCenterPendingMessage = conversation.getMessageCenterPendingMessage(); messageCenterPendingAttachments = conversation.getMessageCenterPendingAttachments(); hasActiveState = conversation.hasActiveState(); messageCenterWhoCardPreviouslyDisplayed = conversation.isMessageCenterWhoCardPreviouslyDisplayed(); unreadMessageCount = conversation.getMessageManager().getUnreadMessageCount(); }
@Override public void onReceiveNotification(ApptentiveNotification notification) { checkConversationQueue(); if (notification.hasName(NOTIFICATION_INTERACTIONS_SHOULD_DISMISS)) { dispatchOnMainQueue(new DispatchTask() { @Override protected void execute() { dismissActivity(); } }); } else if (notification.hasName(NOTIFICATION_CONVERSATION_STATE_DID_CHANGE)) { final Conversation conversation = notification.getUserInfo(NOTIFICATION_KEY_CONVERSATION, Conversation.class); Assert.assertNotNull(conversation, "Conversation expected to be not null"); if (conversation != null && !conversation.hasActiveState()) { dispatchOnMainQueue(new DispatchTask() { @Override protected void execute() { dismissActivity(); } }); } } }
NOTIFICATION_KEY_CONVERSATION, conversation); if (conversation.hasActiveState()) { if (appIsInForeground) {
if (conversation.hasActiveState()) { final String conversationId = notNull(conversation.getConversationId()); final String conversationToken = notNull(conversation.getConversationToken());
if (conversation.hasActiveState()) { item.setConversationToken(notNull(conversation.getConversationToken()));
if (conversation.hasActiveState()) {