-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attachments not working. #25
Comments
Hmm, do you pass in an Array? Please share the code that uses this plugin. Also: iOS, Android, or both? |
Hi,
Here is the code
var logDir = storage.getPublicPictureDirectory().getFolder("Log");
var attachments: Attachment[] = [];
var userid = auth.getUsername();
var files = logDir.getEntitiesSync();
for (var i = 0; i < files.length; i++) {
var entity = files[i];
if(entity.name != "var"){
var attachment:Attachment = <Attachment>{};
attachment.fileName = entity.name;
attachment.path = entity.path;
attachment.mimeType = "text/plain";
attachments.push(attachment);
}
}
email.compose({
subject: "Mobile App log files from user: " + userid,
body: "Log files attached",
to: [‘[email protected]', ‘xxx@[email protected]', ‘[email protected]'],
attachments: attachments,
appPickerTitle: 'A@Z Field Compass' // for Android, default: 'Open with..'
}).then(
function () {
log("Email composer closed");
}, function (err) {
log("Error: " + err);
});
… On Sep 26, 2017, at 11:17 AM, Eddy Verbruggen ***@***.***> wrote:
Hmm, do you pass in an Array? Please share the code that uses this plugin. Also: iOS, Android, or both?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#25 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQNdwhrMLZbkPEVVfUYJYkF0KnqPRtbeks5smRWTgaJpZM4PkZKB>.
|
Sorry forgot to mention it is for ios. I am assuming it is the same problem with android. When I was debugging in the plugin the ‘for in’ loop get the second element as ‘move’
Thanks
… On Sep 26, 2017, at 11:21 AM, Sudharsana Halaharvi ***@***.***> wrote:
Hi,
Here is the code
var logDir = storage.getPublicPictureDirectory().getFolder("Log");
var attachments: Attachment[] = [];
var userid = auth.getUsername();
var files = logDir.getEntitiesSync();
for (var i = 0; i < files.length; i++) {
var entity = files[i];
if(entity.name != "var"){
var attachment:Attachment = <Attachment>{};
attachment.fileName = entity.name;
attachment.path = entity.path;
attachment.mimeType = "text/plain";
attachments.push(attachment);
}
}
email.compose({
subject: "Mobile App log files from user: " + userid,
body: "Log files attached",
to: ***@***.*** ***@***.***>', ***@***.***@xxxx.com ***@***.***>', ***@***.*** ***@***.***>'],
attachments: attachments,
appPickerTitle: ***@***.*** Field Compass' // for Android, default: 'Open with..'
}).then(
function () {
log("Email composer closed");
}, function (err) {
log("Error: " + err);
});
> On Sep 26, 2017, at 11:17 AM, Eddy Verbruggen ***@***.*** ***@***.***>> wrote:
>
> Hmm, do you pass in an Array? Please share the code that uses this plugin. Also: iOS, Android, or both?
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub <#25 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQNdwhrMLZbkPEVVfUYJYkF0KnqPRtbeks5smRWTgaJpZM4PkZKB>.
>
|
Thanks for those details. If you're sure changing the loop syntax in both platforms suffices then please consider doing a PR 😁 |
Hi,
I did change the loop to ‘for(I;i<len;i++)’ in the plugin and it worked.
Thanks
… On Sep 26, 2017, at 11:38 AM, Eddy Verbruggen ***@***.***> wrote:
Thanks for those details. If you're sure changing the loop syntax in both platforms suffices then please consider doing a PR 😁
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#25 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AQNdwk3XQ6lvCS5SiVYXxZxqV89xV1Plks5smRpkgaJpZM4PkZKB>.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Looks like when we have the attachments it fails with the following message (undefined is not a object (evaluating 'path.indexOf'). After researching I found that the code uses 'for in' loop which loops through properties. Changing the loop to 'for(var a = 0; a < arg.attachments; a++) might work better.
Thanks
The text was updated successfully, but these errors were encountered: