public boolean setAssociatedFiles(List<StoredFile> attachedFiles) { this.attachedFiles = attachedFiles; if (attachedFiles == null || attachedFiles.size() == 0) { hasNoAttachments = true; return false; } else { hasNoAttachments = false; } setTextOnly(hasNoAttachments); boolean bRet = false; try { Future<Boolean> future = ApptentiveInternal.getInstance().getApptentiveTaskManager().addCompoundMessageFiles(attachedFiles); bRet = future.get(); } catch (Exception e) { ApptentiveLog.e(MESSAGES, "Unable to set associated files in worker thread"); logException(e); } finally { return bRet; } }
logException(e); continue; } finally {
public List<StoredFile> getAssociatedFiles() { if (hasNoAttachments) { return null; } List<StoredFile> associatedFiles = null; try { Future<List<StoredFile>> future = ApptentiveInternal.getInstance().getApptentiveTaskManager().getAssociatedFiles(getNonce()); associatedFiles = future.get(); } catch (Exception e) { ApptentiveLog.e(MESSAGES, "Unable to get associated files in worker thread"); logException(e); } finally { return associatedFiles; } }
public void deleteAssociatedFiles() { try { Future<List<StoredFile>> future = ApptentiveInternal.getInstance().getApptentiveTaskManager().getAssociatedFiles(getNonce()); List<StoredFile> associatedFiles = future.get(); // Delete local cached files if (associatedFiles == null || associatedFiles.size() == 0) { return; } for (StoredFile file : associatedFiles) { File localFile = new File(file.getLocalFilePath()); localFile.delete(); } // Delete records from db ApptentiveInternal.getInstance().getApptentiveTaskManager().deleteAssociatedFiles(getNonce()); } catch (Exception e) { ApptentiveLog.e(MESSAGES, "Unable to delete associated files in worker thread"); logException(e); } }
} catch (Exception e) { ApptentiveLog.e(MESSAGES, "Unable to set associated images in worker thread"); logException(e); } finally { return bRet;