Improve the debug logs email template.

This commit is contained in:
Matthew Chen 2018-10-18 15:25:25 -04:00
parent 693b3e13a9
commit a746874391
2 changed files with 26 additions and 11 deletions

View File

@ -17,6 +17,7 @@
#import <SignalServiceKit/OWSPrimaryStorage.h>
#import <SignalServiceKit/TSAccountManager.h>
#import <SignalServiceKit/TSContactThread.h>
#import <sys/sysctl.h>
NS_ASSUME_NONNULL_BEGIN
@ -502,13 +503,33 @@ typedef void (^DebugLogUploadFailure)(DebugLogUploader *uploader, NSError *error
{
NSString *emailAddress = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"LOGS_EMAIL"];
NSString *body = [NSString stringWithFormat:@"Log URL: %@ \n Tell us about the issue: ", url];
NSMutableString *body = [NSMutableString new];
[body appendFormat:@"Tell us about the issue: \n\n\n"];
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = malloc(size);
sysctlbyname("hw.machine", machine, &size, NULL, 0);
NSString *platform = [NSString stringWithUTF8String:machine];
free(machine);
[body appendFormat:@"Device: %@ (%@)\n", UIDevice.currentDevice.model, platform];
[body appendFormat:@"iOS Version: %@ \n", [UIDevice currentDevice].systemVersion];
[body appendFormat:@"Signal Version: %@ \n", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]];
[body appendFormat:@"Log URL: %@ \n", url];
NSString *escapedBody =
[body stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
NSString *urlString =
[NSString stringWithFormat:@"mailto:%@?subject=iOS%%20Debug%%20Log&body=%@", emailAddress, escapedBody];
[UIApplication.sharedApplication openURL:[NSURL URLWithString:urlString]];
BOOL success = [UIApplication.sharedApplication openURL:[NSURL URLWithString:urlString]];
if (!success) {
OWSLogError(@"Could not open Email app.");
[OWSAlerts showErrorAlertWithMessage:NSLocalizedString(@"DEBUG_LOG_COULD_NOT_EMAIL",
@"Error indicating that the app could not launch the Email app.")];
}
}
- (void)prepareRedirection:(NSURL *)url completion:(SubmitDebugLogsCompletion)completion

View File

@ -684,6 +684,9 @@
Title of the debug log alert. */
"DEBUG_LOG_ALERT_TITLE" = "One More Step";
/* Error indicating that the app could not launch the Email app. */
"DEBUG_LOG_COULD_NOT_EMAIL" = "Could not open Email app.";
/* Message of the alert before redirecting to GitHub Issues. */
"DEBUG_LOG_GITHUB_ISSUE_ALERT_MESSAGE" = "The gist link was copied in your clipboard. You are about to be redirected to the GitHub issue list.";
@ -1206,9 +1209,6 @@
/* Label for the MIME type of attachments in the 'message metadata' view. */
"MESSAGE_METADATA_VIEW_ATTACHMENT_MIME_TYPE" = "MIME type";
/* Label for 'not yet downloaded' attachments in the 'message metadata' view. */
"MESSAGE_METADATA_VIEW_ATTACHMENT_NOT_YET_DOWNLOADED" = "Not yet downloaded";
/* Status label for messages which are delivered. */
"MESSAGE_METADATA_VIEW_MESSAGE_STATUS_DELIVERED" = "Delivered";
@ -1904,9 +1904,6 @@
/* Table header for the 'censorship circumvention' section. */
"SETTINGS_ADVANCED_CENSORSHIP_CIRCUMVENTION_HEADER" = "Censorship Circumvention";
/* Label for setting that enables dark theme. */
"SETTINGS_ADVANCED_DARK_THEME" = "Dark Theme";
/* No comment provided by engineer. */
"SETTINGS_ADVANCED_DEBUGLOG" = "Enable Debug Log";
@ -2171,9 +2168,6 @@
/* Label for button to verify a user's safety number. */
"SYSTEM_MESSAGE_ACTION_VERIFY_SAFETY_NUMBER" = "Verify Safety Number";
/* No comment provided by engineer. */
"THEME_SECTION" = "Theme";
/* {{number of days}} embedded in strings, e.g. 'Alice updated disappearing messages expiration to {{5 days}}'. See other *_TIME_AMOUNT strings */
"TIME_AMOUNT_DAYS" = "%@ days";