mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 17:59:21 +00:00
Do not send email if this is not available as documentation states
This commit is contained in:
parent
1c08ea1791
commit
399412f6d3
1 changed files with 29 additions and 8 deletions
|
|
@ -802,16 +802,37 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[LinphoneLogger log:LinphoneLoggerError format:@"Trying to email attachment but mandatory field is missing"];
|
||||
return;
|
||||
}
|
||||
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
|
||||
picker.mailComposeDelegate = self;
|
||||
|
||||
[picker setSubject:NSLocalizedString(@"Linphone Logs",nil)];
|
||||
[picker setToRecipients:[NSArray arrayWithObjects:@"linphone-iphone@belledonne-communications.com", nil]];
|
||||
[picker setMessageBody:NSLocalizedString(@"Linphone logs", nil) isHTML:NO];
|
||||
[picker addAttachmentData:attachment mimeType:type fileName:attachmentName];
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Cannot send email",nil)
|
||||
message:NSLocalizedString(@"Simulator cannot send emails. To test this feature, please use a real device.",nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
[error release];
|
||||
#else
|
||||
if ([MFMailComposeViewController canSendMail] == YES) {
|
||||
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
|
||||
picker.mailComposeDelegate = self;
|
||||
|
||||
[self presentViewController:picker animated:true completion:nil];
|
||||
[picker release];
|
||||
[picker setSubject:NSLocalizedString(@"Linphone Logs",nil)];
|
||||
[picker setToRecipients:[NSArray arrayWithObjects:@"linphone-iphone@belledonne-communications.com", nil]];
|
||||
[picker setMessageBody:NSLocalizedString(@"Linphone logs", nil) isHTML:NO];
|
||||
[picker addAttachmentData:attachment mimeType:type fileName:attachmentName];
|
||||
|
||||
[self presentViewController:picker animated:true completion:nil];
|
||||
[picker release];
|
||||
} else {
|
||||
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Cannot send email",nil)
|
||||
message:NSLocalizedString(@"Your device is not configured to send emails. Please configure mail application prior to send logs.",nil)
|
||||
delegate:nil
|
||||
cancelButtonTitle:NSLocalizedString(@"Continue",nil)
|
||||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
[error release];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue