@@ -63,7 +63,7 @@ - (instancetype)init;
63
63
@" 2. \n "
64
64
@" 3. \n "
65
65
@" \n "
66
- @" System version: %@ \n " , [[UIDevice currentDevice ] systemVersion ]];
66
+ @" System version: %@ " , [[UIDevice currentDevice ] systemVersion ]];
67
67
68
68
_logFormatter = [ARKDefaultLogFormatter new ];
69
69
_numberOfRecentErrorLogsToIncludeInEmailBodyWhenAttachmentsAreAvailable = 3 ;
@@ -182,6 +182,7 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
182
182
NSString *bugTitle = [alertView textFieldAtIndex: 0 ].text ;
183
183
NSArray *logStores = [self .logStores copy ];
184
184
NSMapTable *logStoresToLogMessagesMap = [NSMapTable new ];
185
+ NSDictionary *emailBodyAdditions = [self .emailBodyAdditionsDelegate emailBodyAdditionsForEmailBugReporter: self ];
185
186
186
187
if ([MFMailComposeViewController canSendMail ]) {
187
188
self.mailComposeViewController = [MFMailComposeViewController new ];
@@ -195,7 +196,8 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
195
196
196
197
// Only attach data once all log messages have been retrieved.
197
198
if (logStoresToLogMessagesMap.count == logStores.count ) {
198
- NSMutableString *emailBody = [NSMutableString stringWithFormat: @" %@ \n " , self .prefilledEmailBody];
199
+ NSMutableString *emailBody = [self _prefilledEmailBodyWithEmailBodyAdditions: emailBodyAdditions];
200
+
199
201
for (ARKLogStore *logStore in logStores) {
200
202
NSArray *logMessages = [logStoresToLogMessagesMap objectForKey: logStore];
201
203
@@ -245,11 +247,11 @@ - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)
245
247
246
248
// Only append logs once all log messages have been retrieved.
247
249
if (logStoresToLogMessagesMap.count == logStores.count ) {
248
- NSMutableString *emailBody = [NSMutableString new ];
250
+ NSMutableString *emailBody = [self _prefilledEmailBodyWithEmailBodyAdditions: emailBodyAdditions];
251
+
249
252
for (ARKLogStore *logStore in logStores) {
250
253
NSArray *logMessages = [logStoresToLogMessagesMap objectForKey: logStore];
251
-
252
- [emailBody appendFormat: @" %@ \n %@ \n " , self .prefilledEmailBody, [self _recentErrorLogMessagesAsPlainText: logMessages count: self .numberOfRecentErrorLogsToIncludeInEmailBodyWhenAttachmentsAreUnavailable]];
254
+ [emailBody appendFormat: @" %@ \n " , [self _recentErrorLogMessagesAsPlainText: logMessages count: self .numberOfRecentErrorLogsToIncludeInEmailBodyWhenAttachmentsAreUnavailable]];
253
255
}
254
256
255
257
NSURL *composeEmailURL = [self _emailURLWithRecipients: @[self .bugReportRecipientEmailAddress] CC: @" " subject: bugTitle body: emailBody];
@@ -368,6 +370,22 @@ - (void)_dismissEmailComposeWindow;
368
370
}
369
371
}
370
372
373
+ - (NSMutableString *)_prefilledEmailBodyWithEmailBodyAdditions : (nullable NSDictionary *)emailBodyAdditions ;
374
+ {
375
+ NSMutableString *prefilledEmailBodyWithEmailBodyAdditions = [NSMutableString stringWithFormat: @" %@ \n " , self .prefilledEmailBody];
376
+
377
+ if (emailBodyAdditions.count > 0 ) {
378
+ for (NSString *emailBodyAdditionKey in emailBodyAdditions.allKeys ) {
379
+ [prefilledEmailBodyWithEmailBodyAdditions appendFormat: @" %@ : %@ \n " , emailBodyAdditionKey, emailBodyAdditions[emailBodyAdditionKey]];
380
+ }
381
+ }
382
+
383
+ // Add a newline to separate prefill email body and additions from what comes after.
384
+ [prefilledEmailBodyWithEmailBodyAdditions appendString: @" \n " ];
385
+
386
+ return prefilledEmailBodyWithEmailBodyAdditions;
387
+ }
388
+
371
389
- (NSString *)_recentErrorLogMessagesAsPlainText : (NSArray *)logMessages count : (NSUInteger )errorLogsToInclude ;
372
390
{
373
391
NSMutableString *recentErrorLogs = [NSMutableString new ];
0 commit comments