public static synchronized VersionHistoryEntry getLastVersionSeen() { ensureLoaded(); if (versionHistoryEntries != null && !versionHistoryEntries.isEmpty()) { return versionHistoryEntries.get(versionHistoryEntries.size() - 1); } return null; }
/** * Don't use this directly. Used for debugging only. * * @return the base JSONArray */ public static JSONArray getBaseArray() { ensureLoaded(); JSONArray baseArray = new JSONArray(); for (VersionHistoryEntry entry : versionHistoryEntries) { baseArray.put(entry); } return baseArray; }
/** * Returns true if the current version or build is not the first version or build that we have seen. Basically, it just * looks for two or more versions or builds. * * @param selector - The type of version entry we are looking for: version, or build. * @return True if there are records with more than one version or build, depending on the value of selector. */ public static synchronized boolean isUpdate(Selector selector) { ensureLoaded(); Set<String> uniques = new HashSet<String>(); for (VersionHistoryEntry entry : versionHistoryEntries) { switch (selector) { case version_name: uniques.add(entry.getVersionName()); break; case version_code: uniques.add(String.valueOf(entry.getVersionCode())); break; default: break; } } return uniques.size() > 1; }
public static synchronized void updateVersionHistory(Integer newVersionCode, String newVersionName, double date) { ensureLoaded(); try { boolean exists = false; for (VersionHistoryEntry entry : versionHistoryEntries) { if (entry.getVersionCode() == newVersionCode && entry.getVersionName().equals(newVersionName)) { exists = true; } } // Only modify the store if the version hasn't been seen. if (!exists) { VersionHistoryEntry entry = new VersionHistoryEntry(newVersionCode, newVersionName, date); ApptentiveLog.v(CONVERSATION, "Adding Version History entry: %s", entry); versionHistoryEntries.add(new VersionHistoryEntry(newVersionCode, newVersionName, date)); save(); } } catch (Exception e) { ApptentiveLog.w(CONVERSATION, e, "Error updating VersionHistoryStore."); logException(e); } }
ensureLoaded(); for (VersionHistoryEntry entry : versionHistoryEntries) { switch (selector) {