Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-25568

Android: EmailDialog fails to attach more than 1 blob

    Details

      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:

      1. Set up an Android device with a working mail app.
      2. Build and run the below code on that device.
      3. 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

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-6012
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code