Changes based on comments

This commit is contained in:
Christopher
2015-09-07 11:51:55 -07:00
parent 47ea00b50f
commit dce09195cf
2 changed files with 10 additions and 7 deletions
+5 -3
View File
@@ -23,9 +23,11 @@ var MailExampleApp = React.createClass({
subject: 'need help',
recipients: ['support@example.com'],
body: '',
attachmentPath: '', // The absolute path of the file from which to read data.
attachmentType: '', // Mime Type: jpg, png, doc, ppt, html, pdf
attachmentName: '', // Optional: Custom filename for attachment
attachment: {
path: '', // The absolute path of the file from which to read data.
type: '', // Mime Type: jpg, png, doc, ppt, html, pdf
name: '', // Optional: Custom filename for attachment
}
}, (error, event) => {
if(error) {
AlertIOS.alert('Error', 'Could not send mail. Please send a mail to support@example.com');
+5 -4
View File
@@ -47,10 +47,10 @@ RCT_EXPORT_METHOD(mail:(NSDictionary *)options
[mail setToRecipients:recipients];
}
if (options[@"attachmentPath"] && options[@"attachmentType"]){
NSString *attachmentPath = [RCTConvert NSString:options[@"attachmentPath"]];
NSString *attachmentType = [RCTConvert NSString:options[@"attachmentType"]];
NSString *attachmentName = [RCTConvert NSString:options[@"attachmentName"]];
if (options[@"attachment"][@"path"] && options[@"attachment"][@"name"]){
NSString *attachmentPath = [RCTConvert NSString:options[@"attachment"][@"path"]];
NSString *attachmentType = [RCTConvert NSString:options[@"attachment"][@"type"]];
NSString *attachmentName = [RCTConvert NSString:options[@"attachment"][@"name"]];
// Set default filename if not specificed
if (!attachmentName) {
@@ -62,6 +62,7 @@ RCT_EXPORT_METHOD(mail:(NSDictionary *)options
// Determine the MIME type
NSString *mimeType;
if ([attachmentType isEqualToString:@"jpg"]) {
mimeType = @"image/jpeg";
} else if ([attachmentType isEqualToString:@"png"]) {