[TIMOB-25568] Android: EmailDialog fails to attach more than 1 blob
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | android, blob, email, emaildialog, engSchedule |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2017-11-29T03:21:02.000+0000 |
Updated | 2019-06-18T15:35:30.000+0000 |
Description
*Summary:*
When adding multiple blobs as attachments to an EmailDialog, only the last blob gets attached to the e-mail. And the last blob attached is duplicated in the e-mail for every previous blob attachment attempted to be added.
*Steps to Reproduce:*
Set up an Android device with a working mail app.
Build and run the below code on that device.
Tap the "Send E-Mail" button.
var window = Ti.UI.createWindow();
var button = Ti.UI.createButton({ title: "Send E-Mail" });
button.addEventListener("click", function(e) {
var dialog = Ti.UI.createEmailDialog();
dialog.subject = "E-Mail Test";
dialog.toRecipients = ["john.doe@domain.com", "jane.doe@domain.com"];
dialog.messageBody = "This is the e-mail's body.\nThis is the second line.";
dialog.addAttachment(window.toImage());
dialog.addAttachment(button.toImage());
dialog.open();
});
window.add(button);
window.open();
*Result:*
The e-mail draft shows 2 image file attachments that are exactly the same when it shouldn't. They should be different images.
*Expected Result:*
The e-mail draft should have 2 image file attachments.
* Screenshot of the entire Titanium app window.
* Screenshot of just the "Send E-Mail" button.
*Work-Around:*
Write the blobs to file and attach the files instead.
*Reason it Fails:*
Titanium's "EmailDialogProxy" Java class writes all blobs to a temp file with the same file name, "attachment". So, each blob added overwrites the previous one in the temp directory.
https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/EmailDialogProxy.java#L217
No comments