@Override public String toString() { return StringUtils.format("Conversation: localId=%s id=%s state=%s token=%s", getLocalIdentifier(), getConversationId(), getState(), hideIfSanitized(getConversationToken())); } }
public void notifyAuthenticationFailedListener(final Apptentive.AuthenticationFailedReason reason, String conversationIdOfFailedRequest) { checkConversationQueue(); if (isConversationActive()) { String activeConversationId = getConversation().getConversationId(); if (StringUtils.equal(activeConversationId, conversationIdOfFailedRequest)) { final Apptentive.AuthenticationFailedListener listener = authenticationFailedListenerRef != null ? authenticationFailedListenerRef.get() : null; if (listener != null) { // we need to dispatch listener on the main queue DispatchQueue.mainQueue().dispatchAsync(new DispatchTask() { @Override protected void execute() { listener.onAuthenticationFailed(reason); } }); } } } }
if (conversationId != null) { if (!StringUtils.equal(conversation.getConversationId(), conversationId)) { ApptentiveLog.i(PUSH, "Can't generate pending intent from Apptentive push data: push conversation id doesn't match active conversation"); return null;
HttpJsonRequest request = httpClient.createFetchMessagesRequest(conversation.getConversationToken(), conversation.getConversationId(), afterId, null, null, new HttpRequest.Listener<HttpJsonRequest>() { @Override public void onFinish(HttpJsonRequest request) {
item = new ConversationMetadataItem(conversation.getLocalIdentifier(), conversation.getConversationId(), conversation.getConversationDataFile(), conversation.getConversationMessagesFile()); conversationMetadata.addItem(item); } else { assertTrue(conversation.getConversationId() != null || conversation.hasState(ANONYMOUS_PENDING) || conversation.hasState(LEGACY_PENDING), "Missing conversation id for state: %s", conversation.getState()); item.setConversationId(conversation.getConversationId());
public void addPayload(Payload payload) { // TODO: figure out a better way of detecting new events if (payload instanceof EventPayload) { notifyEventGenerated((EventPayload) payload); } payload.setLocalConversationIdentifier(notNull(getLocalIdentifier())); payload.setConversationId(getConversationId()); payload.setToken(getConversationToken()); payload.setEncryptionKey(getEncryptionKey()); payload.setAuthenticated(isAuthenticated()); payload.setSessionId(getSessionId()); // TODO: don't use singleton here ApptentiveInternal.getInstance().getApptentiveTaskManager().addPayload(payload); }
final String conversationId = notNull(conversation.getConversationId()); final String conversationToken = notNull(conversation.getConversationToken()); final String conversationLocalIdentifier = notNull(conversation.getLocalIdentifier());
.createAppConfigurationRequest(conversation.getConversationId(), conversation.getConversationToken(), new HttpRequest.Listener<HttpJsonRequest>() { @Override
sendLoginRequest(activeConversation.getConversationId(), userId, token, callback); break; case LOGGED_IN: if (StringUtils.equal(activeConversation.getUserId(), userId)) { ApptentiveLog.w(CONVERSATION, "Refreshing auth token for logged in user: \"%s\"", userId); sendLoginRequest(activeConversation.getConversationId(), userId, token, callback); return;
HttpRequest existing = httpClient.findRequest(TAG_FETCH_INTERACTIONS_REQUEST); if (existing == null) { HttpJsonRequest request = httpClient.createFetchInteractionsRequest(getConversationToken(), getConversationId(), new HttpRequest.Listener<HttpJsonRequest>() { @Override public void onFinish(HttpJsonRequest request) {