public static PendingIntent prepareMessageCenterPendingIntent(Context context, Conversation conversation) { Intent intent; if (canShowMessageCenterInternal(conversation)) { intent = new Intent(); intent.setClass(context, ApptentiveViewActivity.class); intent.putExtra(Constants.FragmentConfigKeys.TYPE, Constants.FragmentTypes.ENGAGE_INTERNAL_EVENT); intent.putExtra(Constants.FragmentConfigKeys.EXTRA, MessageCenterInteraction.DEFAULT_INTERNAL_EVENT_NAME); } else { intent = MessageCenterInteraction.generateMessageCenterErrorIntent(context); } return (intent != null) ? PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_UPDATE_CURRENT) : null; }
public void clearContextualMessage() { JSONObject auto_msg = getContextualMessage(); if (auto_msg == null) { return; } try { auto_msg.put(KEY_AUTOMATED_MESSAGE_BODY, null); InteractionConfiguration configuration = getConfiguration(); configuration.put(KEY_AUTOMATED_MESSAGE, auto_msg); put(Interaction.KEY_CONFIGURATION, configuration); } catch (JSONException e) { logException(e); } }
WhoCard whoCard = fragment.interaction.getWhoCard(); whoCard.setInitial(initial); fragment.listItems.add(whoCard); fragment.listItems.add(fragment.interaction.getComposer()); fragment.messageCenterRecyclerViewAdapter.notifyItemInserted(fragment.listItems.size() - 1); fragment.messageCenterRecyclerView.setSelection(fragment.listItems.size() - 1); if (!fragment.wasWhoCardAsPreviouslyDisplayed() && fragment.interaction.getWhoCardRequestEnabled()) { JSONObject data = new JSONObject(); try { data.put("required", fragment.interaction.getWhoCardRequired()); data.put("trigger", "automatic"); } catch (JSONException e) { Double createdTime = apptentiveMessage.getCreatedAt(); if (createdTime != null && createdTime > Double.MIN_VALUE) { MessageCenterStatus status = fragment.interaction.getRegularStatus(); if (status != null) { fragment.engageInternal(MessageCenterInteraction.EVENT_NAME_STATUS); fragment.listItems.add(0, fragment.interaction.getGreeting()); fragment.messageCenterRecyclerViewAdapter.notifyItemInserted(0); break; MessageCenterStatus status = null; if (reason == MessageManager.SEND_PAUSE_REASON_NETWORK) { status = fragment.interaction.getErrorStatusNetwork(); fragment.engageInternal(MessageCenterInteraction.EVENT_NAME_MESSAGE_NETWORK_ERROR);
public boolean getWhoCardRequestEnabled() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return false; } JSONObject profile = configuration.optJSONObject(KEY_PROFILE); return profile.optBoolean(KEY_PROFILE_REQUEST, true); }
public WhoCard getWhoCard() { try { return new WhoCard(getProfile().toString()); } catch (JSONException e) { logException(e); } return null; }
public String getContextualMessageBody() { JSONObject auto_msg = getContextualMessage(); if (auto_msg == null) { return null; } return auto_msg.optString(KEY_AUTOMATED_MESSAGE_BODY, null); }
return new RatingDialogInteraction(interactionString); case MessageCenter: return new MessageCenterInteraction(interactionString); case AppStoreRating: return new AppStoreRatingInteraction(interactionString);
prepareMessages(items); String contextMessageBody = interaction.getContextualMessageBody(); if (contextMessageBody != null) {
public boolean getWhoCardRequired() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return false; } JSONObject profile = configuration.optJSONObject(KEY_PROFILE); return profile.optBoolean(KEY_PROFILE_REQUIRE, false); }
public void addWhoCard(boolean initial) { hideFab(); hideProfileButton(); JSONObject profile = interaction.getProfile(); if (profile != null) { pendingWhoCardMode = initial; messagingActionHandler.removeMessages(MSG_MESSAGE_ADD_WHOCARD); messagingActionHandler.removeMessages(MSG_MESSAGE_ADD_COMPOSING); messagingActionHandler.sendEmptyMessage(MSG_REMOVE_STATUS); messagingActionHandler.sendMessage(messagingActionHandler.obtainMessage(MSG_MESSAGE_ADD_WHOCARD, initial ? 0 : 1, 0, profile)); } }
public JSONObject getContextualMessage() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return null; } return configuration.optJSONObject(KEY_AUTOMATED_MESSAGE); }
public static void launchMessageCenterErrorActivity(final Context context) { if (!isMainQueue()) { mainQueue().dispatchAsync(new DispatchTask() { @Override protected void execute() { launchMessageCenterErrorActivity(context); } }); return; } if (context != null) { Intent intent = MessageCenterInteraction.generateMessageCenterErrorIntent(context); if (!(context instanceof Activity)) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); } context.startActivity(intent); } }
public JSONObject getProfile() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return null; } return configuration.optJSONObject(KEY_PROFILE); }
public MessageCenterGreeting getGreeting() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return null; } JSONObject greeting = configuration.optJSONObject(KEY_GREETING); if (greeting == null) { return null; } return new MessageCenterGreeting(greeting.optString(KEY_GREETING_TITLE, null), greeting.optString(KEY_GREETING_BODY, null), greeting.optString(KEY_GREETING_IMAGE, null)); }
public Composer getComposer() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return null; } JSONObject composer = configuration.optJSONObject(KEY_COMPOSER); return new Composer( composer.optString(KEY_COMPOSER_TITLE, null), composer.optString(KEY_COMPOSER_CLOSE_BODY, null), composer.optString(KEY_COMPOSER_CLOSE_DISCARD, null), composer.optString(KEY_COMPOSER_CLOSE_CANCEL, null), composer.optString(KEY_COMPOSER_SEND_BUTTON, null), composer.optString(KEY_COMPOSER_HINT_TEXT, null) ); }
public MessageCenterStatus getErrorStatusNetwork() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return null; } JSONObject errorStatus = configuration.optJSONObject(KEY_ERROR); if (errorStatus == null) { return null; } return new MessageCenterStatus(errorStatus.optString(KEY_ERROR_NETWORK_BODY), R.drawable.apptentive_ic_no_connection); } }
public MessageCenterStatus getErrorStatusServer() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return null; } JSONObject errorStatus = configuration.optJSONObject(KEY_ERROR); if (errorStatus == null) { return null; } return new MessageCenterStatus(errorStatus.optString(KEY_ERROR_HTTP_BODY), R.drawable.apptentive_ic_error); }
public String getBranding() { InteractionConfiguration configuration = getConfiguration(); if (configuration != null && !configuration.isNull(KEY_BRANDING)) { return configuration.optString(KEY_BRANDING, null); } return null; }
public MessageCenterStatus getRegularStatus() { InteractionConfiguration configuration = getConfiguration(); if (configuration == null) { return null; } JSONObject status = configuration.optJSONObject(KEY_STATUS); if (status == null) { return null; } String statusBody = status.optString(KEY_STATUS_BODY); if (statusBody == null || statusBody.isEmpty()) { return null; } return new MessageCenterStatus(statusBody, null); }
public String getTitle() { InteractionConfiguration configuration = getConfiguration(); if (configuration != null && !configuration.isNull(KEY_TITLE)) { return configuration.optString(KEY_TITLE, null); } return null; }