public Actions getActions() { try { InteractionConfiguration configuration = getConfiguration(); if (configuration != null && configuration.has(KEY_ACTIONS)) { return new Actions(configuration.getString(KEY_ACTIONS)); } } catch (JSONException e) { logException(e); } return null; } }
public List<Action> getAsList() { List<Action> ret = new ArrayList<Action>(); try { for (int i = 0; i < length(); i++) { Action button = Action.Factory.parseAction(getJSONObject(i).toString()); if (button != null) { ret.add(button); } } } catch (JSONException e) { ApptentiveLog.w(INTERACTIONS, e, "Exception parsing interactions array."); logException(e); } return ret; } }
List<Action> actions = null; if (actionsObject != null) { actions = actionsObject.getAsList();
List<Action> actions = interaction.getActions().getAsList(); final Action action = actions.get(index); Action.Type actionType = action.getType();
List<Action> actionsList = actions.getAsList(); for (int i = 0; i < actionsList.size(); i++) { Action action = actionsList.get(i);
@Test public void textModalInteraction() { String json = loadTextAssetAsString(TEST_DATA_DIR + "/testTextModalInteraction.json"); Interaction interaction = Interaction.Factory.parseInteraction(json); assertTrue(interaction.getType().equals(Interaction.Type.TextModal)); TextModalInteraction textModalInteraction = (TextModalInteraction) interaction; assertEquals("548cc5dd49f63bb5c2000001", textModalInteraction.getId()); assertEquals("External Deep Links", textModalInteraction.getTitle()); assertEquals("This example allow testing how external deep links are opened.", textModalInteraction.getBody()); List<Action> actions = textModalInteraction.getActions().getAsList(); { Action action = actions.get(0); assertEquals("eBay - Same Task", action.getLabel()); assertTrue(action.getType().equals(Action.Type.interaction)); } } }