Skip to content

Commit 54be3ef

Browse files
author
Dan Federman
committed
Utilize email body additions when attachments are unavailable
1 parent 57bb4b5 commit 54be3ef

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Bug Reporting/ARKEmailBugReporter.m

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
182182
NSString *bugTitle = [alertView textFieldAtIndex:0].text;
183183
NSArray *logStores = [self.logStores copy];
184184
NSMapTable *logStoresToLogMessagesMap = [NSMapTable new];
185+
NSDictionary *emailBodyAdditions = [self.emailBodyAdditionsDelegate emailBodyAdditionsForEmailBugReporter:self];
185186

186187
if ([MFMailComposeViewController canSendMail]) {
187188
self.mailComposeViewController = [MFMailComposeViewController new];
@@ -197,7 +198,6 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
197198
if (logStoresToLogMessagesMap.count == logStores.count) {
198199
NSMutableString *emailBody = [NSMutableString stringWithFormat:@"%@\n", self.prefilledEmailBody];
199200

200-
NSDictionary *emailBodyAdditions = [self.emailBodyAdditionsDelegate emailBodyAdditionsForEmailBugReporter:self];
201201
if (emailBodyAdditions.count > 0) {
202202
for (NSString *emailBodyAdditionKey in emailBodyAdditions.allKeys) {
203203
[emailBody appendFormat:@"%@: %@\n", emailBodyAdditionKey, emailBodyAdditions[emailBodyAdditionKey]];
@@ -256,11 +256,17 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
256256

257257
// Only append logs once all log messages have been retrieved.
258258
if (logStoresToLogMessagesMap.count == logStores.count) {
259-
NSMutableString *emailBody = [NSMutableString new];
259+
NSMutableString *emailBody = [NSMutableString stringWithFormat:@"%@\n", self.prefilledEmailBody];
260+
261+
if (emailBodyAdditions.count > 0) {
262+
for (NSString *emailBodyAdditionKey in emailBodyAdditions.allKeys) {
263+
[emailBody appendFormat:@"%@: %@\n", emailBodyAdditionKey, emailBodyAdditions[emailBodyAdditionKey]];
264+
}
265+
}
266+
260267
for (ARKLogStore *logStore in logStores) {
261268
NSArray *logMessages = [logStoresToLogMessagesMap objectForKey:logStore];
262-
263-
[emailBody appendFormat:@"%@\n%@\n", self.prefilledEmailBody, [self _recentErrorLogMessagesAsPlainText:logMessages count:self.numberOfRecentErrorLogsToIncludeInEmailBodyWhenAttachmentsAreUnavailable]];
269+
[emailBody appendFormat:@"\n%@\n", [self _recentErrorLogMessagesAsPlainText:logMessages count:self.numberOfRecentErrorLogsToIncludeInEmailBodyWhenAttachmentsAreUnavailable]];
264270
}
265271

266272
NSURL *composeEmailURL = [self _emailURLWithRecipients:@[self.bugReportRecipientEmailAddress] CC:@"" subject:bugTitle body:emailBody];

0 commit comments

Comments
 (0)