cordova-email-plugin icon indicating copy to clipboard operation
cordova-email-plugin copied to clipboard

can email.open return indicate if user cancelled the message send?

Open donrowlett opened this issue 7 years ago • 1 comments

After opening and populating draft message, user has option to send or cancel. I would like to handle cancellation differently than send or any other action.

I've coded a callback in the email.open:

     cordova.plugins.email.open({
            app: 'mailto',
            to: siTo,
            attachments: attachments,
            subject:  "Report",
            body:  issueDesc.value,
            isHtml: true,
        }, function (result) {
            if (result == "cancel") {
                window.location.href = "reportAnIssue.html";
            } else {
                window.location.href = "success.html";
            }
        });

I was hoping that the 'result' variable in the callback would return some kind of value to indicate if the user cancelled. If so, I would go back to give the user another chance to create the email, otherwise go to a 'success' page.

(Yes I realize there are other results that should be taken into consideration, but this is good for me now).

Running on my Android, I get 'OK' in the result no matter what action the user takes. On iOS, I get null result.

Is there currently a way to identify a user cancellation?

donrowlett avatar Oct 20 '17 21:10 donrowlett

Looking at the Android code, nothing appears to be passed to the success callback, so no. But maybe the onActivityResult parameters have something useful in them to pass to success.

markdon avatar Oct 23 '17 22:10 markdon