private SharePhotoContent createAndMapAttachments( final SharePhotoContent content, final UUID callId) { final SharePhotoContent.Builder contentBuilder = new SharePhotoContent.Builder().readFrom(content); final List<SharePhoto> photos = new ArrayList<>(); final List<NativeAppCallAttachmentStore.Attachment> attachments = new ArrayList<>(); for (int i = 0; i < content.getPhotos().size(); i++) { SharePhoto sharePhoto = content.getPhotos().get(i); final Bitmap photoBitmap = sharePhoto.getBitmap(); if (photoBitmap != null) { NativeAppCallAttachmentStore.Attachment attachment = NativeAppCallAttachmentStore.createAttachment(callId, photoBitmap); sharePhoto = new SharePhoto.Builder() .readFrom(sharePhoto) .setImageUrl(Uri.parse(attachment.getAttachmentUrl())) .setBitmap(null) .build(); attachments.add(attachment); } photos.add(sharePhoto); } contentBuilder.setPhotos(photos); NativeAppCallAttachmentStore.addAttachments(attachments); return contentBuilder.build(); } }
public static Bundle getTextureUrlBundle( final ShareCameraEffectContent cameraEffectContent, final UUID appCallId) { CameraEffectTextures textures; if (cameraEffectContent == null || (textures = cameraEffectContent.getTextures()) == null) { return null; } Bundle attachmentUrlsBundle = new Bundle(); List<NativeAppCallAttachmentStore.Attachment> attachments = new ArrayList<>(); for (String key : textures.keySet()) { NativeAppCallAttachmentStore.Attachment attachment = getAttachment( appCallId, textures.getTextureUri(key), textures.getTextureBitmap(key)); attachments.add(attachment); attachmentUrlsBundle.putString(key, attachment.getAttachmentUrl()); } NativeAppCallAttachmentStore.addAttachments(attachments); return attachmentUrlsBundle; }
public static Attachment createAttachment(UUID callId, Uri attachmentUri) { Validate.notNull(callId, "callId"); Validate.notNull(attachmentUri, "attachmentUri"); return new Attachment(callId, null, attachmentUri); }
public static Attachment createAttachment(UUID callId, Bitmap attachmentBitmap) { Validate.notNull(callId, "callId"); Validate.notNull(attachmentBitmap, "attachmentBitmap"); return new Attachment(callId, attachmentBitmap, null); }
public static String getVideoUrl(final ShareVideoContent videoContent, final UUID appCallId) { if (videoContent == null || videoContent.getVideo() == null) { return null; } NativeAppCallAttachmentStore.Attachment attachment = NativeAppCallAttachmentStore.createAttachment( appCallId, videoContent.getVideo().getLocalUrl()); ArrayList<NativeAppCallAttachmentStore.Attachment> attachments = new ArrayList<>(1); attachments.add(attachment); NativeAppCallAttachmentStore.addAttachments(attachments); return attachment.getAttachmentUrl(); }