public synchronized VersionHistory getVersionHistory() { return conversation.getVersionHistory(); }
private void migrateVersionHistory() { // An existing static initializer will trigger the V1 to V2 migration of VersionHistory when VersionHistoryStore is loaded below. // Then migrate to V3, which is stored in the Conversation object. JSONArray versionHistoryOld = VersionHistoryStore.getBaseArray(); try { if (versionHistoryOld != null && versionHistoryOld.length() > 0) { VersionHistory versionHistory = conversation.getVersionHistory(); for (int i = 0; i < versionHistoryOld.length(); i++) { VersionHistoryEntry versionHistoryEntryOld = new VersionHistoryEntry((JSONObject) versionHistoryOld.get(i)); versionHistory.updateVersionHistory(versionHistoryEntryOld.getTimestamp(), versionHistoryEntryOld.getVersionCode(), versionHistoryEntryOld.getVersionName()); } } } catch (Exception e) { ApptentiveLog.w(CONVERSATION, e, "Error migrating VersionHistory entries V2 to V3."); logException(e); } }
FieldManager fieldManager = new FieldManager(context, conversation.getVersionHistory(), conversation.getEventData(), conversation.getPerson(), conversation.getDevice(), conversation.getAppRelease()); if (invocation.isCriteriaMet(fieldManager, true)) { interactionIdToLaunch = invocation.getInteractionId();
public String getApplicableInteraction(String eventLabel, boolean verbose) { JSONArray invocations = optJSONArray(eventLabel); if (invocations != null) { for (int i = 0; i < invocations.length(); i++) { JSONObject invocationObject = invocations.optJSONObject(i); if (invocationObject != null) { try { Invocation invocation = new Invocation(invocationObject.toString()); Conversation conversation = ApptentiveInternal.getInstance().getConversation(); FieldManager fieldManager = new FieldManager(ApptentiveInternal.getInstance().getApplicationContext(), conversation.getVersionHistory(), conversation.getEventData(), conversation.getPerson(), conversation.getDevice(), conversation.getAppRelease()); if (invocation.isCriteriaMet(fieldManager, verbose)) { return invocation.getInteractionId(); } } catch (JSONException e) { logException(e); } } } } ApptentiveLog.v(INTERACTIONS, "No runnable Interactions for EventLabel: %s", eventLabel); return null; } }
boolean sdkChanged = false; final VersionHistoryItem lastVersionItemSeen = conversation.getVersionHistory().getLastVersionSeen(); final int currentVersionCode = appRelease.getVersionCode(); final String currentVersionName = appRelease.getVersionName(); conversation.getVersionHistory().updateVersionHistory(Util.currentTimeSeconds(), currentVersionCode, currentVersionName);